List of usage examples for com.vaadin.ui Label setContentMode
public void setContentMode(ContentMode contentMode)
From source file:org.escidoc.browser.ui.tools.BulkTasksView.java
License:Open Source License
private void addHeader() { final Label text = new H2(ViewConstants.FILTERING_RESOURCES_TITLE); text.setContentMode(Label.CONTENT_XHTML); addComponent(text);//from w w w . java 2 s . co m }
From source file:org.escidoc.browser.ui.tools.ImportView.java
License:Open Source License
private void addHeader() { final Label text = new H2(ViewConstants.IMPORT_CONTENT_MODEL); text.setContentMode(Label.CONTENT_XHTML); addComponent(text);//w w w. j a v a2 s. c o m }
From source file:org.escidoc.browser.ui.tools.LoadExampleView.java
License:Open Source License
private void init() { setCompositionRoot(cssLayout);/*w w w. jav a 2s . c om*/ cssLayout.setMargin(true); Label text = new H2(ViewConstants.LOAD_EXAMPLE); text.setContentMode(Label.CONTENT_XHTML); cssLayout.addComponent(text); cssLayout.addComponent(new Ruler()); text = new Label(ViewConstants.LOAD_EXAMPLE_TEXT, Label.CONTENT_XHTML); cssLayout.addComponent(text); final HorizontalLayout hLayout = new HorizontalLayout(); hLayout.setWidth(100, UNITS_PERCENTAGE); hLayout.setHeight(100, UNITS_PERCENTAGE); loadExampleButton.setWidth(150, UNITS_PIXELS); loadExampleButton.addListener(new ClickListener() { @Override public void buttonClick(@SuppressWarnings("unused") ClickEvent event) { try { List<Entry> loadedExamples = adminRepository.loadCommonExamples(); for (Entry entry : loadedExamples) { cssLayout.addComponent(new Label(entry.getMessage())); } } catch (EscidocClientException e) { String msg = "Internal Server Error while loading example set." + e.getMessage(); LOG.error(msg); router.getMainWindow().showNotification("Error at LoadExampleView ", msg, Window.Notification.TYPE_ERROR_MESSAGE); } } }); hLayout.addComponent(loadExampleButton); cssLayout.addComponent(hLayout); }
From source file:org.escidoc.browser.ui.tools.ReindexView.java
License:Open Source License
private void addHeader() { final Label text = new H2(ViewConstants.REINDEX); text.setContentMode(Label.CONTENT_XHTML); addComponent(text);// ww w.j a va2 s . c o m }
From source file:org.escidoc.browser.ui.tools.RepositoryInfoView.java
License:Open Source License
private void addHeader() { final Label text = new H2(ViewConstants.REPOSITORY_INFORMATION); text.setContentMode(Label.CONTENT_XHTML); addComponent(text);/*from w w w . j a va 2 s .com*/ }
From source file:org.freakz.hokan_ng_springboot.bot.views.HomeView.java
License:Apache License
public HomeView() { setSpacing(true);//from w w w . ja v a2 s. co m setMargin(true); Label header = new Label("Welcome to the Vaadin Managed Security Demo!"); header.addStyleName(ValoTheme.LABEL_H1); addComponent(header); Label body = new Label( "<p>This application demonstrate how a Vaadin application can take care of security itself while still integrating with Spring Security.</p>" + "<p>Please try it out by clicking and navigating around as different users. You can log in as <em>user/user</em> or <em>admin/admin</em>. Some of the protected " + "features are hidden from the UI when you cannot access them, others are visible all the time.</p>" + "<p>Also note that since we are using web socket based push, we do not have access to cookies and therefore cannot use Remember Me services.</p>"); body.setContentMode(ContentMode.HTML); addComponent(body); }
From source file:org.iespuigcastellar.attendancemanager.screenlayouts.logininfo.BlackHawkLoginInfoLayout.java
License:Open Source License
public void attach() { HorizontalLayout hlayout = new HorizontalLayout(); hlayout.setSpacing(true);// w w w.j a v a 2 s.co m Embedded item = new Embedded("", new ClassResource("screenlayouts/logininfo/black_hawk.jpg", getApplication())); hlayout.addComponent(item); hlayout.setComponentAlignment(item, Alignment.MIDDLE_CENTER); Label haikuText = new Label( "<p>\"Lnea de gansos en vuelo;<br> al pie de la colina,<br> la luna puesta por sello\"</p>" + "<p>\"Iba yo a los cerezos en flor<br> Dorma bajo ellos<br> As era mi pasatiempo\"</p>" + "<p>\"La lluvia en invierno<br> Muestra lo que los ojos ven<br> Como si fuera cosa antigua\"</p>" + "<p>Yosa Buson</p>"); haikuText.setContentMode(Label.CONTENT_XHTML); hlayout.addComponent(haikuText); addComponent(hlayout); }
From source file:org.ikasan.dashboard.ui.topology.window.ErrorCategorisationWindow.java
License:BSD License
/** * Helper method to initialise this object. * //ww w. ja v a2 s . co 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); }
From source file:org.ikasan.dashboard.ui.topology.window.StartupControlConfigurationWindow.java
License:BSD License
/** * Helper method to initialise this object. * /* w w w . j a v a 2 s .co m*/ * @param message */ protected void init() { setModal(true); setResizable(false); setHeight("320px"); setWidth("550px"); GridLayout gridLayout = new GridLayout(2, 6); gridLayout.setWidth("500px"); gridLayout.setColumnExpandRatio(0, .15f); gridLayout.setColumnExpandRatio(1, .85f); gridLayout.setSpacing(true); gridLayout.setMargin(true); Label startupControlLabel = new Label("Startup Control"); startupControlLabel.addStyleName(ValoTheme.LABEL_HUGE); gridLayout.addComponent(startupControlLabel, 0, 0, 1, 0); Label moduleNameLabel = new Label(); moduleNameLabel.setContentMode(ContentMode.HTML); moduleNameLabel.setValue(VaadinIcons.ARCHIVE.getHtml() + " Module Name:"); moduleNameLabel.setSizeUndefined(); gridLayout.addComponent(moduleNameLabel, 0, 1); gridLayout.setComponentAlignment(moduleNameLabel, Alignment.MIDDLE_RIGHT); startupControl = this.startupControlService.getStartupControl(flow.getModule().getName(), flow.getName()); startupControlItem = new BeanItem<StartupControl>(startupControl); moduleNameTextField = new TextField(); moduleNameTextField.setRequired(true); moduleNameTextField.setPropertyDataSource(startupControlItem.getItemProperty("moduleName")); moduleNameTextField.setReadOnly(true); moduleNameTextField.setWidth("90%"); gridLayout.addComponent(moduleNameTextField, 1, 1); Label flowNameLabel = new Label(); flowNameLabel.setContentMode(ContentMode.HTML); flowNameLabel.setValue(VaadinIcons.AUTOMATION.getHtml() + " Flow Name:"); flowNameLabel.setSizeUndefined(); gridLayout.addComponent(flowNameLabel, 0, 2); gridLayout.setComponentAlignment(flowNameLabel, Alignment.MIDDLE_RIGHT); flowNameTextField = new TextField(); flowNameTextField.setRequired(true); flowNameTextField.setPropertyDataSource(startupControlItem.getItemProperty("flowName")); flowNameTextField.setReadOnly(true); flowNameTextField.setWidth("90%"); gridLayout.addComponent(flowNameTextField, 1, 2); Label startupTypeLabel = new Label("Startup Type:"); startupTypeLabel.setSizeUndefined(); this.startupType = new ComboBox(); this.startupType.addItem(StartupType.MANUAL); this.startupType.setItemCaption(StartupType.MANUAL, "Manual"); this.startupType.addItem(StartupType.AUTOMATIC); this.startupType.setItemCaption(StartupType.AUTOMATIC, "Automatic"); this.startupType.addItem(StartupType.DISABLED); this.startupType.setItemCaption(StartupType.DISABLED, "Disabled"); this.startupType.setPropertyDataSource(startupControlItem.getItemProperty("startupType")); this.startupType.setNullSelectionAllowed(false); this.startupType.addValidator(new StringLengthValidator("A name must be entered.", 1, null, false)); this.startupType.setWidth("90%"); this.startupType.setValidationVisible(false); gridLayout.addComponent(startupTypeLabel, 0, 3); gridLayout.setComponentAlignment(startupTypeLabel, Alignment.MIDDLE_RIGHT); gridLayout.addComponent(this.startupType, 1, 3); Label commentLabel = new Label("Comment:"); commentLabel.setSizeUndefined(); this.comment = new TextArea(); this.comment.setRows(3); this.comment.addValidator(new StringLengthValidator("A name must be entered.", 1, null, false)); this.comment.setWidth("90%"); this.comment.setValidationVisible(false); this.comment.setNullRepresentation(""); this.comment.setPropertyDataSource(startupControlItem.getItemProperty("comment")); gridLayout.addComponent(commentLabel, 0, 4); gridLayout.setComponentAlignment(commentLabel, Alignment.MIDDLE_RIGHT); gridLayout.addComponent(this.comment, 1, 4); Button saveButton = new Button("Save"); Button cancelButton = new Button("Cancel"); GridLayout buttonLayout = new GridLayout(2, 1); buttonLayout.setSpacing(true); buttonLayout.addComponent(saveButton); buttonLayout.setComponentAlignment(saveButton, Alignment.MIDDLE_CENTER); buttonLayout.addComponent(cancelButton); buttonLayout.setComponentAlignment(cancelButton, Alignment.MIDDLE_CENTER); gridLayout.addComponent(buttonLayout, 0, 5, 1, 5); gridLayout.setComponentAlignment(buttonLayout, Alignment.MIDDLE_CENTER); saveButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { StartupControl sc = startupControlItem.getBean(); if (((StartupType) startupType.getValue()) == StartupType.DISABLED && (comment.getValue() == null || comment.getValue().length() == 0)) { Notification.show("A comment must be entered for a 'Disabled' start up type!", Type.ERROR_MESSAGE); return; } else { final IkasanAuthentication authentication = (IkasanAuthentication) VaadinService .getCurrentRequest().getWrappedSession() .getAttribute(DashboardSessionValueConstants.USER); StartupControlConfigurationWindow.this.startupControlService.setStartupType(sc.getModuleName(), sc.getFlowName(), (StartupType) startupType.getValue(), comment.getValue(), authentication.getName()); Notification.show("Saved!"); } } }); cancelButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { UI.getCurrent().removeWindow(StartupControlConfigurationWindow.this); } }); this.setContent(gridLayout); }
From source file:org.ikasan.dashboard.ui.topology.window.WiretapConfigurationWindow.java
License:BSD License
/** * Helper method to initialise this object. * //from w w w . j a va 2 s . co m * @param message */ protected void init() { setModal(true); setHeight("90%"); setWidth("90%"); GridLayout layout = new GridLayout(2, 10); layout.setSizeFull(); layout.setSpacing(true); layout.setMargin(true); layout.setColumnExpandRatio(0, .25f); layout.setColumnExpandRatio(1, .75f); Label wiretapLabel = new Label("Wiretap Configuration"); wiretapLabel.setStyleName(ValoTheme.LABEL_HUGE); layout.addComponent(wiretapLabel); Label moduleNameLabel = new Label(); moduleNameLabel.setContentMode(ContentMode.HTML); moduleNameLabel.setValue(VaadinIcons.ARCHIVE.getHtml() + " Module Name:"); moduleNameLabel.setSizeUndefined(); layout.addComponent(moduleNameLabel, 0, 1); layout.setComponentAlignment(moduleNameLabel, Alignment.MIDDLE_RIGHT); TextField moduleNameTextField = new TextField(); moduleNameTextField.setRequired(true); moduleNameTextField.setValue(this.component.getFlow().getModule().getName()); moduleNameTextField.setReadOnly(true); moduleNameTextField.setWidth("80%"); layout.addComponent(moduleNameTextField, 1, 1); Label flowNameLabel = new Label(); flowNameLabel.setContentMode(ContentMode.HTML); flowNameLabel.setValue(VaadinIcons.AUTOMATION.getHtml() + " Flow Name:"); flowNameLabel.setSizeUndefined(); layout.addComponent(flowNameLabel, 0, 2); layout.setComponentAlignment(flowNameLabel, Alignment.MIDDLE_RIGHT); TextField flowNameTextField = new TextField(); flowNameTextField.setRequired(true); flowNameTextField.setValue(this.component.getFlow().getName()); flowNameTextField.setReadOnly(true); flowNameTextField.setWidth("80%"); layout.addComponent(flowNameTextField, 1, 2); Label componentNameLabel = new Label(); componentNameLabel.setContentMode(ContentMode.HTML); componentNameLabel.setValue(VaadinIcons.COG.getHtml() + " Component Name:"); componentNameLabel.setSizeUndefined(); layout.addComponent(componentNameLabel, 0, 3); layout.setComponentAlignment(componentNameLabel, Alignment.MIDDLE_RIGHT); TextField componentNameTextField = new TextField(); componentNameTextField.setRequired(true); componentNameTextField.setValue(this.component.getName()); componentNameTextField.setReadOnly(true); componentNameTextField.setWidth("80%"); layout.addComponent(componentNameTextField, 1, 3); Label errorCategoryLabel = new Label("Relationship:"); errorCategoryLabel.setSizeUndefined(); layout.addComponent(errorCategoryLabel, 0, 4); layout.setComponentAlignment(errorCategoryLabel, Alignment.MIDDLE_RIGHT); final ComboBox relationshipCombo = new ComboBox(); // relationshipCombo.addValidator(new StringLengthValidator( // "An relationship must be selected!", 1, -1, false)); relationshipCombo.setImmediate(false); relationshipCombo.setValidationVisible(false); relationshipCombo.setRequired(true); relationshipCombo.setRequiredError("A relationship must be selected!"); relationshipCombo.setHeight("30px"); relationshipCombo.setNullSelectionAllowed(false); layout.addComponent(relationshipCombo, 1, 4); relationshipCombo.addItem("before"); relationshipCombo.setItemCaption("before", "Before"); relationshipCombo.addItem("after"); relationshipCombo.setItemCaption("after", "After"); Label jobTypeLabel = new Label("Job Type:"); jobTypeLabel.setSizeUndefined(); layout.addComponent(jobTypeLabel, 0, 5); layout.setComponentAlignment(jobTypeLabel, Alignment.MIDDLE_RIGHT); final ComboBox jobTopCombo = new ComboBox(); // jobTopCombo.addValidator(new StringLengthValidator( // "A job type must be selected!", 1, -1, false)); jobTopCombo.setImmediate(false); jobTopCombo.setValidationVisible(false); jobTopCombo.setRequired(true); jobTopCombo.setRequiredError("A job type must be selected!"); jobTopCombo.setHeight("30px"); jobTopCombo.setNullSelectionAllowed(false); layout.addComponent(jobTopCombo, 1, 5); jobTopCombo.addItem("loggingJob"); jobTopCombo.setItemCaption("loggingJob", "Logging Job"); jobTopCombo.addItem("wiretapJob"); jobTopCombo.setItemCaption("wiretapJob", "Wiretap Job"); final Label timeToLiveLabel = new Label("Time to Live:"); timeToLiveLabel.setSizeUndefined(); timeToLiveLabel.setVisible(false); layout.addComponent(timeToLiveLabel, 0, 6); layout.setComponentAlignment(timeToLiveLabel, Alignment.MIDDLE_RIGHT); final TextField timeToLiveTextField = new TextField(); timeToLiveTextField.setRequired(true); timeToLiveTextField.setValidationVisible(false); jobTopCombo.setRequiredError("A time to live value must be entered!"); timeToLiveTextField.setVisible(false); timeToLiveTextField.setWidth("40%"); layout.addComponent(timeToLiveTextField, 1, 6); jobTopCombo.addValueChangeListener(new ComboBox.ValueChangeListener() { /* (non-Javadoc) * @see com.vaadin.data.Property.ValueChangeListener#valueChange(com.vaadin.data.Property.ValueChangeEvent) */ @Override public void valueChange(ValueChangeEvent event) { String value = (String) event.getProperty().getValue(); if (value.equals("wiretapJob")) { timeToLiveLabel.setVisible(true); timeToLiveTextField.setVisible(true); } else { timeToLiveLabel.setVisible(false); timeToLiveTextField.setVisible(false); } } }); GridLayout buttonLayouts = new GridLayout(3, 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 { relationshipCombo.validate(); jobTopCombo.validate(); if (timeToLiveTextField.isVisible()) { timeToLiveTextField.validate(); } } catch (InvalidValueException e) { relationshipCombo.setValidationVisible(true); relationshipCombo.markAsDirty(); jobTopCombo.setValidationVisible(true); jobTopCombo.markAsDirty(); if (timeToLiveTextField.isVisible()) { timeToLiveTextField.setValidationVisible(true); timeToLiveTextField.markAsDirty(); } Notification.show("There are errors on the wiretap creation form!", Type.ERROR_MESSAGE); return; } createWiretap((String) relationshipCombo.getValue(), (String) jobTopCombo.getValue(), timeToLiveTextField.getValue()); } }); 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(cancelButton); layout.addComponent(buttonLayouts, 0, 7, 1, 7); layout.setComponentAlignment(buttonLayouts, Alignment.MIDDLE_CENTER); Panel paramPanel = new Panel(); paramPanel.setStyleName("dashboard"); paramPanel.setWidth("100%"); paramPanel.setContent(layout); triggerTable = new Table(); Label existingWiretapLabel = new Label("Existing Wiretaps"); existingWiretapLabel.setStyleName(ValoTheme.LABEL_HUGE); layout.addComponent(existingWiretapLabel, 0, 8, 1, 8); layout.addComponent(triggerTable, 0, 9, 1, 9); layout.setComponentAlignment(triggerTable, Alignment.TOP_CENTER); this.triggerTable.setWidth("80%"); this.triggerTable.setHeight(150, Unit.PIXELS); this.triggerTable.setCellStyleGenerator(new IkasanCellStyleGenerator()); this.triggerTable.addStyleName(ValoTheme.TABLE_SMALL); this.triggerTable.addStyleName("ikasan"); this.triggerTable.addContainerProperty("Job Type", String.class, null); this.triggerTable.addContainerProperty("Relationship", String.class, null); this.triggerTable.addContainerProperty("Trigger Parameters", String.class, null); this.triggerTable.addContainerProperty("", Button.class, null); refreshTriggerTable(); GridLayout wrapper = new GridLayout(1, 1); wrapper.setMargin(true); wrapper.setSizeFull(); wrapper.addComponent(paramPanel); this.setContent(wrapper); }