private void removeComponentIfPresent() { Component component = (Component) cellState.connector; if (component != null) { component.setParent(null); cellState.connector = null; } }
void detach() { for (CELL cell : cells.values()) { cell.detach(); } for (CellState cellState : rowState.cellGroups.keySet()) { if (cellState.type == GridStaticCellType.WIDGET && cellState.connector != null) { ((Component) cellState.connector).setParent(null); cellState.connector = null; } } }
private void removeExtensionComponent(Component c) { if (extensionComponents.remove(c)) { c.setParent(null); markAsDirty(); } }
/** * Returns the content (UI) of the custom component. * * @return Component */ protected Component getContent() { if (null == root) { root = initContent(); root.setParent(this); } return root; }
private void addExtensionComponent(Component c) { if (extensionComponents.add(c)) { c.setParent(this); markAsDirty(); } }
/** * Sets the component displayed in this cell. * * @param component * the component to set, not null */ public void setComponent(Component component) { Objects.requireNonNull(component, "component cannot be null"); removeComponentIfPresent(); component.setParent(row.section.getGrid()); cellState.connector = component; cellState.type = GridStaticCellType.WIDGET; row.section.markAsDirty(); }
/** * Sets the component contained in the composite. * <p> * You must set the composition root to a non-null value before the * component can be used. It cannot be changed. * </p> * * @param compositionRoot * the root of the composition component tree. */ protected void setCompositionRoot(Component compositionRoot) { if (root != null) { throw new IllegalStateException( "Composition root cannot be changed"); } if (compositionRoot == null) { throw new IllegalArgumentException( "Composition root cannot be null"); } // set new component if (compositionRoot.getParent() != null) { // If the component already has a parent, try to remove it AbstractSingleComponentContainer.removeFromParent(compositionRoot); } compositionRoot.setParent(this); root = compositionRoot; markAsDirty(); }
/** * Sets the composition root for the component. * * <p> * You must set the composition root to a non-null value before the * component can be used. You can change it later. * </p> * * @param compositionRoot * the root of the composition component tree. */ protected void setCompositionRoot(Component compositionRoot) { if (compositionRoot != root) { if (root != null && equals(root.getParent())) { // remove old component root.setParent(null); } if (compositionRoot != null) { // set new component if (compositionRoot.getParent() != null) { // If the component already has a parent, try to remove it AbstractSingleComponentContainer .removeFromParent(compositionRoot); } compositionRoot.setParent(this); } root = compositionRoot; markAsDirty(); } }
/** * This only implements the events and component parent calls. The extending * classes must implement component list maintenance and call this method * before component list maintenance. * * @see com.vaadin.ui.ComponentContainer#removeComponent(Component) */ @Override public void removeComponent(Component c) { if (equals(c.getParent())) { c.setParent(null); fireComponentDetachEvent(c); markAsDirty(); } }
/** * This only implements the events and component parent calls. The extending * classes must implement component list maintenance and call this method * after component list maintenance. * * @see com.vaadin.ui.ComponentContainer#addComponent(Component) */ @Override public void addComponent(Component c) { // Make sure we're not adding the component inside it's own content if (isOrHasAncestor(c)) { throw new IllegalArgumentException( "Component cannot be added inside it's own content"); } if (c.getParent() != null) { // If the component already has a parent, try to remove it AbstractSingleComponentContainer.removeFromParent(c); } c.setParent(this); fireComponentAttachEvent(c); markAsDirty(); }
/** * Set the visibility of the popup. Does not hide the minimal * representation. * * @param visible */ public void setPopupVisible(boolean visible) { if (isPopupVisible() != visible) { if (visible) { visibleComponent = content.getPopupComponent(); if (visibleComponent == null) { throw new IllegalStateException( "PopupView.Content did not return Component to set visible"); } if (visibleComponent.getParent() != null) { // If the component already has a parent, try to remove it AbstractSingleComponentContainer .removeFromParent(visibleComponent); } visibleComponent.setParent(this); } else { if (equals(visibleComponent.getParent())) { visibleComponent.setParent(null); } visibleComponent = null; } fireEvent(new PopupVisibilityEvent(this)); markAsDirty(); } }
private void addComponent(Component c) { extensionComponents.add(c); c.setParent(this); markAsDirty(); }
/** * Returns the content (UI) of the custom component. * * @return Component */ protected Component getContent() { if (null == root) { root = initContent(); root.setParent(this); } return root; }
private void removeComponent(Component c) { extensionComponents.remove(c); c.setParent(null); markAsDirty(); }
public void setUserMenu(View view) { Component userMenuComponent = view.asVaadinComponent(); userMenuComponent.setParent(this); getState().userMenu = userMenuComponent; }
public void setStickerView(View view) { Component stickerComponent = view.asVaadinComponent(); stickerComponent.setParent(this); getState().sticker = stickerComponent; }
public void setContent(Component newContent) { final Component actualContent = newContent == null ? createDefaultContent() : newContent; if (getState().content != null) { ((Component)getState().content).setParent(null); } getState().content = actualContent; adoptComponent((Component) getState().content); }
public void setHeaderToolbar(Component newHeader) { final Component actualHeader = newHeader == null ? createDefaultHeader() : newHeader; if (getState().headerToolbar != null) { ((Component)getState().headerToolbar).setParent(null); } getState().headerToolbar = actualHeader; adoptComponent((Component) getState().headerToolbar); }
public void setFooterToolbar(Component newFooter) { final Component actualFooter = newFooter == null ? createDefaultFooter() : newFooter; if (getState().footerToolbar != null) { ((Component)getState().footerToolbar).setParent(null); } getState().footerToolbar = actualFooter; adoptComponent((Component) getState().footerToolbar); }