List of usage examples for com.vaadin.ui GridLayout setSpacing
@Override public void setSpacing(boolean spacing)
From source file:org.groom.translation.model.EntriesFlowlet.java
License:Apache License
@Override public void initialize() { final List<FieldDescriptor> fieldDescriptors = TranslationFields.getFieldDescriptors(Entry.class); final List<FilterDescriptor> filterDefinitions = new ArrayList<FilterDescriptor>(); filterDefinitions.add(new FilterDescriptor("basename", "basename", "Basename", new TextField(), 200, "like", String.class, "")); filterDefinitions.add(new FilterDescriptor("language", "language", "Language", new TextField(), 30, "=", String.class, "")); filterDefinitions.add(// w ww. j av a 2 s. c o m new FilterDescriptor("country", "country", "Country", new TextField(), 30, "=", String.class, "")); filterDefinitions .add(new FilterDescriptor("key", "key", "Key", new TextField(), 200, "like", String.class, "")); filterDefinitions.add( new FilterDescriptor("value", "value", "Value", new TextField(), 200, "like", String.class, "")); final EntityManager entityManager = getSite().getSiteContext().getObject(EntityManager.class); container = new LazyEntityContainer<Entry>(entityManager, true, true, false, Entry.class, 1000, new String[] { "basename", "key", "language", "country" }, new boolean[] { true, true, true, true }, "entryId"); ContainerUtil.addContainerProperties(container, fieldDescriptors); final GridLayout gridLayout = new GridLayout(1, 3); gridLayout.setSizeFull(); 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, 1); final Table table = new FormattingTable(); grid = new Grid(table, container); grid.setFields(fieldDescriptors); grid.setFilters(filterDefinitions); table.setColumnCollapsed("entryId", true); table.setColumnCollapsed("path", true); table.setColumnCollapsed("created", true); table.setColumnCollapsed("modified", true); grid.setHeight(UI.getCurrent().getPage().getBrowserWindowHeight() - 350, Unit.PIXELS); gridLayout.addComponent(grid, 0, 2); /*final Button addButton = getSite().getButton("add"); buttonLayout.addComponent(addButton); addButton.addClickListener(new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { final Entry entry = new Entry(); entry.setCreated(new Date()); entry.setModified(entry.getCreated()); entry.setOwner((Company) getSite().getSiteContext().getObject(Company.class)); final EntryFlowlet entryView = getFlow().forward(EntryFlowlet.class); entryView.edit(entry, 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 Entry entity = container.getEntity(grid.getSelectedItemId()); final EntryFlowlet entryView = getFlow().forward(EntryFlowlet.class); entryView.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 Entry entity = container.getEntity(grid.getSelectedItemId()); entity.setDeleted(new Date()); entity.setAuthor(getSite().getSecurityProvider().getUser()); entityManager.getTransaction().begin(); try { entityManager.persist(entityManager.merge(entity)); entityManager.getTransaction().commit(); } catch (final Exception e) { if (entityManager.getTransaction().isActive()) { entityManager.getTransaction().rollback(); } throw new RuntimeException(e); } container.refresh(); } }); final Button unRemoveButton = getSite().getButton("unremove"); buttonLayout.addComponent(unRemoveButton); unRemoveButton.addClickListener(new ClickListener() { /** Serial version UID. */ private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { final Entry entity = container.getEntity(grid.getSelectedItemId()); entity.setDeleted(null); entity.setAuthor(getSite().getSecurityProvider().getUser()); entityManager.getTransaction().begin(); try { entityManager.persist(entityManager.merge(entity)); entityManager.getTransaction().commit(); } catch (final Exception e) { if (entityManager.getTransaction().isActive()) { entityManager.getTransaction().rollback(); } throw new RuntimeException(e); } container.refresh(); } }); /* final Button permanentRemoveButton = getSite().getButton("permanent-remove"); buttonLayout.addComponent(permanentRemoveButton); permanentRemoveButton.addClickListener(new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { final Entry entity = container.getEntity(grid.getSelectedItemId()); entity.setDeleted(null); entityManager.getTransaction().begin(); try { entityManager.remove(entityManager.merge(entity)); entityManager.getTransaction().commit(); } catch (final Exception e) { if (entityManager.getTransaction().isActive()) { entityManager.getTransaction().rollback(); } throw new RuntimeException(e); } container.refresh(); } }); */ final Button synchronizeButton = getSite().getButton("synchronize"); buttonLayout.addComponent(synchronizeButton); synchronizeButton.addClickListener(new ClickListener() { /** Serial version UID. */ private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { TranslationSynchronizer.startSynchronize(); Notification.show(getSite().localize("message-synchronization-started")); } }); final Company company = getSite().getSiteContext().getObject(Company.class); container.removeDefaultFilters(); container.addDefaultFilter(new Compare.Equal("owner.companyId", company.getCompanyId())); grid.refresh(); repositoryField = new ComboBox(getSite().localize("field-repository")); repositoryField.setNullSelectionAllowed(false); repositoryField.setTextInputAllowed(true); repositoryField.setNewItemsAllowed(false); repositoryField.setInvalidAllowed(false); repositoryField.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent event) { container.removeDefaultFilters(); container.addDefaultFilter(new Compare.Equal("owner.companyId", company.getCompanyId())); final Repository repository = (Repository) repositoryField.getValue(); if (repository != null) { container.addDefaultFilter( new Compare.Equal("repository.repositoryId", repository.getRepositoryId())); } } }); final List<Repository> repositories = ReviewDao.getRepositories(entityManager, (Company) getSite().getSiteContext().getObject(Company.class)); for (final Repository repository : repositories) { repositoryField.addItem(repository); repositoryField.setItemCaption(repository, repository.getPath()); if (repositoryField.getItemIds().size() == 1) { repositoryField.setValue(repository); } } final VerticalLayout verticalLayout = new VerticalLayout(); verticalLayout.setMargin(new MarginInfo(false, false, true, false)); verticalLayout.addComponent(repositoryField); gridLayout.addComponent(verticalLayout, 0, 0); }
From source file:org.groom.translation.model.EntryFlowlet.java
License:Apache License
@Override public void initialize() { entityManager = getSite().getSiteContext().getObject(EntityManager.class); final GridLayout gridLayout = new GridLayout(1, 3); gridLayout.setSizeFull();/*from w ww. jav a 2 s . c o m*/ gridLayout.setMargin(false); gridLayout.setSpacing(true); gridLayout.setRowExpandRatio(2, 1f); setViewContent(gridLayout); entryEditor = new ValidatingEditor(TranslationFields.getFieldDescriptors(Entry.class)); entryEditor.setCaption("Entry"); entryEditor.addListener((ValidatingEditorStateListener) this); gridLayout.addComponent(entryEditor, 0, 0); final HorizontalLayout buttonLayout = new HorizontalLayout(); buttonLayout.setSpacing(true); gridLayout.addComponent(buttonLayout, 0, 1); saveButton = new Button("Save"); saveButton.setImmediate(true); buttonLayout.addComponent(saveButton); saveButton.addListener(new ClickListener() { /** Serial version UID. */ private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { entryEditor.commit(); entityManager.getTransaction().begin(); try { entity = entityManager.merge(entity); entity.setAuthor(getSite().getSecurityProvider().getUser()); entity.setModified(new Date()); entityManager.persist(entity); entityManager.getTransaction().commit(); entityManager.detach(entity); entryEditor.discard(); container.refresh(); } catch (final Throwable t) { if (entityManager.getTransaction().isActive()) { entityManager.getTransaction().rollback(); } throw new RuntimeException("Failed to save entity: " + entity, t); } } }); discardButton = new Button("Discard"); discardButton.setImmediate(true); buttonLayout.addComponent(discardButton); discardButton.addListener(new ClickListener() { /** Serial version UID. */ private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { entryEditor.discard(); } }); final List<FieldDescriptor> fieldDescriptors = TranslationFields.getFieldDescriptors(Entry.class); final List<FilterDescriptor> filterDefinitions = new ArrayList<FilterDescriptor>(); container = new LazyEntityContainer<Entry>(entityManager, true, true, false, Entry.class, 1000, new String[] { "basename", "key", "language", "country" }, new boolean[] { true, true, true, true }, "entryId"); container.getQueryView().getQueryDefinition().setMaxQuerySize(1); ContainerUtil.addContainerProperties(container, fieldDescriptors); final Table table = new FormattingTable(); final Grid grid = new Grid(table, container); grid.setCaption("All Translations"); grid.setSizeFull(); grid.setFields(fieldDescriptors); grid.setFilters(filterDefinitions); table.setColumnCollapsed("entryId", true); table.setColumnCollapsed("path", true); table.setColumnCollapsed("created", true); table.setColumnCollapsed("modified", true); gridLayout.addComponent(grid, 0, 2); }
From source file:org.hoot.EntriesFlowlet.java
License:Apache License
@Override public void initialize() { final List<FieldDescriptor> fieldDescriptors = HootFields.getFieldDescriptors(Entry.class); final List<FilterDescriptor> filterDefinitions = new ArrayList<FilterDescriptor>(); filterDefinitions.add(new FilterDescriptor("basename", "basename", "Basename", new TextField(), 200, "like", String.class, "")); filterDefinitions.add(new FilterDescriptor("language", "language", "Language", new TextField(), 30, "=", String.class, "")); filterDefinitions.add(/*from w ww . j a v a 2 s . co m*/ new FilterDescriptor("country", "country", "Country", new TextField(), 30, "=", String.class, "")); filterDefinitions .add(new FilterDescriptor("key", "key", "Key", new TextField(), 200, "like", String.class, "")); filterDefinitions.add( new FilterDescriptor("value", "value", "Value", new TextField(), 200, "like", String.class, "")); final EntityManager entityManager = getSite().getSiteContext().getObject(EntityManager.class); container = new LazyEntityContainer<Entry>(entityManager, true, true, false, Entry.class, 1000, new String[] { "basename", "key", "language", "country" }, new boolean[] { true, true, true, true }, "entryId"); ContainerUtil.addContainerProperties(container, fieldDescriptors); final GridLayout gridLayout = new GridLayout(1, 2); gridLayout.setSizeFull(); 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("entryId", true); table.setColumnCollapsed("path", true); table.setColumnCollapsed("created", true); table.setColumnCollapsed("modified", true); grid.setHeight(UI.getCurrent().getPage().getBrowserWindowHeight() - 250, Unit.PIXELS); 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 Entry entry = new Entry(); entry.setCreated(new Date()); entry.setModified(entry.getCreated()); entry.setOwner((Company) getSite().getSiteContext().getObject(Company.class)); final EntryFlowlet entryView = getFlow().forward(EntryFlowlet.class); entryView.edit(entry, 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 Entry entity = container.getEntity(grid.getSelectedItemId()); final EntryFlowlet entryView = getFlow().forward(EntryFlowlet.class); entryView.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 Entry entity = container.getEntity(grid.getSelectedItemId()); entity.setDeleted(new Date()); entity.setAuthor(getSite().getSecurityProvider().getUser()); entityManager.getTransaction().begin(); try { entityManager.persist(entityManager.merge(entity)); entityManager.getTransaction().commit(); } catch (final Exception e) { if (entityManager.getTransaction().isActive()) { entityManager.getTransaction().rollback(); } throw new RuntimeException(e); } container.refresh(); } }); final Button unRemoveButton = getSite().getButton("unremove"); buttonLayout.addComponent(unRemoveButton); unRemoveButton.addClickListener(new ClickListener() { /** Serial version UID. */ private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { final Entry entity = container.getEntity(grid.getSelectedItemId()); entity.setDeleted(null); entity.setAuthor(getSite().getSecurityProvider().getUser()); entityManager.getTransaction().begin(); try { entityManager.persist(entityManager.merge(entity)); entityManager.getTransaction().commit(); } catch (final Exception e) { if (entityManager.getTransaction().isActive()) { entityManager.getTransaction().rollback(); } throw new RuntimeException(e); } container.refresh(); } }); /* final Button permanentRemoveButton = getSite().getButton("permanent-remove"); buttonLayout.addComponent(permanentRemoveButton); permanentRemoveButton.addClickListener(new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { final Entry entity = container.getEntity(grid.getSelectedItemId()); entity.setDeleted(null); entityManager.getTransaction().begin(); try { entityManager.remove(entityManager.merge(entity)); entityManager.getTransaction().commit(); } catch (final Exception e) { if (entityManager.getTransaction().isActive()) { entityManager.getTransaction().rollback(); } throw new RuntimeException(e); } container.refresh(); } }); */ final Button synchronizeButton = getSite().getButton("synchronize"); buttonLayout.addComponent(synchronizeButton); synchronizeButton.addClickListener(new ClickListener() { /** Serial version UID. */ private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { HootSynchronizer.startSynchronize(); } }); 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.hoot.EntryFlowlet.java
License:Apache License
@Override public void initialize() { entityManager = getSite().getSiteContext().getObject(EntityManager.class); final GridLayout gridLayout = new GridLayout(1, 3); gridLayout.setSizeFull();/*from ww w . j a va 2s . c o m*/ gridLayout.setMargin(false); gridLayout.setSpacing(true); gridLayout.setRowExpandRatio(2, 1f); setViewContent(gridLayout); entryEditor = new ValidatingEditor(HootFields.getFieldDescriptors(Entry.class)); entryEditor.setCaption("Entry"); entryEditor.addListener((ValidatingEditorStateListener) this); gridLayout.addComponent(entryEditor, 0, 0); final HorizontalLayout buttonLayout = new HorizontalLayout(); buttonLayout.setSpacing(true); gridLayout.addComponent(buttonLayout, 0, 1); saveButton = new Button("Save"); saveButton.setImmediate(true); buttonLayout.addComponent(saveButton); saveButton.addListener(new ClickListener() { /** Serial version UID. */ private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { entryEditor.commit(); entityManager.getTransaction().begin(); try { entity = entityManager.merge(entity); entity.setAuthor(getSite().getSecurityProvider().getUser()); entity.setModified(new Date()); entityManager.persist(entity); entityManager.getTransaction().commit(); entityManager.detach(entity); entryEditor.discard(); container.refresh(); } catch (final Throwable t) { if (entityManager.getTransaction().isActive()) { entityManager.getTransaction().rollback(); } throw new RuntimeException("Failed to save entity: " + entity, t); } } }); discardButton = new Button("Discard"); discardButton.setImmediate(true); buttonLayout.addComponent(discardButton); discardButton.addListener(new ClickListener() { /** Serial version UID. */ private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { entryEditor.discard(); } }); final List<FieldDescriptor> fieldDescriptors = HootFields.getFieldDescriptors(Entry.class); final List<FilterDescriptor> filterDefinitions = new ArrayList<FilterDescriptor>(); container = new LazyEntityContainer<Entry>(entityManager, true, true, false, Entry.class, 1000, new String[] { "basename", "key", "language", "country" }, new boolean[] { true, true, true, true }, "entryId"); container.getQueryView().getQueryDefinition().setMaxQuerySize(1); ContainerUtil.addContainerProperties(container, fieldDescriptors); final Table table = new FormattingTable(); final Grid grid = new Grid(table, container); grid.setCaption("All Translations"); grid.setSizeFull(); grid.setFields(fieldDescriptors); grid.setFilters(filterDefinitions); table.setColumnCollapsed("entryId", true); table.setColumnCollapsed("path", true); table.setColumnCollapsed("created", true); table.setColumnCollapsed("modified", true); gridLayout.addComponent(grid, 0, 2); }
From source file:org.hoot.HootView.java
License:Apache License
/** * {@inheritDoc}/* w w w . j a v a 2s . com*/ */ @Override protected void initializeComponents() { final int columnCount = 5; final int rowCount = 3; final GridLayout layout = this; layout.setMargin(true); layout.setSpacing(true); layout.setColumns(columnCount); layout.setRows(rowCount); //layout.setColumnExpandRatio(0, MARGIN_COLUMN_EXPAND_RATIO); //layout.setColumnExpandRatio(MARGIN_COLUMN_RIGTH_INDEX, MARGIN_COLUMN_EXPAND_RATIO); layout.setRowExpandRatio(1, 1.0f); layout.setColumnExpandRatio(2, 1.0f); layout.setSizeFull(); final AbstractComponent logoComponent = getComponent("logo"); logoComponent.setWidth(NAVIGATION_COLUMN_WIDTH, Unit.PIXELS); layout.addComponent(logoComponent, 1, 0); final AbstractComponent navigationComponent = getComponent("navigation"); navigationComponent.setWidth(NAVIGATION_COLUMN_WIDTH, Unit.PIXELS); navigationComponent.setHeight(NAVIGATION_HEIGHT, Unit.PIXELS); layout.addComponent(navigationComponent, 1, 1); //final AbstractComponent headerComponent = getComponent("header"); //headerComponent.setWidth(CONTENT_COLUMN_WIDTH, Unit.PIXELS); //headerComponent.setSizeFull(); //layout.addComponent(headerComponent, 2, 0); final AbstractComponent contentComponent = getComponent("content"); //contentComponent.setWidth(CONTENT_COLUMN_WIDTH, Unit.PIXELS); contentComponent.setSizeFull(); layout.addComponent(contentComponent, 2, 0, 2, 2); //final AbstractComponent footerComponent = getComponent("footer"); //headerComponent.setWidth(CONTENT_COLUMN_WIDTH, Unit.PIXELS); //layout.addComponent(footerComponent, 2, 2); }
From source file:org.ikasan.dashboard.ui.administration.panel.PlatformConfigurationPanel.java
License:BSD License
protected Panel createMapPanel(final ConfigurationParameterMapImpl parameter) { Panel paramPanel = new Panel(); paramPanel.setStyleName("dashboard"); paramPanel.setWidth("100%"); GridLayout paramLayout = new GridLayout(2, 3); paramLayout.setSpacing(true); paramLayout.setSizeFull();//from w w w. j a v a 2 s .c om paramLayout.setMargin(true); paramLayout.setColumnExpandRatio(0, .25f); paramLayout.setColumnExpandRatio(1, .75f); Label label = new Label("Platform Configuration"); label.addStyleName(ValoTheme.LABEL_HUGE); label.setSizeUndefined(); paramLayout.addComponent(label, 0, 0, 1, 0); paramLayout.setComponentAlignment(label, Alignment.TOP_LEFT); final Map<String, String> valueMap = parameter.getValue(); final GridLayout mapLayout = new GridLayout(5, (valueMap.size() != 0 ? valueMap.size() : 1) + 1); mapLayout.setColumnExpandRatio(0, .05f); mapLayout.setColumnExpandRatio(1, .425f); mapLayout.setColumnExpandRatio(2, .05f); mapLayout.setColumnExpandRatio(3, .425f); mapLayout.setColumnExpandRatio(4, .05f); mapLayout.setMargin(true); mapLayout.setSpacing(true); mapLayout.setWidth("100%"); int i = 0; for (final String key : valueMap.keySet()) { final Label keyLabel = new Label("Name:"); final Label valueLabel = new Label("Value:"); final TextField keyField = new TextField(); keyField.setValue(key); keyField.setWidth("100%"); keyField.setNullSettingAllowed(false); keyField.addValidator( new NonZeroLengthStringValidator("Then configuration value name cannot be empty!")); keyField.setValidationVisible(false); final TextField valueField = new TextField(); valueField.setWidth("100%"); valueField.setValue(valueMap.get(key)); valueField.setNullSettingAllowed(false); valueField.addValidator(new NonZeroLengthStringValidator("Then configuration value cannot be empty!")); valueField.setValidationVisible(false); mapLayout.addComponent(keyLabel, 0, i); mapLayout.setComponentAlignment(keyLabel, Alignment.MIDDLE_RIGHT); mapLayout.addComponent(keyField, 1, i); mapLayout.addComponent(valueLabel, 2, i); mapLayout.setComponentAlignment(valueLabel, Alignment.MIDDLE_RIGHT); mapLayout.addComponent(valueField, 3, i); final String mapKey = parameter.getName() + i; TextFieldKeyValuePair pair = new TextFieldKeyValuePair(); pair.key = keyField; pair.value = valueField; this.mapTextFields.put(mapKey, pair); final Button removeButton = new Button("remove"); removeButton.setStyleName(ValoTheme.BUTTON_LINK); removeButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { valueMap.remove(key); mapLayout.removeComponent(keyLabel); mapLayout.removeComponent(valueLabel); mapLayout.removeComponent(keyField); mapLayout.removeComponent(valueField); mapLayout.removeComponent(removeButton); mapTextFields.remove(mapKey); } }); mapLayout.addComponent(removeButton, 4, i); i++; } final Button addButton = new Button("add"); addButton.setStyleName(ValoTheme.BUTTON_LINK); addButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { final Label keyLabel = new Label("Name:"); final Label valueLabel = new Label("Value:"); final TextField keyField = new TextField(); keyField.setWidth("100%"); keyField.setNullSettingAllowed(false); keyField.addValidator( new NonZeroLengthStringValidator("Then configuration value name cannot be empty!")); keyField.setValidationVisible(false); final TextField valueField = new TextField(); valueField.setWidth("100%"); valueField.setNullSettingAllowed(false); valueField.addValidator( new NonZeroLengthStringValidator("Then configuration value cannot be empty!")); valueField.setValidationVisible(false); mapLayout.insertRow(mapLayout.getRows()); mapLayout.removeComponent(addButton); mapLayout.addComponent(keyLabel, 0, mapLayout.getRows() - 2); mapLayout.setComponentAlignment(keyLabel, Alignment.MIDDLE_RIGHT); mapLayout.addComponent(keyField, 1, mapLayout.getRows() - 2); mapLayout.addComponent(valueLabel, 2, mapLayout.getRows() - 2); mapLayout.setComponentAlignment(valueLabel, Alignment.MIDDLE_RIGHT); mapLayout.addComponent(valueField, 3, mapLayout.getRows() - 2); final String mapKey = parameter.getName() + mapTextFields.size(); TextFieldKeyValuePair pair = new TextFieldKeyValuePair(); pair.key = keyField; pair.value = valueField; mapTextFields.put(mapKey, pair); final Button removeButton = new Button("remove"); removeButton.setStyleName(ValoTheme.BUTTON_LINK); removeButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { mapLayout.removeComponent(keyLabel); mapLayout.removeComponent(valueLabel); mapLayout.removeComponent(keyField); mapLayout.removeComponent(valueField); mapLayout.removeComponent(removeButton); mapTextFields.remove(mapKey); } }); mapLayout.addComponent(removeButton, 4, mapLayout.getRows() - 2); mapLayout.addComponent(addButton, 0, mapLayout.getRows() - 1); } }); mapLayout.addComponent(addButton, 0, mapLayout.getRows() - 1); Panel mapPanel = new Panel(); mapPanel.setStyleName(ValoTheme.PANEL_BORDERLESS); mapPanel.setContent(mapLayout); Button saveButton = new Button("Save"); saveButton.addStyleName(ValoTheme.BUTTON_SMALL); saveButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { try { for (TextFieldKeyValuePair textField : mapTextFields.values()) { textField.key.validate(); textField.value.validate(); } } catch (InvalidValueException e) { for (TextFieldKeyValuePair textField : mapTextFields.values()) { textField.key.setValidationVisible(true); textField.value.setValidationVisible(true); } Notification.show("Validation errors have occurred!", Type.ERROR_MESSAGE); return; } HashMap<String, String> map = new HashMap<String, String>(); logger.info("Saving map: " + mapTextFields.size()); for (String key : mapTextFields.keySet()) { if (key.startsWith(parameter.getName())) { TextFieldKeyValuePair pair = mapTextFields.get(key); logger.info("Saving for key: " + key); if (pair.key.getValue() != "") { map.put(pair.key.getValue(), pair.value.getValue()); } } } parameter.setValue(map); PlatformConfigurationPanel.this.configurationManagement.saveConfiguration(platformConfiguration); Notification notification = new Notification("Saved", "The configuration has been saved successfully!", Type.HUMANIZED_MESSAGE); notification.setStyleName(ValoTheme.NOTIFICATION_CLOSABLE); notification.show(Page.getCurrent()); } }); paramLayout.addComponent(mapPanel, 0, 1, 1, 1); paramLayout.setComponentAlignment(mapPanel, Alignment.TOP_CENTER); paramLayout.addComponent(saveButton, 0, 2, 1, 2); paramLayout.setComponentAlignment(saveButton, Alignment.TOP_CENTER); paramPanel.setContent(paramLayout); return paramPanel; }
From source file:org.ikasan.dashboard.ui.administration.panel.PolicyManagementPanel.java
License:BSD License
@SuppressWarnings({ "serial" }) protected void init() { this.setWidth("100%"); this.setHeight("100%"); this.createAssociatedRolesPanel(); this.createPolicyDropPanel(); VerticalLayout layout = new VerticalLayout(); layout.setMargin(true);//from w ww . j a v a 2 s .co m layout.setSpacing(true); layout.setWidth("100%"); Panel policyAdministrationPanel = new Panel(); policyAdministrationPanel.addStyleName(ValoTheme.PANEL_BORDERLESS); policyAdministrationPanel.setHeight("100%"); policyAdministrationPanel.setWidth("100%"); GridLayout gridLayout = new GridLayout(2, 6); gridLayout.setSizeFull(); Label roleManagementLabel = new Label("Policy Management"); roleManagementLabel.setStyleName(ValoTheme.LABEL_HUGE); gridLayout.addComponent(roleManagementLabel, 0, 0, 1, 0); Label roleSearchHintLabel = new Label(); roleSearchHintLabel.setCaptionAsHtml(true); roleSearchHintLabel.setCaption( VaadinIcons.QUESTION_CIRCLE_O.getHtml() + " Type into the Policy Name field to find a policy."); roleSearchHintLabel.addStyleName(ValoTheme.LABEL_TINY); roleSearchHintLabel.addStyleName(ValoTheme.LABEL_LIGHT); gridLayout.addComponent(roleSearchHintLabel, 0, 1, 1, 1); Layout controlLayout = this.initControlLayout(); gridLayout.addComponent(controlLayout, 0, 2, 1, 2); GridLayout formLayout = new GridLayout(2, 4); formLayout.setWidth("100%"); formLayout.setSpacing(true); formLayout.setColumnExpandRatio(0, 1); formLayout.setColumnExpandRatio(1, 5); Label policyNameLabel = new Label("Policy Name:"); policyNameLabel.setSizeUndefined(); final DragAndDropWrapper policyNameFieldWrap = initPolicyNameField(); formLayout.addComponent(policyNameLabel, 0, 0); formLayout.setComponentAlignment(policyNameLabel, Alignment.MIDDLE_RIGHT); formLayout.addComponent(policyNameFieldWrap, 1, 0); Label descriptionLabel = new Label("Description:"); descriptionLabel.setSizeUndefined(); this.descriptionField = new TextArea(); this.descriptionField.setWidth("70%"); this.descriptionField.setHeight("60px"); formLayout.addComponent(descriptionLabel, 0, 1); formLayout.setComponentAlignment(descriptionLabel, Alignment.TOP_RIGHT); formLayout.addComponent(this.descriptionField, 1, 1); this.linkTypeLabel.setSizeUndefined(); formLayout.addComponent(this.linkTypeLabel, 0, 2); formLayout.setComponentAlignment(this.linkTypeLabel, Alignment.MIDDLE_RIGHT); this.linkType.setWidth("70%"); formLayout.addComponent(this.linkType, 1, 2); this.linkTypeLabel.setVisible(false); this.linkType.setVisible(false); this.linkedEntityLabel.setSizeUndefined(); this.linkedEntity = new TextArea(); this.linkedEntity.setWidth("70%"); this.linkedEntity.setHeight("60px"); formLayout.addComponent(this.linkedEntityLabel, 0, 3); formLayout.setComponentAlignment(this.linkedEntityLabel, Alignment.MIDDLE_RIGHT); formLayout.addComponent(linkedEntity, 1, 3); this.linkedEntityLabel.setVisible(false); this.linkedEntity.setVisible(false); gridLayout.addComponent(formLayout, 0, 3, 1, 3); Label roleTableHintLabel = new Label(); roleTableHintLabel.setCaptionAsHtml(true); roleTableHintLabel.setCaption(VaadinIcons.QUESTION_CIRCLE_O.getHtml() + " The Roles table below displays the roles that are assigned the current policy."); roleTableHintLabel.addStyleName(ValoTheme.LABEL_TINY); roleTableHintLabel.addStyleName(ValoTheme.LABEL_LIGHT); gridLayout.addComponent(roleTableHintLabel, 0, 4, 1, 4); gridLayout.addComponent(this.roleTable, 0, 5, 1, 5); policyAdministrationPanel.setContent(gridLayout); layout.addComponent(policyAdministrationPanel); HorizontalLayout roleMemberPanelLayout = new HorizontalLayout(); roleMemberPanelLayout.setMargin(true); roleMemberPanelLayout.addComponent(this.policyDropPanel); roleMemberPanelLayout.setSizeFull(); HorizontalSplitPanel hsplit = new HorizontalSplitPanel(); hsplit.setFirstComponent(layout); hsplit.setSecondComponent(roleMemberPanelLayout); // Set the position of the splitter as percentage hsplit.setSplitPosition(65, Unit.PERCENTAGE); hsplit.setLocked(true); this.setContent(hsplit); }
From source file:org.ikasan.dashboard.ui.administration.panel.PolicyManagementPanel.java
License:BSD License
/** * //from ww w .ja v a 2 s . c o m */ protected void createPolicyDropPanel() { this.policyDropPanel = new Panel(); Label rolePoliciesLabel = new Label("Role/Policy Associations"); rolePoliciesLabel.setStyleName(ValoTheme.LABEL_HUGE); this.policyDropPanel.addStyleName(ValoTheme.PANEL_BORDERLESS); this.policyDropPanel.setHeight("100%"); this.policyDropPanel.setWidth("100%"); this.rolesCombo = new ComboBox("Roles"); this.rolesCombo.setWidth("90%"); this.rolesCombo.addValueChangeListener(new Property.ValueChangeListener() { public void valueChange(ValueChangeEvent event) { final Role role = (Role) event.getProperty().getValue(); if (role != null) { List<Policy> policies = securityService.getAllPoliciesWithRole(role.getName()); PolicyManagementPanel.this.policyDropTable.removeAllItems(); for (final Policy policy : policies) { Button deleteButton = new Button(); deleteButton.setIcon(VaadinIcons.TRASH); deleteButton.addStyleName(ValoTheme.BUTTON_ICON_ONLY); deleteButton.addStyleName(ValoTheme.BUTTON_BORDERLESS); deleteButton.setDescription("Remove Policy from this Role"); deleteButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { role.getPolicies().remove(policy); PolicyManagementPanel.this.saveRole(role); PolicyManagementPanel.this.policyDropTable.removeItem(policy.getName()); PolicyManagementPanel.this.roleTable.removeItem(role); } }); PolicyManagementPanel.this.policyDropTable .addItem(new Object[] { policy.getName(), deleteButton }, policy.getName()); } } } }); this.policyDropTable = new Table(); this.policyDropTable.addContainerProperty("Role Policies", String.class, null); this.policyDropTable.addContainerProperty("", Button.class, null); this.policyDropTable.setHeight("700px"); this.policyDropTable.setWidth("300px"); this.policyDropTable.setDragMode(TableDragMode.ROW); this.policyDropTable.setDropHandler(new DropHandler() { @Override public void drop(final DragAndDropEvent dropEvent) { // criteria verify that this is safe logger.info("Trying to drop: " + dropEvent); if (rolesCombo.getValue() == null) { // Do nothing if there is no role selected logger.info("Ignoring drop: " + dropEvent); return; } final WrapperTransferable t = (WrapperTransferable) dropEvent.getTransferable(); final AutocompleteField sourceContainer = (AutocompleteField) t.getDraggedComponent(); logger.info("sourceContainer.getText(): " + sourceContainer.getText()); Button deleteButton = new Button(); deleteButton.setIcon(VaadinIcons.TRASH); deleteButton.addStyleName(ValoTheme.BUTTON_ICON_ONLY); deleteButton.addStyleName(ValoTheme.BUTTON_BORDERLESS); deleteButton.setDescription("Remove Policy from this Role"); final Policy policy = PolicyManagementPanel.this.securityService .findPolicyByName(sourceContainer.getText()); final Role selectedRole = PolicyManagementPanel.this.securityService .findRoleByName(((Role) rolesCombo.getValue()).getName()); deleteButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { selectedRole.getPolicies().remove(policy); PolicyManagementPanel.this.saveRole(selectedRole); policyDropTable.removeItem(policy.getName()); roleTable.removeItem(selectedRole); } }); PolicyManagementPanel.this.policyDropTable.addItem( new Object[] { sourceContainer.getText(), deleteButton }, sourceContainer.getText()); selectedRole.getPolicies().add(policy); PolicyManagementPanel.this.saveRole(selectedRole); policy.getRoles().add(selectedRole); PolicyManagementPanel.this.roleTable.removeAllItems(); for (final Role role : policy.getRoles()) { Button roleDeleteButton = new Button(); roleDeleteButton.setIcon(VaadinIcons.TRASH); roleDeleteButton.addStyleName(ValoTheme.BUTTON_ICON_ONLY); deleteButton.addStyleName(ValoTheme.BUTTON_BORDERLESS); deleteButton.setDescription("Remove Policy from this Role"); roleDeleteButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { selectedRole.getPolicies().remove(policy); PolicyManagementPanel.this.saveRole(selectedRole); PolicyManagementPanel.this.roleTable.removeItem(role); PolicyManagementPanel.this.policyDropTable.removeItem(policy.getName()); } }); PolicyManagementPanel.this.roleTable.addItem(new Object[] { role.getName(), roleDeleteButton }, role); } } @Override public AcceptCriterion getAcceptCriterion() { return AcceptAll.get(); } }); GridLayout layout = new GridLayout(); layout.setSpacing(true); layout.setWidth("100%"); layout.setHeight("100%"); layout.addComponent(rolePoliciesLabel); layout.addComponent(this.rolesCombo); Label policyDropHintLabel = new Label(); policyDropHintLabel.setCaptionAsHtml(true); policyDropHintLabel.setCaption(VaadinIcons.QUESTION_CIRCLE_O.getHtml() + " Drop a policy into the table below to associate with a role."); policyDropHintLabel.addStyleName(ValoTheme.LABEL_TINY); policyDropHintLabel.addStyleName(ValoTheme.LABEL_LIGHT); layout.addComponent(policyDropHintLabel); layout.addComponent(this.policyDropTable); this.policyDropPanel.setContent(layout); }
From source file:org.ikasan.dashboard.ui.administration.panel.PrincipalManagementPanel.java
License:BSD License
@SuppressWarnings("deprecation") protected void init() { this.setWidth("100%"); this.setHeight("100%"); VerticalLayout layout = new VerticalLayout(); layout.setSpacing(true);/*from ww w. j a va 2 s . c o m*/ layout.setSizeFull(); Panel securityAdministrationPanel = new Panel(); securityAdministrationPanel.addStyleName(ValoTheme.PANEL_BORDERLESS); securityAdministrationPanel.setHeight("100%"); securityAdministrationPanel.setWidth("100%"); GridLayout gridLayout = new GridLayout(2, 5); gridLayout.setWidth("100%"); gridLayout.setHeight("100%"); gridLayout.setMargin(true); gridLayout.setSizeFull(); Label groupManagementLabel = new Label("Group Management"); groupManagementLabel.setStyleName(ValoTheme.LABEL_HUGE); gridLayout.addComponent(groupManagementLabel, 0, 0, 1, 0); Label groupSearchHintLabel = new Label(); groupSearchHintLabel.setCaptionAsHtml(true); groupSearchHintLabel.setCaption( VaadinIcons.QUESTION_CIRCLE_O.getHtml() + " Type into the Group Name field to find a group."); groupSearchHintLabel.addStyleName(ValoTheme.LABEL_TINY); groupSearchHintLabel.addStyleName(ValoTheme.LABEL_LIGHT); gridLayout.addComponent(groupSearchHintLabel, 0, 1, 1, 1); Label principalNameLabel = new Label("Group Name:"); principalNameLabel.setSizeUndefined(); principalNameField = new AutocompleteField<IkasanPrincipal>(); principalNameField.setWidth("70%"); final DragAndDropWrapper principalNameFieldWrap = new DragAndDropWrapper(principalNameField); principalNameFieldWrap.setDragStartMode(DragStartMode.COMPONENT); principalTypeField.setWidth("70%"); descriptionField.setWidth("70%"); descriptionField.setHeight("60px"); roleTable.addContainerProperty("Role", String.class, null); roleTable.addContainerProperty("", Button.class, null); roleTable.setHeight("610px"); roleTable.setWidth("300px"); userTable.addContainerProperty("Associated Users", String.class, null); userTable.setHeight("610px"); userTable.setWidth("300px"); principalDropTable.addContainerProperty("Members", String.class, null); principalDropTable.addContainerProperty("", Button.class, null); principalDropTable.setHeight("700px"); principalDropTable.setWidth("300px"); principalNameField.setQueryListener(new AutocompleteQueryListener<IkasanPrincipal>() { @Override public void handleUserQuery(AutocompleteField<IkasanPrincipal> field, String query) { for (IkasanPrincipal principal : securityService.getPrincipalByNameLike(query)) { field.addSuggestion(principal, principal.getName()); } } }); principalNameField.setSuggestionPickedListener(new AutocompleteSuggestionPickedListener<IkasanPrincipal>() { @Override public void onSuggestionPicked(final IkasanPrincipal principal) { PrincipalManagementPanel.this.principal = principal; PrincipalManagementPanel.this.setValues(); } }); GridLayout formLayout = new GridLayout(2, 3); formLayout.setWidth("100%"); formLayout.setHeight("135px"); formLayout.setSpacing(true); formLayout.setColumnExpandRatio(0, .1f); formLayout.setColumnExpandRatio(1, .8f); formLayout.addComponent(principalNameLabel, 0, 0); formLayout.setComponentAlignment(principalNameLabel, Alignment.MIDDLE_RIGHT); formLayout.addComponent(principalNameFieldWrap, 1, 0); Label principalTypeLabel = new Label("Group Type:"); principalTypeLabel.setSizeUndefined(); formLayout.addComponent(principalTypeLabel, 0, 1); formLayout.setComponentAlignment(principalTypeLabel, Alignment.MIDDLE_RIGHT); formLayout.addComponent(principalTypeField, 1, 1); Label descriptionLabel = new Label("Description:"); descriptionLabel.setSizeUndefined(); formLayout.addComponent(descriptionLabel, 0, 2); formLayout.setComponentAlignment(descriptionLabel, Alignment.TOP_RIGHT); formLayout.addComponent(descriptionField, 1, 2); gridLayout.addComponent(formLayout, 0, 2, 1, 2); principalDropTable.setDragMode(TableDragMode.ROW); principalDropTable.setDropHandler(new DropHandler() { @Override public void drop(final DragAndDropEvent dropEvent) { // criteria verify that this is safe logger.info("Trying to drop: " + dropEvent); if (rolesCombo.getValue() == null) { // Do nothing if there is no role selected logger.info("Ignoring drop: " + dropEvent); return; } final WrapperTransferable t = (WrapperTransferable) dropEvent.getTransferable(); final AutocompleteField sourceContainer = (AutocompleteField) t.getDraggedComponent(); logger.info("sourceContainer.getText(): " + sourceContainer.getText()); Button deleteButton = new Button(); deleteButton.setIcon(VaadinIcons.TRASH); deleteButton.addStyleName(ValoTheme.BUTTON_ICON_ONLY); deleteButton.addStyleName(ValoTheme.BUTTON_BORDERLESS); final IkasanPrincipal principal = securityService.findPrincipalByName(sourceContainer.getText()); final Role roleToRemove = (Role) rolesCombo.getValue(); deleteButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { principalDropTable.removeItem(principal.getName()); principal.getRoles().remove(roleToRemove); securityService.savePrincipal(principal); if (principalNameField.getText().equals(principal.getName())) { roleTable.removeItem(roleToRemove); } } }); principalDropTable.addItem(new Object[] { sourceContainer.getText(), deleteButton }, sourceContainer.getText()); principal.getRoles().add((Role) rolesCombo.getValue()); securityService.savePrincipal(principal); roleTable.removeAllItems(); for (final Role role : principal.getRoles()) { Button roleDeleteButton = new Button(); roleDeleteButton.setIcon(VaadinIcons.TRASH); roleDeleteButton.addStyleName(ValoTheme.BUTTON_ICON_ONLY); roleDeleteButton.addStyleName(ValoTheme.BUTTON_BORDERLESS); roleDeleteButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { roleTable.removeItem(role); principal.getRoles().remove(role); securityService.savePrincipal(principal); principalDropTable.removeItem(principal.getName()); } }); roleTable.addItem(new Object[] { role.getName(), roleDeleteButton }, role); } } @Override public AcceptCriterion getAcceptCriterion() { return AcceptAll.get(); } }); Label roleTableHintLabel = new Label(); roleTableHintLabel.setCaptionAsHtml(true); roleTableHintLabel.setCaption(VaadinIcons.QUESTION_CIRCLE_O.getHtml() + " The Roles table below displays the roles that are assigned to the group. Roles can be deleted from this table."); roleTableHintLabel.addStyleName(ValoTheme.LABEL_TINY); roleTableHintLabel.addStyleName(ValoTheme.LABEL_LIGHT); gridLayout.addComponent(roleTableHintLabel, 0, 3, 1, 3); gridLayout.addComponent(roleTable, 0, 4); gridLayout.addComponent(userTable, 1, 4); this.rolesCombo = new ComboBox("Roles"); this.rolesCombo.setWidth("90%"); this.rolesCombo.addListener(new Property.ValueChangeListener() { public void valueChange(ValueChangeEvent event) { final Role role = (Role) event.getProperty().getValue(); if (role != null) { logger.info("Value changed got Role: " + role); List<IkasanPrincipal> principals = securityService.getAllPrincipalsWithRole(role.getName()); principalDropTable.removeAllItems(); for (final IkasanPrincipal principal : principals) { Button deleteButton = new Button(); deleteButton.setIcon(VaadinIcons.TRASH); deleteButton.addStyleName(ValoTheme.BUTTON_ICON_ONLY); deleteButton.addStyleName(ValoTheme.BUTTON_BORDERLESS); deleteButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { principalDropTable.removeItem(principal.getName()); principal.getRoles().remove(role); securityService.savePrincipal(principal); if (principalNameField.getText().equals(principal.getName())) { roleTable.removeItem(role); } } }); principalDropTable.addItem(new Object[] { principal.getName(), deleteButton }, principal.getName()); } } } }); Panel roleMemberPanel = new Panel(); roleMemberPanel.addStyleName(ValoTheme.PANEL_BORDERLESS); roleMemberPanel.setHeight("100%"); roleMemberPanel.setWidth("100%"); GridLayout roleMemberLayout = new GridLayout(); roleMemberLayout.setSpacing(true); roleMemberLayout.setWidth("100%"); roleMemberLayout.setHeight("100%"); Label roleGroupLabels = new Label("Role/Group Associations"); roleGroupLabels.setStyleName(ValoTheme.LABEL_HUGE); gridLayout.addComponent(roleGroupLabels); Label groupDragHintLabel = new Label(); groupDragHintLabel.setCaptionAsHtml(true); groupDragHintLabel.setCaption(VaadinIcons.QUESTION_CIRCLE_O.getHtml() + " Drop groups into the table below to assign them the role."); roleMemberLayout.addComponent(roleGroupLabels); roleMemberLayout.addComponent(groupDragHintLabel); roleMemberLayout.addComponent(this.rolesCombo); roleMemberLayout.addComponent(this.principalDropTable); roleMemberPanel.setContent(roleMemberLayout); securityAdministrationPanel.setContent(gridLayout); layout.addComponent(securityAdministrationPanel); VerticalLayout roleMemberPanelLayout = new VerticalLayout(); roleMemberPanelLayout.setWidth("100%"); roleMemberPanelLayout.setHeight("100%"); roleMemberPanelLayout.setMargin(true); roleMemberPanelLayout.addComponent(roleMemberPanel); roleMemberPanelLayout.setSizeFull(); HorizontalSplitPanel hsplit = new HorizontalSplitPanel(); hsplit.setFirstComponent(layout); hsplit.setSecondComponent(roleMemberPanelLayout); // Set the position of the splitter as percentage hsplit.setSplitPosition(65, Unit.PERCENTAGE); hsplit.setLocked(true); this.setContent(hsplit); }
From source file:org.ikasan.dashboard.ui.administration.panel.RoleManagementPanel.java
License:BSD License
@SuppressWarnings({ "serial" }) protected void init() { this.setWidth("100%"); this.setHeight("100%"); this.initPolicyNameField(); this.createPolicyDropPanel(); VerticalLayout layout = new VerticalLayout(); layout.setSizeFull();//from w w w.j a va2s .co m Panel roleAdministrationPanel = new Panel(); roleAdministrationPanel.addStyleName(ValoTheme.PANEL_BORDERLESS); roleAdministrationPanel.setHeight("100%"); roleAdministrationPanel.setWidth("100%"); GridLayout gridLayout = new GridLayout(2, 6); gridLayout.setWidth("100%"); gridLayout.setHeight("100%"); gridLayout.setMargin(true); gridLayout.setSizeFull(); Label roleManagementLabel = new Label("Role Management"); roleManagementLabel.setStyleName(ValoTheme.LABEL_HUGE); gridLayout.addComponent(roleManagementLabel, 0, 0, 1, 0); Label roleSearchHintLabel = new Label(); roleSearchHintLabel.setCaptionAsHtml(true); roleSearchHintLabel.setCaption( VaadinIcons.QUESTION_CIRCLE_O.getHtml() + " Type into the Role Name field to find a role."); roleSearchHintLabel.addStyleName(ValoTheme.LABEL_TINY); roleSearchHintLabel.addStyleName(ValoTheme.LABEL_LIGHT); gridLayout.addComponent(roleSearchHintLabel, 0, 1, 1, 1); Layout controlLayout = this.initControlLayout(); gridLayout.addComponent(controlLayout, 0, 2, 1, 2); Label roleNameLabel = new Label("Role Name:"); roleNameLabel.setSizeUndefined(); initRoleNameField(); GridLayout formLayout = new GridLayout(2, 2); formLayout.setWidth("100%"); formLayout.setHeight("115px"); formLayout.setSpacing(true); formLayout.setColumnExpandRatio(0, 1); formLayout.setColumnExpandRatio(1, 5); this.roleNameField.setWidth("70%"); formLayout.addComponent(roleNameLabel, 0, 0); formLayout.setComponentAlignment(roleNameLabel, Alignment.MIDDLE_RIGHT); formLayout.addComponent(this.roleNameField, 1, 0); Label descriptionLabel = new Label("Description:"); descriptionLabel.setSizeUndefined(); this.descriptionField = new TextArea(); this.descriptionField.setWidth("70%"); this.descriptionField.setHeight("60px"); formLayout.addComponent(descriptionLabel, 0, 1); formLayout.setComponentAlignment(descriptionLabel, Alignment.TOP_RIGHT); formLayout.addComponent(descriptionField, 1, 1); gridLayout.addComponent(formLayout, 0, 3, 1, 3); Label roleTableHintLabel = new Label(); roleTableHintLabel.setCaptionAsHtml(true); roleTableHintLabel.setCaption(VaadinIcons.QUESTION_CIRCLE_O.getHtml() + " The Associated Users/Groups table below displays the users/groups that are assigned the current role."); roleTableHintLabel.addStyleName(ValoTheme.LABEL_TINY); roleTableHintLabel.addStyleName(ValoTheme.LABEL_LIGHT); gridLayout.addComponent(roleTableHintLabel, 0, 4, 1, 4); this.associatedPrincipalsTable = new Table(); this.associatedPrincipalsTable.addItemClickListener(this.associatedPrincipalItemClickListener); this.associatedPrincipalsTable.addContainerProperty("Associated Users/Groups", String.class, null); this.associatedPrincipalsTable.addContainerProperty("", Button.class, null); this.associatedPrincipalsTable.setHeight("600px"); this.associatedPrincipalsTable.setWidth("650px"); gridLayout.addComponent(this.associatedPrincipalsTable, 0, 5, 1, 5); roleAdministrationPanel.setContent(gridLayout); layout.addComponent(roleAdministrationPanel); HorizontalLayout policyDropPanelLayout = new HorizontalLayout(); policyDropPanelLayout.setMargin(true); policyDropPanelLayout.addComponent(this.policyDropPanel); policyDropPanelLayout.setSizeFull(); HorizontalSplitPanel hsplit = new HorizontalSplitPanel(); hsplit.setFirstComponent(layout); hsplit.setSecondComponent(policyDropPanelLayout); // Set the position of the splitter as percentage hsplit.setSplitPosition(65, Unit.PERCENTAGE); hsplit.setLocked(true); this.setContent(hsplit); }