Example usage for com.vaadin.ui FormLayout FormLayout

List of usage examples for com.vaadin.ui FormLayout FormLayout

Introduction

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

Prototype

public FormLayout() 

Source Link

Usage

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

License:Apache License

private void displayIssue(IssueServer is) {
    Panel form = new Panel(TRANSLATOR.translate("general.issue"));
    FormLayout layout = new FormLayout();
    form.setContent(layout);//w  w w.  java  2s.  c o  m
    if (is.getIssuePK() == null) {
        //Set creation date
        is.setCreationTime(new Date());
    }
    BeanFieldGroup binder = new BeanFieldGroup(is.getClass());
    binder.setItemDataSource(is);
    Field title = binder.buildAndBind(TRANSLATOR.translate("general.summary"), "title", TextField.class);
    title.setSizeFull();
    layout.addComponent(title);
    Field desc = binder.buildAndBind(TRANSLATOR.translate("general.description"), "description",
            TextArea.class);
    desc.setSizeFull();
    layout.addComponent(desc);
    DateField creation = (DateField) binder.buildAndBind(TRANSLATOR.translate("creation.time"), "creationTime",
            DateField.class);
    creation.setReadOnly(true);
    creation.setDateFormat(VMSettingServer.getSetting("date.format").getStringVal());
    creation.setResolution(Resolution.SECOND);
    layout.addComponent(creation);
    //Add the result
    layout.addComponent(issueType);
    if (is.getIssueType() != null) {
        issueType.setValue(is.getIssueType().getTypeName());
    }
    //Lock if being created
    issueType.setReadOnly(is.getIssueType() == null);
    MessageBox mb = MessageBox.create();
    mb.setData(is);
    mb.asModal(true).withMessage(layout).withButtonAlignment(Alignment.MIDDLE_CENTER).withOkButton(() -> {
        try {
            //Create the attachment
            IssueServer issue = (IssueServer) mb.getData();
            issue.setDescription(((TextArea) desc).getValue().trim());
            issue.setIssueType((IssueType) issueType.getValue());
            issue.setCreationTime(creation.getValue());
            issue.setTitle((String) title.getValue());
            boolean toAdd = issue.getIssuePK() == null;
            issue.write2DB();
            if (toAdd) {
                //Now add it to this Execution Step
                if (getExecutionStep().getExecutionStepHasIssueList() == null) {
                    getExecutionStep().setExecutionStepHasIssueList(new ArrayList<>());
                }
                getExecutionStep().addIssue(issue, ValidationManagerUI.getInstance().getUser());
                getExecutionStep().write2DB();
            }
            w.updateCurrentStep();
        } catch (Exception ex) {
            LOG.log(Level.SEVERE, null, ex);
        }
    }, ButtonOption.focus(), ButtonOption.icon(VaadinIcons.CHECK), ButtonOption.disable())
            .withCancelButton(ButtonOption.icon(VaadinIcons.CLOSE));
    mb.getWindow().setCaption(TRANSLATOR.translate("issue.detail"));
    mb.getWindow().setIcon(ValidationManagerUI.SMALL_APP_ICON);
    ((TextArea) desc).addTextChangeListener((TextChangeEvent event1) -> {
        //Enable if there is a description change.
        mb.getButton(ButtonType.OK).setEnabled(!step.getLocked() && !event1.getText().trim().isEmpty());
    });
    ((TextField) title).addTextChangeListener((TextChangeEvent event1) -> {
        //Enable if there is a title change.
        mb.getButton(ButtonType.OK).setEnabled(!step.getLocked() && !event1.getText().trim().isEmpty());
    });
    mb.open();
}

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

License:Apache License

private void displayComment(AttachmentServer as) {
    Panel form = new Panel(TRANSLATOR.translate("general.comment"));
    FormLayout layout = new FormLayout();
    form.setContent(layout);//w ww . j a v a 2s  .  c  o m
    BeanFieldGroup binder = new BeanFieldGroup(as.getClass());
    binder.setItemDataSource(as);
    Field desc = binder.buildAndBind(TRANSLATOR.translate("general.text"), "textValue", TextArea.class);
    desc.setSizeFull();
    layout.addComponent(desc);
    MessageBox mb = MessageBox.create();
    mb.setData(as);
    mb.asModal(true).withMessage(desc).withButtonAlignment(Alignment.MIDDLE_CENTER).withOkButton(() -> {
        try {
            //Create the attachment
            AttachmentServer a = (AttachmentServer) mb.getData();
            a.setTextValue(((TextArea) desc).getValue().trim());
            boolean toAdd = a.getAttachmentPK() == null;
            a.write2DB();
            if (toAdd) {
                //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, null, ex);
        }
    }, ButtonOption.focus(), ButtonOption.icon(VaadinIcons.CHECK), ButtonOption.disable())
            .withCancelButton(ButtonOption.icon(VaadinIcons.CLOSE));
    mb.getWindow().setCaption(TRANSLATOR.translate("enter.comment"));
    mb.getWindow().setIcon(ValidationManagerUI.SMALL_APP_ICON);
    ((TextArea) desc).addTextChangeListener((TextChangeEvent event1) -> {
        //Enable only when there is a comment.
        mb.getButton(ButtonType.OK).setEnabled(!step.getLocked() && !event1.getText().trim().isEmpty());
    });
    mb.open();
}

From source file:net.sourceforge.javydreamercsw.validation.manager.web.wizard.plan.DetailStep.java

License:Apache License

@Override
public Component getContent() {
    Panel form = new Panel("execution.detail");
    FormLayout layout = new FormLayout();
    form.setContent(layout);//from  w  w w.  ja va2 s  .c  om
    form.addStyleName(ValoTheme.FORMLAYOUT_LIGHT);
    BeanFieldGroup binder = new BeanFieldGroup(TestCaseExecution.class);
    binder.setItemDataSource(tce);
    TextArea name = new TextArea("general.name");
    name.setConverter(new ByteToStringConverter());
    binder.bind(name, "name");
    layout.addComponent(name);
    TextArea scope = new TextArea("general.scope");
    scope.setConverter(new ByteToStringConverter());
    binder.bind(scope, "scope");
    layout.addComponent(scope);
    if (tce.getId() != null) {
        TextArea conclusion = new TextArea("general.conclusion");
        conclusion.setConverter(new ByteToStringConverter());
        binder.bind(conclusion, "conclusion");
        layout.addComponent(conclusion);
        conclusion.setSizeFull();
        layout.addComponent(conclusion);
    }
    binder.setBuffered(false);
    binder.bindMemberFields(form);
    form.setSizeFull();
    return form;
}

From source file:net.sourceforge.javydreamercsw.validation.manager.web.wizard.project.ProjectDetailsStep.java

License:Apache License

@Override
public Component getContent() {
    FormLayout layout = new FormLayout();
    layout.addComponent(getName());
    layout.addComponent(getNotes());
    return layout;
}

From source file:nl.info.magnolia.solr.app.SolrManagementAppViewImpl.java

License:Open Source License

protected Component createSolrServerInformationSection() {
    FormLayout layout = new FormLayout();

    Label serverInformationSectionTitle = new Label(i18n.translate("solr.app.serverInformation.label.title"));
    serverInformationSectionTitle.addStyleName(STYLE_SECTION_TITLE);

    // build and bind fields
    Component solrServerStatus = buildAndBind(SolrManagementSubApp.SOLR_SERVER_STATUS,
            i18n.translate("solr.app.serverInformation.serverStatus"));
    Component nrDocumentsInIndex = buildAndBind(SolrManagementSubApp.SOLR_SERVER_NUMBER_OF_DOCUMENTS,
            i18n.translate("solr.app.serverInformation.numberOfDocsInIndex"));

    Button refreshSolrServerStatusButton = new Button(
            i18n.translate("solr.app.serverInformation.button.refreshSolrServerStatus.caption"),
            event -> listener.refreshView());
    refreshSolrServerStatusButton.addStyleName(STYLE_V_BUTTON_SMALLAPP);
    refreshSolrServerStatusButton.addStyleName(STYLE_COMMIT);

    VerticalLayout buttons = new VerticalLayout();
    buttons.addStyleName(STYLE_BUTTONS);
    buttons.setSpacing(true);/* www.j a  v a 2 s.co  m*/
    buttons.addComponent(refreshSolrServerStatusButton);

    layout.addComponent(serverInformationSectionTitle);
    layout.addComponent(solrServerStatus);
    layout.addComponent(nrDocumentsInIndex);
    layout.addComponent(buttons);

    return layout;
}

From source file:nl.info.magnolia.solr.app.SolrManagementAppViewImpl.java

License:Open Source License

protected Component createSolrIndexManagementSection() {
    FormLayout layout = new FormLayout();

    Label manageSolrSectionTitle = new Label(i18n.translate("solr.app.manageSolrIndex.label.intro"));
    manageSolrSectionTitle.addStyleName(STYLE_SECTION_TITLE);
    layout.addComponent(manageSolrSectionTitle);
    layout.addComponent(new Label(i18n.translate("solr.app.manageSolrIndex.label.description")));

    Button clearSolrIndexButton = new Button(
            i18n.translate("solr.app.management.button.clearSolrIndex.caption"),
            event -> listener.clearSolrIndex());
    clearSolrIndexButton.addStyleName(STYLE_V_BUTTON_SMALLAPP);
    clearSolrIndexButton.addStyleName(STYLE_COMMIT);

    VerticalLayout buttons = new VerticalLayout();
    buttons.addStyleName(STYLE_BUTTONS);
    buttons.setSpacing(true);/* w w w.ja  va 2 s.  co  m*/
    buttons.addComponent(clearSolrIndexButton);

    layout.addComponent(buttons);
    return layout;
}

From source file:nl.info.magnolia.solr.app.SolrManagementAppViewImpl.java

License:Open Source License

protected Component createSolrCrawlerManagementSection() {
    FormLayout layout = new FormLayout();

    Label manageSolrSectionTitle = new Label(i18n.translate("solr.app.manageSolrCrawlers.label.intro"));
    manageSolrSectionTitle.addStyleName(STYLE_SECTION_TITLE);
    layout.addComponent(manageSolrSectionTitle);

    Map<String, CrawlerConfig> crawlers = contentIndexerModule.getCrawlers();
    if (crawlers.isEmpty()) {
        layout.addComponent(/*from ww  w  .  j  a  va 2s . c o  m*/
                new Label(i18n.translate("solr.app.manageSolrCrawlers.noCrawlers.label.description")));
    } else {
        layout.addComponent(new Label(i18n.translate("solr.app.manageSolrCrawlers.label.description")));

        VerticalLayout buttons = new VerticalLayout();
        buttons.addStyleName(STYLE_BUTTONS);
        buttons.setSpacing(true);

        // only create buttons for crawlers that have been configured and are enabled in the content-indexer module.
        for (Map.Entry<String, CrawlerConfig> crawler : crawlers.entrySet()) {
            CrawlerConfig crawlerConfig = crawler.getValue();
            Button runSolrCrawlerButton = new Button(
                    i18n.translate("solr.app.management.button.runSolrCrawler.caption") + " "
                            + crawlerConfig.getName(),
                    event -> listener.runSolrCrawlerCommand(crawlerConfig.getName()));
            runSolrCrawlerButton.addStyleName(STYLE_V_BUTTON_SMALLAPP);
            runSolrCrawlerButton.addStyleName(STYLE_COMMIT);
            buttons.addComponent(runSolrCrawlerButton);
        }
        layout.addComponent(buttons);
    }
    return layout;
}

From source file:nl.kpmg.lcm.ui.view.administration.components.StorageCreateWindow.java

License:Apache License

private void init() {
    optionsArea.setWidth("100%");
    optionsArea.setHeight("100%");
    credentialsArea.setWidth("100%");
    credentialsArea.setHeight("100%");
    enrichmentArea.setWidth("100%");
    enrichmentArea.setHeight("100%");
    saveButton.addClickListener(this);

    FormLayout panelContent = new FormLayout();
    panelContent.setMargin(true);//  ww w  . j a  v a2 s.co m
    panelContent.addComponent(nameField);
    panelContent.addComponent(typeField);
    panelContent.addComponent(optionsArea);
    panelContent.addComponent(credentialsArea);
    panelContent.addComponent(enrichmentArea);
    panelContent.addComponent(saveButton);

    this.setWidth(PANEL_SIZE);
    this.setModal(true);

    this.setContent(panelContent);
}

From source file:nl.kpmg.lcm.ui.view.administration.components.UserCreateWindow.java

License:Apache License

private void init() {
    saveButton.addClickListener(this);

    FormLayout panelContent = new FormLayout();
    panelContent.setMargin(true);/*ww  w .j  a va 2 s .c  o m*/
    nameField.setRequired(true);
    rolesListComboBox = initRolesListComboBox();
    pField.setId("userp");
    pathListArea.setWidth("100%");
    pathListArea.setHeight("100%");
    metadataListArea.setWidth("100%");
    metadataListArea.setHeight("100%");

    panelContent.addComponent(nameField);
    panelContent.addComponent(rolesListComboBox);
    panelContent.addComponent(pField);
    panelContent.addComponent(originField);
    panelContent.addComponent(pathListArea);
    panelContent.addComponent(metadataListArea);
    panelContent.addComponent(saveButton);

    this.setWidth(PANEL_SIZE);
    this.setModal(true);

    this.setContent(panelContent);
}

From source file:nl.kpmg.lcm.ui.view.administration.components.UserGroupCreateWindow.java

License:Apache License

private void init() {
    saveButton.addClickListener(this);

    FormLayout panelContent = new FormLayout();
    panelContent.setMargin(true);/*from   w ww. j  av a  2  s.c o m*/
    nameField.setRequired(true);
    userListArea.setWidth("100%");
    userListArea.setHeight("100%");
    pathListArea.setWidth("100%");
    pathListArea.setHeight("100%");
    metadataListArea.setWidth("100%");
    metadataListArea.setHeight("100%");

    panelContent.addComponent(nameField);
    panelContent.addComponent(userListArea);
    panelContent.addComponent(pathListArea);
    panelContent.addComponent(metadataListArea);
    panelContent.addComponent(saveButton);

    this.setWidth(PANEL_SIZE);
    this.setModal(true);

    this.setContent(panelContent);
}