List of usage examples for com.vaadin.server FontAwesome TRASH_O
FontAwesome TRASH_O
To view the source code for com.vaadin.server FontAwesome TRASH_O.
Click Source Link
From source file:org.jumpmind.metl.ui.mapping.EditMappingPanel.java
License:Open Source License
protected void buildUI() { if (!readOnly) { ButtonBar buttonBar = new ButtonBar(); addComponent(buttonBar);//from w w w . j a va 2s .c om Button autoMapButton = buttonBar.addButton("Auto Map", FontAwesome.FLASH); removeButton = buttonBar.addButton("Remove", FontAwesome.TRASH_O); removeButton.setEnabled(false); autoMapButton.addClickListener(new AutoMapListener()); removeButton.addClickListener(new RemoveListener()); } HorizontalLayout titleHeader = new HorizontalLayout(); titleHeader.setSpacing(true); titleHeader.setMargin(new MarginInfo(false, true, false, true)); titleHeader.setWidth(100f, Unit.PERCENTAGE); titleHeader.addComponent(new Label( "<b>Input Model:</b> " + (component.getInputModel() != null ? component.getInputModel().getName() : "?"), ContentMode.HTML)); titleHeader.addComponent(new Label( "<b>Output Model:</b> " + (component.getOutputModel() != null ? component.getOutputModel().getName() : "?"), ContentMode.HTML)); addComponent(titleHeader); HorizontalLayout filterHeader = new HorizontalLayout(); filterHeader.setSpacing(true); filterHeader.setMargin(new MarginInfo(true, true, true, true)); filterHeader.setWidth(100f, Unit.PERCENTAGE); HorizontalLayout srcFilterHeader = new HorizontalLayout(); srcFilterHeader.setSpacing(true); srcFilterHeader.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); filterHeader.addComponent(srcFilterHeader); HorizontalLayout dstFilterHeader = new HorizontalLayout(); dstFilterHeader.setSpacing(true); dstFilterHeader.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); filterHeader.addComponent(dstFilterHeader); addComponent(filterHeader); srcTextFilter = new TextField(); srcTextFilter.setInputPrompt("Filter"); srcTextFilter.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON); srcTextFilter.setIcon(FontAwesome.SEARCH); srcTextFilter.setImmediate(true); srcTextFilter.setTextChangeEventMode(TextChangeEventMode.LAZY); srcTextFilter.setTextChangeTimeout(200); srcTextFilter.addTextChangeListener(new FilterInputTextListener()); srcFilterHeader.addComponent(srcTextFilter); srcMapFilter = new CheckBox("Mapped Only"); srcMapFilter.addValueChangeListener(new FilterSrcMapListener()); srcFilterHeader.addComponent(srcMapFilter); dstTextFilter = new TextField(); dstTextFilter.setInputPrompt("Filter"); dstTextFilter.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON); dstTextFilter.setIcon(FontAwesome.SEARCH); dstTextFilter.setImmediate(true); dstTextFilter.setTextChangeEventMode(TextChangeEventMode.LAZY); dstTextFilter.setTextChangeTimeout(200); dstTextFilter.addTextChangeListener(new FilterOutputTextListener()); dstFilterHeader.addComponent(dstTextFilter); dstMapFilter = new CheckBox("Mapped Only"); dstMapFilter.addValueChangeListener(new FilterDstMapListener()); dstFilterHeader.addComponent(dstMapFilter); Panel panel = new Panel(); VerticalLayout vlay = new VerticalLayout(); vlay.setSizeFull(); diagram = new MappingDiagram(context, component, readOnly); diagram.setSizeFull(); vlay.addComponent(diagram); panel.setContent(vlay); panel.setSizeFull(); addComponent(panel); setExpandRatio(panel, 1.0f); diagram.addListener(new EventListener()); }
From source file:org.jumpmind.metl.ui.views.admin.GroupPanel.java
License:Open Source License
public GroupPanel(ApplicationContext context, TabbedPanel tabbedPanel) { this.context = context; this.tabbedPanel = tabbedPanel; ButtonBar buttonBar = new ButtonBar(); addComponent(buttonBar);/* w ww . j a v a2 s . c om*/ newButton = buttonBar.addButton("New", FontAwesome.PLUS); newButton.addClickListener(new NewClickListener()); editButton = buttonBar.addButton("Edit", FontAwesome.EDIT); editButton.addClickListener(new EditClickListener()); removeButton = buttonBar.addButton("Remove", FontAwesome.TRASH_O); removeButton.addClickListener(new RemoveClickListener()); container = new BeanItemContainer<Group>(Group.class); table = new Table(); table.setSizeFull(); table.setCacheRate(100); table.setPageLength(100); table.setImmediate(true); table.setSelectable(true); table.setMultiSelect(true); table.setContainerDataSource(container); table.setVisibleColumns("name", "createTime", "lastUpdateTime"); table.setColumnHeaders("Name", "Create Time", "Update Time"); table.addItemClickListener(new TableItemClickListener()); table.addValueChangeListener(new TableValueChangeListener()); table.setSortContainerPropertyId("name"); table.setSortAscending(true); addComponent(table); setExpandRatio(table, 1.0f); refresh(); }
From source file:org.jumpmind.metl.ui.views.admin.NotificationPanel.java
License:Open Source License
public NotificationPanel(ApplicationContext context, TabbedPanel tabbedPanel) { this.context = context; this.tabbedPanel = tabbedPanel; ButtonBar buttonBar = new ButtonBar(); addComponent(buttonBar);/* ww w . j a v a 2 s . c o m*/ newButton = buttonBar.addButton("New", FontAwesome.PLUS); newButton.addClickListener(new NewClickListener()); editButton = buttonBar.addButton("Edit", FontAwesome.EDIT); editButton.addClickListener(new EditClickListener()); removeButton = buttonBar.addButton("Remove", FontAwesome.TRASH_O); removeButton.addClickListener(new RemoveClickListener()); filterField = buttonBar.addFilter(); filterField.addTextChangeListener(this); container = new BeanItemContainer<Notification>(Notification.class); table = new Table(); table.setSizeFull(); table.setCacheRate(100); table.setPageLength(100); table.setImmediate(true); table.setSelectable(true); table.setMultiSelect(true); table.setContainerDataSource(container); table.setVisibleColumns("level", "name", "notifyType", "eventType", "enabled"); table.setColumnHeaders("Level", "Name", "Notify Type", "Event Type", "Enabled"); table.addItemClickListener(new TableItemClickListener()); table.addValueChangeListener(new TableValueChangeListener()); table.setSortContainerPropertyId("name"); table.setSortAscending(true); addComponent(table); setExpandRatio(table, 1.0f); refresh(); }
From source file:org.jumpmind.metl.ui.views.admin.UserPanel.java
License:Open Source License
public UserPanel(ApplicationContext context, TabbedPanel tabbedPanel) { this.context = context; this.tabbedPanel = tabbedPanel; ButtonBar buttonBar = new ButtonBar(); addComponent(buttonBar);//w w w . ja v a 2 s . co m newButton = buttonBar.addButton("New", FontAwesome.PLUS); newButton.addClickListener(new NewClickListener()); editButton = buttonBar.addButton("Edit", FontAwesome.EDIT); editButton.addClickListener(new EditClickListener()); removeButton = buttonBar.addButton("Remove", FontAwesome.TRASH_O); removeButton.addClickListener(new RemoveClickListener()); container = new BeanItemContainer<User>(User.class); table = new Table(); table.setSizeFull(); table.setCacheRate(100); table.setPageLength(100); table.setImmediate(true); table.setSelectable(true); table.setMultiSelect(true); table.setContainerDataSource(container); table.setVisibleColumns("loginId", "name", "lastLoginTime"); table.setColumnHeaders("Login ID", "Full Name", "Last Login Time"); table.addItemClickListener(new TableItemClickListener()); table.addValueChangeListener(new TableValueChangeListener()); table.setSortContainerPropertyId("loginId"); table.setSortAscending(true); addComponent(table); setExpandRatio(table, 1.0f); refresh(); }
From source file:org.jumpmind.metl.ui.views.deploy.EditAgentPanel.java
License:Open Source License
public EditAgentPanel(ApplicationContext context, TabbedPanel tabbedPanel, Agent agent) { this.context = context; this.tabbedPanel = tabbedPanel; this.agent = agent; this.backgroundRefresherService = context.getBackgroundRefresherService(); HorizontalLayout editAgentLayout = new HorizontalLayout(); editAgentLayout.setSpacing(true);/*www .j a v a 2s .c om*/ editAgentLayout.setMargin(new MarginInfo(true, false, false, true)); editAgentLayout.addStyleName(ValoTheme.LAYOUT_HORIZONTAL_WRAPPING); addComponent(editAgentLayout); final ComboBox startModeCombo = new ComboBox("Start Mode"); startModeCombo.setImmediate(true); startModeCombo.setNullSelectionAllowed(false); AgentStartMode[] modes = AgentStartMode.values(); for (AgentStartMode agentStartMode : modes) { startModeCombo.addItem(agentStartMode.name()); } startModeCombo.setValue(agent.getStartMode()); startModeCombo.addValueChangeListener(event -> { agent.setStartMode((String) startModeCombo.getValue()); context.getConfigurationService().save((AbstractObject) EditAgentPanel.this.agent); }); editAgentLayout.addComponent(startModeCombo); editAgentLayout.setComponentAlignment(startModeCombo, Alignment.BOTTOM_LEFT); Button parameterButton = new Button("Parameters"); parameterButton.addClickListener(new ParameterClickListener()); editAgentLayout.addComponent(parameterButton); editAgentLayout.setComponentAlignment(parameterButton, Alignment.BOTTOM_LEFT); HorizontalLayout buttonGroup = new HorizontalLayout(); final TextField hostNameField = new TextField("Hostname"); hostNameField.setImmediate(true); hostNameField.setTextChangeEventMode(TextChangeEventMode.LAZY); hostNameField.setTextChangeTimeout(100); hostNameField.setWidth(20, Unit.EM); hostNameField.setNullRepresentation(""); hostNameField.setValue(agent.getHost()); hostNameField.addValueChangeListener(event -> { agent.setHost((String) hostNameField.getValue()); EditAgentPanel.this.context.getConfigurationService().save((AbstractObject) agent); EditAgentPanel.this.context.getAgentManager().refresh(agent); }); buttonGroup.addComponent(hostNameField); buttonGroup.setComponentAlignment(hostNameField, Alignment.BOTTOM_LEFT); Button getHostNameButton = new Button("Get Host"); getHostNameButton.addClickListener(event -> hostNameField.setValue(AppUtils.getHostName())); buttonGroup.addComponent(getHostNameButton); buttonGroup.setComponentAlignment(getHostNameButton, Alignment.BOTTOM_LEFT); editAgentLayout.addComponent(buttonGroup); editAgentLayout.setComponentAlignment(buttonGroup, Alignment.BOTTOM_LEFT); Button exportButton = new Button("Export Agent Config", event -> exportConfiguration()); editAgentLayout.addComponent(exportButton); editAgentLayout.setComponentAlignment(exportButton, Alignment.BOTTOM_LEFT); CheckBox autoRefresh = new CheckBox("Auto Refresh", Boolean.valueOf(agent.isAutoRefresh())); autoRefresh.setImmediate(true); autoRefresh.addValueChangeListener(event -> { agent.setAutoRefresh(autoRefresh.getValue()); EditAgentPanel.this.context.getConfigurationService().save((AbstractObject) agent); EditAgentPanel.this.context.getAgentManager().refresh(agent); }); editAgentLayout.addComponent(autoRefresh); editAgentLayout.setComponentAlignment(autoRefresh, Alignment.BOTTOM_LEFT); CheckBox allowTestFlowsField = new CheckBox("Allow Test Flows", Boolean.valueOf(agent.isAllowTestFlows())); allowTestFlowsField.setImmediate(true); allowTestFlowsField.addValueChangeListener(event -> { agent.setAllowTestFlows(allowTestFlowsField.getValue()); EditAgentPanel.this.context.getConfigurationService().save((AbstractObject) agent); EditAgentPanel.this.context.getAgentManager().refresh(agent); }); editAgentLayout.addComponent(allowTestFlowsField); editAgentLayout.setComponentAlignment(allowTestFlowsField, Alignment.BOTTOM_LEFT); ButtonBar buttonBar = new ButtonBar(); addComponent(buttonBar); addDeploymentButton = buttonBar.addButton("Add Deployment", Icons.DEPLOYMENT); addDeploymentButton.addClickListener(new AddDeploymentClickListener()); editButton = buttonBar.addButton("Edit", FontAwesome.EDIT); editButton.addClickListener(event -> editClicked()); enableButton = buttonBar.addButton("Enable", FontAwesome.CHAIN); enableButton.addClickListener(event -> enableClicked()); disableButton = buttonBar.addButton("Disable", FontAwesome.CHAIN_BROKEN); disableButton.addClickListener(event -> disableClicked()); removeButton = buttonBar.addButton("Remove", FontAwesome.TRASH_O); removeButton.addClickListener(event -> removeClicked()); runButton = buttonBar.addButton("Run", Icons.RUN); runButton.addClickListener(event -> runClicked()); container = new BeanItemContainer<AgentDeploymentSummary>(AgentDeploymentSummary.class); container.setItemSorter(new TableItemSorter()); table = new Table(); table.setSizeFull(); table.setCacheRate(100); table.setPageLength(100); table.setImmediate(true); table.setSelectable(true); table.setMultiSelect(true); table.setContainerDataSource(container); table.setVisibleColumns("name", "projectName", "type", "status", "logLevel", "startType", "startExpression"); table.setColumnHeaders("Deployment", "Project", "Type", "Status", "Log Level", "Start Type", "Start Expression"); table.addGeneratedColumn("status", new StatusRenderer()); table.addItemClickListener(new TableItemClickListener()); table.addValueChangeListener(new TableValueChangeListener()); table.setSortContainerPropertyId("type"); table.setSortAscending(true); addComponent(table); setExpandRatio(table, 1.0f); refresh(); setButtonsEnabled(); backgroundRefresherService.register(this); }
From source file:org.jumpmind.metl.ui.views.deploy.EditAgentParametersWindow.java
License:Open Source License
public EditAgentParametersWindow(final ApplicationContext context, final Agent agent) { super("Agent Parameters"); this.context = context; this.agent = agent; Button closeButton = new Button("Close"); closeButton.addStyleName(ValoTheme.BUTTON_PRIMARY); closeButton.addClickListener(new CloseClickListener()); ButtonBar buttonBar = new ButtonBar(); buttonBar.addButton("Add", FontAwesome.PLUS, new AddClickListener()); removeButton = buttonBar.addButton("Remove", FontAwesome.TRASH_O, new RemoveClickListener()); removeButton.setEnabled(false);//from w ww.j a v a2 s. c om addComponent(buttonBar); table = new Table(); table.setSizeFull(); BeanItemContainer<AgentParameter> container = new BeanItemContainer<AgentParameter>(AgentParameter.class); table.setContainerDataSource(container); table.setEditable(true); table.setSelectable(true); table.setTableFieldFactory(new EditFieldFactory()); table.setVisibleColumns("name", "value"); table.setColumnHeaders("Name", "Value"); table.addValueChangeListener(this); addComponent(table, 1); addComponent(buildButtonFooter(closeButton)); if (agent.getAgentParameters() != null) { for (AgentParameter parameter : agent.getAgentParameters()) { table.addItem(parameter); } } }
From source file:org.jumpmind.metl.ui.views.design.EditContentRouterPanel.java
License:Open Source License
protected void buildUI() { if (!readOnly) { ButtonBar buttonBar = new ButtonBar(); addComponent(buttonBar);//from w ww . j a v a 2s. co m addButton = buttonBar.addButton("Add", FontAwesome.PLUS); addButton.addClickListener((event) -> table.addItem(new Route())); removeButton = buttonBar.addButton("Remove", FontAwesome.TRASH_O); removeButton.addClickListener((event) -> { if (table.getValue() != null) { table.removeItem(table.getValue()); save(); } }); } table.setContainerDataSource(container); table.setSelectable(true); table.setSortEnabled(false); table.setImmediate(true); table.setSizeFull(); table.setVisibleColumns(new Object[] { "matchExpression", "targetStepId" }); table.setColumnHeaders(new String[] { "Expression", "Target Step" }); table.setTableFieldFactory(new EditFieldFactory()); table.addItemClickListener((event) -> { if (table.getValue() != null) { table.setValue(null); } }); table.setEditable(true); if (!readOnly) { table.addValueChangeListener((event) -> removeButton.setEnabled(table.getValue() != null)); } addComponent(table); setExpandRatio(table, 1.0f); String json = flowStep.getComponent().get(ContentRouter.SETTING_CONFIG); if (isNotBlank(json)) { try { List<Route> routes = new ObjectMapper().readValue(json, new TypeReference<List<Route>>() { }); for (Route route : routes) { table.addItem(route); } } catch (Exception e) { throw new RuntimeException(e); } } }
From source file:org.jumpmind.metl.ui.views.design.EditFlowPanel.java
License:Open Source License
protected HorizontalLayout buildButtonBar() { ButtonBar buttonBar = new ButtonBar(); if (!readOnly) { runButton = buttonBar.addButton("Run", Icons.RUN); runButton.addClickListener(new ClickListener() { @Override//from w w w .j a v a 2 s.c o m public void buttonClick(ClickEvent event) { runFlow(); } }); copyButton = buttonBar.addButton("Copy", FontAwesome.COPY); copyButton.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { copySelected(); } }); delButton = buttonBar.addButton("Remove", FontAwesome.TRASH_O); delButton.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { deleteSelected(); } }); delButton.setEnabled(false); } parametersButton = buttonBar.addButton("Parameters", FontAwesome.LIST_OL); parametersButton .addClickListener((event) -> new EditParametersDialog(context, flow, readOnly).showAtSize(.75)); return buttonBar; }
From source file:org.jumpmind.metl.ui.views.design.EditParametersDialog.java
License:Open Source License
public EditParametersDialog(ApplicationContext context, Flow flow, boolean readOnly) { super("Flow Parameters"); this.context = context; this.flow = flow; Button closeButton = new Button("Close"); closeButton.addStyleName(ValoTheme.BUTTON_PRIMARY); closeButton.addClickListener(new CloseClickListener()); if (!readOnly) { ButtonBar buttonBar = new ButtonBar(); buttonBar.addButton("Add", FontAwesome.PLUS, new AddClickListener()); insertButton = buttonBar.addButton("Insert", FontAwesome.CHEVRON_RIGHT, new InsertClickListener()); insertButton.setEnabled(false);/*from ww w. j a v a 2 s. c o m*/ removeButton = buttonBar.addButton("Remove", FontAwesome.TRASH_O, new RemoveClickListener()); removeButton.setEnabled(false); addComponent(buttonBar); } table = new Table(); table.setSizeFull(); container = new BeanItemContainer<FlowParameter>(FlowParameter.class); table.setContainerDataSource(container); table.setSelectable(true); table.setSortEnabled(false); if (!readOnly) { table.setEditable(true); table.setDragMode(TableDragMode.ROW); table.setDropHandler(new TableDropHandler()); table.setTableFieldFactory(new EditFieldFactory()); table.addValueChangeListener(this); } table.setVisibleColumns("position", "name", "defaultValue"); table.setColumnHeaders("#", "Name", "Default Value"); table.setColumnExpandRatio("name", .3f); table.setColumnExpandRatio("defaultValue", .6f); addComponent(table, 1); addComponent(buildButtonFooter(closeButton)); List<FlowParameter> params = flow.getFlowParameters(); Collections.sort(params, new Comparator<FlowParameter>() { public int compare(FlowParameter o1, FlowParameter o2) { return new Integer(o1.getPosition()).compareTo(new Integer(o2.getPosition())); } }); for (FlowParameter flowParameter : params) { table.addItem(flowParameter); } }
From source file:org.jumpmind.metl.ui.views.design.EditModelPanel.java
License:Open Source License
public EditModelPanel(ApplicationContext context, String modelId, boolean readOnly) { this.context = context; this.model = new Model(modelId); this.readOnly = readOnly; context.getConfigurationService().refresh(model); ButtonBar buttonBar = new ButtonBar(); addComponent(buttonBar);/*from w w w .ja va 2 s .c o m*/ if (!readOnly) { addEntityButton = buttonBar.addButton("Add Entity", FontAwesome.TABLE); addEntityButton.addClickListener(new AddEntityClickListener()); addAttributeButton = buttonBar.addButton("Add Attribute", FontAwesome.COLUMNS); addAttributeButton.addClickListener(new AddAttributeClickListener()); editButton = buttonBar.addButton("Edit", FontAwesome.EDIT); editButton.addClickListener(new EditClickListener()); removeButton = buttonBar.addButton("Remove", FontAwesome.TRASH_O); removeButton.addClickListener(new RemoveClickListener()); importButton = buttonBar.addButton("Import ...", FontAwesome.DOWNLOAD); importButton.addClickListener(new ImportClickListener()); } filterField = buttonBar.addFilter(); filterField.addTextChangeListener(new TextChangeListener() { public void textChange(TextChangeEvent event) { filterField.setValue(event.getText()); treeTable.removeAllItems(); addAll(event.getText(), EditModelPanel.this.model.getModelEntities()); } }); treeTable.setSizeFull(); treeTable.setCacheRate(100); treeTable.setPageLength(100); treeTable.setImmediate(true); treeTable.setSelectable(true); treeTable.setMultiSelect(true); treeTable.addGeneratedColumn("name", new ColumnGenerator() { public Object generateCell(Table source, Object itemId, Object columnId) { final AbstractObject obj = (AbstractObject) itemId; if (lastEditItemIds.contains(itemId) && !readOnly) { ImmediateUpdateTextField t = new ImmediateUpdateTextField(null) { protected void save(String text) { obj.setName(text); EditModelPanel.this.context.getConfigurationService().save(obj); }; }; t.setWidth(100, Unit.PERCENTAGE); t.setValue(obj.getName()); t.focus(); t.selectAll(); return t; } else { return UiUtils.getName(filterField.getValue(), obj.getName()); } } }); treeTable.setColumnHeader("name", "Name"); treeTable.addGeneratedColumn("description", new ColumnGenerator() { public Object generateCell(Table source, Object itemId, Object columnId) { if (itemId instanceof ModelAttribute) { final ModelAttribute obj = (ModelAttribute) itemId; if (lastEditItemIds.contains(itemId) && !readOnly) { ImmediateUpdateTextField t = new ImmediateUpdateTextField(null) { protected void save(String text) { obj.setDescription(text); EditModelPanel.this.context.getConfigurationService().save(obj); }; }; t.setWidth(100, Unit.PERCENTAGE); t.setValue(obj.getDescription()); return t; } else { return UiUtils.getName(filterField.getValue(), obj.getDescription()); } } if (itemId instanceof ModelEntity) { final ModelEntity obj = (ModelEntity) itemId; if (lastEditItemIds.contains(itemId) && !readOnly) { ImmediateUpdateTextField t = new ImmediateUpdateTextField(null) { protected void save(String text) { obj.setDescription(text); EditModelPanel.this.context.getConfigurationService().save(obj); }; }; t.setWidth(100, Unit.PERCENTAGE); t.setValue(obj.getDescription()); return t; } else { return UiUtils.getName(filterField.getValue(), obj.getDescription()); } } else return null; } }); treeTable.setColumnHeader("description", "Description"); treeTable.addGeneratedColumn("type", new ColumnGenerator() { public Object generateCell(Table source, Object itemId, Object columnId) { if (itemId instanceof ModelAttribute) { final ModelAttribute obj = (ModelAttribute) itemId; if (lastEditItemIds.contains(itemId) && !readOnly) { final ComboBox cbox = new ComboBox(); cbox.setNullSelectionAllowed(false); for (DataType dataType : DataType.values()) { cbox.addItem(dataType.name()); } cbox.setValue(obj.getType()); cbox.addValueChangeListener(new ValueChangeListener() { public void valueChange(ValueChangeEvent event) { obj.setType((String) cbox.getValue()); EditModelPanel.this.context.getConfigurationService().save(obj); } }); cbox.addBlurListener(new BlurListener() { public void blur(BlurEvent event) { Collection<?> items = treeTable.getItemIds(); boolean found = false; for (Object item : items) { if (item.equals(obj)) { found = true; } else if (found) { selectOnly(item); editSelectedItem(); break; } } } }); return cbox; } else { return obj.getType(); } } else { return null; } } }); treeTable.setColumnHeader("type", "Type"); treeTable.addGeneratedColumn("pk", new ColumnGenerator() { public Object generateCell(Table source, Object itemId, Object columnId) { if (itemId instanceof ModelAttribute) { final ModelAttribute obj = (ModelAttribute) itemId; if (lastEditItemIds.contains(itemId) && !readOnly) { final CheckBox cbox = new CheckBox(); cbox.setValue(obj.isPk()); cbox.setImmediate(true); cbox.addValueChangeListener(event -> togglePk(obj)); cbox.addBlurListener(new BlurListener() { public void blur(BlurEvent event) { Collection<?> items = treeTable.getItemIds(); boolean found = false; for (Object item : items) { if (item.equals(obj)) { found = true; } else if (found) { selectOnly(item); editSelectedItem(); break; } } } }); return cbox; } else if (obj.isPk()) { return new Label(FontAwesome.KEY.getHtml(), ContentMode.HTML); } } return null; } }); treeTable.setColumnHeader("pk", "PK"); treeTable.setColumnWidth("pk", 40); treeTable.addItemClickListener(new TreeTableItemClickListener()); treeTable.addValueChangeListener(new TreeTableValueChangeListener()); enterKeyListener = new ShortcutListener("Enter", KeyCode.ENTER, null) { public void handleAction(Object sender, Object target) { lastEditItemIds = Collections.emptySet(); treeTable.refreshRowCache(); } }; addComponent(treeTable); setExpandRatio(treeTable, 1.0f); HorizontalLayout hlayout = new HorizontalLayout(); addComponent(hlayout); Button collapseAll = new Button("Collapse All"); collapseAll.addStyleName(ValoTheme.BUTTON_LINK); collapseAll.addStyleName(ValoTheme.BUTTON_SMALL); hlayout.addComponent(collapseAll); collapseAll.addClickListener(new ClickListener() { public void buttonClick(ClickEvent event) { for (Object itemId : treeTable.getItemIds()) { treeTable.setCollapsed(itemId, true); } } }); Button expandAll = new Button("Expand All"); expandAll.addStyleName(ValoTheme.BUTTON_LINK); expandAll.addStyleName(ValoTheme.BUTTON_SMALL); hlayout.addComponent(expandAll); expandAll.addClickListener(new ClickListener() { public void buttonClick(ClickEvent event) { for (Object itemId : treeTable.getItemIds()) { treeTable.setCollapsed(itemId, false); } } }); addAll("", model.getModelEntities()); setButtonsEnabled(); }