|
15 | 15 | */
|
16 | 16 | package com.vaadin.flow.component.confirmdialog;
|
17 | 17 |
|
18 |
| -import java.util.Collection; |
19 | 18 | import java.util.Optional;
|
20 | 19 |
|
21 | 20 | import com.vaadin.flow.component.Component;
|
22 | 21 | import com.vaadin.flow.component.ComponentEvent;
|
23 | 22 | import com.vaadin.flow.component.ComponentEventListener;
|
24 | 23 | import com.vaadin.flow.component.ComponentUtil;
|
25 | 24 | import com.vaadin.flow.component.DomEvent;
|
26 |
| -import com.vaadin.flow.component.HasOrderedComponents; |
| 25 | +import com.vaadin.flow.component.HasComponents; |
27 | 26 | import com.vaadin.flow.component.HasSize;
|
28 | 27 | import com.vaadin.flow.component.HasStyle;
|
29 | 28 | import com.vaadin.flow.component.Tag;
|
|
62 | 61 | @NpmPackage(value = "@vaadin/confirm-dialog", version = "25.0.0-alpha12")
|
63 | 62 | @JsModule("@vaadin/confirm-dialog/src/vaadin-confirm-dialog.js")
|
64 | 63 | public class ConfirmDialog extends Component
|
65 |
| - implements HasSize, HasStyle, HasOrderedComponents { |
| 64 | + implements HasComponents, HasSize, HasStyle { |
66 | 65 |
|
67 | 66 | /**
|
68 | 67 | * Event that is fired when the user clicks the Confirm button
|
@@ -703,176 +702,18 @@ public void setCloseOnEsc(boolean closeOnEsc) {
|
703 | 702 | }
|
704 | 703 |
|
705 | 704 | /**
|
706 |
| - * Confirm dialog does not support adding content. Use |
707 |
| - * {@link #setText(Component)} instead to initialize content as a component. |
| 705 | + * {@inheritDoc} |
708 | 706 | * <p>
|
709 |
| - * This method is inherited from {@link HasOrderedComponents} and has been |
710 |
| - * marked as deprecated to indicate that it is not supported. |
711 |
| - * |
712 |
| - * @deprecated since v24.4, not supported |
713 |
| - */ |
714 |
| - @Deprecated |
715 |
| - @Override |
716 |
| - public void add(Component... components) { |
717 |
| - HasOrderedComponents.super.add(components); |
718 |
| - } |
719 |
| - |
720 |
| - /** |
721 |
| - * Confirm dialog does not support adding content. Use |
722 |
| - * {@link #setText(Component)} instead to initialize content as a component. |
723 |
| - * <p> |
724 |
| - * This method is inherited from {@link HasOrderedComponents} and has been |
725 |
| - * marked as deprecated to indicate that it is not supported. |
726 |
| - * |
727 |
| - * @deprecated since v24.4, not supported |
728 |
| - */ |
729 |
| - @Deprecated |
730 |
| - @Override |
731 |
| - public void add(Collection<Component> components) { |
732 |
| - HasOrderedComponents.super.add(components); |
733 |
| - } |
734 |
| - |
735 |
| - /** |
736 |
| - * Confirm dialog does not support adding content. Use |
737 |
| - * {@link #setText(String)} instead to initialize content as text. |
738 |
| - * <p> |
739 |
| - * This method is inherited from {@link HasOrderedComponents} and has been |
740 |
| - * marked as deprecated to indicate that it is not supported. |
741 |
| - * |
742 |
| - * @deprecated since v24.4, not supported |
| 707 | + * Removes all components from this component except elements that have slot |
| 708 | + * attribute, such as header and buttons. |
743 | 709 | */
|
744 |
| - @Deprecated |
745 |
| - @Override |
746 |
| - public void add(String text) { |
747 |
| - HasOrderedComponents.super.add(text); |
748 |
| - } |
749 |
| - |
750 |
| - /** |
751 |
| - * Confirm dialog does not support removing content. |
752 |
| - * <p> |
753 |
| - * This method is inherited from {@link HasOrderedComponents} and has been |
754 |
| - * marked as deprecated to indicate that it is not supported. |
755 |
| - * |
756 |
| - * @deprecated since v24.4, not supported |
757 |
| - */ |
758 |
| - @Deprecated |
759 |
| - @Override |
760 |
| - public void remove(Component... components) { |
761 |
| - HasOrderedComponents.super.remove(components); |
762 |
| - } |
763 |
| - |
764 |
| - /** |
765 |
| - * Confirm dialog does not support removing content. |
766 |
| - * <p> |
767 |
| - * This method is inherited from {@link HasOrderedComponents} and has been |
768 |
| - * marked as deprecated to indicate that it is not supported. |
769 |
| - * |
770 |
| - * @deprecated since v24.4, not supported |
771 |
| - */ |
772 |
| - @Deprecated |
773 |
| - @Override |
774 |
| - public void remove(Collection<Component> components) { |
775 |
| - HasOrderedComponents.super.remove(components); |
776 |
| - } |
777 |
| - |
778 |
| - /** |
779 |
| - * Confirm dialog does not support removing content. |
780 |
| - * <p> |
781 |
| - * This method is inherited from {@link HasOrderedComponents} and has been |
782 |
| - * marked as deprecated to indicate that it is not supported. |
783 |
| - * |
784 |
| - * @deprecated since v24.4, not supported |
785 |
| - */ |
786 |
| - @Deprecated |
787 | 710 | @Override
|
788 | 711 | public void removeAll() {
|
789 |
| - HasOrderedComponents.super.removeAll(); |
790 |
| - } |
791 |
| - |
792 |
| - /** |
793 |
| - * Confirm dialog does not support adding content. Use |
794 |
| - * {@link #setText(Component)} instead to initialize content as a component. |
795 |
| - * <p> |
796 |
| - * This method is inherited from {@link HasOrderedComponents} and has been |
797 |
| - * marked as deprecated to indicate that it is not supported. |
798 |
| - * |
799 |
| - * @deprecated since v24.4, not supported |
800 |
| - */ |
801 |
| - @Deprecated |
802 |
| - @Override |
803 |
| - public void addComponentAtIndex(int index, Component component) { |
804 |
| - HasOrderedComponents.super.addComponentAtIndex(index, component); |
805 |
| - } |
806 |
| - |
807 |
| - /** |
808 |
| - * Confirm dialog does not support adding content. Use |
809 |
| - * {@link #setText(Component)} instead to initialize content as a component. |
810 |
| - * <p> |
811 |
| - * This method is inherited from {@link HasOrderedComponents} and has been |
812 |
| - * marked as deprecated to indicate that it is not supported. |
813 |
| - * |
814 |
| - * @deprecated since v24.4, not supported |
815 |
| - */ |
816 |
| - @Deprecated |
817 |
| - @Override |
818 |
| - public void addComponentAsFirst(Component component) { |
819 |
| - HasOrderedComponents.super.addComponentAsFirst(component); |
820 |
| - } |
821 |
| - |
822 |
| - /** |
823 |
| - * Confirm dialog does not support replacing content. |
824 |
| - * <p> |
825 |
| - * This method is inherited from {@link HasOrderedComponents} and has been |
826 |
| - * marked as deprecated to indicate that it is not supported. |
827 |
| - * |
828 |
| - * @deprecated since v24.4, not supported |
829 |
| - */ |
830 |
| - @Deprecated |
831 |
| - @Override |
832 |
| - public void replace(Component oldComponent, Component newComponent) { |
833 |
| - HasOrderedComponents.super.replace(oldComponent, newComponent); |
834 |
| - } |
835 |
| - |
836 |
| - /** |
837 |
| - * Confirm dialog does not support multiple components. |
838 |
| - * <p> |
839 |
| - * This method is inherited from {@link HasOrderedComponents} and has been |
840 |
| - * marked as deprecated to indicate that it is not supported. |
841 |
| - * |
842 |
| - * @deprecated since v24.4, not supported |
843 |
| - */ |
844 |
| - @Deprecated |
845 |
| - @Override |
846 |
| - public int indexOf(Component component) { |
847 |
| - return HasOrderedComponents.super.indexOf(component); |
848 |
| - } |
849 |
| - |
850 |
| - /** |
851 |
| - * Confirm dialog does not support multiple components. |
852 |
| - * <p> |
853 |
| - * This method is inherited from {@link HasOrderedComponents} and has been |
854 |
| - * marked as deprecated to indicate that it is not supported. |
855 |
| - * |
856 |
| - * @deprecated since v24.4, not supported |
857 |
| - */ |
858 |
| - @Deprecated |
859 |
| - @Override |
860 |
| - public int getComponentCount() { |
861 |
| - return HasOrderedComponents.super.getComponentCount(); |
862 |
| - } |
863 |
| - |
864 |
| - /** |
865 |
| - * Confirm dialog does not support multiple components. |
866 |
| - * <p> |
867 |
| - * This method is inherited from {@link HasOrderedComponents} and has been |
868 |
| - * marked as deprecated to indicate that it is not supported. |
869 |
| - * |
870 |
| - * @deprecated since v24.4, not supported |
871 |
| - */ |
872 |
| - @Deprecated |
873 |
| - @Override |
874 |
| - public Component getComponentAt(int index) { |
875 |
| - return HasOrderedComponents.super.getComponentAt(index); |
| 712 | + getElement().getChildren().forEach(child -> { |
| 713 | + if (!child.hasAttribute("slot")) { |
| 714 | + child.removeFromParent(); |
| 715 | + } |
| 716 | + }); |
876 | 717 | }
|
877 | 718 |
|
878 | 719 | private void setModality(boolean modal) {
|
|
0 commit comments