List of usage examples for com.vaadin.ui Label setValue
public void setValue(String value)
From source file:org.escidoc.browser.elabsmodul.views.helpers.LabsLayoutHelper.java
License:Open Source License
public static HorizontalLayout createHorizontalLayoutWithELabsLabelAndStaticComboData(final String labelTxt, String value, boolean required) { Preconditions.checkNotNull(labelTxt, "Label is null"); HorizontalLayout horizontalLayout = new HorizontalLayout(); horizontalLayout.setSizeUndefined(); horizontalLayout.setDescription(USER_DESCR_ON_HOR_LAYOUT_TO_EDIT); horizontalLayout.setEnabled(true);//from w w w. j a v a 2 s. c o m horizontalLayout.setSpacing(true); horizontalLayout.setHeight(HOR_PANEL_HEIGHT); Label label = new Label(); label.setWidth(LABEL_WIDTH); label.setValue(DIV_ALIGN_RIGHT + (required ? ELabsViewContants.REQUIRED_SIGN : "") + labelTxt + DIV_END); label.setContentMode(Label.CONTENT_XHTML); label.setDescription(USER_DESCR_ON_LABEL_TO_EDIT); Label textLabel = new Label(value); textLabel.setWidth(TEXT_WIDTH); textLabel.setDescription(USER_DESCR_ON_LABEL_TO_EDIT); textLabel.setStyleName(STYLE_ELABS_TEXT_AS_LABEL); horizontalLayout.setStyleName(STYLE_ELABS_HOR_PANEL); horizontalLayout.addComponent(label, 0); horizontalLayout.addComponent(textLabel, 1); horizontalLayout.setComponentAlignment(label, Alignment.MIDDLE_LEFT); horizontalLayout.setComponentAlignment(textLabel, Alignment.MIDDLE_RIGHT); return horizontalLayout; }
From source file:org.escidoc.browser.elabsmodul.views.helpers.LabsLayoutHelper.java
License:Open Source License
public static HorizontalLayout createHorizontalLayoutWithELabsLabelAndLabelComplexData(final String labelTxt, String dataTxt, boolean required) { Preconditions.checkNotNull(labelTxt, "Label is null"); HorizontalLayout horizontalLayout = new HorizontalLayout(); horizontalLayout.setSizeUndefined(); horizontalLayout.setDescription(USER_DESCR_ON_HOR_LAYOUT_TO_EDIT); horizontalLayout.setEnabled(true);/*from www .j ava 2s . c om*/ horizontalLayout.setSpacing(true); horizontalLayout.setHeight(HOR_PANEL_HEIGHT); Label label = new Label(); label.setWidth(LABEL_WIDTH); label.setValue(DIV_ALIGN_RIGHT + (required ? ELabsViewContants.REQUIRED_SIGN : "") + labelTxt + DIV_END); label.setContentMode(Label.CONTENT_XHTML); label.setDescription(USER_DESCR_ON_LABEL_TO_EDIT); Label textLabel = new Label(dataTxt); textLabel.setWidth(TEXT_WIDTH); textLabel.setDescription(USER_DESCR_ON_LABEL_TO_EDIT); textLabel.setStyleName(STYLE_ELABS_TEXT_AS_LABEL); horizontalLayout.setStyleName(STYLE_ELABS_HOR_PANEL); horizontalLayout.addComponent(label, 0); horizontalLayout.addComponent(textLabel, 1); horizontalLayout.setComponentAlignment(label, Alignment.MIDDLE_LEFT); horizontalLayout.setComponentAlignment(textLabel, Alignment.MIDDLE_RIGHT); return horizontalLayout; }
From source file:org.escidoc.browser.elabsmodul.views.helpers.LabsLayoutHelper.java
License:Open Source License
public static HorizontalLayout createHorizontalLayoutWithELabsLabelAndRelatedDataForRig(final String labelTxt, Property dataProperty, RigBean rigBean, final IRigAction controller, LabsRigTableHelper helper, boolean required) { synchronized (LOCK_1) { Preconditions.checkNotNull(labelTxt, "Label is null"); Preconditions.checkNotNull(dataProperty, "DataSource is null"); Preconditions.checkNotNull(rigBean, "RigBean is null"); Preconditions.checkNotNull(helper, "Helper is null"); Preconditions.checkNotNull(controller, "Controller is null"); HorizontalLayout horizontalLayout = new HorizontalLayout(); horizontalLayout.setSizeUndefined(); horizontalLayout.setEnabled(true); horizontalLayout.setSpacing(true); horizontalLayout.setStyleName(STYLE_ELABS_HOR_PANEL_FOR_TABLE); Label label = new Label(); label.setWidth(LABEL_WIDTH);//from ww w.j a v a 2 s . c om label.setValue( DIV_ALIGN_RIGHT + (required ? ELabsViewContants.REQUIRED_SIGN : "") + labelTxt + DIV_END); label.setContentMode(Label.CONTENT_XHTML); label.setDescription(USER_DESCR_ON_LABEL_TO_EDIT); label.setStyleName(STYLE_ELABS_HOR_PANEL); horizontalLayout.addComponent(label, 0); horizontalLayout.addComponent(helper.createTableLayoutForRig(rigBean, controller), 1); horizontalLayout.setComponentAlignment(label, Alignment.TOP_LEFT); return horizontalLayout; } }
From source file:org.escidoc.browser.elabsmodul.views.helpers.LabsLayoutHelper.java
License:Open Source License
public static HorizontalLayout createHorizontalLayoutWithPublicationDataForStudy(final String labelTxt, Property dataProperty, boolean isMotNotResPublication, LabsStudyTableHelper helper, boolean required) { synchronized (LOCK_2) { Preconditions.checkNotNull(labelTxt, "Label is null"); Preconditions.checkNotNull(dataProperty, "DataSource is null"); Preconditions.checkNotNull(helper, "Helper is null"); HorizontalLayout horizontalLayout = new HorizontalLayout(); horizontalLayout.setSizeUndefined(); horizontalLayout.setEnabled(true); horizontalLayout.setSpacing(true); horizontalLayout.setStyleName(STYLE_ELABS_HOR_PANEL_FOR_TABLE); Label label = new Label(); label.setWidth(LABEL_WIDTH);//from w w w . j ava 2 s .c o m label.setValue( DIV_ALIGN_RIGHT + (required ? ELabsViewContants.REQUIRED_SIGN : "") + labelTxt + DIV_END); label.setContentMode(Label.CONTENT_XHTML); label.setDescription(USER_DESCR_ON_LABEL_TO_EDIT); label.setStyleName(STYLE_ELABS_HOR_PANEL); horizontalLayout.addComponent(label, 0); if (isMotNotResPublication) { horizontalLayout.addComponent(helper.createTableLayoutForMotPublications(), 1); } else { horizontalLayout.addComponent(helper.createTableLayoutForResPublications(), 1); } horizontalLayout.setComponentAlignment(label, Alignment.TOP_LEFT); return horizontalLayout; } }
From source file:org.escidoc.browser.elabsmodul.views.helpers.LabsLayoutHelper.java
License:Open Source License
public static HorizontalLayout createHorizontalLayoutWithELabsLabelAndCheckBoxData(final String labelTxt, final String checkBoxDescription, Property dataProperty, boolean required) { final HorizontalLayout horizontalLayout = new HorizontalLayout(); horizontalLayout.setSizeUndefined(); horizontalLayout.setDescription(USER_DESCR_ON_HOR_LAYOUT_TO_EDIT); horizontalLayout.setEnabled(true);//from w ww .j a v a 2 s. c om horizontalLayout.setSpacing(true); horizontalLayout.setHeight(HOR_PANEL_HEIGHT); horizontalLayout.setStyleName(STYLE_ELABS_HOR_PANEL); Label label = new Label(); label.setWidth(LABEL_WIDTH); label.setValue(DIV_ALIGN_RIGHT + (required ? ELabsViewContants.REQUIRED_SIGN : "") + labelTxt + DIV_END); label.setContentMode(Label.CONTENT_XHTML); label.setDescription(USER_DESCR_ON_LABEL_TO_EDIT); final CheckBox checkBox = new CheckBox(checkBoxDescription, dataProperty); checkBox.setEnabled(true); checkBox.setVisible(true); checkBox.setWidth(TEXT_WIDTH); checkBox.setStyleName(STYLE_ELABS_TEXT_AS_LABEL); checkBox.setDescription(USER_DESCR_ON_LABEL_TO_EDIT); horizontalLayout.addComponent(label, 0); horizontalLayout.addComponent(checkBox, 1); horizontalLayout.setComponentAlignment(label, Alignment.MIDDLE_LEFT); horizontalLayout.setComponentAlignment(checkBox, Alignment.MIDDLE_RIGHT); return horizontalLayout; }
From source file:org.escidoc.browser.elabsmodul.views.helpers.LabsRigTableHelper.java
License:Open Source License
public VerticalLayout createTableLayoutForRig(final RigBean rigBean, final IRigAction controller) { Preconditions.checkNotNull(rigBean, "rigModel is null"); final int RIG_TABLE_SIZE = 5; this.rigBean = rigBean; final Label selectedLabel = new Label("No selection"); final VerticalLayout layout = new VerticalLayout(); layout.setSizeUndefined();/*w w w . j av a2 s . c o m*/ this.rigTable = new Table(); this.rigTable.setSelectable(true); this.rigTable.setMultiSelect(true); this.rigTable.setMultiSelectMode(MultiSelectMode.DEFAULT); this.rigTable.setImmediate(true); this.rigTable.setPageLength(RIG_TABLE_SIZE); this.rigTable.setWidth("350px"); this.rigTable.setColumnReorderingAllowed(false); this.rigTable.setColumnCollapsingAllowed(false); this.rigTable.setRowHeaderMode(Table.ROW_HEADER_MODE_HIDDEN); this.rigTable.setContainerDataSource(fillRigTableData(rigBean.getContentList())); this.rigTable.setColumnHeaders(new String[] { "Name", "Id" }); // put // these // into // ELabsViewContants this.rigTable.addListener(new Table.ValueChangeListener() { private static final long serialVersionUID = 2000562132182698589L; @Override public void valueChange(final ValueChangeEvent event) { int selSize = 0; Set<?> values = null; try { values = (Set<?>) event.getProperty().getValue(); } catch (ClassCastException e) { LOG.warn("Table should be multiselectable!", e.getMessage()); } if (values == null || values.size() == 0) { selectedLabel.setValue("No selection"); } else { selSize = values.size(); selectedLabel.setValue("Selected: " + selSize + " element" + ((selSize > 1) ? "s" : "")); } if (selSize == 0) { rigDeleteButton.setEnabled(false); } else if (selSize == 1) { rigDeleteButton.setEnabled(true); rigDeleteButton.setCaption(DELETE_BUTTON_TEXT); } else { rigDeleteButton.setEnabled(true); rigDeleteButton.setCaption(DELETES_BUTTON_TEXT); } } }); layout.addComponent(this.rigTable); layout.addComponent(selectedLabel); addRigButtonToLayout(layout, controller); return layout; }
From source file:org.escidoc.browser.elabsmodul.views.helpers.LabsStudyTableHelper.java
License:Open Source License
public VerticalLayout createTableLayoutForMotPublications() { final int RIG_TABLE_SIZE = 4; final Label selectedLabel = new Label("No selection"); final VerticalLayout layout = new VerticalLayout(); layout.setSizeUndefined();//from w w w . j ava2 s . co m motPubTable = new Table(); motPubTable.setSelectable(true); motPubTable.setMultiSelect(true); motPubTable.setMultiSelectMode(MultiSelectMode.DEFAULT); motPubTable.setImmediate(true); motPubTable.setPageLength(RIG_TABLE_SIZE); motPubTable.setWidth("450px"); motPubTable.setColumnReorderingAllowed(false); motPubTable.setColumnCollapsingAllowed(false); motPubTable.setRowHeaderMode(Table.ROW_HEADER_MODE_ICON_ONLY); motPubTable.setContainerDataSource(fillMotPubTableData()); motPubTable.setColumnHeaders(new String[] { "Url" }); motPubTable.addListener(new Table.ValueChangeListener() { private static final long serialVersionUID = 2000562132182698589L; @Override public void valueChange(final ValueChangeEvent event) { int selSize = 0; Set<?> values = null; try { values = (Set<?>) event.getProperty().getValue(); } catch (ClassCastException e) { LOG.warn("Table should be multiselectable!", e.getMessage()); } if (values == null || values.size() == 0) { selectedLabel.setValue("No selection"); } else { selSize = values.size(); selectedLabel.setValue("Selected: " + selSize + " document" + ((selSize > 1) ? "s" : "")); } if (selSize == 0) { motPubDeleteButton.setEnabled(false); } else if (selSize == 1) { motPubDeleteButton.setEnabled(true); motPubDeleteButton.setCaption(DELETE_BUTTON_TEXT); } else { motPubDeleteButton.setEnabled(true); motPubDeleteButton.setCaption(DELETES_BUTTON_TEXT); } } }); layout.addComponent(motPubTable); layout.addComponent(selectedLabel); addMotPubButtonsToLayout(layout); return layout; }
From source file:org.escidoc.browser.elabsmodul.views.helpers.LabsStudyTableHelper.java
License:Open Source License
public VerticalLayout createTableLayoutForResPublications() { final int RIG_TABLE_SIZE = 4; final Label selectedLabel = new Label("No selection"); final VerticalLayout layout = new VerticalLayout(); layout.setSizeUndefined();// w w w .ja v a 2 s . c o m resPubTable = new Table(); resPubTable.setSelectable(true); resPubTable.setMultiSelect(true); resPubTable.setMultiSelectMode(MultiSelectMode.DEFAULT); resPubTable.setImmediate(true); resPubTable.setPageLength(RIG_TABLE_SIZE); resPubTable.setWidth("450px"); resPubTable.setColumnReorderingAllowed(false); resPubTable.setColumnCollapsingAllowed(false); resPubTable.setRowHeaderMode(Table.ROW_HEADER_MODE_ICON_ONLY); resPubTable.setContainerDataSource(fillResPubTableData()); resPubTable.setColumnHeaders(new String[] { "Url" }); resPubTable.addListener(new Table.ValueChangeListener() { private static final long serialVersionUID = 2000562132182698589L; @Override public void valueChange(final ValueChangeEvent event) { int selSize = 0; Set<?> values = null; try { values = (Set<?>) event.getProperty().getValue(); } catch (ClassCastException e) { LOG.warn("Table should be multiselectable!", e.getMessage()); } if (values == null || values.size() == 0) { selectedLabel.setValue("No selection"); } else { selSize = values.size(); selectedLabel.setValue("Selected: " + selSize + " document" + ((selSize > 1) ? "s" : "")); } if (selSize == 0) { resPubDeleteButton.setEnabled(false); } else if (selSize == 1) { resPubDeleteButton.setEnabled(true); resPubDeleteButton.setCaption(DELETE_BUTTON_TEXT); } else { resPubDeleteButton.setEnabled(true); resPubDeleteButton.setCaption(DELETES_BUTTON_TEXT); } } }); layout.addComponent(resPubTable); layout.addComponent(selectedLabel); addResPubButtonsToLayout(layout); return layout; }
From source file:org.ikasan.dashboard.ui.topology.window.CategorisedErrorOccurrenceViewWindow.java
License:BSD License
protected Panel createErrorOccurrenceDetailsPanel() { Panel errorOccurrenceDetailsPanel = new Panel(); GridLayout layout = new GridLayout(4, 7); layout.setWidth("100%"); layout.setSpacing(true);/*from ww w .j av a 2 s . c om*/ layout.setColumnExpandRatio(0, .10f); layout.setColumnExpandRatio(1, .30f); layout.setColumnExpandRatio(2, .05f); layout.setColumnExpandRatio(3, .30f); Label errorOccurrenceDetailsLabel = new Label(" Categorised Error Occurence Details", ContentMode.HTML); Label errorCategoryLabel = new Label(); if (categorisedErrorOccurrence.getErrorCategorisation().getErrorCategory() .equals(ErrorCategorisation.BLOCKER)) { errorOccurrenceDetailsLabel = new Label( VaadinIcons.BAN.getHtml() + " Categorised Error Occurence Details", ContentMode.HTML); errorCategoryLabel = new Label(VaadinIcons.BAN.getHtml() + " Blocker", ContentMode.HTML); } else if (categorisedErrorOccurrence.getErrorCategorisation().getErrorCategory() .equals(ErrorCategorisation.CRITICAL)) { errorOccurrenceDetailsLabel = new Label( VaadinIcons.EXCLAMATION.getHtml() + " Categorised Error Occurence Details", ContentMode.HTML); errorCategoryLabel = new Label(VaadinIcons.EXCLAMATION.getHtml() + " Critical", ContentMode.HTML); } else if (categorisedErrorOccurrence.getErrorCategorisation().getErrorCategory() .equals(ErrorCategorisation.MAJOR)) { errorOccurrenceDetailsLabel = new Label( VaadinIcons.ARROW_UP.getHtml() + " Categorised Error Occurence Details", ContentMode.HTML); errorCategoryLabel = new Label(VaadinIcons.ARROW_UP.getHtml() + " Major", ContentMode.HTML); } else if (categorisedErrorOccurrence.getErrorCategorisation().getErrorCategory() .equals(ErrorCategorisation.TRIVIAL)) { errorOccurrenceDetailsLabel = new Label( VaadinIcons.ARROW_DOWN.getHtml() + " Categorised Error Occurence Details", ContentMode.HTML); errorCategoryLabel = new Label(VaadinIcons.ARROW_DOWN.getHtml() + " Trivial", ContentMode.HTML); } errorOccurrenceDetailsLabel.setStyleName(ValoTheme.LABEL_HUGE); layout.addComponent(errorOccurrenceDetailsLabel, 0, 0, 3, 0); Label label = new Label("Module Name:"); label.setSizeUndefined(); layout.addComponent(label, 0, 1); layout.setComponentAlignment(label, Alignment.MIDDLE_RIGHT); TextField tf1 = new TextField(); tf1.setValue(this.categorisedErrorOccurrence.getErrorOccurrence().getModuleName()); tf1.setReadOnly(true); tf1.setWidth("80%"); layout.addComponent(tf1, 1, 1); label = new Label("Flow Name:"); label.setSizeUndefined(); layout.addComponent(label, 0, 2); layout.setComponentAlignment(label, Alignment.MIDDLE_RIGHT); TextField tf2 = new TextField(); tf2.setValue(this.categorisedErrorOccurrence.getErrorOccurrence().getFlowName()); tf2.setReadOnly(true); tf2.setWidth("80%"); layout.addComponent(tf2, 1, 2); label = new Label("Component Name:"); label.setSizeUndefined(); layout.addComponent(label, 0, 3); layout.setComponentAlignment(label, Alignment.MIDDLE_RIGHT); TextField tf3 = new TextField(); tf3.setValue(this.categorisedErrorOccurrence.getErrorOccurrence().getFlowElementName()); tf3.setReadOnly(true); tf3.setWidth("80%"); layout.addComponent(tf3, 1, 3); label = new Label("Date/Time:"); label.setSizeUndefined(); layout.addComponent(label, 0, 4); layout.setComponentAlignment(label, Alignment.MIDDLE_RIGHT); TextField tf4 = new TextField(); tf4.setValue(new Date(this.categorisedErrorOccurrence.getErrorOccurrence().getTimestamp()).toString()); tf4.setReadOnly(true); tf4.setWidth("80%"); layout.addComponent(tf4, 1, 4); GridLayout wrapperLayout = new GridLayout(1, 4); wrapperLayout.setMargin(true); wrapperLayout.setWidth("100%"); Label errorMessageLabel = new Label("Error Message:"); errorMessageLabel.setSizeUndefined(); layout.addComponent(errorMessageLabel, 0, 5); layout.setComponentAlignment(errorMessageLabel, Alignment.TOP_RIGHT); final TextArea errorMessageTextArea = new TextArea(); errorMessageTextArea.setWidth("650px"); errorMessageTextArea.setRows(6); errorMessageTextArea .setValue(this.categorisedErrorOccurrence.getErrorCategorisation().getErrorDescription()); layout.addComponent(errorMessageTextArea, 1, 5, 3, 5); AceEditor editor = new AceEditor(); editor.setCaption("Error Details"); editor.setValue(this.categorisedErrorOccurrence.getErrorOccurrence().getErrorDetail()); editor.setReadOnly(true); editor.setMode(AceMode.xml); editor.setTheme(AceTheme.eclipse); editor.setHeight(470, Unit.PIXELS); editor.setWidth("100%"); label = new Label("Error Category:"); label.setSizeUndefined(); layout.addComponent(label, 2, 1); layout.setComponentAlignment(label, Alignment.MIDDLE_RIGHT); layout.addComponent(errorCategoryLabel, 3, 1); layout.setComponentAlignment(errorCategoryLabel, Alignment.MIDDLE_LEFT); label = new Label("System Action:"); label.setSizeUndefined(); layout.addComponent(label, 2, 2); layout.setComponentAlignment(label, Alignment.MIDDLE_RIGHT); TextField systemAction = new TextField(); systemAction.setValue(this.categorisedErrorOccurrence.getErrorOccurrence().getAction()); systemAction.setReadOnly(true); systemAction.setWidth("80%"); layout.addComponent(systemAction, 3, 2); label = new Label("User Action:"); label.setSizeUndefined(); layout.addComponent(label, 2, 3); layout.setComponentAlignment(label, Alignment.MIDDLE_RIGHT); TextField userAction = new TextField(); userAction.setValue(""); userAction.setReadOnly(true); userAction.setWidth("80%"); layout.addComponent(userAction, 3, 3); label = new Label("User Action By:"); label.setSizeUndefined(); layout.addComponent(label, 2, 4); layout.setComponentAlignment(label, Alignment.MIDDLE_RIGHT); Label userActionBy = new Label(); userActionBy.setValue(""); userActionBy.setReadOnly(true); userActionBy.setWidth("80%"); layout.addComponent(userActionBy, 3, 4); AceEditor eventEditor = new AceEditor(); eventEditor.setCaption("Event Payload"); if (this.categorisedErrorOccurrence.getErrorOccurrence().getEvent() != null) { eventEditor .setValue(new String((byte[]) this.categorisedErrorOccurrence.getErrorOccurrence().getEvent())); } eventEditor.setReadOnly(true); eventEditor.setMode(AceMode.java); eventEditor.setTheme(AceTheme.eclipse); eventEditor.setHeight(470, Unit.PIXELS); eventEditor.setWidth("100%"); HorizontalLayout formLayout = new HorizontalLayout(); formLayout.setWidth("100%"); formLayout.setHeight(300, Unit.PIXELS); formLayout.addComponent(layout); wrapperLayout.addComponent(formLayout, 0, 0); // VerticalSplitPanel vSplitPanel = new VerticalSplitPanel(); // vSplitPanel.setWidth("100%"); // vSplitPanel.setHeight(800, Unit.PIXELS); // vSplitPanel.addStyleName(ValoTheme.SPLITPANEL_LARGE); TabSheet tabsheet = new TabSheet(); tabsheet.setSizeFull(); HorizontalLayout h1 = new HorizontalLayout(); h1.setSizeFull(); h1.setMargin(true); h1.addComponent(eventEditor); // vSplitPanel.setFirstComponent(h1); HorizontalLayout h2 = new HorizontalLayout(); h2.setSizeFull(); h2.setMargin(true); h2.addComponent(editor); // vSplitPanel.setSecondComponent(h2); tabsheet.addTab(h2, "Error Details"); tabsheet.addTab(h1, "Event Payload"); wrapperLayout.addComponent(tabsheet, 0, 1); // wrapperLayout.addComponent(vSplitPanel, 0, 1); errorOccurrenceDetailsPanel.setContent(wrapperLayout); return errorOccurrenceDetailsPanel; }
From source file:org.ikasan.dashboard.ui.topology.window.ErrorCategorisationWindow.java
License:BSD License
/** * Helper method to initialise this object. * //from ww w . j ava2 s.c o m * @param message */ protected void init() { setModal(true); setHeight("90%"); setWidth("90%"); this.existingCategorisedErrorsTable = new Table(); this.existingCategorisedErrorsTable.setWidth("100%"); this.existingCategorisedErrorsTable.setHeight(200, Unit.PIXELS); this.existingCategorisedErrorsTable.addContainerProperty("Module Name", String.class, null); this.existingCategorisedErrorsTable.setColumnExpandRatio("Module Name", .1f); this.existingCategorisedErrorsTable.addContainerProperty("Flow Name", String.class, null); this.existingCategorisedErrorsTable.setColumnExpandRatio("Flow Name", .1f); this.existingCategorisedErrorsTable.addContainerProperty("Component Name", String.class, null); this.existingCategorisedErrorsTable.setColumnExpandRatio("Component Name", .1f); this.existingCategorisedErrorsTable.addContainerProperty("Action", String.class, null); this.existingCategorisedErrorsTable.setColumnExpandRatio("Action", .1f); this.existingCategorisedErrorsTable.addContainerProperty("Error Category", Label.class, null); this.existingCategorisedErrorsTable.setColumnExpandRatio("Error Category", .1f); this.existingCategorisedErrorsTable.addContainerProperty("Error Message", String.class, null); this.existingCategorisedErrorsTable.setColumnExpandRatio("Error Message", .5f); this.existingCategorisedErrorsTable.addStyleName("wordwrap-table"); this.existingCategorisedErrorsTable.addStyleName(ValoTheme.TABLE_NO_STRIPES); this.existingCategorisedErrorsTable.setCellStyleGenerator(new Table.CellStyleGenerator() { @Override public String getStyle(Table source, Object itemId, Object propertyId) { ErrorCategorisationLink errorCategorisationLink = (ErrorCategorisationLink) itemId; if (propertyId == null) { // Styling for row if (errorCategorisationLink.getErrorCategorisation().getErrorCategory() .equals(ErrorCategorisation.TRIVIAL)) { return "ikasan-green-small"; } else if (errorCategorisationLink.getErrorCategorisation().getErrorCategory() .equals(ErrorCategorisation.MAJOR)) { return "ikasan-green-small"; } else if (errorCategorisationLink.getErrorCategorisation().getErrorCategory() .equals(ErrorCategorisation.CRITICAL)) { return "ikasan-orange-small"; } else if (errorCategorisationLink.getErrorCategorisation().getErrorCategory() .equals(ErrorCategorisation.BLOCKER)) { return "ikasan-red-small"; } } if (errorCategorisationLink.getErrorCategorisation().getErrorCategory() .equals(ErrorCategorisation.TRIVIAL)) { return "ikasan-green-small"; } else if (errorCategorisationLink.getErrorCategorisation().getErrorCategory() .equals(ErrorCategorisation.MAJOR)) { return "ikasan-green-small"; } else if (errorCategorisationLink.getErrorCategorisation().getErrorCategory() .equals(ErrorCategorisation.CRITICAL)) { return "ikasan-orange-small"; } else if (errorCategorisationLink.getErrorCategorisation().getErrorCategory() .equals(ErrorCategorisation.BLOCKER)) { return "ikasan-red-small"; } return "ikasan-small"; } }); this.existingCategorisedErrorsTable.addItemClickListener(new ItemClickEvent.ItemClickListener() { @Override public void itemClick(ItemClickEvent itemClickEvent) { logger.info("table item slected: " + (ErrorCategorisationLink) itemClickEvent.getItemId()); errorCategorisationLink = (ErrorCategorisationLink) itemClickEvent.getItemId(); errorCategorisation = errorCategorisationLink.getErrorCategorisation(); errorCategorisationItem = new BeanItem<ErrorCategorisation>(errorCategorisation); errorCategorisationLinkItem = new BeanItem<ErrorCategorisationLink>(errorCategorisationLink); moduleNameTextField .setPropertyDataSource(errorCategorisationLinkItem.getItemProperty("moduleName")); flowNameTextField.setPropertyDataSource(errorCategorisationLinkItem.getItemProperty("flowName")); componentNameTextField .setPropertyDataSource(errorCategorisationLinkItem.getItemProperty("flowElementName")); errorCategoryCombo.setPropertyDataSource(errorCategorisationItem.getItemProperty("errorCategory")); errorMessageTextArea .setPropertyDataSource(errorCategorisationItem.getItemProperty("errorDescription")); actionCombo.setPropertyDataSource(errorCategorisationLinkItem.getItemProperty("action")); exceptionClassTextField .setPropertyDataSource(errorCategorisationLinkItem.getItemProperty("exceptionClass")); errorMessageTextArea.markAsDirty(); actionCombo.markAsDirty(); errorCategoryCombo.markAsDirty(); componentNameTextField.markAsDirty(); flowNameTextField.markAsDirty(); moduleNameTextField.markAsDirty(); } }); refreshExistingCategorisedErrorsTable(); layout.setSizeFull(); layout.setSpacing(true); layout.setMargin(true); layout.setColumnExpandRatio(0, .25f); layout.setColumnExpandRatio(1, .75f); if (this.errorCategorisationLink == null) { clear(); } Label configuredResourceIdLabel = new Label("Error Categorisation"); configuredResourceIdLabel.setStyleName(ValoTheme.LABEL_HUGE); layout.addComponent(configuredResourceIdLabel, 0, 0, 1, 0); if (this.module == null && this.flow == null && this.component == null) { Label errorCategorisationHintLabel = new Label(); errorCategorisationHintLabel.setCaptionAsHtml(true); errorCategorisationHintLabel.setCaption(VaadinIcons.QUESTION_CIRCLE_O.getHtml() + " You are creating an error categorisation for server wide errors. This categorisation will be applied" + " against errors that occur server wide, that do not have a more focused error categorisation."); errorCategorisationHintLabel.addStyleName(ValoTheme.LABEL_LIGHT); errorCategorisationHintLabel.addStyleName(ValoTheme.LABEL_SMALL); layout.addComponent(errorCategorisationHintLabel, 0, 1, 1, 1); } else if (this.flow == null && this.component == null) { Label errorCategorisationHintLabel = new Label(); errorCategorisationHintLabel.setCaptionAsHtml(true); errorCategorisationHintLabel.setCaption(VaadinIcons.QUESTION_CIRCLE_O.getHtml() + " You are creating an error categorisation for module wide errors. This categorisation will be applied" + " against errors that occur within this module, that do not have a more focused error categorisation."); errorCategorisationHintLabel.addStyleName(ValoTheme.LABEL_LIGHT); errorCategorisationHintLabel.addStyleName(ValoTheme.LABEL_SMALL); layout.addComponent(errorCategorisationHintLabel, 0, 1, 1, 1); } else if (this.component == null) { Label errorCategorisationHintLabel = new Label(); errorCategorisationHintLabel.setCaptionAsHtml(true); errorCategorisationHintLabel.setCaption(VaadinIcons.QUESTION_CIRCLE_O.getHtml() + " You are creating an error categorisation for flow wide errors. This categorisation will be applied" + " against errors that occur within this flow, that do not have a more focused error categorisation."); errorCategorisationHintLabel.addStyleName(ValoTheme.LABEL_LIGHT); errorCategorisationHintLabel.addStyleName(ValoTheme.LABEL_SMALL); layout.addComponent(errorCategorisationHintLabel, 0, 1, 1, 1); } else { Label errorCategorisationHintLabel = new Label(); errorCategorisationHintLabel.setCaptionAsHtml(true); errorCategorisationHintLabel.setCaption(VaadinIcons.QUESTION_CIRCLE_O.getHtml() + " You are creating an error categorisation against a component. This is the most focused error categorisation" + " that can be applied. This categorisation will be applied against errors that occur on this component."); errorCategorisationHintLabel.addStyleName(ValoTheme.LABEL_LIGHT); errorCategorisationHintLabel.addStyleName(ValoTheme.LABEL_SMALL); layout.addComponent(errorCategorisationHintLabel, 0, 1, 1, 1); } if (this.module != null) { Label moduleNameLabel = new Label(); moduleNameLabel.setContentMode(ContentMode.HTML); moduleNameLabel.setValue(VaadinIcons.ARCHIVE.getHtml() + " Module Name:"); moduleNameLabel.setSizeUndefined(); layout.addComponent(moduleNameLabel, 0, 2); layout.setComponentAlignment(moduleNameLabel, Alignment.MIDDLE_RIGHT); moduleNameTextField.setRequired(true); moduleNameTextField.setPropertyDataSource(errorCategorisationLinkItem.getItemProperty("moduleName")); moduleNameTextField.setReadOnly(true); moduleNameTextField.setWidth("80%"); layout.addComponent(moduleNameTextField, 1, 2); } if (this.flow != null) { Label flowNameLabel = new Label(); flowNameLabel.setContentMode(ContentMode.HTML); flowNameLabel.setValue(VaadinIcons.AUTOMATION.getHtml() + " Flow Name:"); flowNameLabel.setSizeUndefined(); layout.addComponent(flowNameLabel, 0, 3); layout.setComponentAlignment(flowNameLabel, Alignment.MIDDLE_RIGHT); flowNameTextField.setRequired(true); flowNameTextField.setPropertyDataSource(errorCategorisationLinkItem.getItemProperty("flowName")); flowNameTextField.setReadOnly(true); flowNameTextField.setWidth("80%"); layout.addComponent(flowNameTextField, 1, 3); } if (this.component != null) { Label componentNameLabel = new Label(); componentNameLabel.setContentMode(ContentMode.HTML); componentNameLabel.setValue(VaadinIcons.COG.getHtml() + " Component Name:"); componentNameLabel.setSizeUndefined(); layout.addComponent(componentNameLabel, 0, 4); layout.setComponentAlignment(componentNameLabel, Alignment.MIDDLE_RIGHT); componentNameTextField.setRequired(true); componentNameTextField .setPropertyDataSource(errorCategorisationLinkItem.getItemProperty("flowElementName")); componentNameTextField.setReadOnly(true); componentNameTextField.setWidth("80%"); layout.addComponent(componentNameTextField, 1, 4); } Label exceptionClassLabel = new Label(); exceptionClassLabel.setContentMode(ContentMode.HTML); exceptionClassLabel.setValue("Exception Class:"); exceptionClassLabel.setSizeUndefined(); layout.addComponent(exceptionClassLabel, 0, 5); layout.setComponentAlignment(exceptionClassLabel, Alignment.MIDDLE_RIGHT); this.exceptionClassTextField.setWidth("80%"); exceptionClassTextField .setPropertyDataSource(errorCategorisationLinkItem.getItemProperty("exceptionClass")); layout.addComponent(exceptionClassTextField, 1, 5); Label actionLabel = new Label(); actionLabel.setContentMode(ContentMode.HTML); actionLabel.setValue("Action:"); actionLabel.setSizeUndefined(); layout.addComponent(actionLabel, 0, 6); layout.setComponentAlignment(actionLabel, Alignment.MIDDLE_RIGHT); Label errorCategoryLabel = new Label("Error Category:"); errorCategoryLabel.setSizeUndefined(); layout.addComponent(errorCategoryLabel, 0, 7); layout.setComponentAlignment(errorCategoryLabel, Alignment.MIDDLE_RIGHT); this.setupComboBoxesAndItems(); Label errorMessageLabel = new Label("Error Message:"); errorMessageLabel.setSizeUndefined(); layout.addComponent(errorMessageLabel, 0, 8); layout.setComponentAlignment(errorMessageLabel, Alignment.TOP_RIGHT); errorMessageTextArea.addValidator(new StringLengthValidator( "You must define an error message between 1 and 2048 characters in length!", 1, 2048, false)); errorMessageTextArea.setValidationVisible(false); errorMessageTextArea.setPropertyDataSource(errorCategorisationItem.getItemProperty("errorDescription")); errorMessageTextArea.setRequired(true); errorMessageTextArea.setWidth("650px"); errorMessageTextArea.setRows(8); errorMessageTextArea.setRequiredError("An error message is required!"); layout.addComponent(errorMessageTextArea, 1, 8); GridLayout buttonLayouts = new GridLayout(4, 1); buttonLayouts.setSpacing(true); Button saveButton = new Button("Save"); saveButton.setStyleName(ValoTheme.BUTTON_SMALL); saveButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { try { errorCategoryCombo.validate(); errorMessageTextArea.validate(); actionCombo.validate(); } catch (InvalidValueException e) { errorCategoryCombo.setValidationVisible(true); errorMessageTextArea.setValidationVisible(true); actionCombo.setValidationVisible(true); errorCategoryCombo.markAsDirty(); errorMessageTextArea.markAsDirty(); actionCombo.markAsDirty(); return; } try { errorCategorisationService.save(errorCategorisationItem.getBean()); errorCategorisationLink.setErrorCategorisation(errorCategorisationItem.getBean()); errorCategorisationService.save(errorCategorisationLink); } catch (Exception e) { if (e.getCause() instanceof ConstraintViolationException) { Notification.show( "An error occurred trying to save an error categorisation: Action type must be unique for a given node!", Type.ERROR_MESSAGE); } else { Notification.show( "An error occurred trying to save an error categorisation: " + e.getMessage(), Type.ERROR_MESSAGE); } } refreshExistingCategorisedErrorsTable(); Notification.show("Saved!"); } }); Button clearButton = new Button("Clear"); clearButton.setStyleName(ValoTheme.BUTTON_SMALL); clearButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { clear(); } }); Button deleteButton = new Button("Delete"); deleteButton.setStyleName(ValoTheme.BUTTON_SMALL); deleteButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { ErrorCategorisation ec = errorCategorisationLink.getErrorCategorisation(); errorCategorisationService.delete(errorCategorisationLink); errorCategorisationService.delete(ec); existingCategorisedErrorsTable.removeItem(errorCategorisationLink); clear(); } }); Button cancelButton = new Button("Cancel"); cancelButton.setStyleName(ValoTheme.BUTTON_SMALL); cancelButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { close(); } }); buttonLayouts.addComponent(saveButton); buttonLayouts.addComponent(clearButton); buttonLayouts.addComponent(deleteButton); buttonLayouts.addComponent(cancelButton); layout.addComponent(buttonLayouts, 0, 9, 1, 9); layout.setComponentAlignment(buttonLayouts, Alignment.MIDDLE_CENTER); Label existingCategorisationLabel = new Label("Existing Error Categorisations"); existingCategorisationLabel.setStyleName(ValoTheme.LABEL_HUGE); layout.addComponent(existingCategorisationLabel, 0, 10, 1, 10); Label uniquenessHintLabel = new Label(); uniquenessHintLabel.setCaptionAsHtml(true); uniquenessHintLabel.setCaption(VaadinIcons.QUESTION_CIRCLE_O.getHtml() + " You can only create one error categorisation per Action type for a give node. If you attempt to create more you will receive an error when" + " trying to save."); uniquenessHintLabel.addStyleName(ValoTheme.LABEL_LIGHT); uniquenessHintLabel.addStyleName(ValoTheme.LABEL_SMALL); layout.addComponent(uniquenessHintLabel, 0, 11, 1, 11); Label editHintLabel = new Label(); editHintLabel.setCaptionAsHtml(true); editHintLabel.setCaption(VaadinIcons.QUESTION_CIRCLE_O.getHtml() + " You can can click on a row in the table below to edit an error categorisation."); editHintLabel.addStyleName(ValoTheme.LABEL_BOLD); editHintLabel.addStyleName(ValoTheme.LABEL_SMALL); layout.addComponent(editHintLabel, 0, 12, 1, 12); layout.addComponent(this.existingCategorisedErrorsTable, 0, 13, 1, 13); layout.setComponentAlignment(this.existingCategorisedErrorsTable, Alignment.MIDDLE_CENTER); Panel paramPanel = new Panel(); paramPanel.addStyleName(ValoTheme.PANEL_BORDERLESS); paramPanel.setWidth("100%"); paramPanel.setContent(layout); GridLayout wrapper = new GridLayout(); // wrapper.setMargin(true); wrapper.setSizeFull(); wrapper.addComponent(paramPanel); this.setContent(wrapper); }