Example usage for com.vaadin.ui GridLayout addComponent

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

Introduction

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

Prototype

public void addComponent(Component component, int column1, int row1, int column2, int row2)
        throws OverlapsException, OutOfBoundsException 

Source Link

Document

Adds a component to the grid in the specified area.

Usage

From source file:io.subutai.plugin.accumulo.ui.wizard.WelcomeStep.java

public WelcomeStep(final Wizard wizard) {

    setSizeFull();//from w w  w  . j a  v a 2s .  c  o  m

    GridLayout grid = new GridLayout(10, 6);
    grid.setSpacing(true);
    grid.setMargin(true);
    grid.setSizeFull();

    Label welcomeMsg = new Label("<center><h2>Welcome to Accumulo Installation Wizard!</h2>");
    welcomeMsg.setContentMode(ContentMode.HTML);
    grid.addComponent(welcomeMsg, 3, 1, 6, 2);

    Label logoImg = new Label();
    // Image as a file resource
    logoImg.setIcon(new FileResource(FileUtil.getFile(AccumuloPortalModule.MODULE_IMAGE, this)));
    logoImg.setContentMode(ContentMode.HTML);
    logoImg.setHeight(56, Unit.PIXELS);
    logoImg.setWidth(220, Unit.PIXELS);
    grid.addComponent(logoImg, 1, 3, 2, 5);

    Button startOverHadoopNZK = new Button("Start over Hadoop & ZK installation");
    startOverHadoopNZK.setId("startOverHadoopNZK");
    startOverHadoopNZK.addStyleName("default");
    grid.addComponent(startOverHadoopNZK, 4, 4, 4, 4);
    grid.setComponentAlignment(startOverHadoopNZK, Alignment.BOTTOM_RIGHT);

    startOverHadoopNZK.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            wizard.init();
            wizard.getConfig().setSetupType(SetupType.OVER_HADOOP_N_ZK);
            wizard.next();
        }
    });

    setContent(grid);
}

From source file:life.qbic.components.qOfferManager.java

License:Open Source License

private void init() {

    DBManager.setCredentials();//from   w  w  w  . ja v a 2 s .  c  o  m
    DBManager.getDatabaseInstance();
    db = Database.Instance;
    managerTabs = new TabSheet();

    /*    System.out.println(ft.format(dNow) + "  INFO  Offer Manager accessed! - User: "
            + LiferayAndVaadinUtils.getUser().getScreenName());*/

    managerTabs.addStyleName(ValoTheme.TABSHEET_FRAMED);
    managerTabs.addStyleName(ValoTheme.TABSHEET_EQUAL_WIDTH_TABS);

    final GridLayout gridLayout = new GridLayout(6, 6);
    gridLayout.setMargin(true);
    gridLayout.setSpacing(true);

    try {

        managerTabs.addTab(createOfferGeneratorTab(), "Offer Generator");
        managerTabs.addTab(createOfferManagerTab(), "Offer Manager");
        managerTabs.addTab(createPackageManagerTab(), "Package Manager");

        managerTabs.setSelectedTab(1); // show the offer manager first, since this will probably be mostly in use

        // TODO: make this more elegant
        // if one changes the tab e.g. from the offer manager to the package manager, creates a new package and goes
        // back to the offer manager tab, the package won't be updated -> workaround:
        // since the selected offer in the offer manager grid won't requery the database for the information needed, we
        // deselect the current offer (if any has been selected), so the user has to select the offer again -> information
        // for the database is queried again and e.g. the newly created packages are shown properly)
        managerTabs.addSelectedTabChangeListener((TabSheet.SelectedTabChangeListener) event -> {
            OfferManagerTab.getOfferManagerGrid().deselectAll();
            OfferManagerTab.getDetailsLayout().removeAllComponents();
        });

    } catch (SQLException e1) {
        e1.printStackTrace();
    }

    try {
        gridLayout.addComponent(managerTabs, 0, 1, 5, 1);
    } catch (OverlapsException | OutOfBoundsException e) {
        e.printStackTrace();
    }

    gridLayout.setSizeFull();
    setCompositionRoot(gridLayout);
}

From source file:org.activiti.editor.ui.EditorProcessDefinitionDetailPanel.java

License:Apache License

protected void initHeader() {
    GridLayout details = new GridLayout(2, 2);
    details.setWidth(100, UNITS_PERCENTAGE);
    details.addStyleName(ExplorerLayout.STYLE_TITLE_BLOCK);
    details.setSpacing(true);//from w w  w . j  a  v  a  2 s  .co m
    details.setMargin(false, false, true, false);
    details.setColumnExpandRatio(1, 1.0f);
    detailPanelLayout.addComponent(details);

    // Image
    Embedded image = new Embedded(null, Images.PROCESS_50);
    details.addComponent(image, 0, 0, 0, 1);

    // Name
    Label nameLabel = new Label(modelData.getName());
    nameLabel.addStyleName(Reindeer.LABEL_H2);
    details.addComponent(nameLabel, 1, 0);

    // Properties
    HorizontalLayout propertiesLayout = new HorizontalLayout();
    propertiesLayout.setSpacing(true);
    details.addComponent(propertiesLayout);

    // Version
    String versionString = i18nManager.getMessage(Messages.PROCESS_VERSION, modelData.getVersion());
    Label versionLabel = new Label(versionString);
    versionLabel.addStyleName(ExplorerLayout.STYLE_PROCESS_HEADER_VERSION);
    propertiesLayout.addComponent(versionLabel);
}

From source file:org.activiti.explorer.ui.flow.ProcessDefinitionDetailPanel.java

License:Apache License

protected void initHeader() {
    GridLayout taskDetails = new GridLayout(4, 2);
    taskDetails.setWidth(100, UNITS_PERCENTAGE);
    taskDetails.addStyleName(ExplorerLayout.STYLE_TITLE_BLOCK);
    taskDetails.setSpacing(true);//from w  w  w . j av  a2  s.c o m
    taskDetails.setMargin(false, false, true, false);

    // Add image
    Embedded image = new Embedded(null, Images.FLOW_50);
    taskDetails.addComponent(image, 0, 0, 0, 1);

    // Add task name
    Label nameLabel = new Label(processDefinition.getName());
    nameLabel.addStyleName(Reindeer.LABEL_H2);
    taskDetails.addComponent(nameLabel, 1, 0, 3, 0);

    // Add version
    String versionString = i18nManager.getMessage(Messages.FLOW_VERSION, processDefinition.getVersion());
    Label versionLabel = new Label(versionString);
    versionLabel.addStyleName(ExplorerLayout.STYLE_FLOW_HEADER_VERSION);
    taskDetails.addComponent(versionLabel, 1, 1);

    // Add deploy time
    PrettyTimeLabel deployTimeLabel = new PrettyTimeLabel(i18nManager.getMessage(Messages.FLOW_DEPLOY_TIME),
            deployment.getDeploymentTime(), null);
    deployTimeLabel.addStyleName(ExplorerLayout.STYLE_FLOW_HEADER_DEPLOY_TIME);
    taskDetails.addComponent(deployTimeLabel, 2, 1);

    taskDetails.setColumnExpandRatio(1, 1.0f);
    taskDetails.setColumnExpandRatio(2, 1.0f);
    taskDetails.setColumnExpandRatio(3, 1.0f);

    verticalLayout.addComponent(taskDetails);
}

From source file:org.activiti.explorer.ui.flow.ProcessInstanceDetailPanel.java

License:Apache License

protected void addName() {
    GridLayout header = new GridLayout(3, 2);
    header.setWidth(100, UNITS_PERCENTAGE);
    header.addStyleName(ExplorerLayout.STYLE_TITLE_BLOCK);
    header.setSpacing(true);//from w w w .ja  va2 s .  c  om
    header.setMargin(false, false, true, false);

    // Add image
    Embedded image = new Embedded(null, Images.FLOW_50);
    header.addComponent(image, 0, 0, 0, 1);

    // Add task name
    Label nameLabel = new Label(processDefinition.getName() + " (" + processInstance.getId() + ")");
    nameLabel.addStyleName(Reindeer.LABEL_H2);
    header.addComponent(nameLabel, 1, 0, 2, 0);

    // Add start time
    PrettyTimeLabel startTimeLabel = new PrettyTimeLabel(i18nManager.getMessage(Messages.FLOW_START_TIME),
            historicProcessInstance.getStartTime(), null);
    startTimeLabel.addStyleName(ExplorerLayout.STYLE_FLOW_HEADER_START_TIME);
    header.addComponent(startTimeLabel, 1, 1);

    header.setColumnExpandRatio(1, 1.0f);
    header.setColumnExpandRatio(2, 1.0f);

    verticalLayout.addComponent(header);
}

From source file:org.activiti.explorer.ui.management.deployment.DeploymentDetailPanel.java

License:Apache License

protected void addDeploymentName() {

    GridLayout taskDetails = new GridLayout(3, 2);
    taskDetails.setWidth(100, UNITS_PERCENTAGE);
    taskDetails.addStyleName(ExplorerLayout.STYLE_TITLE_BLOCK);
    taskDetails.setSpacing(true);/*  w ww  .  ja  v  a2  s.com*/
    taskDetails.setMargin(false, false, true, false);

    // Add image
    Embedded image = new Embedded(null, Images.DEPLOYMENT_50);
    taskDetails.addComponent(image, 0, 0, 0, 1);

    // Add deployment name
    Label nameLabel = new Label();
    if (deployment.getName() != null) {
        nameLabel.setValue(deployment.getName());
    } else {
        nameLabel.setValue(i18nManager.getMessage(Messages.DEPLOYMENT_NO_NAME));
    }
    nameLabel.addStyleName(Reindeer.LABEL_H2);
    taskDetails.addComponent(nameLabel, 1, 0, 2, 0);

    // Add deploy time
    PrettyTimeLabel deployTimeLabel = new PrettyTimeLabel(
            i18nManager.getMessage(Messages.DEPLOYMENT_DEPLOY_TIME), deployment.getDeploymentTime(), null,
            true);
    deployTimeLabel.addStyleName(ExplorerLayout.STYLE_DEPLOYMENT_HEADER_DEPLOY_TIME);
    taskDetails.addComponent(deployTimeLabel, 1, 1);

    taskDetails.setColumnExpandRatio(1, 1.0f);
    taskDetails.setColumnExpandRatio(2, 1.0f);

    addDetailComponent(taskDetails);
}

From source file:org.activiti.explorer.ui.management.job.JobDetailPanel.java

License:Apache License

protected void addHeader() {
    GridLayout jobDetails = new GridLayout(3, 2);
    jobDetails.setWidth(100, UNITS_PERCENTAGE);
    jobDetails.addStyleName(ExplorerLayout.STYLE_TITLE_BLOCK);
    jobDetails.setSpacing(true);/*from w w w. j  av  a 2  s .com*/
    jobDetails.setMargin(false, false, true, false);

    // Add image
    Embedded image = new Embedded(null, Images.JOB_50);
    jobDetails.addComponent(image, 0, 0, 0, 1);

    // Add job name
    Label nameLabel = new Label(getJobLabel(job));
    nameLabel.addStyleName(Reindeer.LABEL_H2);
    jobDetails.addComponent(nameLabel, 1, 0, 2, 0);

    // Add due date
    PrettyTimeLabel dueDateLabel = new PrettyTimeLabel(i18nManager.getMessage(Messages.JOB_DUEDATE),
            job.getDuedate(), i18nManager.getMessage(Messages.JOB_NO_DUEDATE), false);
    dueDateLabel.addStyleName(ExplorerLayout.STYLE_JOB_HEADER_DUE_DATE);
    jobDetails.addComponent(dueDateLabel, 1, 1);

    jobDetails.setColumnExpandRatio(1, 1.0f);
    jobDetails.setColumnExpandRatio(2, 1.0f);

    addDetailComponent(jobDetails);
}

From source file:org.activiti.explorer.ui.management.process.ProcessInstanceDetailPanel.java

License:Apache License

protected void addHeader() {
    GridLayout header = new GridLayout(3, 2);
    header.setWidth(100, UNITS_PERCENTAGE);
    header.addStyleName(ExplorerLayout.STYLE_TITLE_BLOCK);
    header.setSpacing(true);/*from   w w  w.  jav a  2  s .  c  om*/
    header.setMargin(false, false, true, false);

    // Add image
    Embedded image = new Embedded(null, Images.PROCESS_50);
    header.addComponent(image, 0, 0, 0, 1);

    // Add task name
    Label nameLabel = new Label(getProcessDisplayName(processDefinition, processInstance));
    nameLabel.addStyleName(Reindeer.LABEL_H2);
    header.addComponent(nameLabel, 1, 0, 2, 0);

    // Add start time
    PrettyTimeLabel startTimeLabel = new PrettyTimeLabel(i18nManager.getMessage(Messages.PROCESS_START_TIME),
            historicProcessInstance.getStartTime(), null, true);
    startTimeLabel.addStyleName(ExplorerLayout.STYLE_PROCESS_HEADER_START_TIME);
    header.addComponent(startTimeLabel, 1, 1);

    header.setColumnExpandRatio(1, 1.0f);
    header.setColumnExpandRatio(2, 1.0f);

    panelLayout.addComponent(header);
}

From source file:org.activiti.explorer.ui.process.AbstractProcessDefinitionDetailPanel.java

License:Apache License

protected void initHeader() {
    GridLayout details = new GridLayout(2, 2);
    details.setWidth(100, UNITS_PERCENTAGE);
    details.addStyleName(ExplorerLayout.STYLE_TITLE_BLOCK);
    details.setSpacing(true);//from  ww  w .j av  a 2  s .  co m
    details.setMargin(false, false, true, false);
    details.setColumnExpandRatio(1, 1.0f);
    detailPanelLayout.addComponent(details);

    // Image
    Embedded image = new Embedded(null, Images.PROCESS_50);
    details.addComponent(image, 0, 0, 0, 1);

    // Name
    Label nameLabel = new Label(getProcessDisplayName(processDefinition));
    nameLabel.addStyleName(Reindeer.LABEL_H2);
    details.addComponent(nameLabel, 1, 0);

    // Properties
    HorizontalLayout propertiesLayout = new HorizontalLayout();
    propertiesLayout.setSpacing(true);
    details.addComponent(propertiesLayout);

    // Version
    String versionString = i18nManager.getMessage(Messages.PROCESS_VERSION, processDefinition.getVersion());
    Label versionLabel = new Label(versionString);
    versionLabel.addStyleName(ExplorerLayout.STYLE_PROCESS_HEADER_VERSION);
    propertiesLayout.addComponent(versionLabel);

    // Add deploy time
    PrettyTimeLabel deployTimeLabel = new PrettyTimeLabel(i18nManager.getMessage(Messages.PROCESS_DEPLOY_TIME),
            deployment.getDeploymentTime(), null, true);
    deployTimeLabel.addStyleName(ExplorerLayout.STYLE_PROCESS_HEADER_DEPLOY_TIME);
    propertiesLayout.addComponent(deployTimeLabel);
}

From source file:org.activiti.explorer.ui.reports.ReportDetailPanel.java

License:Apache License

protected void initHeader() {
    GridLayout details = new GridLayout(2, 2);
    details.setWidth(100, UNITS_PERCENTAGE);
    details.addStyleName(ExplorerLayout.STYLE_TITLE_BLOCK);
    details.setSpacing(true);//from ww  w  . j a v  a  2 s  .com
    details.setMargin(false, false, true, false);
    details.setColumnExpandRatio(1, 1.0f);
    detailPanelLayout.addComponent(details);

    // Image
    Embedded image = new Embedded(null, Images.REPORT_50);
    details.addComponent(image, 0, 0, 0, 1);

    // Name
    Label nameLabel = new Label(getReportDisplayName());
    nameLabel.addStyleName(Reindeer.LABEL_H2);
    details.addComponent(nameLabel, 1, 0);

    // Properties
    HorizontalLayout propertiesLayout = new HorizontalLayout();
    propertiesLayout.setSpacing(true);
    details.addComponent(propertiesLayout);

    // Version
    String versionString = i18nManager.getMessage(Messages.PROCESS_VERSION, processDefinition.getVersion());
    Label versionLabel = new Label(versionString);
    versionLabel.addStyleName(ExplorerLayout.STYLE_PROCESS_HEADER_VERSION);
    propertiesLayout.addComponent(versionLabel);
}