Example usage for com.vaadin.ui FormLayout addComponent

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

Introduction

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

Prototype

@Override
public void addComponent(Component c) 

Source Link

Document

Add a component into this container.

Usage

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);/*from   w w w. jav 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  ww w.  j  a  va2s  .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());//  w  w  w  .j  av a  2s .co m
    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);/*from w w w  .j av a2  s .c  o  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);//from   w  w w .  j a  v  a 2  s. c  o 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(// w  w  w .  jav a  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);//from  w ww .jav  a2  s  . c  o 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  .  ja  v a 2  s  .c  om
    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  w w  .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);
}

From source file:nl.kpmg.lcm.ui.view.metadata.MetadataCreateWindow.java

License:Apache License

private void init() {
    tabsheet = new TabSheet();

    sectionPanel = initSectionPanel();//from w  w  w.j a v  a 2  s  .  c  o m
    tabsheet.addTab(sectionPanel, "Section view");

    rawPanel = initRawPanel();
    tabsheet.addTab(rawPanel, "Raw view");
    tabsheet.addSelectedTabChangeListener((event) -> {
        if (event.getTabSheet().getSelectedTab() == rawPanel) {
            try {
                updateRawView();
            } catch (Property.ReadOnlyException | IOException ex) {
                Notification.show("Unable to merge metadata sections. Raw metadata is not updated!");
            }
        } else if (event.getTabSheet().getSelectedTab() == sectionPanel) {
            updateSectionView();
        }
    });

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

    FormLayout mainPanel = new FormLayout();
    mainPanel.addComponent(tabsheet);

    saveButton = new Button("Save");
    saveButton.addClickListener(this);
    mainPanel.addComponent(saveButton);

    this.setContent(mainPanel);
}