List of usage examples for com.vaadin.ui Panel setStyleName
@Override public void setStyleName(String style)
From source file:org.ikasan.dashboard.ui.topology.window.WiretapConfigurationWindow.java
License:BSD License
/** * Helper method to initialise this object. * /*from www. j a v a 2s . c om*/ * @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); }
From source file:org.ikasan.dashboard.ui.topology.window.WiretapPayloadViewWindow.java
License:BSD License
protected Panel createWiretapDetailsPanel() { Panel errorOccurrenceDetailsPanel = new Panel(); errorOccurrenceDetailsPanel.setSizeFull(); errorOccurrenceDetailsPanel.setStyleName("dashboard"); GridLayout layout = new GridLayout(2, 6); layout.setSizeFull();//from ww w . j a va 2s . c om layout.setSpacing(true); layout.setColumnExpandRatio(0, 0.2f); layout.setColumnExpandRatio(1, 0.8f); Label wiretapDetailsLabel = new Label("Wiretap Details"); wiretapDetailsLabel.setStyleName(ValoTheme.LABEL_HUGE); layout.addComponent(wiretapDetailsLabel); Label moduleNameLabel = new Label("Module Name:"); moduleNameLabel.setSizeUndefined(); layout.addComponent(moduleNameLabel, 0, 1); layout.setComponentAlignment(moduleNameLabel, Alignment.MIDDLE_RIGHT); TextField moduleName = new TextField(); moduleName.setValue(this.wiretapEvent.getModuleName()); moduleName.setReadOnly(true); moduleName.setWidth("80%"); layout.addComponent(moduleName, 1, 1); Label flowNameLabel = new Label("Flow Name:"); flowNameLabel.setSizeUndefined(); layout.addComponent(flowNameLabel, 0, 2); layout.setComponentAlignment(flowNameLabel, Alignment.MIDDLE_RIGHT); TextField tf2 = new TextField(); tf2.setValue(this.wiretapEvent.getFlowName()); tf2.setReadOnly(true); tf2.setWidth("80%"); layout.addComponent(tf2, 1, 2); Label componentNameLabel = new Label("Component Name:"); componentNameLabel.setSizeUndefined(); layout.addComponent(componentNameLabel, 0, 3); layout.setComponentAlignment(componentNameLabel, Alignment.MIDDLE_RIGHT); TextField tf3 = new TextField(); tf3.setValue(this.wiretapEvent.getComponentName()); tf3.setReadOnly(true); tf3.setWidth("80%"); layout.addComponent(tf3, 1, 3); Label dateTimeLabel = new Label("Date/Time:"); dateTimeLabel.setSizeUndefined(); layout.addComponent(dateTimeLabel, 0, 4); layout.setComponentAlignment(dateTimeLabel, Alignment.MIDDLE_RIGHT); TextField tf4 = new TextField(); tf4.setValue(new Date(this.wiretapEvent.getTimestamp()).toString()); tf4.setReadOnly(true); tf4.setWidth("80%"); layout.addComponent(tf4, 1, 4); Label eventIdLabel = new Label("Event Id:"); eventIdLabel.setSizeUndefined(); layout.addComponent(eventIdLabel, 0, 5); layout.setComponentAlignment(eventIdLabel, Alignment.MIDDLE_RIGHT); TextField tf5 = new TextField(); tf5.setValue(((WiretapFlowEvent) wiretapEvent).getEventId()); tf5.setReadOnly(true); tf5.setWidth("80%"); layout.addComponent(tf5, 1, 5); GridLayout wrapperLayout = new GridLayout(1, 4); wrapperLayout.setWidth("100%"); // wrapperLayout.setMargin(true); // wrapperLayout.setSizeFull(); AceEditor editor = new AceEditor(); editor.setCaption("Event"); editor.setValue(this.wiretapEvent.getEvent()); editor.setReadOnly(true); editor.setMode(AceMode.xml); editor.setTheme(AceTheme.eclipse); editor.setWidth("100%"); editor.setHeight(550, Unit.PIXELS); // HorizontalLayout formLayout = new HorizontalLayout(); // formLayout.setWidth("100%"); // formLayout.setHeight(120, Unit.PIXELS); // formLayout.addComponent(layout); wrapperLayout.addComponent(layout, 0, 0); wrapperLayout.addComponent(editor, 0, 2); wrapperLayout.setComponentAlignment(editor, Alignment.TOP_LEFT); errorOccurrenceDetailsPanel.setContent(wrapperLayout); return errorOccurrenceDetailsPanel; }
From source file:org.openeos.services.ui.vaadin.internal.abstractform.AbstractFormVaadinTabImpl.java
License:Apache License
@Override protected void showEdit() { if (getActiveObject() == null) { List<UIBean> selectedObjects = getSelectedObjectsInList(); if (selectedObjects.size() > 0) { this.setActiveObject(selectedObjects.get(0)); } else {/*w w w. j a v a2s .c o m*/ //TODO i18n getMainContainer().getWindow().showNotification("Select an intem", "Please select an item to edit", Notification.TYPE_HUMANIZED_MESSAGE); showView(View.LIST); return; } } Panel panel = new Panel(); panel.setSizeFull(); panel.setStyleName("background-default"); getMainContainer().addComponent(panel); if (getActiveObject().isNew()) { newForm.setValue(getActiveObject()); panel.addComponent(newForm.getImplementation()); } else { editForm.setValue(getActiveObject()); editForm.getBindingContext().updateFields(); panel.addComponent(editForm.getImplementation()); } modified = false; }
From source file:org.openeos.usertask.ui.internal.vaadin.TasksWindow.java
License:Apache License
private void displayTask(UserTask task) { Panel mainPanel = new Panel(); mainPanel.setStyleName("background-default"); VerticalLayout layout = new VerticalLayout(); layout.setMargin(true);/*w w w . java 2 s. c om*/ layout.setSpacing(true); layout.setWidth(100f, VerticalLayout.UNITS_PERCENTAGE); mainPanel.setContent(layout); mainPanel.setSizeFull(); mainPanel.addComponent(createTaskTitle(task)); mainPanel.addComponent(createTaskSummary(task)); Component customComponent = createCustomComponent(task); if (customComponent != null) { mainPanel.addComponent(customComponent); } mainSplitPanel.setSecondComponent(mainPanel); }
From source file:org.openeos.usertask.ui.internal.vaadin.TasksWindow.java
License:Apache License
private Component createTaskSummary(UserTask task) { // TextField name = new TextField("Name"); // name.setValue(task.getName()); // name.setReadOnly(true); // name.setWidth("100%"); TextField priority = new TextField("Priority"); priority.setValue(Integer.toString(task.getPriority())); priority.setReadOnly(true);/*from w w w . ja v a2 s . c om*/ TextField status = new TextField("Status"); status.setValue(task.getStatus().getDescription()); status.setReadOnly(true); TextArea description = new TextArea("Description"); description.setSizeFull(); description.setValue(task.getDescription()); description.setReadOnly(true); description.setRows(3); ComponentContainer buttons = createSummaryButtons(task); VerticalLayout secondColumnFields = new VerticalLayout(); secondColumnFields.setMargin(false); secondColumnFields.setSizeFull(); secondColumnFields.addComponent(priority); secondColumnFields.addComponent(status); HorizontalLayout fieldsLayout = new HorizontalLayout(); fieldsLayout.setSizeFull(); fieldsLayout.setMargin(false); fieldsLayout.setSpacing(false); fieldsLayout.addComponent(description); fieldsLayout.addComponent(secondColumnFields); fieldsLayout.setExpandRatio(description, 4.0f); fieldsLayout.setExpandRatio(secondColumnFields, 1.0f); HorizontalLayout mainLayout = new HorizontalLayout(); mainLayout.setMargin(true); mainLayout.setSpacing(false); mainLayout.setSizeFull(); mainLayout.addComponent(fieldsLayout); mainLayout.addComponent(buttons); mainLayout.setComponentAlignment(buttons, Alignment.TOP_LEFT); mainLayout.setExpandRatio(fieldsLayout, 1.0f); Panel panel = new Panel("Summary"); panel.setStyleName("background-transparent"); panel.setContent(mainLayout); return panel; }
From source file:org.openeos.usertask.ui.internal.vaadin.TasksWindow.java
License:Apache License
private void displayEmptyTask() { Panel panel = new Panel(); panel.setSizeFull();/*w w w. j a v a2s. c o m*/ panel.setStyleName("background-default"); mainSplitPanel.setSecondComponent(panel); }
From source file:org.openeos.usertask.ui.VaadinEntityUsertaskUI.java
License:Apache License
protected Panel createPanel(String caption) { Panel panel = new Panel(caption); panel.setStyleName("background-transparent"); return panel; }
From source file:org.processbase.ui.core.template.DefaultConfirmDialogFactory.java
License:Open Source License
public ConfirmDialog create(final String caption, final String message, final String okCaption, final String cancelCaption) { // Create a confirm dialog final ConfirmDialog confirm = new ConfirmDialog(); confirm.setCaption(caption != null ? caption : DEFAULT_CAPTION); // Close listener implementation confirm.addListener(new Window.CloseListener() { private static final long serialVersionUID = 1971800928047045825L; public void windowClose(CloseEvent ce) { confirm.setConfirmed(false); if (confirm.getListener() != null) { confirm.getListener().onClose(confirm); }/*w w w . jav a 2 s . co m*/ } }); // Create content VerticalLayout c = (VerticalLayout) confirm.getContent(); c.setSizeFull(); c.setSpacing(true); // Panel for scrolling lengthty messages. Panel scroll = new Panel(new VerticalLayout()); scroll.setScrollable(true); c.addComponent(scroll); scroll.setWidth("100%"); scroll.setHeight("100%"); scroll.setStyleName(Reindeer.PANEL_LIGHT); c.setExpandRatio(scroll, 1f); // Always HTML, but escape Label text = new Label("", Label.CONTENT_RAW); scroll.addComponent(text); confirm.setMessageLabel(text); confirm.setMessage(message); HorizontalLayout buttons = new HorizontalLayout(); c.addComponent(buttons); buttons.setSpacing(true); buttons.setHeight(format(BUTTON_HEIGHT) + "em"); buttons.setWidth("100%"); Label spacer = new Label(""); buttons.addComponent(spacer); spacer.setWidth("100%"); buttons.setExpandRatio(spacer, 1f); final Button cancel = new Button(cancelCaption != null ? cancelCaption : DEFAULT_CANCEL_CAPTION); cancel.setData(false); cancel.setClickShortcut(KeyCode.ESCAPE, null); buttons.addComponent(cancel); buttons.setComponentAlignment(cancel, Alignment.MIDDLE_RIGHT); confirm.setCancelButton(cancel); final Button ok = new Button(okCaption != null ? okCaption : DEFAULT_OK_CAPTION); ok.setData(true); ok.setClickShortcut(KeyCode.ENTER, null); ok.setStyleName(Reindeer.BUTTON_DEFAULT); ok.focus(); buttons.addComponent(ok); buttons.setComponentAlignment(ok, Alignment.MIDDLE_RIGHT); confirm.setOkButton(ok); // Create a listener for buttons Button.ClickListener cb = new Button.ClickListener() { private static final long serialVersionUID = 3525060915814334881L; public void buttonClick(ClickEvent event) { // Copy the button date to window for passing through either // "OK" or "CANCEL" confirm.setConfirmed(event.getButton() == ok); // This has to be invoked as the window.close // event is not fired when removed. if (confirm.getListener() != null) { confirm.getListener().onClose(confirm); } confirm.close(); } }; cancel.addListener(cb); ok.addListener(cb); // Approximate the size of the dialog double[] dim = getDialogDimensions(message, ConfirmDialog.CONTENT_TEXT_WITH_NEWLINES); confirm.setWidth(format(dim[0]) + "em"); confirm.setHeight(format(dim[1]) + "em"); confirm.setResizable(false); return confirm; }
From source file:org.processbase.ui.core.template.HumanTaskWindow.java
License:Open Source License
private Panel getCommentPanel(Date date, String userId, String message) { Panel p = new Panel(); p.setStyleName("minimal"); ((Layout) p.getContent()).setMargin(false, true, false, true); p.addComponent(new Label("<b>" + String.format("%1$tY-%1$tm-%1$td %1$tH:%1$tM", new Object[] { date }) + " - " + userId + "</b><p/>" + message, Label.CONTENT_XHTML)); return p;//from w w w.ja v a 2s .c om }
From source file:org.vaadin.addons.sitekit.example.FeedbackViewlet.java
License:Apache License
/** * Default constructor.// w ww. j a v a 2s .com */ public FeedbackViewlet() { final List<FieldDescriptor> fieldDescriptors = FieldSetDescriptorRegister.getFieldSetDescriptor("feedback") .getFieldDescriptors(); editor = new ValidatingEditor(fieldDescriptors); final Button submitButton = new Button(getSite().localize("button-submit")); submitButton.addClickListener(new ClickListener() { /** The default serial version ID. */ private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { editor.commit(); final EntityManager entityManager = getSite().getSiteContext().getObject(EntityManager.class); final Company company = getSite().getSiteContext().getObject(Company.class); try { Notification.show(getSite().localize("message-feedback-submit-success"), Notification.Type.HUMANIZED_MESSAGE); } catch (final Exception e) { LOGGER.error("Error adding user.", e); Notification.show(getSite().localize("message-feedback-submit-error"), Notification.Type.WARNING_MESSAGE); } reset(); } }); editor.addListener(new ValidatingEditorStateListener() { @Override public void editorStateChanged(final ValidatingEditor source) { if (source.isValid()) { submitButton.setEnabled(true); } else { submitButton.setEnabled(false); } } }); reset(); final HorizontalLayout titleLayout = new HorizontalLayout(); titleLayout.setMargin(new MarginInfo(true, false, true, false)); titleLayout.setSpacing(true); final Embedded titleIcon = new Embedded(null, getSite().getIcon("view-icon-feedback")); titleIcon.setWidth(32, Unit.PIXELS); titleIcon.setHeight(32, Unit.PIXELS); titleLayout.addComponent(titleIcon); final Label titleLabel = new Label("<h1>" + getSite().localize("view-feedback") + "</h1>", ContentMode.HTML); titleLayout.addComponent(titleLabel); final VerticalLayout panel = new VerticalLayout(); panel.addComponent(titleLayout); panel.addComponent(editor); panel.addComponent(submitButton); panel.setSpacing(true); panel.setMargin(true); final Panel mainLayout = new Panel(); mainLayout.setStyleName(Reindeer.PANEL_LIGHT); mainLayout.setContent(panel); setCompositionRoot(mainLayout); }