Example usage for com.vaadin.ui Window setHeight

List of usage examples for com.vaadin.ui Window setHeight

Introduction

In this page you can find the example usage for com.vaadin.ui Window setHeight.

Prototype

@Override
    public void setHeight(float height, Unit unit) 

Source Link

Usage

From source file:de.metas.ui.web.vaadin.report.VaadinJRViewerProvider.java

License:Open Source License

@Override
public void openViewer(final byte[] data, final OutputType type, final String title, final ProcessInfo pi)
        throws JRException {
    final StreamResource pdfResource = new StreamResource(() -> new ByteArrayInputStream(data), "report.pdf");

    final Window window = new Window();
    window.setCaption(title);/*from   w  w w .ja  v a 2s.c  om*/

    window.setStyleName(STYLE);
    window.center();
    window.setWidth(800, Unit.PIXELS);
    window.setHeight(600, Unit.PIXELS);

    final BrowserFrame pdfComp = new BrowserFrame();
    pdfComp.setPrimaryStyleName(STYLE + "-content");
    pdfComp.setSizeFull();
    pdfComp.setSource(pdfResource);
    window.setContent(pdfComp);

    UI.getCurrent().addWindow(window);
}

From source file:de.symeda.sormas.ui.caze.CaseController.java

License:Open Source License

public void openClassificationRulesPopup(CaseDataDto caze) {
    VerticalLayout classificationRulesLayout = new VerticalLayout();
    classificationRulesLayout.setMargin(true);

    DiseaseClassificationCriteriaDto diseaseCriteria = FacadeProvider.getCaseClassificationFacade()
            .getByDisease(caze.getDisease());
    if (diseaseCriteria != null) {
        Label suspectContent = new Label();
        suspectContent.setContentMode(ContentMode.HTML);
        suspectContent.setWidth(100, Unit.PERCENTAGE);
        suspectContent.setValue(ClassificationHtmlRenderer.createSuspectHtmlString(diseaseCriteria));
        classificationRulesLayout.addComponent(suspectContent);

        Label probableContent = new Label();
        probableContent.setContentMode(ContentMode.HTML);
        probableContent.setWidth(100, Unit.PERCENTAGE);
        probableContent.setValue(ClassificationHtmlRenderer.createProbableHtmlString(diseaseCriteria));
        classificationRulesLayout.addComponent(probableContent);

        Label confirmedContent = new Label();
        confirmedContent.setContentMode(ContentMode.HTML);
        confirmedContent.setWidth(100, Unit.PERCENTAGE);
        confirmedContent.setValue(ClassificationHtmlRenderer.createConfirmedHtmlString(diseaseCriteria));
        classificationRulesLayout.addComponent(confirmedContent);
    }//from   w w w .  j  ava  2s.  c om

    Window popupWindow = VaadinUiUtil.showPopupWindow(classificationRulesLayout);
    popupWindow.addCloseListener(e -> {
        popupWindow.close();
    });
    popupWindow.setWidth(860, Unit.PIXELS);
    popupWindow.setHeight(80, Unit.PERCENTAGE);
    popupWindow.setCaption(
            I18nProperties.getString(Strings.classificationRulesFor) + " " + caze.getDisease().toString());
}

From source file:de.symeda.sormas.ui.events.EventParticipantsController.java

License:Open Source License

public void editEventParticipant(String eventParticipantUuid) {
    EventParticipantDto eventParticipant = FacadeProvider.getEventParticipantFacade()
            .getEventParticipantByUuid(eventParticipantUuid);
    EventParticipantEditForm editForm = new EventParticipantEditForm(
            FacadeProvider.getEventFacade().getEventByUuid(eventParticipant.getEvent().getUuid()),
            UserRight.EVENTPARTICIPANT_EDIT);
    editForm.setValue(eventParticipant);
    final CommitDiscardWrapperComponent<EventParticipantEditForm> editView = new CommitDiscardWrapperComponent<EventParticipantEditForm>(
            editForm, editForm.getFieldGroup());

    Window window = VaadinUiUtil.showModalPopupWindow(editView,
            I18nProperties.getString(Strings.headingEditEventParticipant));
    // form is too big for typical screens
    window.setHeight(80, Unit.PERCENTAGE);

    editView.addCommitListener(new CommitListener() {
        @Override//from   w ww. ja  v  a 2s. c o m
        public void onCommit() {
            if (!editForm.getFieldGroup().isModified()) {
                EventParticipantDto dto = editForm.getValue();
                personFacade.savePerson(dto.getPerson());
                dto = eventParticipantFacade.saveEventParticipant(dto);
                Notification.show(I18nProperties.getString(Strings.messageEventParticipantSaved),
                        Type.WARNING_MESSAGE);
                refreshView();
            }
        }
    });

    if (UserProvider.getCurrent().hasUserRole(UserRole.ADMIN)) {
        editView.addDeleteListener(new DeleteListener() {
            @Override
            public void onDelete() {
                FacadeProvider.getEventParticipantFacade().deleteEventParticipant(
                        editForm.getValue().toReference(),
                        UserProvider.getCurrent().getUserReference().getUuid());
                UI.getCurrent().removeWindow(window);
                refreshView();
            }
        }, I18nProperties.getCaption(EventParticipantDto.I18N_PREFIX));
    }
}

From source file:de.symeda.sormas.ui.user.UserController.java

License:Open Source License

public void create() {
    CommitDiscardWrapperComponent<UserEditForm> userCreateComponent = getUserCreateComponent();
    Window window = VaadinUiUtil.showModalPopupWindow(userCreateComponent,
            I18nProperties.getString(Strings.headingCreateNewUser));
    // user form is too big for typical screens
    window.setWidth(userCreateComponent.getWrappedComponent().getWidth() + 64 + 20, Unit.PIXELS);
    window.setHeight(90, Unit.PERCENTAGE);
}

From source file:de.symeda.sormas.ui.user.UserController.java

License:Open Source License

public void edit(UserDto user) {
    CommitDiscardWrapperComponent<UserEditForm> userComponent = getUserEditComponent(user.getUuid());
    Window window = VaadinUiUtil.showModalPopupWindow(userComponent,
            I18nProperties.getString(Strings.headingEditUser));
    // user form is too big for typical screens
    window.setWidth(userComponent.getWrappedComponent().getWidth() + 64 + 20, Unit.PIXELS);
    window.setHeight(90, Unit.PERCENTAGE);
}

From source file:de.symeda.sormas.ui.visit.VisitController.java

License:Open Source License

public void editVisit(String visitUuid, ContactReferenceDto contactRef,
        Consumer<VisitReferenceDto> doneConsumer) {
    VisitDto visit = FacadeProvider.getVisitFacade().getVisitByUuid(visitUuid);
    ContactDto contact = FacadeProvider.getContactFacade().getContactByUuid(contactRef.getUuid());
    VisitReferenceDto referenceDto = visit.toReference();
    PersonDto visitPerson = FacadeProvider.getPersonFacade().getPersonByUuid(visit.getPerson().getUuid());
    VisitEditForm editForm = new VisitEditForm(visit.getDisease(), contact, visitPerson, false,
            UserRight.VISIT_EDIT);/* ww  w.j av  a2 s  .c  om*/
    editForm.setValue(visit);
    final CommitDiscardWrapperComponent<VisitEditForm> editView = new CommitDiscardWrapperComponent<VisitEditForm>(
            editForm, editForm.getFieldGroup());
    editView.setWidth(100, Unit.PERCENTAGE);

    Window window = VaadinUiUtil.showModalPopupWindow(editView,
            I18nProperties.getString(Strings.headingEditVisit));
    // visit form is too big for typical screens
    window.setWidth(editForm.getWidth() + 90, Unit.PIXELS);
    window.setHeight(80, Unit.PERCENTAGE);

    editView.addCommitListener(new CommitListener() {
        @Override
        public void onCommit() {
            if (!editForm.getFieldGroup().isModified()) {
                VisitDto dto = editForm.getValue();
                dto = FacadeProvider.getVisitFacade().saveVisit(dto);
                if (doneConsumer != null) {
                    doneConsumer.accept(referenceDto);
                }
            }
        }
    });

    if (UserProvider.getCurrent().hasUserRole(UserRole.ADMIN)) {
        editView.addDeleteListener(new DeleteListener() {
            @Override
            public void onDelete() {
                FacadeProvider.getVisitFacade().deleteVisit(referenceDto, UserProvider.getCurrent().getUuid());
                UI.getCurrent().removeWindow(window);
                if (doneConsumer != null) {
                    doneConsumer.accept(referenceDto);
                }
            }
        }, I18nProperties.getCaption(VisitDto.I18N_PREFIX));
    }
}

From source file:de.symeda.sormas.ui.visit.VisitController.java

License:Open Source License

public void createVisit(ContactReferenceDto contactRef, Consumer<VisitReferenceDto> doneConsumer) {
    VisitDto visit = createNewVisit(contactRef);
    ContactDto contact = FacadeProvider.getContactFacade().getContactByUuid(contactRef.getUuid());
    PersonDto contactPerson = FacadeProvider.getPersonFacade().getPersonByUuid(contact.getPerson().getUuid());
    VisitEditForm createForm = new VisitEditForm(visit.getDisease(), contact, contactPerson, true,
            UserRight.VISIT_CREATE);/*  ww w. j a  va2  s.  c om*/
    createForm.setValue(visit);
    final CommitDiscardWrapperComponent<VisitEditForm> editView = new CommitDiscardWrapperComponent<VisitEditForm>(
            createForm, createForm.getFieldGroup());

    editView.addCommitListener(new CommitListener() {
        @Override
        public void onCommit() {
            if (!createForm.getFieldGroup().isModified()) {
                VisitDto dto = createForm.getValue();
                dto = FacadeProvider.getVisitFacade().saveVisit(dto);
                if (doneConsumer != null) {
                    doneConsumer.accept(dto.toReference());
                }
            }
        }
    });

    Window window = VaadinUiUtil.showModalPopupWindow(editView,
            I18nProperties.getString(Strings.headingCreateNewVisit));
    // visit form is too big for typical screens
    window.setWidth(createForm.getWidth() + 64 + 24, Unit.PIXELS);
    window.setHeight(80, Unit.PERCENTAGE);
}

From source file:net.sourceforge.javydreamercsw.validation.manager.web.execution.ExecutionWizardStep.java

License:Apache License

@Override
public Component getContent() {
    Panel form = new Panel(TRANSLATOR.translate("step.detail"));
    if (getExecutionStep().getExecutionStart() == null) {
        //Set the start date.
        getExecutionStep().setExecutionStart(new Date());
    }//  www  .j  a v a  2  s  .c  om
    FormLayout layout = new FormLayout();
    form.setContent(layout);
    form.addStyleName(ValoTheme.FORMLAYOUT_LIGHT);
    BeanFieldGroup binder = new BeanFieldGroup(getExecutionStep().getStep().getClass());
    binder.setItemDataSource(getExecutionStep().getStep());
    TextArea text = new TextArea(TRANSLATOR.translate("general.text"));
    text.setConverter(new ByteToStringConverter());
    binder.bind(text, "text");
    text.setSizeFull();
    layout.addComponent(text);
    Field notes = binder.buildAndBind(TRANSLATOR.translate("general.notes"), "notes", TextArea.class);
    notes.setSizeFull();
    layout.addComponent(notes);
    if (getExecutionStep().getExecutionStart() != null) {
        start = new DateField(TRANSLATOR.translate("start.date"));
        start.setResolution(Resolution.SECOND);
        start.setDateFormat(VMSettingServer.getSetting("date.format").getStringVal());
        start.setValue(getExecutionStep().getExecutionStart());
        start.setReadOnly(true);
        layout.addComponent(start);
    }
    if (getExecutionStep().getExecutionEnd() != null) {
        end = new DateField(TRANSLATOR.translate("end.date"));
        end.setDateFormat(VMSettingServer.getSetting("date.format").getStringVal());
        end.setResolution(Resolution.SECOND);
        end.setValue(getExecutionStep().getExecutionEnd());
        end.setReadOnly(true);
        layout.addComponent(end);
    }
    binder.setReadOnly(true);
    //Space to record result
    if (getExecutionStep().getResultId() != null) {
        result.setValue(getExecutionStep().getResultId().getResultName());
    }
    layout.addComponent(result);
    if (reviewer) {//Space to record review
        if (getExecutionStep().getReviewResultId() != null) {
            review.setValue(getExecutionStep().getReviewResultId().getReviewName());
        }
        layout.addComponent(review);
    }
    //Add Reviewer name
    if (getExecutionStep().getReviewer() != null) {
        TextField reviewerField = new TextField(TRANSLATOR.translate("general.reviewer"));
        reviewerField.setValue(getExecutionStep().getReviewer().getFirstName() + " "
                + getExecutionStep().getReviewer().getLastName());
        reviewerField.setReadOnly(true);
        layout.addComponent(reviewerField);
    }
    if (getExecutionStep().getReviewDate() != null) {
        reviewDate = new DateField(TRANSLATOR.translate("review.date"));
        reviewDate.setDateFormat(VMSettingServer.getSetting("date.format").getStringVal());
        reviewDate.setResolution(Resolution.SECOND);
        reviewDate.setValue(getExecutionStep().getReviewDate());
        reviewDate.setReadOnly(true);
        layout.addComponent(reviewDate);
    }
    if (VMSettingServer.getSetting("show.expected.result").getBoolVal()) {
        TextArea expectedResult = new TextArea(TRANSLATOR.translate("expected.result"));
        expectedResult.setConverter(new ByteToStringConverter());
        binder.bind(expectedResult, "expectedResult");
        expectedResult.setSizeFull();
        layout.addComponent(expectedResult);
    }
    //Add the fields
    fields.clear();
    getExecutionStep().getStep().getDataEntryList().forEach(de -> {
        switch (de.getDataEntryType().getId()) {
        case 1://String
            TextField tf = new TextField(TRANSLATOR.translate(de.getEntryName()));
            tf.setRequired(true);
            tf.setData(de.getEntryName());
            if (VMSettingServer.getSetting("show.expected.result").getBoolVal()) {
                //Add expected result
                DataEntryProperty stringCase = DataEntryServer.getProperty(de, "property.match.case");
                DataEntryProperty r = DataEntryServer.getProperty(de, "property.expected.result");
                if (r != null && !r.getPropertyValue().equals("null")) {
                    String error = TRANSLATOR.translate("expected.result") + ": " + r.getPropertyValue();
                    tf.setRequiredError(error);
                    tf.setRequired(DataEntryServer.getProperty(de, "property.required").getPropertyValue()
                            .equals("true"));
                    tf.addValidator((Object val) -> {
                        //We have an expected result and a match case requirement
                        if (stringCase != null && stringCase.getPropertyValue().equals("true")
                                ? !((String) val).equals(r.getPropertyValue())
                                : !((String) val).equalsIgnoreCase(r.getPropertyValue())) {
                            throw new InvalidValueException(error);
                        }
                    });
                }
            }
            fields.add(tf);
            //Set value if already recorded
            updateValue(tf);
            layout.addComponent(tf);
            break;
        case 2://Numeric
            NumberField field = new NumberField(TRANSLATOR.translate(de.getEntryName()));
            field.setSigned(true);
            field.setUseGrouping(true);
            field.setGroupingSeparator(',');
            field.setDecimalSeparator('.');
            field.setConverter(new StringToDoubleConverter());
            field.setRequired(
                    DataEntryServer.getProperty(de, "property.required").getPropertyValue().equals("true"));
            field.setData(de.getEntryName());
            Double min = null, max = null;
            for (DataEntryProperty prop : de.getDataEntryPropertyList()) {
                String value = prop.getPropertyValue();
                if (prop.getPropertyName().equals("property.max")) {
                    try {
                        max = Double.parseDouble(value);
                    } catch (NumberFormatException ex) {
                        //Leave as null
                    }
                } else if (prop.getPropertyName().equals("property.min")) {
                    try {
                        min = Double.parseDouble(value);
                    } catch (NumberFormatException ex) {
                        //Leave as null
                    }
                }
            }
            //Add expected result
            if (VMSettingServer.getSetting("show.expected.result").getBoolVal()
                    && (min != null || max != null)) {
                String error = TRANSLATOR.translate("error.out.of.range") + " "
                        + (min == null ? " " : (TRANSLATOR.translate("property.min") + ": " + min)) + " "
                        + (max == null ? "" : (TRANSLATOR.translate("property.max") + ": " + max));
                field.setRequiredError(error);
                field.addValidator(new DoubleRangeValidator(error, min, max));
            }
            fields.add(field);
            //Set value if already recorded
            updateValue(field);
            layout.addComponent(field);
            break;
        case 3://Boolean
            CheckBox cb = new CheckBox(TRANSLATOR.translate(de.getEntryName()));
            cb.setData(de.getEntryName());
            cb.setRequired(
                    DataEntryServer.getProperty(de, "property.required").getPropertyValue().equals("true"));
            if (VMSettingServer.getSetting("show.expected.result").getBoolVal()) {
                DataEntryProperty r = DataEntryServer.getProperty(de, "property.expected.result");
                if (r != null) {
                    //Add expected result
                    String error = TRANSLATOR.translate("expected.result") + ": " + r.getPropertyValue();
                    cb.addValidator((Object val) -> {
                        if (!val.toString().equals(r.getPropertyValue())) {
                            throw new InvalidValueException(error);
                        }
                    });
                }
            }
            fields.add(cb);
            //Set value if already recorded
            updateValue(cb);
            layout.addComponent(cb);
            break;
        case 4://Attachment
            Label l = new Label(TRANSLATOR.translate(de.getEntryName()));
            layout.addComponent(l);
            break;
        default:
            LOG.log(Level.SEVERE, "Unexpected field type: {0}", de.getDataEntryType().getId());
        }
    });
    //Add the Attachments
    HorizontalLayout attachments = new HorizontalLayout();
    attachments.setCaption(TRANSLATOR.translate("general.attachment"));
    HorizontalLayout comments = new HorizontalLayout();
    comments.setCaption(TRANSLATOR.translate("general.comments"));
    HorizontalLayout issues = new HorizontalLayout();
    issues.setCaption(TRANSLATOR.translate("general.issue"));
    int commentCounter = 0;
    int issueCounter = 0;
    for (ExecutionStepHasIssue ei : getExecutionStep().getExecutionStepHasIssueList()) {
        issueCounter++;
        Button a = new Button("Issue #" + issueCounter);
        a.setIcon(VaadinIcons.BUG);
        a.addClickListener((Button.ClickEvent event) -> {
            displayIssue(new IssueServer(ei.getIssue()));
        });
        a.setEnabled(!step.getLocked());
        issues.addComponent(a);
    }
    for (ExecutionStepHasAttachment attachment : getExecutionStep().getExecutionStepHasAttachmentList()) {
        switch (attachment.getAttachment().getAttachmentType().getType()) {
        case "comment": {
            //Comments go in a different section
            commentCounter++;
            Button a = new Button("Comment #" + commentCounter);
            a.setIcon(VaadinIcons.CLIPBOARD_TEXT);
            a.addClickListener((Button.ClickEvent event) -> {
                if (!step.getLocked()) {
                    //Prompt if user wants this removed
                    MessageBox mb = getDeletionPrompt(attachment);
                    mb.open();
                } else {
                    displayComment(new AttachmentServer(attachment.getAttachment().getAttachmentPK()));
                }
            });
            a.setEnabled(!step.getLocked());
            comments.addComponent(a);
            break;
        }
        default: {
            Button a = new Button(attachment.getAttachment().getFileName());
            a.setEnabled(!step.getLocked());
            a.setIcon(VaadinIcons.PAPERCLIP);
            a.addClickListener((Button.ClickEvent event) -> {
                if (!step.getLocked()) {
                    //Prompt if user wants this removed
                    MessageBox mb = getDeletionPrompt(attachment);
                    mb.open();
                } else {
                    displayAttachment(new AttachmentServer(attachment.getAttachment().getAttachmentPK()));
                }
            });
            attachments.addComponent(a);
            break;
        }
        }
    }
    if (attachments.getComponentCount() > 0) {
        layout.addComponent(attachments);
    }
    if (comments.getComponentCount() > 0) {
        layout.addComponent(comments);
    }
    if (issues.getComponentCount() > 0) {
        layout.addComponent(issues);
    }
    //Add the menu
    HorizontalLayout hl = new HorizontalLayout();
    attach = new Button(TRANSLATOR.translate("add.attachment"));
    attach.setIcon(VaadinIcons.PAPERCLIP);
    attach.addClickListener((Button.ClickEvent event) -> {
        //Show dialog to upload file.
        Window dialog = new VMWindow(TRANSLATOR.translate("attach.file"));
        VerticalLayout vl = new VerticalLayout();
        MultiFileUpload multiFileUpload = new MultiFileUpload() {
            @Override
            protected void handleFile(File file, String fileName, String mimeType, long length) {
                try {
                    LOG.log(Level.FINE, "Received file {1} at: {0}",
                            new Object[] { file.getAbsolutePath(), fileName });
                    //Process the file
                    //Create the attachment
                    AttachmentServer a = new AttachmentServer();
                    a.addFile(file, fileName);
                    //Overwrite the default file name set in addFile. It'll be a temporary file name
                    a.setFileName(fileName);
                    a.write2DB();
                    //Now add it to this Execution Step
                    if (getExecutionStep().getExecutionStepHasAttachmentList() == null) {
                        getExecutionStep().setExecutionStepHasAttachmentList(new ArrayList<>());
                    }
                    getExecutionStep().addAttachment(a);
                    getExecutionStep().write2DB();
                    w.updateCurrentStep();
                } catch (Exception ex) {
                    LOG.log(Level.SEVERE, "Error creating attachment!", ex);
                }
            }
        };
        multiFileUpload.setCaption(TRANSLATOR.translate("select.files.attach"));
        vl.addComponent(multiFileUpload);
        dialog.setContent(vl);
        dialog.setHeight(25, Sizeable.Unit.PERCENTAGE);
        dialog.setWidth(25, Sizeable.Unit.PERCENTAGE);
        ValidationManagerUI.getInstance().addWindow(dialog);
    });
    hl.addComponent(attach);
    bug = new Button(TRANSLATOR.translate("create.issue"));
    bug.setIcon(VaadinIcons.BUG);
    bug.addClickListener((Button.ClickEvent event) -> {
        displayIssue(new IssueServer());
    });
    hl.addComponent(bug);
    comment = new Button(TRANSLATOR.translate("add.comment"));
    comment.setIcon(VaadinIcons.CLIPBOARD_TEXT);
    comment.addClickListener((Button.ClickEvent event) -> {
        AttachmentServer as = new AttachmentServer();
        //Get comment type
        AttachmentType type = AttachmentTypeServer.getTypeForExtension("comment");
        as.setAttachmentType(type);
        displayComment(as);
    });
    hl.addComponent(comment);
    step.update();
    attach.setEnabled(!step.getLocked());
    bug.setEnabled(!step.getLocked());
    comment.setEnabled(!step.getLocked());
    result.setEnabled(!step.getLocked());
    layout.addComponent(hl);
    return layout;
}

From source file:net.sourceforge.javydreamercsw.validation.manager.web.file.TextDisplay.java

License:Apache License

@Override
public Window getViewer(File f) {
    BufferedReader br = null;//from   w  w w.  ja  v a 2 s . co  m
    Window w = new VMWindow(f.getName());
    w.setHeight(80, Sizeable.Unit.PERCENTAGE);
    w.setWidth(80, Sizeable.Unit.PERCENTAGE);
    //Just a plain panel will do
    TextArea text = new TextArea();
    text.setSizeFull();
    w.setContent(text);
    try {
        br = new BufferedReader(new FileReader(f));
        String line;
        StringBuilder sb = new StringBuilder();
        try {
            while ((line = br.readLine()) != null) {
                sb.append(line).append("\n");
            }
            text.setValue(sb.toString());
            text.setReadOnly(true);
        } catch (IOException ex) {
            Exceptions.printStackTrace(ex);
        }
    } catch (FileNotFoundException ex) {
        Exceptions.printStackTrace(ex);
    } finally {
        try {
            if (br != null) {
                br.close();
            }
        } catch (IOException ex) {
            Exceptions.printStackTrace(ex);
        }
    }
    return w;
}

From source file:net.sourceforge.javydreamercsw.validation.manager.web.workflow.WorkflowViewer.java

License:Apache License

private Component getControls() {
    VerticalLayout controls = new VerticalLayout();
    Button addStep = new Button(TRANSLATOR.translate("general.add.step"));
    VerticalLayout vl = new VerticalLayout();
    TextField name = new TextField(TRANSLATOR.translate("general.name"));
    vl.addComponent(name);/*from www  . j ava  2 s.c  o  m*/
    addStep.addClickListener(listener -> {
        MessageBox prompt = MessageBox.createQuestion().withCaption(TRANSLATOR.translate("general.add.step"))
                .withMessage(vl).withYesButton(() -> {
                    if (name.getValue() != null && !name.getValue().isEmpty()) {
                        Graph.Node node = new Graph.Node(TRANSLATOR.translate(name.getValue()));
                        nodes.put(--count, node);
                        node.setParam(KEY, "" + count);
                        node.setParam(ITEM_NAME, TRANSLATOR.translate(name.getValue()));
                        added.add(node);
                        refreshWorkflow();
                    }
                }, ButtonOption.focus(), ButtonOption.icon(VaadinIcons.CHECK))
                .withNoButton(ButtonOption.icon(VaadinIcons.CLOSE));
        prompt.getWindow().setIcon(ValidationManagerUI.SMALL_APP_ICON);
        prompt.open();
    });
    addStep.setWidth(100, Unit.PERCENTAGE);
    addStep.setEnabled(workflows.getValue() != null);
    controls.addComponent(addStep);
    Button addTransition = new Button(TRANSLATOR.translate("general.add.transition"));
    VerticalLayout vl2 = new VerticalLayout();
    TextField transitionName = new TextField(TRANSLATOR.translate("general.name"));
    ListSelect nodeList = new ListSelect(TRANSLATOR.translate("general.step"));
    BeanItemContainer<Graph.Node> container = new BeanItemContainer<>(Graph.Node.class, nodes.values());
    nodeList.setContainerDataSource(container);
    nodeList.getItemIds().forEach(id -> {
        Graph.Node temp = ((Graph.Node) id);
        nodeList.setItemCaption(id, temp.getId());
    });
    nodeList.setNullSelectionAllowed(false);
    vl2.addComponent(transitionName);
    vl2.addComponent(nodeList);
    addTransition.addClickListener(listener -> {
        MessageBox prompt = MessageBox.createQuestion()
                .withCaption(TRANSLATOR.translate("general.add.transition")).withMessage(vl2)
                .withYesButton(() -> {
                    if (transitionName.getValue() != null && !transitionName.getValue().isEmpty()
                            && selected instanceof Subgraph.Node) {
                        Subgraph.Edge edge = new Subgraph.Edge();
                        edge.setDest((Subgraph.Node) nodeList.getValue());
                        edges.put(transitionName.getValue(),
                                new AbstractMap.SimpleEntry<>((Subgraph.Node) selected, edge));
                        edge.setParam(KEY, "" + --count);
                        added.add(edge);
                        refreshWorkflow();
                    }
                }, ButtonOption.focus(), ButtonOption.icon(VaadinIcons.CHECK))
                .withNoButton(ButtonOption.icon(VaadinIcons.CLOSE));
        prompt.getWindow().setIcon(ValidationManagerUI.SMALL_APP_ICON);
        prompt.open();
    });
    addTransition.setWidth(100, Unit.PERCENTAGE);
    addTransition.setEnabled(selected instanceof Subgraph.Node);
    controls.addComponent(addTransition);
    Button delete = new Button(TRANSLATOR.translate("general.delete"));
    delete.setEnabled(selected != null);
    delete.setWidth(100, Unit.PERCENTAGE);
    delete.addClickListener(listener -> {
        MessageBox prompt = MessageBox.createQuestion().withCaption(TRANSLATOR.translate("general.delete"))
                .withMessage(TRANSLATOR.translate("general.delete.confirmation")).withYesButton(() -> {
                    if (selected instanceof Subgraph.Edge) {
                        Subgraph.Edge edge = (Subgraph.Edge) selected;
                        edges.remove(edge.getParam("label"));
                        addToDelete(edge);
                    } else {
                        Graph.Node node = (Graph.Node) selected;
                        addToDelete(node);
                    }
                    refreshWorkflow();
                }, ButtonOption.focus(), ButtonOption.icon(VaadinIcons.CHECK))
                .withNoButton(ButtonOption.icon(VaadinIcons.CLOSE));
        prompt.getWindow().setIcon(ValidationManagerUI.SMALL_APP_ICON);
        prompt.open();
    });
    controls.addComponent(delete);
    Button rename = new Button(TRANSLATOR.translate("general.rename"));
    rename.setWidth(100, Unit.PERCENTAGE);
    rename.setEnabled(selected != null);
    rename.addClickListener(listener -> {
        Window w = new VMWindow(TRANSLATOR.translate("general.rename"));
        w.setWidth(25, Unit.PERCENTAGE);
        w.setHeight(25, Unit.PERCENTAGE);
        UI.getCurrent().addWindow(w);
    });
    controls.addComponent(rename);
    Button save = new Button(TRANSLATOR.translate("general.save"));
    save.setWidth(100, Unit.PERCENTAGE);
    save.setEnabled(!added.isEmpty() || !deleted.isEmpty());
    save.addClickListener(listener -> {
        List<Graph.Node> nodesToAdd = new ArrayList<>();
        List<Subgraph.Edge> edgesToAdd = new ArrayList<>();
        WorkflowServer ws = new WorkflowServer(((Workflow) workflows.getValue()).getId());
        added.forEach(a -> {
            if (a instanceof Graph.Node) {
                nodesToAdd.add((Graph.Node) a);
            } else if (a instanceof Subgraph.Edge) {
                edgesToAdd.add((Subgraph.Edge) a);
            }
        });
        deleted.forEach(a -> {
            LOG.log(Level.INFO, "Deleted: {0}", a);
        });
        nodesToAdd.forEach(node -> {
            try {
                ws.addStep(node.getParam(ITEM_NAME));
            } catch (VMException ex) {
                LOG.log(Level.SEVERE, ex.getLocalizedMessage(), ex);
            }
        });
        displayWorkflow(ws.getEntity());
    });
    controls.addComponent(save);
    Button cancel = new Button(TRANSLATOR.translate("general.cancel"));
    cancel.setWidth(100, Unit.PERCENTAGE);
    cancel.setEnabled(selected != null);
    cancel.addClickListener(listener -> {
        Workflow w = (Workflow) workflows.getValue();
        if (w != null) {
            displayWorkflow(w);
        }
        deleted.clear();
        added.clear();
    });
    controls.addComponent(cancel);
    return controls;
}