Example usage for com.vaadin.ui GridLayout GridLayout

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

Introduction

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

Prototype

public GridLayout(int columns, int rows) 

Source Link

Document

Constructor for a grid of given size (number of columns and rows).

Usage

From source file:org.activiti.explorer.ui.content.email.EmailDetailPanel.java

License:Apache License

public EmailDetailPanel(Attachment attachment) {
    setSizeFull();/* w w  w.j  ava 2 s  . c  o m*/
    ((AbstractLayout) getContent()).setMargin(true);
    ((SpacingHandler) getContent()).setSpacing(true);
    addStyleName(Reindeer.PANEL_LIGHT);

    this.attachment = attachment;
    this.i18nManager = ExplorerApp.get().getI18nManager();
    this.taskService = ProcessEngines.getDefaultProcessEngine().getTaskService();

    gridLayout = new GridLayout(2, 4);
    gridLayout.setSpacing(true);
    addComponent(gridLayout);

    InputStream contentStream = taskService.getAttachmentContent(attachment.getId());
    // TODO: Error handling
    JSONObject emailJson = new JSONObject(new JSONTokener(new InputStreamReader(contentStream)));

    String html = emailJson.getString(Constants.EMAIL_HTML_CONTENT);
    String subject = emailJson.getString(Constants.EMAIL_SUBJECT);
    String recipients = emailJson.getString(Constants.EMAIL_RECIPIENT);
    String sentDate = emailJson.getString(Constants.EMAIL_SENT_DATE);
    String receivedDate = emailJson.getString(Constants.EMAIL_RECEIVED_DATE);

    // Add subject
    addSimpleRow(Messages.EMAIL_SUBJECT, subject);
    addSimpleRow(Messages.EMAIL_RECIPIENTS, recipients);
    addSimpleRow(Messages.EMAIL_SENT_DATE, sentDate);
    addSimpleRow(Messages.EMAIL_RECEIVED_DATE, receivedDate);

    // Add HTML content
    addHtmlContent(html);

}

From source file:org.activiti.explorer.ui.custom.ConfirmationDialogPopupWindow.java

License:Apache License

public ConfirmationDialogPopupWindow(String title, String description) {
    setWidth(400, UNITS_PIXELS);/*  ww  w.j  a va 2  s. c o m*/
    setModal(true);
    setResizable(false);

    addStyleName(Reindeer.PANEL_LIGHT);

    layout = new GridLayout(2, 2);
    layout.setMargin(true);
    layout.setSpacing(true);
    layout.setSizeFull();

    setContent(layout);

    I18nManager i18nManager = ExplorerApp.get().getI18nManager();
    if (title != null) {
        setCaption(title);
    } else {
        setCaption(i18nManager.getMessage(Messages.CONFIRMATION_DIALOG_DEFAULT_TITLE));
    }

    initLabel(description);
    initButtons(i18nManager);
}

From source file:org.activiti.explorer.ui.custom.TabbedSelectionWindow.java

License:Apache License

protected void initComponentLayout() {
    selectedComponentLayout = new GridLayout(1, 2);
    selectedComponentLayout.setSizeFull();
    selectedComponentLayout.setMargin(true);
    selectedComponentLayout.setSpacing(true);
    selectedComponentLayout.addStyleName(ExplorerLayout.STYLE_RELATED_CONTENT_CREATE_DETAIL);

    windowLayout.addComponent(selectedComponentLayout);
    windowLayout.setExpandRatio(selectedComponentLayout, 1.0f);

    selectedComponentLayout.setRowExpandRatio(0, 1.0f);
    selectedComponentLayout.setColumnExpandRatio(0, 1.0f);
}

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 ww .  java 2 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  ww  . j  av a 2s  .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.admin.AdminDatabaseSettingsPanel.java

License:Apache License

protected void initSettingsProperties() {
    detailsGrid = new GridLayout(2, 3);
    detailsGrid.setSpacing(true);/*from  ww  w  .ja  v  a 2s .  co m*/
    detailLayout.setMargin(true, true, true, false);
    detailLayout.addComponent(detailsGrid);

    // Database type
    Label typeLabel = new Label(i18nManager.getMessage(Messages.DATABASE_TYPE) + ": ");
    typeLabel.addStyleName(ExplorerLayout.STYLE_LABEL_BOLD);
    detailsGrid.addComponent(typeLabel);
    Label typeValueLabel = new Label(engineConfiguration.getDatabaseType());
    detailsGrid.addComponent(typeValueLabel);

    // Database schema update
    Label schemaUpdateLabel = new Label(i18nManager.getMessage(Messages.DATABASE_UPDATE) + ": ");
    schemaUpdateLabel.addStyleName(ExplorerLayout.STYLE_LABEL_BOLD);
    detailsGrid.addComponent(schemaUpdateLabel);
    Label schemaUpdateValueLabel = new Label(engineConfiguration.getDatabaseSchemaUpdate());
    detailsGrid.addComponent(schemaUpdateValueLabel);

    // Config type
    Label configTypeLabel = new Label(i18nManager.getMessage(Messages.DATABASE_CONFIG_TYPE) + ": ");
    configTypeLabel.addStyleName(ExplorerLayout.STYLE_LABEL_BOLD);
    detailsGrid.addComponent(configTypeLabel);
    String databaseConfigType = getDatabaseType();
    Label configTypeValueLabel = new Label(databaseConfigType);
    detailsGrid.addComponent(configTypeValueLabel);

    if ("JNDI".equals(databaseConfigType)) {
        // JNDI
        Label jndiLabel = new Label(i18nManager.getMessage(Messages.DATABASE_JNDI) + ": ");
        jndiLabel.addStyleName(ExplorerLayout.STYLE_LABEL_BOLD);
        detailsGrid.addComponent(jndiLabel);
        Label jndiValueLabel = new Label(engineConfiguration.getDataSourceJndiName());
        detailsGrid.addComponent(jndiValueLabel);

    } else if ("Datasource".equals(databaseConfigType)) {

        // Datasource class
        Label datasourceLabel = new Label(i18nManager.getMessage(Messages.DATABASE_DATASOURCE_CLASS) + ": ");
        datasourceLabel.addStyleName(ExplorerLayout.STYLE_LABEL_BOLD);
        detailsGrid.addComponent(datasourceLabel);
        Label datasourceValueLabel = new Label(engineConfiguration.getDataSource().getClass().getName());
        detailsGrid.addComponent(datasourceValueLabel);

    } else {

        // JDBC URL
        Label jdbcURLLabel = new Label(i18nManager.getMessage(Messages.DATABASE_JDBC_URL) + ": ");
        jdbcURLLabel.addStyleName(ExplorerLayout.STYLE_LABEL_BOLD);
        detailsGrid.addComponent(jdbcURLLabel);
        Label jdbcURLValueLabel = new Label(engineConfiguration.getJdbcUrl());
        detailsGrid.addComponent(jdbcURLValueLabel);
    }
}

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  w  w .ja va  2s  .  c  o  m
    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.identity.GroupDetailPanel.java

License:Apache License

protected void initGroupProperties() {
    detailsGrid = new GridLayout(2, 3);
    detailsGrid.setSpacing(true);/*from  w  ww .  j  a  va 2  s  .  c om*/
    detailLayout.setMargin(true, true, true, false);
    detailLayout.addComponent(detailsGrid);

    // id
    Label idLabel = new Label(i18nManager.getMessage(Messages.GROUP_ID) + ": ");
    idLabel.addStyleName(ExplorerLayout.STYLE_LABEL_BOLD);
    detailsGrid.addComponent(idLabel);
    Label idValueLabel = new Label(group.getId());
    detailsGrid.addComponent(idValueLabel);

    // name
    Label nameLabel = new Label(i18nManager.getMessage(Messages.GROUP_NAME) + ": ");
    nameLabel.addStyleName(ExplorerLayout.STYLE_LABEL_BOLD);
    detailsGrid.addComponent(nameLabel);
    if (!editingDetails) {
        Label nameValueLabel = new Label(group.getName());
        detailsGrid.addComponent(nameValueLabel);
    } else {
        nameTextField = new TextField(null, group.getName());
        detailsGrid.addComponent(nameTextField);
    }

    // Type
    Label typeLabel = new Label(i18nManager.getMessage(Messages.GROUP_TYPE) + ": ");
    typeLabel.addStyleName(ExplorerLayout.STYLE_LABEL_BOLD);
    detailsGrid.addComponent(typeLabel);
    if (!editingDetails) {
        Label typeValueLabel = new Label(group.getType());
        detailsGrid.addComponent(typeValueLabel);
    } else {
        typeCombobox = new ComboBox(null, Arrays.asList("assignment", "security-role"));
        typeCombobox.setNullSelectionAllowed(false);
        typeCombobox.setInvalidAllowed(false);
        typeCombobox.select(group.getType());
        detailsGrid.addComponent(typeCombobox);
    }
}

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.c  o  m
    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);//w ww.ja  va 2s .  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);
}