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:com.klwork.explorer.ui.AbstractPage.java

License:Apache License

protected void initMainLayout() {
    if (showEvents) {
        grid = new GridLayout(3, 3);
        grid.setColumnExpandRatio(0, .20f);
        grid.setColumnExpandRatio(1, .57f);
        grid.setColumnExpandRatio(2, .23f);
    } else {/*  w w  w . j  a  v a2 s .c o  m*/
        grid = new GridLayout(2, 3);

        grid.setColumnExpandRatio(0, .20f);
        grid.setColumnExpandRatio(1, .80f);
    }

    grid.addStyleName(Reindeer.SPLITPANEL_SMALL);
    grid.setSizeFull();

    // Height division
    grid.setRowExpandRatio(2, 1.0f);

    setCompositionRoot(grid);
}

From source file:com.klwork.explorer.ui.base.AbstractMainGridPage.java

License:Apache License

protected void initMainLayout() {
    grid = new GridLayout(2, 1);
    grid.setColumnExpandRatio(0, .85f);/*from   w w w  .ja va2 s .c o  m*/
    //
    grid.setColumnExpandRatio(1, .15f);
    // setCompositionRoot(grid);
    getMainLayout().addComponent(grid);
    grid.setSizeFull();
}

From source file:com.klwork.explorer.ui.base.AbstractPage.java

License:Apache License

protected void initMainLayout() {
    if (showEvents) {
        grid = new GridLayout(3, 3);
        grid.setColumnExpandRatio(0, .20f);
        grid.setColumnExpandRatio(1, .57f);
        grid.setColumnExpandRatio(2, .23f);
    } else {//ww w  .j  a v  a 2  s .  c o  m
        grid = new GridLayout(2, 3);

        grid.setColumnExpandRatio(0, .20f);
        grid.setColumnExpandRatio(1, .80f);
    }
    grid.addStyleName(Reindeer.SPLITPANEL_SMALL);
    grid.setSizeFull();

    // Height division
    grid.setRowExpandRatio(2, 1.0f);

    setCompositionRoot(grid);
}

From source file:com.klwork.explorer.ui.base.AbstractSecondMainPage.java

License:Apache License

protected void initMainLayout() {
    grid = new GridLayout(2, 1);
    grid.setColumnExpandRatio(0, .10f);/*from   w ww  . j ava2s .  c  om*/
    grid.setColumnExpandRatio(1, .90f);
    // setCompositionRoot(grid);
    getMainLayout().addComponent(grid);
    grid.setSizeFull();
}

From source file:com.klwork.explorer.ui.content.CreateAttachmentPopupWindow.java

License:Apache License

public CreateAttachmentPopupWindow(List types) {
    this.includeTypes = types;
    this.i18nManager = ViewToolManager.getI18nManager();
    this.attachmentRendererManager = ViewToolManager.getAttachmentRendererManager();
    this.taskService = ProcessEngines.getDefaultProcessEngine().getTaskService();

    setCaption(i18nManager.getMessage(Messages.RELATED_CONTENT_ADD));
    setWidth(700, Unit.PIXELS);/* w ww. jav a2s . c o m*/
    setHeight(430, Unit.PIXELS);
    center();
    setModal(true);
    addStyleName(Reindeer.WINDOW_LIGHT);

    layout = new HorizontalLayout();
    layout.setSpacing(false);
    layout.setMargin(true);
    layout.setSizeFull();
    setContent(layout);

    initTable();
    // ?
    detailLayout = new GridLayout(1, 2);
    detailLayout.setSizeFull();
    detailLayout.setMargin(true);
    detailLayout.setSpacing(true);
    detailLayout.addStyleName(ExplorerLayout.STYLE_RELATED_CONTENT_CREATE_DETAIL);

    layout.addComponent(detailLayout);
    layout.setExpandRatio(detailLayout, 1.0f);

    detailLayout.setRowExpandRatio(0, 1.0f);
    detailLayout.setColumnExpandRatio(0, 1.0f);
    // 
    initActions();
}

From source file:com.klwork.explorer.ui.content.email.EmailDetailPanel.java

License:Apache License

public EmailDetailPanel(Attachment attachment) {
    setSizeFull();//from  w w  w .  ja  va  2  s  .  co  m
    mainLayout = new VerticalLayout();
    mainLayout.setMargin(true);
    mainLayout.setSpacing(true);
    addStyleName(Reindeer.PANEL_LIGHT);

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

    gridLayout = new GridLayout(2, 4);
    gridLayout.setSpacing(true);
    mainLayout.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:com.klwork.explorer.ui.custom.ConfirmationDialogPopupWindow.java

License:Apache License

public ConfirmationDialogPopupWindow(String title, String description) {
    setWidth(400, Unit.PIXELS);//from  w  ww.  j  a va  2  s  . c  om
    setModal(true);
    setResizable(false);
    setHeight("30%");
    setWidth("50%");
    center();

    addStyleName(Reindeer.PANEL_LIGHT);

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

    setContent(layout);

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

    initLabel(description);
    initButtons(i18nManager);
}

From source file:com.klwork.explorer.ui.task.HistoricTaskDetailPanel.java

License:Apache License

protected void initHeader() {
    GridLayout taskDetails = new GridLayout(5, 2);
    taskDetails.setWidth(100, UNITS_PERCENTAGE);
    taskDetails.addStyleName(ExplorerLayout.STYLE_TITLE_BLOCK);
    taskDetails.setSpacing(true);/*from   w  w  w  .  ja  v a  2  s.  c  om*/
    taskDetails.setMargin(new MarginInfo(false, false, true, false));

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

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

    // Add due date
    PrettyTimeLabel dueDateLabel = new PrettyTimeLabel(i18nManager.getMessage(Messages.TASK_DUEDATE_SHORT),
            historicTask.getDueDate(), i18nManager.getMessage(Messages.TASK_DUEDATE_UNKNOWN), false);
    dueDateLabel.addStyleName(ExplorerLayout.STYLE_TASK_HEADER_DUEDATE);
    taskDetails.addComponent(dueDateLabel, 1, 1);

    // Add priority
    Integer lowMedHighPriority = convertPriority(historicTask.getPriority());
    Label priorityLabel = new Label();
    switch (lowMedHighPriority) {
    case 1:
        priorityLabel.setValue(i18nManager.getMessage(Messages.TASK_PRIORITY_LOW));
        priorityLabel.addStyleName(ExplorerLayout.STYLE_TASK_HEADER_PRIORITY_LOW);
        break;
    case 2:
        priorityLabel.setValue(i18nManager.getMessage(Messages.TASK_PRIORITY_MEDIUM));
        priorityLabel.addStyleName(ExplorerLayout.STYLE_TASK_HEADER_PRIORITY_MEDIUM);
        break;
    case 3:
    default:
        priorityLabel.setValue(i18nManager.getMessage(Messages.TASK_PRIORITY_HIGH));
        priorityLabel.addStyleName(ExplorerLayout.STYLE_TASK_HEADER_PRIORITY_HIGH);
    }
    taskDetails.addComponent(priorityLabel, 2, 1);

    // Add create date
    PrettyTimeLabel createLabel = new PrettyTimeLabel(i18nManager.getMessage(Messages.TASK_CREATED_SHORT),
            historicTask.getStartTime(), "", true);
    createLabel.addStyleName(ExplorerLayout.STYLE_TASK_HEADER_CREATE_TIME);
    taskDetails.addComponent(createLabel, 3, 1);

    // Add label to fill excess space
    Label spacer = new Label();
    spacer.setContentMode(Label.CONTENT_XHTML);
    spacer.setValue(" ");
    spacer.setSizeUndefined();
    taskDetails.addComponent(spacer);

    taskDetails.setColumnExpandRatio(1, 1.0f);
    taskDetails.setColumnExpandRatio(2, 1.0f);
    taskDetails.setColumnExpandRatio(3, 1.0f);
    taskDetails.setColumnExpandRatio(4, 1.0f);
    centralLayout.addComponent(taskDetails);
}

From source file:com.klwork.explorer.ui.task.TaskDetailPanel.java

License:Apache License

protected void initHeader() {
    GridLayout taskDetails = new GridLayout(2, 2);
    taskDetails.setWidth(100, Unit.PERCENTAGE);
    taskDetails.addStyleName(ExplorerLayout.STYLE_TITLE_BLOCK);
    taskDetails.setSpacing(true);/*from w  w w  .  j av a2s. com*/
    taskDetails.setMargin(new MarginInfo(false, false, true, false));
    taskDetails.setColumnExpandRatio(1, 1.0f);
    centralLayout.addComponent(taskDetails);

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

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

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

    propertiesLayout.addComponent(new DueDateComponent(task, i18nManager, taskService));
    propertiesLayout.addComponent(new PriorityComponent(task, i18nManager, taskService));
    //?
    initCreateTime(propertiesLayout);
}

From source file:com.klwork.explorer.ui.user.ChangePasswordPopupWindow.java

License:Apache License

protected void initPasswordFields() {
    inputGrid = new GridLayout(2, 2);
    inputGrid.setSpacing(true);//  w  ww  . java  2s  .c om
    layout.addComponent(inputGrid);
    layout.setComponentAlignment(inputGrid, Alignment.MIDDLE_CENTER);

    Label newPasswordLabel = new Label(i18nManager.getMessage(Messages.PROFILE_NEW_PASSWORD));
    inputGrid.addComponent(newPasswordLabel);
    passwordField1 = new PasswordField();
    passwordField1.setWidth(150, UNITS_PIXELS);
    inputGrid.addComponent(passwordField1);
    passwordField1.focus();

    Label confirmPasswordLabel = new Label(i18nManager.getMessage(Messages.PROFILE_CONFIRM_PASSWORD));
    inputGrid.addComponent(confirmPasswordLabel);
    passwordField2 = new PasswordField();
    passwordField2.setWidth(150, UNITS_PIXELS);
    inputGrid.addComponent(passwordField2);
}