List of usage examples for com.vaadin.ui Button setVisible
@Override public void setVisible(boolean visible)
From source file:org.eclipse.hawkbit.ui.rollout.rollout.DefineGroupsLayout.java
License:Open Source License
private Button createAddButton() { final Button button = SPUIComponentProvider.getButton(UIComponentIdProvider.ROLLOUT_GROUP_ADD_ID, i18n.getMessage("button.rollout.add.group"), "", "", true, FontAwesome.PLUS, SPUIButtonStyleNoBorderWithIcon.class); button.setSizeUndefined();/* w w w .ja v a 2 s. co m*/ button.addStyleName("default-color"); button.setEnabled(true); button.setVisible(true); button.addClickListener(event -> addGroupRowAndValidate()); return button; }
From source file:org.hip.vif.admin.groupadmin.ui.BibliographySearchView.java
License:Open Source License
/** View constructor. * * @param inQuestion {@link Question} the actual question, possibly the question the bibliography will be linked * with/* w ww. java 2s. c o m*/ * @param inGroup {@link Group} the actual group * @param inTitles {@link IndexedContainer} the titles of existing bibliography entries, to be filled in the combo * box * @param inAuthors {@link IndexedContainer} the authors of existing bibliography entries, to be filled in the combo * box * @param inTask {@link BibliographyHandleTask} the task (controller) of this view */ public BibliographySearchView(final Question inQuestion, final Group inGroup, final IndexedContainer inTitles, final IndexedContainer inAuthors, final BibliographyHandleTask inTask) { final VerticalLayout lLayout = new VerticalLayout(); setCompositionRoot(lLayout); lLayout.setSpacing(true); final IMessages lMessages = Activator.getMessages(); lLayout.setStyleName("vif-view"); //$NON-NLS-1$ final String lTitle = lMessages.getFormattedMessage("ui.bibliography.link.title.page", //$NON-NLS-1$ BeanWrapperHelper.getPlain(QuestionHome.KEY_QUESTION, inQuestion), BeanWrapperHelper.getString(QuestionHome.KEY_QUESTION_DECIMAL, inQuestion)); lLayout.addComponent( new Label(String.format(VIFViewHelper.TMPL_TITLE, "vif-pagetitle", lTitle), ContentMode.HTML)); //$NON-NLS-1$ lLayout.addComponent(new Label(lMessages.getMessage("ui.bibliography.link.remark"), ContentMode.HTML)); //$NON-NLS-1$ final LabelValueTable lTable = new org.ripla.web.util.LabelValueTable(); title = createComboBox(inTitles); title.focus(); lTable.addRow(lMessages.getMessage("ui.bibliography.label.title"), title); //$NON-NLS-1$ author = createComboBox(inAuthors); lTable.addRow(lMessages.getMessage("ui.bibliography.label.author"), author); //$NON-NLS-1$ lLayout.addComponent(lTable); final Button lSearch = new Button(lMessages.getMessage("ui.bibliography.link.button.search")); //$NON-NLS-1$ final Button lCreate = new Button(lMessages.getMessage("ui.bibliography.link.button.create")); //$NON-NLS-1$ lCreate.addClickListener(new ClickListener() { @Override public void buttonClick(final ClickEvent inEvent) { if (!inTask.createNew(title.getValue(), author.getValue())) { Notification.show(Activator.getMessages().getMessage("errmsg.save.general"), //$NON-NLS-1$ Type.WARNING_MESSAGE); } } }); lCreate.setVisible(false); final ResultView lResultView = new ResultView(inTask); lResultView.setVisible(false); lSearch.setClickShortcut(KeyCode.ENTER); lSearch.addClickListener(new ClickListener() { @Override public void buttonClick(final ClickEvent inEvent) { if (inTask.searchFor(title.getValue(), author.getValue())) { lCreate.setVisible(true); lResultView.fillTable(inTask.getTexts()); lResultView.setVisible(true); } } }); lLayout.addComponent(RiplaViewHelper.createButtons(lSearch, lCreate)); lLayout.addComponent(RiplaViewHelper.createSpacer()); lLayout.addComponent(lResultView); }
From source file:org.hip.vif.admin.permissions.ui.PermissionEditView.java
License:Open Source License
/** Constructor * * @param inPermissions {@link LoadedPermissionContainer} the permissions * @param inRoles {@link CodeList} the roles * @param inTask {@link PermissionsEditTask} */ public PermissionEditView(final LoadedPermissionContainer inPermissions, final CodeList inRoles, final PermissionsEditTask inTask) { final VerticalLayout lLayout = new VerticalLayout(); setCompositionRoot(lLayout);// www . j a v a 2s. c om final IMessages lMessages = Activator.getMessages(); lLayout.setStyleName("vif-table"); //$NON-NLS-1$ lLayout.addComponent(new Label( String.format(VIFViewHelper.TMPL_TITLE, "vif-pagetitle", //$NON-NLS-1$ lMessages.getMessage("component.menu.title")), //$NON-NLS-1$ ContentMode.HTML)); final Label lSubtitle = new Label( String.format(SUBTITLE_WARNING, lMessages.getMessage("ui.permission.remark.delete")), //$NON-NLS-1$ ContentMode.HTML); lLayout.addComponent(lSubtitle); lSubtitle.setVisible(false); final Table lTable = new Table(); lTable.setWidth("100%"); //$NON-NLS-1$ lTable.setStyleName("vif-permission-table"); //$NON-NLS-1$ lTable.setContainerDataSource(inPermissions); // generate column checkbox for delete lTable.addGeneratedColumn(LoadedPermissionContainer.FIELD_CHECK, new Table.ColumnGenerator() { @Override public Object generateCell(final Table inSource, final Object inItemId, final Object inColumnId) { if (Constants.PERMISSION_EDIT.equals(((LoadedPermissionBean) inItemId).getLabel())) { return new Label(); } return VIFViewHelper.createCheck((ISelectableBean) inItemId, new VIFViewHelper.IConfirmationModeChecker() { @Override public boolean inConfirmationMode() { return confirmationMode; } }); } }); // generate column label lTable.addGeneratedColumn(LoadedPermissionContainer.FIELD_LABEL, new Table.ColumnGenerator() { @Override public Object generateCell(final Table inSource, final Object inItemId, final Object inColumnId) { final LoadedPermissionBean lPermission = (LoadedPermissionBean) inItemId; return new Label(String.format(TMPL_LABEL, lPermission.getDescription(), lPermission.getLabel()), ContentMode.HTML); } }); // generate column checkbox for roles lTable.addGeneratedColumn(LoadedPermissionContainer.FIELD_ROLE_SU, new ColumnCheckBoxGenerator(Role.SU)); lTable.addGeneratedColumn(LoadedPermissionContainer.FIELD_ROLE_ADMIN, new ColumnCheckBoxGenerator(Role.ADMIN)); lTable.addGeneratedColumn(LoadedPermissionContainer.FIELD_ROLE_GROUPADMIN, new ColumnCheckBoxGenerator(Role.GROUP_ADMIN)); lTable.addGeneratedColumn(LoadedPermissionContainer.FIELD_ROLE_PARTICIPANT, new ColumnCheckBoxGenerator(Role.PARTICIPANT)); lTable.addGeneratedColumn(LoadedPermissionContainer.FIELD_ROLE_MEMBER, new ColumnCheckBoxGenerator(Role.MEMBER)); lTable.addGeneratedColumn(LoadedPermissionContainer.FIELD_ROLE_GUEST, new ColumnCheckBoxGenerator(Role.GUEST)); lTable.addGeneratedColumn(LoadedPermissionContainer.FIELD_ROLE_EXCLUDED, new ColumnCheckBoxGenerator(Role.EXCLUDED)); lTable.setPageLength(inPermissions.size() > TABLE_SIZE ? TABLE_SIZE : 0); lTable.setColumnCollapsingAllowed(true); lTable.setColumnReorderingAllowed(true); lTable.setSelectable(true); lTable.setImmediate(true); lTable.setVisibleColumns(LoadedPermissionContainer.NATURAL_COL_ORDER); lTable.setColumnHeaders(getHeaders(inRoles, lMessages)); lTable.setColumnExpandRatio(LoadedPermissionContainer.FIELD_LABEL, 1); lLayout.addComponent(lTable); final Button lDelete = new Button(lMessages.getMessage("ui.permission.button.delete")); //$NON-NLS-1$ final Button lSave = new Button(lMessages.getMessage("ui.permission.button.save")); //$NON-NLS-1$ lSave.addClickListener(new Button.ClickListener() { @Override public void buttonClick(final ClickEvent inEvent) { if (!inTask.saveChanges()) { Notification.show(lMessages.getMessage("errmsg.permissions.save"), //$NON-NLS-1$ Type.WARNING_MESSAGE); } } }); lLayout.addComponent(RiplaViewHelper.createButtons(lDelete, lSave)); lLayout.addComponent(RiplaViewHelper.createSpacer()); final Component lInput = createInput(inTask, lMessages); lLayout.addComponent(lInput); // add button click listeners lDelete.addClickListener(new Button.ClickListener() { @Override public void buttonClick(final ClickEvent inEvent) { if (confirmationMode) { if (!inTask.deletePermissions()) { Notification.show(lMessages.getMessage("errmsg.permissions.delete"), //$NON-NLS-1$ Type.WARNING_MESSAGE); } } else { if (VIFViewHelper.processAction(inPermissions)) { confirmationMode = true; inPermissions.addContainerFilter(new SelectedFilter()); lSubtitle.setVisible(true); lTable.setSelectable(false); lTable.setPageLength(0); lInput.setVisible(false); lSave.setVisible(false); } } } }); }
From source file:org.hip.vif.forum.groups.ui.BibliographySearchView.java
License:Open Source License
/** View constructor. * * @param inQuestion {@link Question} the actual question, possibly the question the bibliography will be linked * with/* www . j av a2 s. com*/ * @param inGroup {@link Group} the actual group * @param inTitles {@link IndexedContainer} the titles of existing bibliography entries, to be filled in the combo * box * @param inAuthors {@link IndexedContainer} the authors of existing bibliography entries, to be filled in the combo * box * @param inTask {@link BibliographyHandleTask} the task (controller) of this view */ public BibliographySearchView(final Question inQuestion, final Group inGroup, final IndexedContainer inTitles, final IndexedContainer inAuthors, final BibliographyHandleTask inTask) { final VerticalLayout lLayout = new VerticalLayout(); setCompositionRoot(lLayout); lLayout.setSpacing(true); final IMessages lMessages = Activator.getMessages(); lLayout.setStyleName("vif-view"); //$NON-NLS-1$ final String lTitle = lMessages.getFormattedMessage("ui.bibliography.link.title.page", //$NON-NLS-1$ BeanWrapperHelper.getPlain(QuestionHome.KEY_QUESTION, inQuestion), BeanWrapperHelper.getString(QuestionHome.KEY_QUESTION_DECIMAL, inQuestion)); lLayout.addComponent( new Label(String.format(VIFViewHelper.TMPL_TITLE, "vif-pagetitle", lTitle), ContentMode.HTML)); //$NON-NLS-1$ lLayout.addComponent(new Label(lMessages.getMessage("ui.bibliography.link.remark"), ContentMode.HTML)); //$NON-NLS-1$ final LabelValueTable lTable = new LabelValueTable(); title = createComboBox(inTitles); title.focus(); lTable.addRow(lMessages.getMessage("ui.bibliography.label.title"), title); //$NON-NLS-1$ author = createComboBox(inAuthors); lTable.addRow(lMessages.getMessage("ui.bibliography.label.author"), author); //$NON-NLS-1$ lLayout.addComponent(lTable); final Button lSearch = new Button(lMessages.getMessage("ui.bibliography.link.button.search")); //$NON-NLS-1$ final Button lCreate = new Button(lMessages.getMessage("ui.bibliography.link.button.create")); //$NON-NLS-1$ lCreate.addClickListener(new Button.ClickListener() { @Override public void buttonClick(final ClickEvent inEvent) { if (!inTask.createNew(title.getValue(), author.getValue())) { Notification.show(Activator.getMessages().getMessage("errmsg.general"), Type.WARNING_MESSAGE); //$NON-NLS-1$ } } }); lCreate.setVisible(false); final ResultView lResultView = new ResultView(inTask); lResultView.setVisible(false); lSearch.setClickShortcut(KeyCode.ENTER); lSearch.addClickListener(new Button.ClickListener() { @Override public void buttonClick(final ClickEvent inEvent) { if (inTask.searchFor(title.getValue(), author.getValue())) { lCreate.setVisible(true); lResultView.fillTable(inTask.getTexts()); lResultView.setVisible(true); } } }); lLayout.addComponent(RiplaViewHelper.createButtons(lSearch, lCreate)); lLayout.addComponent(RiplaViewHelper.createSpacer()); lLayout.addComponent(lResultView); }
From source file:org.hip.vif.forum.suspend.ui.SuspendView.java
License:Open Source License
/** Constructor * * @param inGroups {@link GroupContainer} the groups that are affected * @param inDates {@link DatePrepare} an initial or earlier suspend period * @param inTask {@link SuspendTask} */ public SuspendView(final GroupContainer inGroups, final DatePrepare inDates, final SuspendTask inTask) { super();// w w w. j a v a 2s . c o m final VerticalLayout lLayout = new VerticalLayout(); setCompositionRoot(lLayout); final IMessages lMessages = Activator.getMessages(); lLayout.setStyleName("vif-view"); //$NON-NLS-1$ lLayout.addComponent(new Label(String.format(VIFViewHelper.TMPL_TITLE, "vif-pagetitle", //$NON-NLS-1$ lMessages.getMessage("ui.suspend.view.title.page")), ContentMode.HTML)); //$NON-NLS-1$ final Button lSuspend = new Button(lMessages.getMessage("ui.suspend.view.button.suspend")); //$NON-NLS-1$ final Button lClear = new Button(lMessages.getMessage("ui.suspend.view.button.clear")); //$NON-NLS-1$ final String lDatePattern = PreferencesHandler.INSTANCE.getDatePattern(); final LabelValueTable lTable = new LabelValueTable(); final PopupDateField lFrom = createDateField(inDates.getFromDate(), lDatePattern); lFrom.addValidator(new DateFieldValidator()); lFrom.focus(); lTable.addRow(lMessages.getFormattedMessage("ui.suspend.view.label.from", lDatePattern), lFrom); //$NON-NLS-1$ final PopupDateField lTo = createDateField(inDates.getToDate(), lDatePattern); lTo.addValidator(new DateFieldValidator(lFrom)); lTable.addRow(lMessages.getFormattedMessage("ui.suspend.view.label.to", lDatePattern), lTo); //$NON-NLS-1$ lLayout.addComponent(lTable); lLayout.addComponent(RiplaViewHelper.createSpacer()); lSuspend.addClickListener(new Button.ClickListener() { @Override public void buttonClick(final ClickEvent inEvent) { // NOPMD final DateFieldValidator lValidator = new DateFieldValidator(lFrom, lTo); try { lValidator.validate(); if (inTask.saveSuspendDates(lFrom.getValue(), lTo.getValue())) { Notification.show(lMessages.getMessage("msg.data.saved"), Type.TRAY_NOTIFICATION); //$NON-NLS-1$ lClear.setVisible(true); } else { Notification.show(lMessages.getMessage("errmsg.general"), Type.ERROR_MESSAGE); //$NON-NLS-1$ } } catch (final InvalidValueException exc) { Notification.show(exc.getMessage(), Type.WARNING_MESSAGE); } } }); lSuspend.setClickShortcut(KeyCode.ENTER); lClear.addClickListener(new Button.ClickListener() { @Override public void buttonClick(final ClickEvent inEvent) { // NOPMD if (inTask.clearSuspendDates()) { Notification.show(lMessages.getMessage("msg.data.cleared"), Type.TRAY_NOTIFICATION); //$NON-NLS-1$ lFrom.setValue(new Date()); lFrom.focus(); lTo.setValue(null); lClear.setVisible(false); } else { Notification.show(lMessages.getMessage("errmsg.general"), Type.ERROR_MESSAGE); //$NON-NLS-1$ } } }); lLayout.addComponent(RiplaViewHelper.createButtons(lSuspend, lClear)); // Clear button is visible only if there's something to clear. lClear.setVisible(inDates.getSuspendDateState() == SuspendState.HAS_DATES); lLayout.addComponent(RiplaViewHelper.createSpacer()); lLayout.addComponent(new Label(String.format(VIFViewHelper.TMPL_TITLE, "vif-subtitle", //$NON-NLS-1$ lMessages.getMessage("ui.suspend.view.subtitle")), ContentMode.HTML)); //$NON-NLS-1$ lLayout.addComponent(createTable(inGroups)); }
From source file:org.ikasan.dashboard.ui.mappingconfiguration.component.MappingConfigurationConfigurationValuesTable.java
License:BSD License
/** * Method to add a record to the component. * //from www . ja va2s . c o m * @throws MappingConfigurationServiceException */ public void addNewRecord() throws MappingConfigurationServiceException { Long sourceSystemGroupId = null; if (this.mappingConfiguration.getNumberOfParams() > 1) { sourceSystemGroupId = this.mappingConfigurationService.getNextSequenceNumber(); } TargetConfigurationValue targetConfigurationValue = new TargetConfigurationValue(); targetConfigurationValue.setTargetSystemValue("Add targetSystemValue"); this.mappingConfigurationService.saveTargetConfigurationValue(targetConfigurationValue); VerticalLayout tableCellLayout = new VerticalLayout(); SourceConfigurationValue sourceConfigurationValue = null; final Button deleteButton = new Button("Delete"); ArrayList<SourceConfigurationValue> sourceConfigurationValues = new ArrayList<SourceConfigurationValue>(); for (int i = 0; i < this.mappingConfiguration.getNumberOfParams(); i++) { sourceConfigurationValue = new SourceConfigurationValue(); sourceConfigurationValue.setSourceSystemValue("Add source system value"); sourceConfigurationValue.setSourceConfigGroupId(sourceSystemGroupId); sourceConfigurationValue.setTargetConfigurationValue(targetConfigurationValue); sourceConfigurationValue.setMappingConfigurationId(this.mappingConfiguration.getId()); sourceConfigurationValues.add(sourceConfigurationValue); this.mappingConfiguration.getSourceConfigurationValues().add(sourceConfigurationValue); BeanItem<SourceConfigurationValue> item = new BeanItem<SourceConfigurationValue>( sourceConfigurationValue); final TextField tf = new TextField(item.getItemProperty("sourceSystemValue")); tableCellLayout.addComponent(tf); tf.setReadOnly(true); tf.setWidth(300, Unit.PIXELS); } BeanItem<TargetConfigurationValue> targetConfigurationItem = new BeanItem<TargetConfigurationValue>( targetConfigurationValue); final TextField targetConfigurationTextField = new TextField( targetConfigurationItem.getItemProperty("targetSystemValue")); targetConfigurationTextField.setReadOnly(true); targetConfigurationTextField.setWidth(300, Unit.PIXELS); final DeleteRowAction action = new DeleteRowAction(sourceConfigurationValues, this.mappingConfiguration, this, this.mappingConfigurationService, this.systemEventService); deleteButton.setIcon(VaadinIcons.TRASH); deleteButton.addStyleName(ValoTheme.BUTTON_ICON_ONLY); deleteButton.setDescription("Delete this record"); deleteButton.addStyleName(ValoTheme.BUTTON_BORDERLESS); deleteButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { IkasanMessageDialog dialog = new IkasanMessageDialog("Delete record", "This mapping configuration record will be permanently removed. " + "Are you sure you wish to proceed?.", action); UI.getCurrent().addWindow(dialog); } }); final IkasanAuthentication authentication = (IkasanAuthentication) VaadinService.getCurrentRequest() .getWrappedSession().getAttribute(DashboardSessionValueConstants.USER); if (authentication != null && (authentication.hasGrantedAuthority(SecurityConstants.ALL_AUTHORITY) || authentication.hasGrantedAuthority(SecurityConstants.EDIT_MAPPING_AUTHORITY)) || authentication.canAccessLinkedItem(PolicyLinkTypeConstants.MAPPING_CONFIGURATION_LINK_TYPE, mappingConfiguration.getId())) { deleteButton.setVisible(true); } else { deleteButton.setVisible(false); } Item item = this.container.addItemAt(0, sourceConfigurationValue); Property<Layout> sourceProperty = item.getItemProperty("Source Configuration Value"); sourceProperty.setValue(tableCellLayout); Property<TextField> targetProperty = item.getItemProperty("Target Configuration Value"); targetProperty.setValue(targetConfigurationTextField); Property<Button> deleteProperty = item.getItemProperty("Delete"); deleteProperty.setValue(deleteButton); this.mappingConfigurationService.saveMappingConfiguration(mappingConfiguration); this.setEditable(true); IkasanAuthentication principal = (IkasanAuthentication) VaadinService.getCurrentRequest() .getWrappedSession().getAttribute(DashboardSessionValueConstants.USER); logger.info("User: " + principal.getName() + " added new mapping configuration value for Mapping Configuration " + this.mappingConfiguration); systemEventService.logSystemEvent(MappingConfigurationConstants.MAPPING_CONFIGURATION_SERVICE, "Added new mapping configuration value for Mapping Configuration: " + this.mappingConfiguration, principal.getName()); }
From source file:org.ikasan.dashboard.ui.mappingconfiguration.component.MappingConfigurationConfigurationValuesTable.java
License:BSD License
/** * Method to help populate the table with values associated with the MappingConfiguration. * /*from w w w . java2 s . co m*/ * @param mappingConfiguration */ public void populateTable(final MappingConfiguration mappingConfiguration) { this.mappingConfiguration = mappingConfiguration; Set<SourceConfigurationValue> sourceConfigurationValues = mappingConfiguration .getSourceConfigurationValues(); super.removeAllItems(); Iterator<SourceConfigurationValue> sourceConfigurationValueItr = sourceConfigurationValues.iterator(); ArrayList<SourceConfigurationValue> usedSourceConfigurationValues = new ArrayList<SourceConfigurationValue>(); ArrayList<SourceConfigurationValue> groupedSourceSystemValues = new ArrayList<SourceConfigurationValue>(); while (sourceConfigurationValueItr.hasNext()) { SourceConfigurationValue value = sourceConfigurationValueItr.next(); VerticalLayout tableCellLayout = new VerticalLayout(); for (int i = 0; i < this.mappingConfiguration.getNumberOfParams(); i++) { if (!usedSourceConfigurationValues.contains(value)) { groupedSourceSystemValues.add(value); BeanItem<SourceConfigurationValue> item = new BeanItem<SourceConfigurationValue>(value); final TextField tf = new TextField(item.getItemProperty("sourceSystemValue")); tf.setWidth(300, Unit.PIXELS); tableCellLayout.addComponent(tf); tf.setReadOnly(true); usedSourceConfigurationValues.add(value); Iterator<SourceConfigurationValue> partnerSourceConfigurationValueItr = sourceConfigurationValues .iterator(); while (partnerSourceConfigurationValueItr.hasNext()) { SourceConfigurationValue partnerSourceConfigurationValue = partnerSourceConfigurationValueItr .next(); if (partnerSourceConfigurationValue.getSourceConfigGroupId() != null && !usedSourceConfigurationValues.contains(partnerSourceConfigurationValue) && partnerSourceConfigurationValue.getId().compareTo(value.getId()) != 0 && partnerSourceConfigurationValue.getSourceConfigGroupId() .compareTo(value.getSourceConfigGroupId()) == 0) { groupedSourceSystemValues.add(partnerSourceConfigurationValue); item = new BeanItem<SourceConfigurationValue>(partnerSourceConfigurationValue); final TextField stf = new TextField(item.getItemProperty("sourceSystemValue")); stf.setWidth(300, Unit.PIXELS); tableCellLayout.addComponent(stf); stf.setReadOnly(true); usedSourceConfigurationValues.add(partnerSourceConfigurationValue); } } TargetConfigurationValue targetConfigurationValue = value.getTargetConfigurationValue(); BeanItem<TargetConfigurationValue> targetConfigurationItem = new BeanItem<TargetConfigurationValue>( targetConfigurationValue); final TextField targetConfigurationTextField = new TextField( targetConfigurationItem.getItemProperty("targetSystemValue")); targetConfigurationTextField.setReadOnly(true); targetConfigurationTextField.setWidth(300, Unit.PIXELS); final DeleteRowAction action = new DeleteRowAction(groupedSourceSystemValues, this.mappingConfiguration, this, this.mappingConfigurationService, this.systemEventService); final Button deleteButton = new Button("Delete"); deleteButton.setData(value); deleteButton.setIcon(VaadinIcons.TRASH); deleteButton.addStyleName(ValoTheme.BUTTON_ICON_ONLY); deleteButton.setDescription("Delete this record"); deleteButton.addStyleName(ValoTheme.BUTTON_BORDERLESS); deleteButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { IkasanMessageDialog dialog = new IkasanMessageDialog("Delete record", "This mapping configuration record will be permanently removed. " + "Are you sure you wish to proceed?.", action); UI.getCurrent().addWindow(dialog); } }); final IkasanAuthentication authentication = (IkasanAuthentication) VaadinService .getCurrentRequest().getWrappedSession() .getAttribute(DashboardSessionValueConstants.USER); if (authentication != null && (authentication.hasGrantedAuthority(SecurityConstants.ALL_AUTHORITY) || authentication.hasGrantedAuthority(SecurityConstants.EDIT_MAPPING_AUTHORITY)) || authentication.canAccessLinkedItem( PolicyLinkTypeConstants.MAPPING_CONFIGURATION_LINK_TYPE, mappingConfiguration.getId())) { deleteButton.setVisible(true); } else { deleteButton.setVisible(false); } this.addItem(new Object[] { tableCellLayout, targetConfigurationTextField, deleteButton }, value); groupedSourceSystemValues = new ArrayList<SourceConfigurationValue>(); } } } }
From source file:org.ikasan.dashboard.ui.mappingconfiguration.panel.MappingConfigurationView.java
License:BSD License
/** * Helper method to initialise this object. *///from w w w .j a v a 2s .c om protected void init() { this.setSizeFull(); HorizontalLayout topContainer = new HorizontalLayout(); topContainer.setSizeFull(); topContainer.setMargin(true); topContainer.addComponent(this.searchPanel); HorizontalLayout bottomContainer = new HorizontalLayout(); bottomContainer.setMargin(true); bottomContainer.setSizeFull(); bottomContainer.addComponent(this.viewComponentContainer); final Button hideFilterButton = new Button(); hideFilterButton.setIcon(VaadinIcons.MINUS); hideFilterButton.setCaption("Hide Filter"); hideFilterButton.setStyleName(ValoTheme.BUTTON_LINK); hideFilterButton.addStyleName(ValoTheme.BUTTON_SMALL); final Button showFilterButton = new Button(); showFilterButton.setIcon(VaadinIcons.PLUS); showFilterButton.setCaption("Show Filter"); showFilterButton.addStyleName(ValoTheme.BUTTON_LINK); showFilterButton.addStyleName(ValoTheme.BUTTON_SMALL); showFilterButton.setVisible(false); hideFilterButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { hideFilterButton.setVisible(false); showFilterButton.setVisible(true); splitPosition = verticalSplitPanel.getSplitPosition(); splitUnit = verticalSplitPanel.getSplitPositionUnit(); verticalSplitPanel.setSplitPosition(0, Unit.PIXELS); } }); showFilterButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { hideFilterButton.setVisible(true); showFilterButton.setVisible(false); verticalSplitPanel.setSplitPosition(splitPosition, splitUnit); } }); GridLayout filterButtonLayout = new GridLayout(2, 1); filterButtonLayout.setHeight(25, Unit.PIXELS); filterButtonLayout.addComponent(hideFilterButton, 0, 0); filterButtonLayout.addComponent(showFilterButton, 1, 0); this.verticalSplitPanel = new VerticalSplitPanel(topContainer, bottomContainer); this.verticalSplitPanel.addStyleName(ValoTheme.SPLITPANEL_LARGE); this.verticalSplitPanel.setSizeFull(); this.verticalSplitPanel.setSplitPosition(260, Unit.PIXELS); GridLayout wrapper = new GridLayout(1, 2); wrapper.setRowExpandRatio(0, .01f); wrapper.setRowExpandRatio(1, .99f); wrapper.setSizeFull(); wrapper.addComponent(filterButtonLayout); wrapper.setComponentAlignment(filterButtonLayout, Alignment.MIDDLE_RIGHT); wrapper.addComponent(verticalSplitPanel); this.setContent(wrapper); }
From source file:org.ikasan.dashboard.ui.topology.component.ActionedExclusionTab.java
License:BSD License
public Layout createLayout() { this.actionedExclusionsTable = new Table(); this.actionedExclusionsTable.setSizeFull(); this.actionedExclusionsTable.setCellStyleGenerator(new IkasanSmallCellStyleGenerator()); this.actionedExclusionsTable.addContainerProperty("Module Name", String.class, null); this.actionedExclusionsTable.addContainerProperty("Flow Name", String.class, null); this.actionedExclusionsTable.addContainerProperty("Action", String.class, null); this.actionedExclusionsTable.addContainerProperty("Actioned By", String.class, null); this.actionedExclusionsTable.addContainerProperty("Timestamp", String.class, null); this.actionedExclusionsTable.addItemClickListener(new ItemClickEvent.ItemClickListener() { @Override//from www . j a v a2 s.co m public void itemClick(ItemClickEvent itemClickEvent) { ExclusionEventAction exclusionEventAction = (ExclusionEventAction) itemClickEvent.getItemId(); ErrorOccurrence errorOccurrence = (ErrorOccurrence) errorReportingService .find(exclusionEventAction.getErrorUri()); ExclusionEventAction action = hospitalManagementService .getExclusionEventActionByErrorUri(exclusionEventAction.getErrorUri()); ActionedExclusionEventViewWindow actionExclusionEventViewWindow = new ActionedExclusionEventViewWindow( errorOccurrence, serialiserFactory, action, hospitalManagementService, topologyService); UI.getCurrent().addWindow(actionExclusionEventViewWindow); } }); Button searchButton = new Button("Search"); searchButton.setStyleName(ValoTheme.BUTTON_SMALL); searchButton.addClickListener(new Button.ClickListener() { @SuppressWarnings("unchecked") public void buttonClick(ClickEvent event) { actionedExclusionsTable.removeAllItems(); ArrayList<String> modulesNames = null; if (errorOccurenceModules.getItemIds().size() > 0) { modulesNames = new ArrayList<String>(); for (Object module : errorOccurenceModules.getItemIds()) { modulesNames.add(((Module) module).getName()); } } ArrayList<String> flowNames = null; if (errorOccurenceFlows.getItemIds().size() > 0) { flowNames = new ArrayList<String>(); for (Object flow : errorOccurenceFlows.getItemIds()) { flowNames.add(((Flow) flow).getName()); } } ArrayList<String> componentNames = null; if (errorOccurenceComponents.getItemIds().size() > 0) { componentNames = new ArrayList<String>(); for (Object component : errorOccurenceComponents.getItemIds()) { componentNames.add(((Component) component).getName()); } } if (modulesNames == null && flowNames == null && componentNames == null && !((BusinessStream) businessStreamCombo.getValue()).getName().equals("All")) { BusinessStream businessStream = ((BusinessStream) businessStreamCombo.getValue()); modulesNames = new ArrayList<String>(); for (BusinessStreamFlow flow : businessStream.getFlows()) { modulesNames.add(flow.getFlow().getModule().getName()); } } List<ExclusionEventAction> exclusionEventActions = hospitalManagementService .getActionedExclusions(modulesNames, flowNames, fromDate.getValue(), toDate.getValue()); for (ExclusionEventAction exclusionEventAction : exclusionEventActions) { Date date = new Date(exclusionEventAction.getTimestamp()); SimpleDateFormat format = new SimpleDateFormat("yyyy MM dd HH:mm:ss"); String timestamp = format.format(date); actionedExclusionsTable .addItem( new Object[] { exclusionEventAction.getModuleName(), exclusionEventAction.getFlowName(), exclusionEventAction.getAction(), exclusionEventAction.getActionedBy(), timestamp }, exclusionEventAction); } } }); Button clearButton = new Button("Clear"); clearButton.setStyleName(ValoTheme.BUTTON_SMALL); clearButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { errorOccurenceModules.removeAllItems(); errorOccurenceFlows.removeAllItems(); errorOccurenceComponents.removeAllItems(); } }); GridLayout layout = new GridLayout(1, 6); layout.setMargin(false); layout.setHeight(270, Unit.PIXELS); GridLayout listSelectLayout = new GridLayout(3, 1); listSelectLayout.setSpacing(true); listSelectLayout.setSizeFull(); errorOccurenceModules.setIcon(VaadinIcons.ARCHIVE); errorOccurenceModules.addContainerProperty("Module Name", String.class, null); errorOccurenceModules.addContainerProperty("", Button.class, null); errorOccurenceModules.setSizeFull(); errorOccurenceModules.setCellStyleGenerator(new IkasanSmallCellStyleGenerator()); errorOccurenceModules.setDragMode(TableDragMode.ROW); errorOccurenceModules.setDropHandler(new DropHandler() { @Override public void drop(final DragAndDropEvent dropEvent) { // criteria verify that this is safe logger.info("Trying to drop: " + dropEvent); final DataBoundTransferable t = (DataBoundTransferable) dropEvent.getTransferable(); if (t.getItemId() instanceof Module) { final Module module = (Module) t.getItemId(); logger.info("sourceContainer.getText(): " + module.getName()); Button deleteButton = new Button(); deleteButton.setIcon(VaadinIcons.TRASH); deleteButton.addStyleName(ValoTheme.BUTTON_BORDERLESS); deleteButton.addStyleName(ValoTheme.BUTTON_ICON_ONLY); // Add the delete functionality to each role that is added deleteButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { errorOccurenceModules.removeItem(module); } }); errorOccurenceModules.addItem(new Object[] { module.getName(), deleteButton }, module); for (final Flow flow : module.getFlows()) { deleteButton = new Button(); deleteButton.setIcon(VaadinIcons.TRASH); deleteButton.addStyleName(ValoTheme.BUTTON_BORDERLESS); deleteButton.addStyleName(ValoTheme.BUTTON_ICON_ONLY); // Add the delete functionality to each role that is added deleteButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { errorOccurenceFlows.removeItem(flow); } }); errorOccurenceFlows.addItem(new Object[] { flow.getName(), deleteButton }, flow); for (final Component component : flow.getComponents()) { deleteButton = new Button(); deleteButton.setIcon(VaadinIcons.TRASH); deleteButton.addStyleName(ValoTheme.BUTTON_BORDERLESS); deleteButton.addStyleName(ValoTheme.BUTTON_ICON_ONLY); // Add the delete functionality to each role that is added deleteButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { errorOccurenceComponents.removeItem(component); } }); errorOccurenceComponents.addItem(new Object[] { component.getName(), deleteButton }, component); } } } } @Override public AcceptCriterion getAcceptCriterion() { return AcceptAll.get(); } }); listSelectLayout.addComponent(errorOccurenceModules, 0, 0); errorOccurenceFlows.setIcon(VaadinIcons.AUTOMATION); errorOccurenceFlows.addContainerProperty("Flow Name", String.class, null); errorOccurenceFlows.addContainerProperty("", Button.class, null); errorOccurenceFlows.setSizeFull(); errorOccurenceFlows.setCellStyleGenerator(new IkasanSmallCellStyleGenerator()); errorOccurenceFlows.setDropHandler(new DropHandler() { @Override public void drop(final DragAndDropEvent dropEvent) { // criteria verify that this is safe logger.info("Trying to drop: " + dropEvent); final DataBoundTransferable t = (DataBoundTransferable) dropEvent.getTransferable(); if (t.getItemId() instanceof Flow) { final Flow flow = (Flow) t.getItemId(); logger.info("sourceContainer.getText(): " + flow.getName()); Button deleteButton = new Button(); deleteButton.setIcon(VaadinIcons.TRASH); deleteButton.addStyleName(ValoTheme.BUTTON_BORDERLESS); deleteButton.addStyleName(ValoTheme.BUTTON_ICON_ONLY); // Add the delete functionality to each role that is added deleteButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { errorOccurenceFlows.removeItem(flow); } }); errorOccurenceFlows.addItem(new Object[] { flow.getName(), deleteButton }, flow); for (final Component component : flow.getComponents()) { deleteButton = new Button(); deleteButton.setIcon(VaadinIcons.TRASH); deleteButton.addStyleName(ValoTheme.BUTTON_BORDERLESS); deleteButton.addStyleName(ValoTheme.BUTTON_ICON_ONLY); // Add the delete functionality to each role that is added deleteButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { errorOccurenceComponents.removeItem(component); } }); errorOccurenceComponents.addItem(new Object[] { component.getName(), deleteButton }, component); } } } @Override public AcceptCriterion getAcceptCriterion() { return AcceptAll.get(); } }); listSelectLayout.addComponent(errorOccurenceFlows, 1, 0); errorOccurenceComponents.setIcon(VaadinIcons.COG); errorOccurenceComponents.setSizeFull(); errorOccurenceComponents.addContainerProperty("Component Name", String.class, null); errorOccurenceComponents.addContainerProperty("", Button.class, null); errorOccurenceComponents.setCellStyleGenerator(new IkasanCellStyleGenerator()); errorOccurenceComponents.setSizeFull(); errorOccurenceComponents.setCellStyleGenerator(new IkasanSmallCellStyleGenerator()); errorOccurenceComponents.setDropHandler(new DropHandler() { @Override public void drop(final DragAndDropEvent dropEvent) { // criteria verify that this is safe logger.info("Trying to drop: " + dropEvent); final DataBoundTransferable t = (DataBoundTransferable) dropEvent.getTransferable(); if (t.getItemId() instanceof Component) { final Component component = (Component) t.getItemId(); logger.info("sourceContainer.getText(): " + component.getName()); Button deleteButton = new Button(); deleteButton.setIcon(VaadinIcons.TRASH); deleteButton.addStyleName(ValoTheme.BUTTON_BORDERLESS); deleteButton.addStyleName(ValoTheme.BUTTON_ICON_ONLY); // Add the delete functionality to each role that is added deleteButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { errorOccurenceComponents.removeItem(component); } }); errorOccurenceComponents.addItem(new Object[] { component.getName(), deleteButton }, component); } } @Override public AcceptCriterion getAcceptCriterion() { return AcceptAll.get(); } }); listSelectLayout.addComponent(this.errorOccurenceComponents, 2, 0); GridLayout dateSelectLayout = new GridLayout(2, 1); dateSelectLayout.setSizeFull(); fromDate = new PopupDateField("From date"); fromDate.setResolution(Resolution.MINUTE); fromDate.setValue(this.getMidnightToday()); dateSelectLayout.addComponent(fromDate, 0, 0); toDate = new PopupDateField("To date"); toDate.setResolution(Resolution.MINUTE); toDate.setValue(this.getTwentyThreeFixtyNineToday()); dateSelectLayout.addComponent(toDate, 1, 0); final VerticalSplitPanel vSplitPanel = new VerticalSplitPanel(); vSplitPanel.setHeight("95%"); GridLayout searchLayout = new GridLayout(2, 1); searchLayout.setSpacing(true); searchLayout.addComponent(searchButton, 0, 0); searchLayout.addComponent(clearButton, 1, 0); final Button hideFilterButton = new Button(); hideFilterButton.setIcon(VaadinIcons.MINUS); hideFilterButton.setCaption("Hide Filter"); hideFilterButton.setStyleName(ValoTheme.BUTTON_LINK); hideFilterButton.addStyleName(ValoTheme.BUTTON_SMALL); final Button showFilterButton = new Button(); showFilterButton.setIcon(VaadinIcons.PLUS); showFilterButton.setCaption("Show Filter"); showFilterButton.addStyleName(ValoTheme.BUTTON_LINK); showFilterButton.addStyleName(ValoTheme.BUTTON_SMALL); showFilterButton.setVisible(false); final HorizontalLayout hListSelectLayout = new HorizontalLayout(); hListSelectLayout.setHeight(150, Unit.PIXELS); hListSelectLayout.setWidth("100%"); hListSelectLayout.addComponent(listSelectLayout); final HorizontalLayout hDateSelectLayout = new HorizontalLayout(); hDateSelectLayout.setHeight(40, Unit.PIXELS); hDateSelectLayout.setWidth("100%"); hDateSelectLayout.addComponent(dateSelectLayout); final HorizontalLayout hSearchLayout = new HorizontalLayout(); hSearchLayout.setHeight(30, Unit.PIXELS); hSearchLayout.setWidth("100%"); hSearchLayout.addComponent(searchLayout); hSearchLayout.setComponentAlignment(searchLayout, Alignment.MIDDLE_CENTER); hideFilterButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { hideFilterButton.setVisible(false); showFilterButton.setVisible(true); splitPosition = vSplitPanel.getSplitPosition(); splitUnit = vSplitPanel.getSplitPositionUnit(); vSplitPanel.setSplitPosition(0, Unit.PIXELS); } }); showFilterButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { hideFilterButton.setVisible(true); showFilterButton.setVisible(false); vSplitPanel.setSplitPosition(splitPosition, splitUnit); } }); GridLayout filterButtonLayout = new GridLayout(2, 1); filterButtonLayout.setHeight(25, Unit.PIXELS); filterButtonLayout.addComponent(hideFilterButton, 0, 0); filterButtonLayout.addComponent(showFilterButton, 1, 0); Label filterHintLabel = new Label(); filterHintLabel.setCaptionAsHtml(true); filterHintLabel.setCaption(VaadinIcons.QUESTION_CIRCLE_O.getHtml() + " Drag items from the topology tree to the tables below in order to narrow your search."); filterHintLabel.addStyleName(ValoTheme.LABEL_TINY); filterHintLabel.addStyleName(ValoTheme.LABEL_LIGHT); layout.addComponent(filterHintLabel); layout.addComponent(hListSelectLayout); layout.addComponent(hDateSelectLayout); layout.addComponent(hSearchLayout); layout.setSizeFull(); Panel filterPanel = new Panel(); filterPanel.setHeight(300, Unit.PIXELS); filterPanel.setWidth("100%"); filterPanel.setContent(layout); filterPanel.addStyleName(ValoTheme.PANEL_BORDERLESS); vSplitPanel.setFirstComponent(filterPanel); CssLayout hErrorTable = new CssLayout(); hErrorTable.setSizeFull(); hErrorTable.addComponent(this.actionedExclusionsTable); vSplitPanel.setSecondComponent(hErrorTable); vSplitPanel.setSplitPosition(310, Unit.PIXELS); GridLayout wrapper = new GridLayout(1, 2); wrapper.setRowExpandRatio(0, .01f); wrapper.setRowExpandRatio(1, .99f); wrapper.setSizeFull(); wrapper.addComponent(filterButtonLayout); wrapper.setComponentAlignment(filterButtonLayout, Alignment.MIDDLE_RIGHT); wrapper.addComponent(vSplitPanel); return wrapper; }
From source file:org.ikasan.dashboard.ui.topology.component.BusinessStreamTab.java
License:BSD License
public Layout createBusinessStreamLayout() { this.businessStreamTable = new Table(); this.businessStreamTable.addContainerProperty("Server Name", String.class, null); this.businessStreamTable.addContainerProperty("Module Name", String.class, null); this.businessStreamTable.addContainerProperty("Flow Name", String.class, null); this.businessStreamTable.addContainerProperty("", Button.class, null); this.businessStreamTable.setWidth("100%"); this.businessStreamTable.setHeight(600, Unit.PIXELS); this.businessStreamTable.setCellStyleGenerator(new IkasanSmallCellStyleGenerator()); this.businessStreamTable.setDragMode(TableDragMode.ROW); this.businessStreamTable.setDropHandler(new DropHandler() { @Override// w w w . ja va 2s . c om public void drop(final DragAndDropEvent dropEvent) { final IkasanAuthentication authentication = (IkasanAuthentication) VaadinService.getCurrentRequest() .getWrappedSession().getAttribute(DashboardSessionValueConstants.USER); if (authentication != null && (!authentication.hasGrantedAuthority(SecurityConstants.ALL_AUTHORITY) && !authentication .hasGrantedAuthority(SecurityConstants.MODIFY_BUSINESS_STREAM_AUTHORITY))) { Notification.show("You do not have the privilege to modify a business stream."); return; } final DataBoundTransferable t = (DataBoundTransferable) dropEvent.getTransferable(); if (t.getItemId() instanceof Flow) { final Flow flow = (Flow) t.getItemId(); final BusinessStream businessStream = (BusinessStream) businessStreamCombo.getValue(); BusinessStreamFlowKey key = new BusinessStreamFlowKey(); key.setBusinessStreamId(businessStream.getId()); key.setFlowId(flow.getId()); final BusinessStreamFlow businessStreamFlow = new BusinessStreamFlow(key); businessStreamFlow.setFlow(flow); businessStreamFlow.setOrder(businessStreamTable.getItemIds().size()); if (!businessStream.getFlows().contains(businessStreamFlow)) { businessStream.getFlows().add(businessStreamFlow); topologyService.saveBusinessStream(businessStream); Button deleteButton = new Button(); Resource deleteIcon = VaadinIcons.TRASH; deleteButton.setIcon(deleteIcon); deleteButton.addStyleName(ValoTheme.BUTTON_ICON_ONLY); deleteButton.addStyleName(ValoTheme.BUTTON_BORDERLESS); deleteButton.setDescription("Delete the flow from the business stream."); deleteButton.setData(businessStreamFlow); // Add the delete functionality to each role that is added deleteButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { businessStream.getFlows().remove(businessStreamFlow); topologyService.deleteBusinessStreamFlow(businessStreamFlow); topologyService.saveBusinessStream(businessStream); businessStreamTable.removeItem(businessStreamFlow.getFlow()); } }); businessStreamTable .addItem( new Object[] { flow.getModule().getServer().getName(), flow.getModule().getName(), flow.getName(), deleteButton }, businessStreamFlow); } } else if (t.getItemId() instanceof Module) { final Module sourceContainer = (Module) t.getItemId(); for (Flow flow : sourceContainer.getFlows()) { final BusinessStream businessStream = (BusinessStream) businessStreamCombo.getValue(); BusinessStreamFlowKey key = new BusinessStreamFlowKey(); key.setBusinessStreamId(businessStream.getId()); key.setFlowId(flow.getId()); final BusinessStreamFlow businessStreamFlow = new BusinessStreamFlow(key); businessStreamFlow.setFlow(flow); businessStreamFlow.setOrder(businessStreamTable.getItemIds().size()); if (!businessStream.getFlows().contains(businessStreamFlow)) { businessStream.getFlows().add(businessStreamFlow); topologyService.saveBusinessStream(businessStream); Button deleteButton = new Button(); Resource deleteIcon = VaadinIcons.TRASH; deleteButton.setIcon(deleteIcon); deleteButton.addStyleName(ValoTheme.BUTTON_ICON_ONLY); deleteButton.addStyleName(ValoTheme.BUTTON_BORDERLESS); deleteButton.setDescription("Delete the flow from the business stream."); deleteButton.setData(businessStreamFlow); // Add the delete functionality to each role that is added deleteButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { businessStream.getFlows().remove(businessStreamFlow); topologyService.deleteBusinessStreamFlow(businessStreamFlow); topologyService.saveBusinessStream(businessStream); businessStreamTable.removeItem(businessStreamFlow.getFlow()); } }); businessStreamTable.addItem( new Object[] { flow.getModule().getServer().getName(), flow.getModule().getName(), flow.getName(), deleteButton }, businessStreamFlow); } } } else { Notification.show("Only modules or flows can be dragged to this table."); } } @Override public AcceptCriterion getAcceptCriterion() { return AcceptAll.get(); } }); GridLayout layout = new GridLayout(1, 6); layout.setMargin(true); layout.setSpacing(true); layout.setSizeFull(); Label tableDropHintLabel = new Label(); tableDropHintLabel.setCaptionAsHtml(true); tableDropHintLabel.setCaption(VaadinIcons.QUESTION_CIRCLE_O.getHtml() + " Drag modules or flows from the topology tree to the table below to build a business stream."); tableDropHintLabel.addStyleName(ValoTheme.LABEL_TINY); tableDropHintLabel.addStyleName(ValoTheme.LABEL_LIGHT); layout.addComponent(tableDropHintLabel); GridLayout controlsLayout = new GridLayout(3, 3); controlsLayout.setColumnExpandRatio(0, .05f); controlsLayout.setColumnExpandRatio(1, .65f); controlsLayout.setColumnExpandRatio(2, .3f); controlsLayout.setWidth("100%"); controlsLayout.setSpacing(true); Label newBusinessStreamLabel = new Label("New Business Stream:"); newBusinessStreamLabel.setSizeUndefined(); controlsLayout.addComponent(newBusinessStreamLabel, 0, 0); controlsLayout.setComponentAlignment(newBusinessStreamLabel, Alignment.MIDDLE_RIGHT); Button newButton = new Button(); newButton.setIcon(VaadinIcons.PLUS); newButton.addStyleName(ValoTheme.BUTTON_ICON_ONLY); newButton.addStyleName(ValoTheme.BUTTON_BORDERLESS); newButton.setDescription("Create a new business stream."); newButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { final NewBusinessStreamWindow newBusinessStreamWindow = new NewBusinessStreamWindow(); UI.getCurrent().addWindow(newBusinessStreamWindow); newBusinessStreamWindow.addCloseListener(new Window.CloseListener() { // inline close-listener public void windowClose(CloseEvent e) { topologyService.saveBusinessStream(newBusinessStreamWindow.getBusinessStream()); businessStreamCombo.addItem(newBusinessStreamWindow.getBusinessStream()); businessStreamCombo.setItemCaption(newBusinessStreamWindow.getBusinessStream(), newBusinessStreamWindow.getBusinessStream().getName()); businessStreamCombo.select(newBusinessStreamWindow.getBusinessStream()); businessStreamTable.removeAllItems(); } }); } }); final IkasanAuthentication authentication = (IkasanAuthentication) VaadinService.getCurrentRequest() .getWrappedSession().getAttribute(DashboardSessionValueConstants.USER); if (authentication != null && (!authentication.hasGrantedAuthority(SecurityConstants.ALL_AUTHORITY) && !authentication.hasGrantedAuthority(SecurityConstants.CREATE_BUSINESS_STREAM_AUTHORITY))) { newButton.setVisible(false); } controlsLayout.addComponent(newButton, 1, 0); Label businessStreamLabel = new Label("Business Stream:"); businessStreamLabel.setSizeUndefined(); final TextArea descriptionTextArea = new TextArea(); descriptionTextArea.setReadOnly(true); this.businessStreamCombo.addValueChangeListener(new ValueChangeListener() { public void valueChange(ValueChangeEvent event) { if (event.getProperty() != null && event.getProperty().getValue() != null) { final BusinessStream businessStream = (BusinessStream) event.getProperty().getValue(); descriptionTextArea.setReadOnly(false); descriptionTextArea.setValue(businessStream.getDescription()); descriptionTextArea.setReadOnly(true); businessStreamTable.removeAllItems(); for (final BusinessStreamFlow businessStreamFlow : businessStream.getFlows()) { logger.info("Adding flow: " + businessStreamFlow); Button deleteButton = new Button(); deleteButton.setIcon(VaadinIcons.TRASH); deleteButton.addStyleName(ValoTheme.BUTTON_ICON_ONLY); deleteButton.addStyleName(ValoTheme.BUTTON_BORDERLESS); deleteButton.setDescription("Delete the flow from the business stream."); // Add the delete functionality to each role that is added deleteButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { businessStream.getFlows().remove(businessStreamFlow); topologyService.deleteBusinessStreamFlow(businessStreamFlow); topologyService.saveBusinessStream(businessStream); businessStreamTable.removeItem(businessStreamFlow.getFlow()); } }); final IkasanAuthentication authentication = (IkasanAuthentication) VaadinService .getCurrentRequest().getWrappedSession() .getAttribute(DashboardSessionValueConstants.USER); if (authentication != null && (!authentication.hasGrantedAuthority(SecurityConstants.ALL_AUTHORITY) && !authentication.hasGrantedAuthority( SecurityConstants.MODIFY_BUSINESS_STREAM_AUTHORITY))) { deleteButton.setVisible(false); } businessStreamTable.addItem( new Object[] { businessStreamFlow.getFlow().getModule().getServer().getName(), businessStreamFlow.getFlow().getName(), businessStreamFlow.getFlow().getName(), deleteButton }, businessStreamFlow); } } } }); businessStreamCombo.setWidth("100%"); controlsLayout.addComponent(businessStreamLabel, 0, 1); controlsLayout.setComponentAlignment(businessStreamLabel, Alignment.MIDDLE_RIGHT); controlsLayout.addComponent(businessStreamCombo, 1, 1); Button deleteButton = new Button(); deleteButton.setIcon(VaadinIcons.TRASH); deleteButton.addStyleName(ValoTheme.BUTTON_ICON_ONLY); deleteButton.addStyleName(ValoTheme.BUTTON_BORDERLESS); deleteButton.setDescription("Delete the selected business stream."); deleteButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { Collection<BusinessStreamFlow> businessStreamFlows = (Collection<BusinessStreamFlow>) businessStreamTable .getItemIds(); for (BusinessStreamFlow businessStreamFlow : businessStreamFlows) { topologyService.deleteBusinessStreamFlow(businessStreamFlow); } BusinessStream businessStream = (BusinessStream) businessStreamCombo.getValue(); topologyService.deleteBusinessStream(businessStream); businessStreamTable.removeAllItems(); List<BusinessStream> businessStreams = topologyService.getAllBusinessStreams(); businessStreamCombo.removeItem(businessStream); descriptionTextArea.setValue(""); } }); if (authentication != null && (!authentication.hasGrantedAuthority(SecurityConstants.ALL_AUTHORITY) && !authentication.hasGrantedAuthority(SecurityConstants.DELETE_BUSINESS_STREAM_AUTHORITY))) { deleteButton.setVisible(false); } controlsLayout.addComponent(deleteButton, 2, 1); Label descriptionLabel = new Label("Description:"); descriptionLabel.setSizeUndefined(); descriptionTextArea.setRows(4); descriptionTextArea.setWidth("100%"); controlsLayout.addComponent(descriptionLabel, 0, 2); controlsLayout.setComponentAlignment(descriptionLabel, Alignment.TOP_RIGHT); controlsLayout.addComponent(descriptionTextArea, 1, 2); layout.addComponent(controlsLayout); layout.addComponent(this.businessStreamTable); return layout; }