List of usage examples for com.vaadin.ui HorizontalLayout setSizeUndefined
@Override public void setSizeUndefined()
From source file:info.magnolia.ui.form.field.upload.basic.BasicUploadField.java
License:Open Source License
/** * Build the Completed Action Layout.// w ww.j ava 2 s .c o m */ protected Layout createCompletedActionLayout() { // Action Button (Upload new or delete). Default is always Upload HorizontalLayout actionLayout = new HorizontalLayout(); actionLayout.setSizeUndefined(); actionLayout.addStyleName("buttons"); actionLayout.setSpacing(true); // Add Upload Button getUpload().setButtonCaption(getCaption(selectAnotherCaption, null)); actionLayout.addComponent(getUpload()); // Add Remove Button if a file is present. if (!getValue().isEmpty()) { Button delete = createDeleteButton(); actionLayout.addComponent(delete); actionLayout.setComponentAlignment(delete, Alignment.MIDDLE_RIGHT); } return actionLayout; }
From source file:org.activiti.editor.ui.EditorProcessDefinitionInfoComponent.java
License:Apache License
protected void initImage() { processImageContainer = new VerticalLayout(); Label processTitle = new Label(i18nManager.getMessage(Messages.PROCESS_HEADER_DIAGRAM)); processTitle.addStyleName(ExplorerLayout.STYLE_H3); processImageContainer.addComponent(processTitle); StreamSource streamSource = null; final byte[] editorSourceExtra = repositoryService.getModelEditorSourceExtra(modelData.getId()); if (editorSourceExtra != null) { streamSource = new StreamSource() { private static final long serialVersionUID = 1L; public InputStream getStream() { InputStream inStream = null; try { inStream = new ByteArrayInputStream(editorSourceExtra); } catch (Exception e) { LOGGER.warn("Error reading PNG in StreamSource", e); }/*w w w . j a v a2 s. c om*/ return inStream; } }; } if (streamSource != null) { Embedded embedded = new Embedded(null, new ImageStreamSource(streamSource, ExplorerApp.get())); embedded.setType(Embedded.TYPE_IMAGE); embedded.setSizeUndefined(); Panel imagePanel = new Panel(); // using panel for scrollbars imagePanel.addStyleName(Reindeer.PANEL_LIGHT); imagePanel.setWidth(100, UNITS_PERCENTAGE); imagePanel.setHeight(700, UNITS_PIXELS); HorizontalLayout panelLayout = new HorizontalLayout(); panelLayout.setSizeUndefined(); imagePanel.setContent(panelLayout); imagePanel.addComponent(embedded); processImageContainer.addComponent(imagePanel); } else { Label noImageAvailable = new Label(i18nManager.getMessage(Messages.PROCESS_NO_DIAGRAM)); processImageContainer.addComponent(noImageAvailable); } addComponent(processImageContainer); }
From source file:org.activiti.explorer.ui.management.process.ProcessInstanceDetailPanel.java
License:Apache License
protected void addProcessImage() { ProcessDefinitionEntity processDefinitionEntity = (ProcessDefinitionEntity) ((RepositoryServiceImpl) repositoryService) .getDeployedProcessDefinition(processDefinition.getId()); // Only show when graphical notation is defined if (processDefinitionEntity != null && processDefinitionEntity.isGraphicalNotationDefined()) { StreamResource diagram = new ProcessDefinitionImageStreamResourceBuilder() .buildStreamResource(processInstance, repositoryService, runtimeService); if (diagram != null) { Label header = new Label(i18nManager.getMessage(Messages.PROCESS_HEADER_DIAGRAM)); header.addStyleName(ExplorerLayout.STYLE_H3); header.addStyleName(ExplorerLayout.STYLE_DETAIL_BLOCK); header.addStyleName(ExplorerLayout.STYLE_NO_LINE); panelLayout.addComponent(header); Embedded embedded = new Embedded(null, diagram); embedded.setType(Embedded.TYPE_IMAGE); embedded.setSizeUndefined(); Panel imagePanel = new Panel(); // using panel for scrollbars imagePanel.setScrollable(true); imagePanel.addStyleName(Reindeer.PANEL_LIGHT); imagePanel.setWidth(100, UNITS_PERCENTAGE); imagePanel.setHeight(400, UNITS_PIXELS); HorizontalLayout panelLayoutT = new HorizontalLayout(); panelLayoutT.setSizeUndefined(); imagePanel.setContent(panelLayoutT); imagePanel.addComponent(embedded); panelLayout.addComponent(imagePanel); }// w w w . ja v a 2 s . co m } }
From source file:org.activiti.explorer.ui.management.processinstance.ProcessInstanceDetailPanel.java
License:Apache License
protected void addProcessImage() { ProcessDefinitionEntity processDefinitionEntity = (ProcessDefinitionEntity) ((RepositoryServiceImpl) repositoryService) .getDeployedProcessDefinition(processDefinition.getId()); // Only show when graphical notation is defined if (processDefinitionEntity != null) { boolean didDrawImage = false; if (ExplorerApp.get().isUseJavascriptDiagram()) { try { final InputStream definitionStream = repositoryService.getResourceAsStream( processDefinition.getDeploymentId(), processDefinition.getResourceName()); XMLInputFactory xif = XmlUtil.createSafeXmlInputFactory(); XMLStreamReader xtr = xif.createXMLStreamReader(definitionStream); BpmnModel bpmnModel = new BpmnXMLConverter().convertToBpmnModel(xtr); if (!bpmnModel.getFlowLocationMap().isEmpty()) { int maxX = 0; int maxY = 0; for (String key : bpmnModel.getLocationMap().keySet()) { GraphicInfo graphicInfo = bpmnModel.getGraphicInfo(key); double elementX = graphicInfo.getX() + graphicInfo.getWidth(); if (maxX < elementX) { maxX = (int) elementX; }//from w ww . j a va2 s. c o m double elementY = graphicInfo.getY() + graphicInfo.getHeight(); if (maxY < elementY) { maxY = (int) elementY; } } Panel imagePanel = new Panel(); // using panel for scrollbars imagePanel.addStyleName(Reindeer.PANEL_LIGHT); imagePanel.setWidth(100, UNITS_PERCENTAGE); imagePanel.setHeight(100, UNITS_PERCENTAGE); URL explorerURL = ExplorerApp.get().getURL(); URL url = new URL(explorerURL.getProtocol(), explorerURL.getHost(), explorerURL.getPort(), explorerURL.getPath().replace("/ui", "") + "diagram-viewer/index.html?processDefinitionId=" + processDefinition.getId() + "&processInstanceId=" + processInstance.getId()); Embedded browserPanel = new Embedded("", new ExternalResource(url)); browserPanel.setType(Embedded.TYPE_BROWSER); browserPanel.setWidth(maxX + 350 + "px"); browserPanel.setHeight(maxY + 220 + "px"); HorizontalLayout panelLayoutT = new HorizontalLayout(); panelLayoutT.setSizeUndefined(); imagePanel.setContent(panelLayoutT); imagePanel.addComponent(browserPanel); panelLayout.addComponent(imagePanel); didDrawImage = true; } } catch (Exception e) { LOGGER.error("Error loading process diagram component", e); } } if (!didDrawImage && processDefinitionEntity.isGraphicalNotationDefined()) { ProcessEngineConfiguration processEngineConfiguration = ProcessEngines.getDefaultProcessEngine() .getProcessEngineConfiguration(); ProcessDiagramGenerator diagramGenerator = processEngineConfiguration.getProcessDiagramGenerator(); StreamResource diagram = new ProcessDefinitionImageStreamResourceBuilder().buildStreamResource( processInstance, repositoryService, runtimeService, diagramGenerator, processEngineConfiguration); if (diagram != null) { Label header = new Label(i18nManager.getMessage(Messages.PROCESS_HEADER_DIAGRAM)); header.addStyleName(ExplorerLayout.STYLE_H3); header.addStyleName(ExplorerLayout.STYLE_DETAIL_BLOCK); header.addStyleName(ExplorerLayout.STYLE_NO_LINE); panelLayout.addComponent(header); Embedded embedded = new Embedded(null, diagram); embedded.setType(Embedded.TYPE_IMAGE); embedded.setSizeUndefined(); Panel imagePanel = new Panel(); // using panel for scrollbars imagePanel.setScrollable(true); imagePanel.addStyleName(Reindeer.PANEL_LIGHT); imagePanel.setWidth(100, UNITS_PERCENTAGE); imagePanel.setHeight(100, UNITS_PERCENTAGE); HorizontalLayout panelLayoutT = new HorizontalLayout(); panelLayoutT.setSizeUndefined(); imagePanel.setContent(panelLayoutT); imagePanel.addComponent(embedded); panelLayout.addComponent(imagePanel); } } } }
From source file:org.activiti.explorer.ui.process.ProcessDefinitionInfoComponent.java
License:Apache License
protected void initImage() { processImageContainer = new VerticalLayout(); Label processTitle = new Label(i18nManager.getMessage(Messages.PROCESS_HEADER_DIAGRAM)); processTitle.addStyleName(ExplorerLayout.STYLE_H3); processImageContainer.addComponent(processTitle); boolean didDrawImage = false; if (ExplorerApp.get().isUseJavascriptDiagram()) { try {/*from w w w .j a v a2 s.c o m*/ final InputStream definitionStream = repositoryService.getResourceAsStream( processDefinition.getDeploymentId(), processDefinition.getResourceName()); XMLInputFactory xif = XmlUtil.createSafeXmlInputFactory(); XMLStreamReader xtr = xif.createXMLStreamReader(definitionStream); BpmnModel bpmnModel = new BpmnXMLConverter().convertToBpmnModel(xtr); if (!bpmnModel.getFlowLocationMap().isEmpty()) { int maxX = 0; int maxY = 0; for (String key : bpmnModel.getLocationMap().keySet()) { GraphicInfo graphicInfo = bpmnModel.getGraphicInfo(key); double elementX = graphicInfo.getX() + graphicInfo.getWidth(); if (maxX < elementX) { maxX = (int) elementX; } double elementY = graphicInfo.getY() + graphicInfo.getHeight(); if (maxY < elementY) { maxY = (int) elementY; } } Panel imagePanel = new Panel(); // using panel for scrollbars imagePanel.addStyleName(Reindeer.PANEL_LIGHT); imagePanel.setWidth(100, UNITS_PERCENTAGE); imagePanel.setHeight(100, UNITS_PERCENTAGE); URL explorerURL = ExplorerApp.get().getURL(); URL url = new URL(explorerURL.getProtocol(), explorerURL.getHost(), explorerURL.getPort(), explorerURL.getPath().replace("/ui", "") + "diagram-viewer/index.html?processDefinitionId=" + processDefinition.getId()); Embedded browserPanel = new Embedded("", new ExternalResource(url)); browserPanel.setType(Embedded.TYPE_BROWSER); browserPanel.setWidth(maxX + 350 + "px"); browserPanel.setHeight(maxY + 220 + "px"); HorizontalLayout panelLayout = new HorizontalLayout(); panelLayout.setSizeUndefined(); imagePanel.setContent(panelLayout); imagePanel.addComponent(browserPanel); processImageContainer.addComponent(imagePanel); didDrawImage = true; } } catch (Exception e) { LOGGER.error("Error loading process diagram component", e); } } if (didDrawImage == false) { StreamResource diagram = null; // Try generating process-image stream if (processDefinition.getDiagramResourceName() != null) { diagram = new ProcessDefinitionImageStreamResourceBuilder().buildStreamResource(processDefinition, repositoryService); } if (diagram != null) { Embedded embedded = new Embedded(null, diagram); embedded.setType(Embedded.TYPE_IMAGE); embedded.setSizeUndefined(); Panel imagePanel = new Panel(); // using panel for scrollbars imagePanel.addStyleName(Reindeer.PANEL_LIGHT); imagePanel.setWidth(100, UNITS_PERCENTAGE); imagePanel.setHeight(100, UNITS_PERCENTAGE); HorizontalLayout panelLayout = new HorizontalLayout(); panelLayout.setSizeUndefined(); imagePanel.setContent(panelLayout); imagePanel.addComponent(embedded); processImageContainer.addComponent(imagePanel); didDrawImage = true; } } if (didDrawImage == false) { Label noImageAvailable = new Label(i18nManager.getMessage(Messages.PROCESS_NO_DIAGRAM)); processImageContainer.addComponent(noImageAvailable); } addComponent(processImageContainer); }
From source file:org.activiti.explorer.ui.process.simple.editor.SimpleTableEditor.java
License:Apache License
protected void showDiagram() { StreamResource.StreamSource streamSource = new StreamSource() { private static final long serialVersionUID = 6993112534181068935L; public InputStream getStream() { WorkflowDefinitionConversion workflowDefinitionConversion = ExplorerApp.get() .getWorkflowDefinitionConversionFactory() .createWorkflowDefinitionConversion(createWorkflow()); final ProcessEngineImpl defaultProcessEngine = (ProcessEngineImpl) ProcessEngines .getDefaultProcessEngine(); final ProcessEngineConfiguration processEngineConfiguration = defaultProcessEngine .getProcessEngineConfiguration(); final ProcessDiagramGenerator diagramGenerator = processEngineConfiguration .getProcessDiagramGenerator(); return diagramGenerator.generateDiagram(workflowDefinitionConversion.getBpmnModel(), "png", processEngineConfiguration.getActivityFontName(), processEngineConfiguration.getLabelFontName(), processEngineConfiguration.getClassLoader()); }//from w w w . j a va 2s. c om }; // resource must have unique id (or cache-crap can happen)! StreamResource imageresource = new StreamResource(streamSource, UUID.randomUUID() + ".png", ExplorerApp.get()); Embedded diagram = new Embedded("", imageresource); diagram.setType(Embedded.TYPE_IMAGE); diagram.setSizeUndefined(); imagePanel = new Panel(); // using panel for scrollbars imagePanel.setScrollable(true); imagePanel.addStyleName(Reindeer.PANEL_LIGHT); imagePanel.setWidth(100, UNITS_PERCENTAGE); imagePanel.setHeight("100%"); mainLayout.addComponent(imagePanel); HorizontalLayout panelLayout = new HorizontalLayout(); panelLayout.setSizeUndefined(); imagePanel.setContent(panelLayout); imagePanel.addComponent(diagram); }
From source file:org.agocontrol.site.viewlet.bus.BusesFlowlet.java
License:Apache License
@Override public void initialize() { final List<FieldDescriptor> fieldDescriptors = AgoControlSiteFields.getFieldDescriptors(Bus.class); final List<FilterDescriptor> filterDefinitions = new ArrayList<FilterDescriptor>(); final EntityManager entityManager = getSite().getSiteContext().getObject(EntityManager.class); container = new EntityContainer<Bus>(entityManager, true, true, false, Bus.class, 1000, new String[] { "name" }, new boolean[] { true }, "busId"); ContainerUtil.addContainerProperties(container, fieldDescriptors); final GridLayout gridLayout = new GridLayout(1, 2); gridLayout.setSizeFull();//from w w w .j a v a2 s . c o m gridLayout.setMargin(false); gridLayout.setSpacing(true); gridLayout.setRowExpandRatio(1, 1f); setViewContent(gridLayout); final HorizontalLayout buttonLayout = new HorizontalLayout(); buttonLayout.setSpacing(true); buttonLayout.setSizeUndefined(); gridLayout.addComponent(buttonLayout, 0, 0); final Table table = new FormattingTable(); grid = new Grid(table, container); grid.setFields(fieldDescriptors); grid.setFilters(filterDefinitions); table.setColumnCollapsed("created", true); table.setColumnCollapsed("modified", true); gridLayout.addComponent(grid, 0, 1); final Button addButton = getSite().getButton("add"); buttonLayout.addComponent(addButton); addButton.addClickListener(new ClickListener() { /** Serial version UID. */ private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { final Bus bus = new Bus(); bus.setCreated(new Date()); bus.setModified(bus.getCreated()); bus.setInventorySynchronized(new Date(0L)); bus.setConnectionStatus(BusConnectionStatus.Disconnected); bus.setOwner((Company) getSite().getSiteContext().getObject(Company.class)); final BusFlowlet busView = getViewSheet().forward(BusFlowlet.class); busView.edit(bus, true); } }); final Button editButton = getSite().getButton("edit"); buttonLayout.addComponent(editButton); editButton.addClickListener(new ClickListener() { /** Serial version UID. */ private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { final Bus entity = container.getEntity(grid.getSelectedItemId()); final BusFlowlet busView = getViewSheet().forward(BusFlowlet.class); busView.edit(entity, false); } }); final Button removeButton = getSite().getButton("remove"); buttonLayout.addComponent(removeButton); removeButton.addClickListener(new ClickListener() { /** Serial version UID. */ private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { container.removeItem(grid.getSelectedItemId()); container.commit(); } }); final Company company = getSite().getSiteContext().getObject(Company.class); container.removeDefaultFilters(); container.addDefaultFilter(new Compare.Equal("owner.companyId", company.getCompanyId())); grid.refresh(); }
From source file:org.agocontrol.site.viewlet.element.ElementsFlowlet.java
License:Apache License
@Override public void initialize() { final List<FieldDescriptor> fieldDescriptors = AgoControlSiteFields.getFieldDescriptors(Element.class); final List<FilterDescriptor> filterDefinitions = new ArrayList<FilterDescriptor>(); final EntityManager entityManager = getSite().getSiteContext().getObject(EntityManager.class); container = new EntityContainer<Element>(entityManager, true, true, false, Element.class, 1000, new String[] { "treeIndex" }, new boolean[] { true }, "elementId"); ContainerUtil.addContainerProperties(container, fieldDescriptors); final GridLayout gridLayout = new GridLayout(1, 2); gridLayout.setSizeFull();/*from ww w. ja v a 2 s . co m*/ gridLayout.setMargin(false); gridLayout.setSpacing(true); gridLayout.setRowExpandRatio(1, 1f); setViewContent(gridLayout); final HorizontalLayout buttonLayout = new HorizontalLayout(); buttonLayout.setSpacing(true); buttonLayout.setSizeUndefined(); gridLayout.addComponent(buttonLayout, 0, 0); final Table table = new FormattingTable(); grid = new Grid(table, container); grid.setFields(fieldDescriptors); grid.setFilters(filterDefinitions); table.setColumnCollapsed("elementId", true); table.setColumnCollapsed("bus", true); table.setColumnCollapsed("created", true); table.setColumnCollapsed("modified", true); gridLayout.addComponent(grid, 0, 1); final Button addButton = getSite().getButton("add"); buttonLayout.addComponent(addButton); addButton.addClickListener(new ClickListener() { /** Serial version UID. */ private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { final Element element = new Element(); element.setCreated(new Date()); element.setModified(element.getCreated()); element.setOwner((Company) getSite().getSiteContext().getObject(Company.class)); final ElementFlowlet elementView = getViewSheet().forward(ElementFlowlet.class); elementView.edit(element, true); } }); final Button editButton = getSite().getButton("edit"); buttonLayout.addComponent(editButton); editButton.addClickListener(new ClickListener() { /** Serial version UID. */ private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { final Element entity = container.getEntity(grid.getSelectedItemId()); final ElementFlowlet elementView = getViewSheet().forward(ElementFlowlet.class); elementView.edit(entity, false); } }); final Button removeButton = getSite().getButton("remove"); buttonLayout.addComponent(removeButton); removeButton.addClickListener(new ClickListener() { /** Serial version UID. */ private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { final Element element = container.getEntity(grid.getSelectedItemId()); container.removeItem(grid.getSelectedItemId()); container.commit(); final BusClient busClient = ((AgoControlSiteUI) UI.getCurrent()).getBusClient(element.getBus()); if (busClient != null) { if (busClient.removeElement(element)) { Notification.show("Element removal sent to bus.", Notification.Type.HUMANIZED_MESSAGE); } else { Notification.show("Element removal bus error.", Notification.Type.ERROR_MESSAGE); } } } }); final Company company = getSite().getSiteContext().getObject(Company.class); container.removeDefaultFilters(); container.addDefaultFilter(new Compare.Equal("owner.companyId", company.getCompanyId())); grid.refresh(); }
From source file:org.agocontrol.site.viewlet.record.RecordsFlowlet.java
License:Apache License
@Override public void initialize() { final List<FieldDescriptor> fieldDescriptors = AgoControlSiteFields.getFieldDescriptors(Record.class); final List<FilterDescriptor> filterDefinitions = new ArrayList<FilterDescriptor>(); final EntityManager entityManager = getSite().getSiteContext().getObject(EntityManager.class); container = new LazyEntityContainer<Record>(entityManager, true, false, false, Record.class, 50, new String[] { "created" }, new boolean[] { false }, "recordId"); ContainerUtil.addContainerProperties(container, fieldDescriptors); final GridLayout gridLayout = new GridLayout(1, 2); gridLayout.setSizeFull();/* www . java 2s . c om*/ gridLayout.setMargin(false); gridLayout.setSpacing(true); gridLayout.setRowExpandRatio(1, 1f); setViewContent(gridLayout); final HorizontalLayout buttonLayout = new HorizontalLayout(); buttonLayout.setSpacing(true); buttonLayout.setSizeUndefined(); gridLayout.addComponent(buttonLayout, 0, 0); final Table table = new FormattingTable(); grid = new Grid(table, container); grid.setFields(fieldDescriptors); grid.setFilters(filterDefinitions); table.setColumnCollapsed("recordId", true); table.setColumnCollapsed("modified", true); gridLayout.addComponent(grid, 0, 1); final Button addButton = getSite().getButton("add"); buttonLayout.addComponent(addButton); addButton.addClickListener(new ClickListener() { /** Serial version UID. */ private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { final Record record = new Record(); record.setCreated(new Date()); record.setModified(record.getCreated()); record.setOwner((Company) getSite().getSiteContext().getObject(Company.class)); final RecordFlowlet recordView = getViewSheet().forward(RecordFlowlet.class); recordView.edit(record, true); } }); final Button editButton = getSite().getButton("edit"); buttonLayout.addComponent(editButton); editButton.addClickListener(new ClickListener() { /** Serial version UID. */ private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { final Record entity = container.getEntity(grid.getSelectedItemId()); final RecordFlowlet recordView = getViewSheet().forward(RecordFlowlet.class); recordView.edit(entity, false); } }); final Button removeButton = getSite().getButton("remove"); buttonLayout.addComponent(removeButton); removeButton.addClickListener(new ClickListener() { /** Serial version UID. */ private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { container.removeItem(grid.getSelectedItemId()); container.commit(); } }); final Company company = getSite().getSiteContext().getObject(Company.class); container.removeDefaultFilters(); container.addDefaultFilter(new Compare.Equal("owner.companyId", company.getCompanyId())); }
From source file:org.agocontrol.site.viewlet.recordset.RecordSetsFlowlet.java
License:Apache License
@Override public void initialize() { final List<FieldDescriptor> fieldDescriptors = AgoControlSiteFields.getFieldDescriptors(RecordSet.class); final List<FilterDescriptor> filterDefinitions = new ArrayList<FilterDescriptor>(); final EntityManager entityManager = getSite().getSiteContext().getObject(EntityManager.class); container = new EntityContainer<RecordSet>(entityManager, true, true, false, RecordSet.class, 1000, new String[] { "name" }, new boolean[] { true }, "recordSetId"); ContainerUtil.addContainerProperties(container, fieldDescriptors); final GridLayout gridLayout = new GridLayout(1, 2); gridLayout.setSizeFull();//from ww w . j a v a 2 s. co m gridLayout.setMargin(false); gridLayout.setSpacing(true); gridLayout.setRowExpandRatio(1, 1f); setViewContent(gridLayout); final HorizontalLayout buttonLayout = new HorizontalLayout(); buttonLayout.setSpacing(true); buttonLayout.setSizeUndefined(); gridLayout.addComponent(buttonLayout, 0, 0); final Table table = new FormattingTable(); grid = new Grid(table, container); grid.setFields(fieldDescriptors); grid.setFilters(filterDefinitions); table.setColumnCollapsed("created", true); table.setColumnCollapsed("modified", true); gridLayout.addComponent(grid, 0, 1); final Button addButton = getSite().getButton("add"); buttonLayout.addComponent(addButton); addButton.addClickListener(new ClickListener() { /** Serial version UID. */ private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { final RecordSet recordSet = new RecordSet(); recordSet.setCreated(new Date()); recordSet.setModified(recordSet.getCreated()); recordSet.setOwner((Company) getSite().getSiteContext().getObject(Company.class)); final RecordSetFlowlet recordSetView = getViewSheet().forward(RecordSetFlowlet.class); recordSetView.edit(recordSet, true); } }); final Button editButton = getSite().getButton("edit"); buttonLayout.addComponent(editButton); editButton.addClickListener(new ClickListener() { /** Serial version UID. */ private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { final RecordSet entity = container.getEntity(grid.getSelectedItemId()); final RecordSetFlowlet recordSetView = getViewSheet().forward(RecordSetFlowlet.class); recordSetView.edit(entity, false); } }); final Button removeButton = getSite().getButton("remove"); buttonLayout.addComponent(removeButton); removeButton.addClickListener(new ClickListener() { /** Serial version UID. */ private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { container.removeItem(grid.getSelectedItemId()); container.commit(); } }); final Company company = getSite().getSiteContext().getObject(Company.class); container.removeDefaultFilters(); container.addDefaultFilter(new Compare.Equal("owner.companyId", company.getCompanyId())); grid.refresh(); }