private Button createMenuButton(VaadinIcons icon, String caption, Supplier<CustomComponent> content) { final Button button = new Button(caption, (e) -> { contentLayout.removeAllComponents(); contentLayout.addComponent(content.get()); }); button.setIcon(icon); button.addStyleName(ValoTheme.BUTTON_HUGE); button.addStyleName(ValoTheme.BUTTON_ICON_ALIGN_TOP); button.addStyleName(ValoTheme.BUTTON_BORDERLESS); button.addStyleName(ValoTheme.MENU_ITEM); button.setWidth("100%"); button.setId(buttonID().apply(MainView.class, caption)); return button; }
@Override public ComponentContainer[] getToolbars() { List<CustomComponent> result = new ArrayList<CustomComponent>(); @SuppressWarnings("rawtypes") Iterator iterator = this.getComponentIterator(); while(iterator.hasNext()){ Component component = (Component) iterator.next(); if(component instanceof CustomComponent){ result.add((CustomComponent) component); } } CustomComponent[] resultToArray = new CustomComponent[result.size()]; return result.toArray(resultToArray); }
private Pair<String, Button> createMenuButton(VaadinIcons icon, String caption, Supplier<CustomComponent> content) { final Button button = new Button(caption, (e) -> { contentLayout.removeAllComponents(); contentLayout.addComponent(content.get()); }); button.setIcon(icon); button.addStyleName(ValoTheme.BUTTON_HUGE); button.addStyleName(ValoTheme.BUTTON_ICON_ALIGN_TOP); button.addStyleName(ValoTheme.BUTTON_BORDERLESS); button.addStyleName(ValoTheme.MENU_ITEM); button.setWidth("100%"); button.setId(buttonID().apply(this.getClass(), caption)); return new Pair<>(mapToShiroRole(caption), button); }
protected void resetAttributeOption() { // // Remove GUI components from layout // this.horizontalLayoutAttribute.removeAllComponents(); this.currentComponent = null; // // Grab our currently selected option value // Object value = self.optionGroupAttribute.getValue(); // // What is it set to? // if (value.toString().equals(ATTRIBUTE_OPTION_DICTIONARY)) { this.currentComponent = new AttributeDictionarySelectorComponent(this.datatype, this.defaultAttribute); } else if (value.toString().equals(ATTRIBUTE_OPTION_STANDARD)) { this.currentComponent = new AttributeStandardSelectorComponent(this.datatype, this.defaultAttribute); } else if (value.toString().equals(ATTRIBUTE_OPTION_INPUT)) { this.currentComponent = new AttributeSimpleCreatorComponent(this.datatype, this.defaultAttribute); } else { logger.error("Unknown option" + value); return; } this.currentComponent.addListener(this); this.horizontalLayoutAttribute.addComponent((CustomComponent) this.currentComponent); this.currentComponent.fireAttributeChanged(this.currentComponent.getAttribute()); }
@Override public void showView(View view) { logger.debug("Displaying View " + view); if (view instanceof CustomComponent) { setContent((CustomComponent) view); } else if (view instanceof ComponentContainer) { setContent((ComponentContainer) view); } else { throw new IllegalStateException("View not supported! "); } }
/** * * @param ctx * @return Tab that should be added to the dialog. */ public static CustomComponent create(UserDialogContext ctx) { final ConfigCopyPasteTab tab = new ConfigCopyPasteTab(ctx); tab.buildLayout(); return tab; }
@Override public void removeToolbar(CustomComponent toolbar) { this.removeComponent(toolbar); }
/*** * Agrega un componente al panel de contenido. * @param component */ public void setContenido(CustomComponent component) { this.mainLayout.addComponent(component); }
/*** * Agrega un componente al panel de contenido en una posición dada. * @param component El componente a agregar. * @param cssPosition La posición del componente. */ public void setContenido(CustomComponent component, String cssPosition) { this.mainLayout.addComponent(component, cssPosition); }
public void removeToolbar(CustomComponent toolbar);