/** * Removes all components from the container. This should probably be * re-implemented in extending classes for a more powerful implementation. */ @Override public void removeAllComponents() { final LinkedList<Component> l = new LinkedList<>(); // Adds all components for (final Iterator<Component> i = getComponentIterator(); i .hasNext();) { l.add(i.next()); } // Removes all component for (Component aL : l) { removeComponent(aL); } }
super.removeComponent(component); keyMapper.remove(component); components.remove(component);
/** * Removes the component from this container. * * @param c * the component to be removed. */ @Override public void removeComponent(Component c) { super.removeComponent(c); if (c == getFirstComponent()) { getState().firstChild = null; } else if (c == getSecondComponent()) { getState().secondChild = null; } }
@Override public void removeComponent(Component c) { children.remove(c); super.removeComponent(c); markAsDirty(); }
@Override public void removeComponent(Component c) { super.removeComponent(c); components.remove(c); markAsDirty(); }
@Override public void removeComponent(Component c) { super.removeComponent(c); children.remove(c); markAsDirty(); }
@Override public void replaceComponent(Component oldComponent, Component newComponent) { for (GoogleMapInfoWindow window : infoWindowContents.keySet()) { if (infoWindowContents.get(window).equals(oldComponent)) { setInfoWindowContents(window, newComponent); super.removeComponent(oldComponent); break; } } }
@Override public void removeComponent(final Component c) { if (c instanceof MagnoliaTab) { final MagnoliaTab tab = (MagnoliaTab) c; super.removeComponent(c); tabs.remove(tab); markAsDirty(); } }
/** * Sets the toolbar component, usually a {@link Toolbar}. If a previous * toolbar is set, it is removed from the layout and forgotten. * * @param toolbar * The component to put in the toolbar slot. */ public void setToolbar(Component toolbar) { if (this.toolbar != null && this.toolbar != toolbar) { super.removeComponent(this.toolbar); } this.toolbar = toolbar; if (toolbar != null) { super.addComponent(toolbar); } }
@Override public void replaceComponent(Component oldComponent, Component newComponent) { int index = children.indexOf(oldComponent); if (index != -1) { children.remove(index); children.add(index, newComponent); super.removeComponent(oldComponent); super.addComponent(newComponent); markAsDirty(); } }
/** * The toolbar or content can be removed - other attempts will result in an * {@link IllegalArgumentException}. If the content is removed, an empty * {@link CssLayout} is set as the content. */ @Override public void removeComponent(Component c) { if (c == toolbar) { super.removeComponent(c); toolbar = null; } else if (c == mainComponent) { setContent(null); } else { throw new IllegalArgumentException( " Only the toolbar or main content can be removed"); } markAsDirty(); }
/** * Removes the given tab content and the tab button associated with it. * * @param c * the tab content to remove */ public void removeTab(Component c) { TabButton tabButton = getTabButton(c); tabs.remove(c); if (tabButton != null) { toolbar.removeComponent(tabButton); if (c == currentComponent) { super.removeComponent(c); Component next = tabs.iterator().next(); if (next != null) { setSelectedTab(next); } } } }
@Override public void removeComponent(Component c) { super.removeComponent(c); components.remove(c); if (hasControl(LLayers.class)) { LLayers layersControl = getLayersControl(); if (layersControl != null) { layersControl.removeLayer((LeafletLayer) c); } } markAsDirty(); // ?? is this really needed }
/** * Sets the main content of the NavigationView. If null, an empty * {@link CssLayout} will be used. * * @param c * the component to set as the content */ public void setContent(Component c) { if (mainComponent == c) { return; } if (mainComponent != null) { super.removeComponent(mainComponent); } if (c == null) { c = new CssLayout(); } super.addComponent(c); mainComponent = c; markAsDirty(); }
/** * Sets the component in the right slot. * * @param c * the component to put in the right slot. */ public void setRightComponent(Component c) { if (navigationBarComponent != null) { super.removeComponent(navigationBarComponent); } if (c != null) { super.addComponent(c); } getState().setRightComponent(c); navigationBarComponent = c; markAsDirty(); }
/** * Sets the component in the left slot. This place most commonly features * the back button. Setting the left component replaces any existing * components, including the back button. * * @param c * the component to put in the left slot. */ public void setLeftComponent(Component c) { if (leftNavigationBarComponent != null) { super.removeComponent(leftNavigationBarComponent); } if (c != null) { super.addComponent(c); } getState().setLeftComponent(c); leftNavigationBarComponent = c; markAsDirty(); }
/** * Sets the active tab, i.e. sets the content as currently visible and marks * its button in the tab-bar as active. * * @param tab * the content to show */ public void setSelectedTab(Component tab) { if (currentComponent != null) { TabButton tabButton = getTabButton(currentComponent); if (tabButton != null) { tabButton.setSelected(false); } super.removeComponent(currentComponent); } super.addComponent(tab); currentComponent = tab; getTabButton(currentComponent).setSelected(true); markAsDirty(); fireSelectedTabChange(); }