List of usage examples for com.vaadin.ui Panel setContent
@Override public void setContent(Component content)
From source file:org.vaadin.addons.criteriacontainersample.AbstractEntityApplication.java
License:Apache License
/** * Create the top panel where the user can add filtering restrictions. * @param mainWindow//from w w w. j a v a 2 s . c o m * @return */ private Panel createFilterPanel(VerticalLayout mainLayout) { Panel filterPanel = new Panel(); filterPanel.addStyleName(Runo.PANEL_LIGHT); HorizontalLayout filterLayout = new HorizontalLayout(); filterLayout.setMargin(false); filterLayout.setSpacing(true); filterPanel.setContent(filterLayout); mainLayout.addComponent(filterPanel); Panel buttonPanel = new Panel(); buttonPanel.addStyleName(Runo.PANEL_LIGHT); HorizontalLayout buttonLayout = new HorizontalLayout(); buttonLayout.setMargin(false); buttonLayout.setSpacing(true); buttonPanel.setContent(buttonLayout); mainLayout.addComponent(buttonPanel); Panel buttonPanel2 = new Panel(); buttonPanel2.addStyleName(Runo.PANEL_LIGHT); HorizontalLayout buttonLayout2 = new HorizontalLayout(); buttonLayout2.setMargin(false); buttonLayout2.setSpacing(true); buttonPanel2.setContent(buttonLayout2); mainLayout.addComponent(buttonPanel2); nameFilterField = new TextField("Name"); filterPanel.addComponent(nameFilterField); refreshButton = new Button("Refresh"); refreshButton.addListener(this); buttonPanel.addComponent(refreshButton); editButton = new Button("Edit"); editButton.addListener(this); buttonPanel.addComponent(editButton); saveButton = new Button("Save"); saveButton.addListener(this); saveButton.setEnabled(false); buttonPanel2.addComponent(saveButton); cancelButton = new Button("Cancel"); cancelButton.addListener(this); cancelButton.setEnabled(false); buttonPanel2.addComponent(cancelButton); addItemButton = new Button("Add Row"); addItemButton.addListener(this); addItemButton.setEnabled(false); buttonPanel2.addComponent(addItemButton); removeItemButton = new Button("Remove Row"); removeItemButton.addListener(this); removeItemButton.setEnabled(false); buttonPanel2.addComponent(removeItemButton); return buttonPanel2; }
From source file:org.vaadin.addons.lazyquerycontainer.example.mock.VaadinApplication.java
License:Apache License
@Override protected void init(VaadinRequest request) { VerticalLayout mainLayout = new VerticalLayout(); mainLayout.setMargin(true);//w w w . jav a 2s . c om mainLayout.setSpacing(true); setContent(mainLayout); Panel buttonPanel = new Panel(); buttonPanel.addStyleName(Runo.PANEL_LIGHT); HorizontalLayout buttonLayout = new HorizontalLayout(); buttonLayout.setMargin(false); buttonLayout.setSpacing(true); buttonPanel.setContent(buttonLayout); mainLayout.addComponent(buttonPanel); Panel buttonPanel2 = new Panel(); buttonPanel2.addStyleName(Runo.PANEL_LIGHT); HorizontalLayout buttonLayout2 = new HorizontalLayout(); buttonLayout2.setMargin(false); buttonLayout2.setSpacing(true); buttonPanel2.setContent(buttonLayout2); mainLayout.addComponent(buttonPanel2); refreshButton = new Button("Refresh"); refreshButton.setIcon(new ClassResource(QueryItemStatusColumnGenerator.class, "images/table_refresh.png")); refreshButton.addClickListener(this); buttonLayout.addComponent(refreshButton); editButton = new Button("Edit"); editButton.setIcon(new ClassResource(QueryItemStatusColumnGenerator.class, "images/table_edit.png")); editButton.addClickListener(this); buttonLayout.addComponent(editButton); addPropertyButton = new Button("Add Column"); addPropertyButton.setIcon(new ClassResource(QueryItemStatusColumnGenerator.class, "images/tab_add.png")); addPropertyButton.addClickListener(this); buttonLayout.addComponent(addPropertyButton); removeAllItemsButton = new Button("Remove All Rows"); removeAllItemsButton.setIcon(new ClassResource(QueryItemStatusColumnGenerator.class, "images/delete.png")); removeAllItemsButton.addClickListener(this); buttonLayout.addComponent(removeAllItemsButton); saveButton = new Button("Save"); saveButton.setIcon(new ClassResource(QueryItemStatusColumnGenerator.class, "images/table_save.png")); saveButton.addClickListener(this); saveButton.setEnabled(false); buttonLayout2.addComponent(saveButton); cancelButton = new Button("Cancel"); cancelButton.setIcon(new ClassResource(QueryItemStatusColumnGenerator.class, "images/cancel.png")); cancelButton.addClickListener(this); cancelButton.setEnabled(false); buttonLayout2.addComponent(cancelButton); addItemButton = new Button("Add Row"); addItemButton .setIcon(new ClassResource(QueryItemStatusColumnGenerator.class, "images/table_row_insert.png")); addItemButton.addClickListener(this); addItemButton.setEnabled(false); buttonLayout2.addComponent(addItemButton); removeItemButton = new Button("Remove Row"); removeItemButton .setIcon(new ClassResource(QueryItemStatusColumnGenerator.class, "images/table_row_delete.png")); removeItemButton.addClickListener(this); removeItemButton.setEnabled(false); buttonLayout2.addComponent(removeItemButton); table = new Table(); mainLayout.addComponent(table); table.setPageLength(20); mockQueryFactory = new MockQueryFactory(2000, 10, 20); container = new LazyQueryContainer(new LazyQueryDefinition(true, 50, "Index"), mockQueryFactory); container.addContainerProperty(LazyQueryView.PROPERTY_ID_ITEM_STATUS, QueryItemStatus.class, QueryItemStatus.None, true, false); container.addContainerProperty("Index", Integer.class, 0, true, true); container.addContainerProperty("ReverseIndex", Integer.class, 0, true, true); container.addContainerProperty("Editable", String.class, "", false, false); container.addContainerProperty(LazyQueryView.DEBUG_PROPERTY_ID_QUERY_INDEX, Integer.class, 0, true, false); container.addContainerProperty(LazyQueryView.DEBUG_PROPERTY_ID_BATCH_INDEX, Integer.class, 0, true, false); container.addContainerProperty(LazyQueryView.DEBUG_PROPERTY_ID_BATCH_QUERY_TIME, Long.class, 0, true, false); table.setContainerDataSource(container); visibleColumnIds.add(LazyQueryView.PROPERTY_ID_ITEM_STATUS); visibleColumnIds.add("Index"); visibleColumnIds.add("ReverseIndex"); visibleColumnIds.add("Editable"); visibleColumnIds.add(LazyQueryView.DEBUG_PROPERTY_ID_QUERY_INDEX); visibleColumnIds.add(LazyQueryView.DEBUG_PROPERTY_ID_BATCH_INDEX); visibleColumnIds.add(LazyQueryView.DEBUG_PROPERTY_ID_BATCH_QUERY_TIME); visibleColumnLabels.add(""); visibleColumnLabels.add("Index"); visibleColumnLabels.add("Reverse Index"); visibleColumnLabels.add("Editable"); visibleColumnLabels.add("Query"); visibleColumnLabels.add("Batch"); visibleColumnLabels.add("Time [ms]"); table.setColumnWidth("Editable", 135); table.setVisibleColumns(visibleColumnIds.toArray()); table.setColumnHeaders(visibleColumnLabels.toArray(new String[0])); table.setColumnWidth(LazyQueryView.PROPERTY_ID_ITEM_STATUS, 16); table.addGeneratedColumn(LazyQueryView.PROPERTY_ID_ITEM_STATUS, new QueryItemStatusColumnGenerator()); table.setEditable(false); table.setMultiSelect(true); table.setMultiSelectMode(MultiSelectMode.DEFAULT); table.setSelectable(true); //table.setWriteThrough(true); }
From source file:org.vaadin.addons.sitekit.example.FeedbackViewlet.java
License:Apache License
/** * Default constructor.//from ww w. j a va 2 s .c om */ public FeedbackViewlet() { final List<FieldDescriptor> fieldDescriptors = FieldSetDescriptorRegister.getFieldSetDescriptor("feedback") .getFieldDescriptors(); editor = new ValidatingEditor(fieldDescriptors); final Button submitButton = new Button(getSite().localize("button-submit")); submitButton.addClickListener(new ClickListener() { /** The default serial version ID. */ private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { editor.commit(); final EntityManager entityManager = getSite().getSiteContext().getObject(EntityManager.class); final Company company = getSite().getSiteContext().getObject(Company.class); try { Notification.show(getSite().localize("message-feedback-submit-success"), Notification.Type.HUMANIZED_MESSAGE); } catch (final Exception e) { LOGGER.error("Error adding user.", e); Notification.show(getSite().localize("message-feedback-submit-error"), Notification.Type.WARNING_MESSAGE); } reset(); } }); editor.addListener(new ValidatingEditorStateListener() { @Override public void editorStateChanged(final ValidatingEditor source) { if (source.isValid()) { submitButton.setEnabled(true); } else { submitButton.setEnabled(false); } } }); reset(); final HorizontalLayout titleLayout = new HorizontalLayout(); titleLayout.setMargin(new MarginInfo(true, false, true, false)); titleLayout.setSpacing(true); final Embedded titleIcon = new Embedded(null, getSite().getIcon("view-icon-feedback")); titleIcon.setWidth(32, Unit.PIXELS); titleIcon.setHeight(32, Unit.PIXELS); titleLayout.addComponent(titleIcon); final Label titleLabel = new Label("<h1>" + getSite().localize("view-feedback") + "</h1>", ContentMode.HTML); titleLayout.addComponent(titleLabel); final VerticalLayout panel = new VerticalLayout(); panel.addComponent(titleLayout); panel.addComponent(editor); panel.addComponent(submitButton); panel.setSpacing(true); panel.setMargin(true); final Panel mainLayout = new Panel(); mainLayout.setStyleName(Reindeer.PANEL_LIGHT); mainLayout.setContent(panel); setCompositionRoot(mainLayout); }
From source file:org.vaadin.addons.sitekit.module.content.view.RenderFlowlet.java
License:Apache License
@Override public void enter() { final EntityManager entityManager = Site.getCurrent().getSiteContext().getObject(EntityManager.class); final String html; try {/*from w w w . j av a 2 s . c o m*/ html = new Markdown4jProcessor().process(content.getMarkup()); } catch (IOException e) { throw new SiteException("Error processing markdown.", e); } ((AbstractFlowViewlet) getFlow()).getTopRightLayout().removeComponent(topEditButton); ((AbstractFlowViewlet) getFlow()).getBottomRightLayout().removeComponent(bottomEditButton); ((AbstractFlowViewlet) getFlow()).getTopRightLayout().addComponent(topEditButton); ((AbstractFlowViewlet) getFlow()).getBottomRightLayout().addComponent(bottomEditButton); final VerticalLayout layout = new VerticalLayout(); //layout.addComponent(topEditButton); layout.addComponent(new Label(html, ContentMode.HTML)); layout.setSpacing(true); layout.setMargin(true); final Panel panel = new Panel(); panel.setStyleName(Reindeer.PANEL_LIGHT); panel.setContent(layout); setCompositionRoot(panel); }
From source file:org.vaadin.addons.sitekit.module.content.view.RenderViewlet.java
License:Apache License
@Override public void attach() { super.attach(); final String html; try {/*ww w . java2s.c om*/ html = new Markdown4jProcessor().process((String) getViewletDescriptor().getConfiguration()); } catch (IOException e) { throw new SiteException("Error processing markdown.", e); } final VerticalLayout layout = new VerticalLayout(); layout.addComponent(new Label(html, ContentMode.HTML)); layout.setSpacing(true); layout.setMargin(true); final Panel panel = new Panel(); panel.setStyleName(Reindeer.PANEL_LIGHT); panel.setContent(layout); setCompositionRoot(panel); }
From source file:org.vaadin.addons.sitekit.site.AbstractCustomView.java
License:Apache License
/** * Instantiates component for given slot. * @param slot The slot component will be placed to. * @return The instantiated component//from w w w . j ava 2 s . co m */ public final AbstractComponent getComponent(final String slot) { try { final ViewletDescriptor viewletDescriptor = slotViewletDescriptorMap.get(slot); if (viewletDescriptor != null) { final Class<?> componentClass = Class.forName(viewletDescriptor.getComponentClass()); final AbstractComponent component = (AbstractComponent) componentClass.newInstance(); //component.setDescription(viewletDescriptor.getDescription()); if (component instanceof Viewlet) { ((Viewlet) component).setViewletDescriptor(viewletDescriptor); } slotComponentMap.put(slot, component); return component; } else { final Panel panel = new Panel(); panel.setContent(new Label(slot)); return panel; } } catch (final Exception e) { throw new SiteException("Error instantiating viewlet for page: " + pageVersion.getTitle() + " version: " + pageVersion.getVersion() + " slot: " + slot, e); } }
From source file:org.vaadin.addons.sitekit.site.AbstractSiteView.java
License:Apache License
/** * Instantiates component for given slot. * @param slot The slot component will be placed to. * @return The instantiated component/* www .j ava 2 s .c o m*/ */ protected final AbstractComponent getComponent(final String slot) { try { final ViewletDescriptor viewletDescriptor = slotViewletDescriptorMap.get(slot); if (viewletDescriptor != null) { final Class<?> componentClass = Class.forName(viewletDescriptor.getComponentClass()); final AbstractComponent component = (AbstractComponent) componentClass.newInstance(); //component.setDescription(viewletDescriptor.getDescription()); if (component instanceof Viewlet) { ((Viewlet) component).setViewletDescriptor(viewletDescriptor); } slotComponentMap.put(slot, component); return component; } else { final Panel panel = new Panel(); panel.setContent(new Label(slot)); return panel; } } catch (final Exception e) { throw new SiteException("Error instantiating viewlet for page: " + pageVersion.getTitle() + " version: " + pageVersion.getVersion() + " slot: " + slot, e); } }
From source file:org.vaadin.addons.sitekit.viewlet.anonymous.login.LoginFlowlet.java
License:Apache License
@SuppressWarnings("serial") @Override/* w ww. j av a 2 s.c o m*/ public void initialize() { final VerticalLayout layout = new VerticalLayout(); layout.setSpacing(true); final Company company = getSite().getSiteContext().getObject(Company.class); if (company.isOpenIdLogin()) { final Panel openIdPanel = new Panel(); openIdPanel.setStyleName(Reindeer.PANEL_LIGHT); openIdPanel.setCaption("OpenID Login"); layout.addComponent(openIdPanel); final HorizontalLayout openIdLayout = new HorizontalLayout(); openIdPanel.setContent(openIdLayout); openIdLayout.setMargin(new MarginInfo(false, false, true, false)); openIdLayout.setSpacing(true); final String returnViewName = "openidlogin"; final Map<String, String> urlIconMap = OpenIdUtil.getOpenIdProviderUrlIconMap(); for (final String url : urlIconMap.keySet()) { openIdLayout.addComponent(OpenIdUtil.getLoginButton(url, urlIconMap.get(url), returnViewName)); } } loginForm = new LoginForm() { @Override public String getLoginHTML() { return super.getLoginHTML().replace("<input class='v-textfield v-widget' style='display:block;'", "<input class='v-textfield v-widget' style='margin-bottom:10px; display:block;'"); } }; loginForm.setLoginButtonCaption(getSite().localize("button-login")); loginForm.setUsernameCaption(getSite().localize("input-user-name")); loginForm.setPasswordCaption(getSite().localize("input-user-password")); loginForm.addListener(this); layout.addComponent(loginForm); final Button registerButton = new Button(getSite().localize("button-register") + " >>"); registerButton.addListener(new ClickListener() { @Override public void buttonClick(final ClickEvent event) { getFlow().forward(RegisterFlowlet.class); } }); layout.addComponent(registerButton); if (company.isEmailPasswordReset()) { final Button forgotPasswordButton = new Button(getSite().localize("button-forgot-password") + " >>"); forgotPasswordButton.addListener(new ClickListener() { @Override public void buttonClick(final ClickEvent event) { getFlow().forward(ForgotPasswordFlowlet.class); } }); layout.addComponent(forgotPasswordButton); } setViewContent(layout); }
From source file:org.vaadin.addons.sitekit.viewlet.user.AccountFlowlet.java
License:Apache License
@Override public void initialize() { final List<FieldDescriptor> fieldDefinitions = SiteFields.getFieldDescriptors(Customer.class); final List<FilterDescriptor> filterDefinitions = new ArrayList<FilterDescriptor>(); filterDefinitions.add(new FilterDescriptor("companyName", "companyName", "Company Name", new TextField(), 101, "=", String.class, "")); filterDefinitions.add(new FilterDescriptor("lastName", "lastName", "Last Name", new TextField(), 101, "=", String.class, "")); final EntityManager entityManager = getSite().getSiteContext().getObject(EntityManager.class); entityContainer = new EntityContainer<Customer>(entityManager, true, false, false, Customer.class, 1000, new String[] { "companyName", "lastName" }, new boolean[] { false, false }, "customerId"); for (final FieldDescriptor fieldDefinition : fieldDefinitions) { entityContainer.addContainerProperty(fieldDefinition.getId(), fieldDefinition.getValueType(), fieldDefinition.getDefaultValue(), fieldDefinition.isReadOnly(), fieldDefinition.isSortable()); }//from w w w .ja va 2 s . com final GridLayout gridLayout = new GridLayout(1, 6); gridLayout.setRowExpandRatio(0, 0.0f); gridLayout.setRowExpandRatio(1, 0.0f); gridLayout.setRowExpandRatio(2, 0.0f); gridLayout.setRowExpandRatio(3, 0.0f); gridLayout.setRowExpandRatio(4, 0.0f); gridLayout.setRowExpandRatio(5, 1.0f); gridLayout.setSizeFull(); gridLayout.setMargin(false); gridLayout.setSpacing(true); gridLayout.setRowExpandRatio(4, 1f); setViewContent(gridLayout); final HorizontalLayout userAccountTitle = new HorizontalLayout(); userAccountTitle.setMargin(new MarginInfo(false, false, false, false)); userAccountTitle.setSpacing(true); final Embedded userAccountTitleIcon = new Embedded(null, getSite().getIcon("view-icon-user")); userAccountTitleIcon.setWidth(32, UNITS_PIXELS); userAccountTitleIcon.setHeight(32, UNITS_PIXELS); userAccountTitle.addComponent(userAccountTitleIcon); final Label userAccountTitleLabel = new Label("<h2>User Account</h2>", Label.CONTENT_XHTML); userAccountTitle.addComponent(userAccountTitleLabel); gridLayout.addComponent(userAccountTitle, 0, 0); final HorizontalLayout titleLayout = new HorizontalLayout(); titleLayout.setMargin(new MarginInfo(true, false, false, false)); titleLayout.setSpacing(true); final Embedded titleIcon = new Embedded(null, getSite().getIcon("view-icon-customer")); titleIcon.setWidth(32, UNITS_PIXELS); titleIcon.setHeight(32, UNITS_PIXELS); titleLayout.addComponent(titleIcon); final Label titleLabel = new Label("<h2>Customer Accounts</h2>", Label.CONTENT_XHTML); titleLayout.addComponent(titleLabel); gridLayout.addComponent(titleLayout, 0, 3); final Table table = new Table(); table.setPageLength(10); entityGrid = new Grid(table, entityContainer); entityGrid.setFields(fieldDefinitions); entityGrid.setFilters(filterDefinitions); //entityGrid.setFixedWhereCriteria("e.owner.companyId=:companyId"); table.setColumnCollapsed("created", true); table.setColumnCollapsed("modified", true); table.setColumnCollapsed("company", true); gridLayout.addComponent(entityGrid, 0, 5); final Button editUserButton = new Button("Edit User Account"); editUserButton.setIcon(getSite().getIcon("button-icon-edit")); gridLayout.addComponent(editUserButton, 0, 2); editUserButton.addListener(new ClickListener() { /** Serial version UID. */ private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { final User entity = ((SecurityProviderSessionImpl) getSite().getSecurityProvider()) .getUserFromSession(); final UserAccountFlowlet customerView = getFlow().getFlowlet(UserAccountFlowlet.class); customerView.edit(entity, false); getFlow().forward(UserAccountFlowlet.class); } }); final Company company = getSite().getSiteContext().getObject(Company.class); if (company.isOpenIdLogin()) { final Panel openIdPanel = new Panel(); openIdPanel.setStyleName(Reindeer.PANEL_LIGHT); openIdPanel.setCaption("Choose OpenID Provider:"); gridLayout.addComponent(openIdPanel, 0, 1); final HorizontalLayout openIdLayout = new HorizontalLayout(); openIdPanel.setContent(openIdLayout); openIdLayout.setMargin(new MarginInfo(false, false, true, false)); openIdLayout.setSpacing(true); final String returnViewName = "openidlink"; final Map<String, String> urlIconMap = OpenIdUtil.getOpenIdProviderUrlIconMap(); for (final String url : urlIconMap.keySet()) { openIdLayout.addComponent(OpenIdUtil.getLoginButton(url, urlIconMap.get(url), returnViewName)); } } final HorizontalLayout customerButtonsLayout = new HorizontalLayout(); gridLayout.addComponent(customerButtonsLayout, 0, 4); customerButtonsLayout.setMargin(false); customerButtonsLayout.setSpacing(true); final Button editCustomerDetailsButton = new Button("Edit Customer Details"); customerButtonsLayout.addComponent(editCustomerDetailsButton); editCustomerDetailsButton.setEnabled(false); editCustomerDetailsButton.setIcon(getSite().getIcon("button-icon-edit")); editCustomerDetailsButton.addListener(new ClickListener() { /** Serial version UID. */ private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { final Customer entity = entityContainer.getEntity(entityGrid.getSelectedItemId()); final CustomerFlowlet customerView = getFlow().forward(CustomerFlowlet.class); customerView.edit(entity, false); } }); final Button editCustomerMembersButton = new Button("Edit Customer Members"); customerButtonsLayout.addComponent(editCustomerMembersButton); editCustomerMembersButton.setEnabled(false); editCustomerMembersButton.setIcon(getSite().getIcon("button-icon-edit")); editCustomerMembersButton.addListener(new ClickListener() { /** Serial version UID. */ private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { final Customer entity = entityContainer.getEntity(entityGrid.getSelectedItemId()); final GroupFlowlet view = getFlow().forward(GroupFlowlet.class); view.edit(entity.getMemberGroup(), false); } }); final Button editCustomerAdminsButton = new Button("Edit Customer Admins"); customerButtonsLayout.addComponent(editCustomerAdminsButton); editCustomerAdminsButton.setEnabled(false); editCustomerAdminsButton.setIcon(getSite().getIcon("button-icon-edit")); editCustomerAdminsButton.addListener(new ClickListener() { /** Serial version UID. */ private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { final Customer entity = entityContainer.getEntity(entityGrid.getSelectedItemId()); final GroupFlowlet view = getFlow().forward(GroupFlowlet.class); view.edit(entity.getAdminGroup(), false); } }); table.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(final Property.ValueChangeEvent event) { editCustomerDetailsButton.setEnabled(table.getValue() != null); editCustomerMembersButton.setEnabled(table.getValue() != null); editCustomerAdminsButton.setEnabled(table.getValue() != null); } }); }
From source file:org.vaadin.addons.sitekit.viewlet.user.privilege.PrivilegesFlowlet.java
License:Apache License
@Override protected void initialize() { final HorizontalLayout titleLayout = new HorizontalLayout(); titleLayout.setMargin(new MarginInfo(true, false, true, false)); titleLayout.setSpacing(true);/*w w w.j a va2 s . c o m*/ final Embedded titleIcon = new Embedded(null, getSite().getIcon("view-icon-privileges")); titleIcon.setWidth(32, Unit.PIXELS); titleIcon.setHeight(32, Unit.PIXELS); titleLayout.addComponent(titleIcon); titleLabel = new Label("<h1>" + getSite().localize("view-privileges") + "</h1>", ContentMode.HTML); titleLayout.addComponent(titleLabel); matrixLayout = new VerticalLayout(); matrixLayout.setSpacing(true); matrixLayout.setMargin(false); final HorizontalLayout buttonLayout = new HorizontalLayout(); buttonLayout.setSpacing(true); saveButton = getSite().getButton("save"); buttonLayout.addComponent(saveButton); saveButton.addClickListener(new Button.ClickListener() { /** Serial version UID. */ private static final long serialVersionUID = 1L; @Override public void buttonClick(final Button.ClickEvent event) { saveGroupMatrix(); saveUserMatrix(); PrivilegeCache.flush((Company) Site.getCurrent().getSiteContext().getObject(Company.class)); } }); discardButton = getSite().getButton("discard"); buttonLayout.addComponent(discardButton); discardButton.addClickListener(new Button.ClickListener() { /** Serial version UID. */ private static final long serialVersionUID = 1L; @Override public void buttonClick(final Button.ClickEvent event) { refreshGroupMatrix(); refreshUserMatrix(); } }); final VerticalLayout panel = new VerticalLayout(); panel.addComponent(titleLayout); panel.addComponent(matrixLayout); panel.addComponent(buttonLayout); panel.setSpacing(true); panel.setMargin(true); final Panel mainLayout = new Panel(); mainLayout.setStyleName(Reindeer.PANEL_LIGHT); mainLayout.setContent(panel); setCompositionRoot(mainLayout); }