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:org.activiti.explorer.ui.reports.SavedReportDetailPanel.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  2s  .c  o m
    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(SavedReportListItem.getReportDisplayName(historicProcessInstance));
    nameLabel.addStyleName(Reindeer.LABEL_H2);
    details.addComponent(nameLabel, 1, 0);

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

    // Created Time
    String createLabel = i18nManager.getMessage(Messages.REPORTING_CREATE_TIME,
            new HumanTime(i18nManager).format(historicProcessInstance.getEndTime()));
    Label versionLabel = new Label(createLabel);
    versionLabel.addStyleName(ExplorerLayout.STYLE_PROCESS_HEADER_START_TIME);
    propertiesLayout.addComponent(versionLabel);
}

From source file:org.activiti.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);//  www.ja  va2s.  c om
    taskDetails.setMargin(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:org.activiti.explorer.ui.task.TaskDetailPanel.java

License:Apache License

protected void initHeader() {
    GridLayout taskDetails = new GridLayout(2, 2);
    taskDetails.setWidth(100, UNITS_PERCENTAGE);
    taskDetails.addStyleName(ExplorerLayout.STYLE_TITLE_BLOCK);
    taskDetails.setSpacing(true);//  ww w .  j  a v  a2 s .  c o  m
    taskDetails.setMargin(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:org.agocontrol.site.viewlet.dashboard.DashboardViewlet.java

License:Apache License

/**
 * Default constructor which constructs component hierarchy.
 *///w  ww .  j ava2  s  .  c om
public DashboardViewlet() {
    site = ((AgoControlSiteUI) UI.getCurrent()).getSite();
    siteContext = getSite().getSiteContext();
    entityManager = siteContext.getObject(EntityManager.class);

    final GridLayout gridLayout = new GridLayout();
    gridLayout.setSizeFull();
    gridLayout.setRows(3);
    gridLayout.setColumns(2);
    gridLayout.setSpacing(true);
    gridLayout.setColumnExpandRatio(0, 1);
    gridLayout.setColumnExpandRatio(1, 0);
    gridLayout.setRowExpandRatio(0, 0);
    gridLayout.setRowExpandRatio(1, 0);
    gridLayout.setRowExpandRatio(2, 1);

    buildingSelectPanel = new BuildingSelectPanel();
    //buildingSelectPanel.setCaption("Building Selection");
    //buildingSelectPanel.setSizeFull();
    gridLayout.addComponent(buildingSelectPanel, 0, 0, 1, 0);

    buildingControlPanel = new BuildingControlPanel();
    //buildingControlPanel.setCaption("Control Panel");
    //buildingControlPanel.setHeight(200, Unit.PIXELS);
    buildingControlPanel.setSizeFull();
    gridLayout.addComponent(buildingControlPanel, 0, 1, 0, 2);

    chartPanel = new ChartPanel();
    chartPanel.setSizeFull();
    chartPanel.setWidth(700, Unit.PIXELS);
    chartPanel.setHeight(400, Unit.PIXELS);
    gridLayout.addComponent(chartPanel, 1, 1);

    eventPanel = new EventPanel();
    //eventPanel.setCaption("Bus Events");
    //ventPanel.setHeight(200, Unit.PIXELS);
    eventPanel.setSizeFull();
    gridLayout.addComponent(eventPanel, 1, 2);

    setCompositionRoot(gridLayout);
}

From source file:org.balisunrise.vaadin.components.user.UserPanel.java

License:Open Source License

private void init() {

    model = new CreateUserModel();
    BeanItem<CreateUserModel> item = new BeanItem<>(model);
    FieldGroup fg = new FieldGroup(item);

    nome = new TextField("Nome");
    nome.setWidth("100%");
    nome.setMaxLength(50);/*  w  w  w .j  a va2s. c  o m*/
    fg.bind(nome, "nome");

    login = new TextField("Login");
    login.setWidth("100%");
    login.setMaxLength(32);
    fg.bind(login, "login");

    senha = new PasswordField("Senha");
    senha.setWidth("100%");
    senha.setMaxLength(32);
    fg.bind(senha, "senha");

    repita = new PasswordField("Repita a senha");
    repita.setWidth("100%");
    repita.setMaxLength(32);
    fg.bind(repita, "repita");

    GridLayout grid = new GridLayout(20, 1);
    grid.setWidth("100%");
    grid.setHeightUndefined();
    grid.setSpacing(true);

    grid.addComponent(nome, 0, 0, 9, 0);
    grid.addComponent(login, 10, 0, 19, 0);
    grid.setRows(2);
    grid.addComponent(senha, 0, 1, 9, 1);
    grid.addComponent(repita, 10, 1, 19, 1);

    addComponent(grid);
    setSpacing(true);

    repita.addBlurListener((e) -> {
        try {
            fg.commit();
            Notification.show("Changes committed!\n" + model.toString(), Notification.Type.TRAY_NOTIFICATION);
        } catch (final FieldGroup.CommitException ex) {
            Notification.show("Commit failed: " + ex.getCause().getMessage(),
                    Notification.Type.TRAY_NOTIFICATION);
        }
    });
}

From source file:org.bubblecloud.ilves.comment.CommentListComponent.java

License:Open Source License

public void refresh() {

    final String contextPath = VaadinService.getCurrentRequest().getContextPath();
    final Site site = Site.getCurrent();

    final Company company = site.getSiteContext().getObject(Company.class);
    final EntityManager entityManager = site.getSiteContext().getObject(EntityManager.class);

    final CriteriaBuilder builder = entityManager.getCriteriaBuilder();
    final CriteriaQuery<Comment> commentCriteriaQuery = builder.createQuery(Comment.class);
    final Root<Comment> commentRoot = commentCriteriaQuery.from(Comment.class);
    commentCriteriaQuery.where(builder.and(builder.equal(commentRoot.get("owner"), company),
            builder.equal(commentRoot.get("dataId"), contextPath)));
    commentCriteriaQuery.orderBy(builder.asc(commentRoot.get("created")));

    final TypedQuery<Comment> commentTypedQuery = entityManager.createQuery(commentCriteriaQuery);
    final List<Comment> commentList = commentTypedQuery.getResultList();

    final Panel panel = new Panel(site.localize("panel-comments"));
    setCompositionRoot(panel);/*from   w w  w.  j a  va 2s .  c  o m*/

    final GridLayout gridLayout = new GridLayout(3, commentList.size() + 1);
    panel.setContent(gridLayout);
    gridLayout.setSpacing(true);
    gridLayout.setMargin(true);
    gridLayout.setColumnExpandRatio(0, 0.0f);
    gridLayout.setColumnExpandRatio(1, 0.1f);
    gridLayout.setColumnExpandRatio(2, 0.9f);

    final Label authorHeaderLabel = new Label();
    authorHeaderLabel.setStyleName(ValoTheme.LABEL_BOLD);
    authorHeaderLabel.setValue(site.localize("column-header-author"));
    gridLayout.addComponent(authorHeaderLabel, 0, 0, 1, 0);

    final Label commentHeaderLabel = new Label();
    commentHeaderLabel.setStyleName(ValoTheme.LABEL_BOLD);
    commentHeaderLabel.setValue(site.localize("column-header-comment"));
    gridLayout.addComponent(commentHeaderLabel, 2, 0);

    for (int i = 0; i < commentList.size(); i++) {
        final Comment comment = commentList.get(i);

        final Link authorImageLink = GravatarUtil.getGravatarImageLink(comment.getAuthor().getEmailAddress());
        gridLayout.addComponent(authorImageLink, 0, i + 1);

        final Label authorLabel = new Label();
        final String authorName = comment.getAuthor().getFirstName();
        authorLabel.setValue(authorName);
        gridLayout.addComponent(authorLabel, 1, i + 1);

        final Label messageLabel = new Label();
        messageLabel.setValue(comment.getMessage());
        gridLayout.addComponent(messageLabel, 2, i + 1);
    }

}

From source file:org.bubblecloud.ilves.ui.administrator.company.CompanyFlowlet.java

License:Apache License

@Override
public void initialize() {
    entityManager = getSite().getSiteContext().getObject(EntityManager.class);

    final GridLayout gridLayout = new GridLayout(2, 3);
    gridLayout.setSizeFull();/*from   w ww  . j av  a  2s . c o  m*/
    gridLayout.setMargin(false);
    gridLayout.setSpacing(true);
    gridLayout.setRowExpandRatio(1, 1f);
    setViewContent(gridLayout);

    companyEditor = new ValidatingEditor(SiteFields.getFieldDescriptors(Company.class));
    companyEditor.setCaption("Site");
    companyEditor.addListener((ValidatingEditorStateListener) this);
    gridLayout.addComponent(companyEditor, 0, 0, 0, 1);

    invoicingAddressEditor = new ValidatingEditor(SiteFields.getFieldDescriptors(PostalAddress.class));
    invoicingAddressEditor.setCaption("Invoicing Address");
    invoicingAddressEditor.addListener((ValidatingEditorStateListener) this);
    gridLayout.addComponent(invoicingAddressEditor, 1, 0);

    deliveryAddressEditor = new ValidatingEditor(SiteFields.getFieldDescriptors(PostalAddress.class));
    deliveryAddressEditor.setCaption("Delivery Address");
    deliveryAddressEditor.addListener((ValidatingEditorStateListener) this);
    gridLayout.addComponent(deliveryAddressEditor, 1, 1);

    final HorizontalLayout buttonLayout = new HorizontalLayout();
    buttonLayout.setSpacing(true);
    gridLayout.addComponent(buttonLayout, 0, 2);

    saveButton = new Button("Save");
    saveButton.setImmediate(true);
    buttonLayout.addComponent(saveButton);
    saveButton.addClickListener(new ClickListener() {
        /** Serial version UID. */
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(final ClickEvent event) {
            companyEditor.commit();
            invoicingAddressEditor.commit();
            deliveryAddressEditor.commit();
            if (entity.getCompanyId() == null) {
                SecurityService.addCompany(getSite().getSiteContext(), entity);
            } else {
                SecurityService.updateCompany(getSite().getSiteContext(), entity);
            }
        }
    });

    discardButton = new Button("Discard");
    discardButton.setImmediate(true);
    buttonLayout.addComponent(discardButton);
    discardButton.addClickListener(new ClickListener() {
        /** Serial version UID. */
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(final ClickEvent event) {
            companyEditor.discard();
            invoicingAddressEditor.discard();
            deliveryAddressEditor.discard();
        }
    });

}

From source file:org.eclipse.hawkbit.ui.rollout.rollout.AddUpdateRolloutWindowLayout.java

License:Open Source License

private GridLayout createSimpleGroupDefinitionTab() {
    final GridLayout layout = new GridLayout();
    layout.setSpacing(true);//from  w w w. ja  va2s.com
    layout.setColumns(3);
    layout.setRows(4);
    layout.setStyleName("marginTop");

    layout.addComponent(getLabel("caption.rollout.generate.groups"), 0, 0, 2, 0);

    layout.addComponent(getMandatoryLabel("prompt.number.of.groups"), 0, 1);
    layout.addComponent(noOfGroups, 1, 1);
    noOfGroups.addValidator(nullValidator);
    layout.addComponent(groupSizeLabel, 2, 1);

    layout.addComponent(getMandatoryLabel("prompt.tigger.threshold"), 0, 2);
    layout.addComponent(triggerThreshold, 1, 2);
    triggerThreshold.addValidator(nullValidator);
    layout.addComponent(getPercentHintLabel(), 2, 2);

    layout.addComponent(getMandatoryLabel("prompt.error.threshold"), 0, 3);
    layout.addComponent(errorThreshold, 1, 3);
    errorThreshold.addValidator(nullValidator);
    layout.addComponent(errorThresholdOptionGroup, 2, 3);

    return layout;
}

From source file:org.ikasan.dashboard.ui.administration.panel.PlatformConfigurationPanel.java

License:BSD License

protected Panel createMapPanel(final ConfigurationParameterMapImpl parameter) {
    Panel paramPanel = new Panel();
    paramPanel.setStyleName("dashboard");
    paramPanel.setWidth("100%");

    GridLayout paramLayout = new GridLayout(2, 3);
    paramLayout.setSpacing(true);/*from  w w w. jav a  2s. c o m*/
    paramLayout.setSizeFull();
    paramLayout.setMargin(true);
    paramLayout.setColumnExpandRatio(0, .25f);
    paramLayout.setColumnExpandRatio(1, .75f);

    Label label = new Label("Platform Configuration");
    label.addStyleName(ValoTheme.LABEL_HUGE);
    label.setSizeUndefined();
    paramLayout.addComponent(label, 0, 0, 1, 0);
    paramLayout.setComponentAlignment(label, Alignment.TOP_LEFT);

    final Map<String, String> valueMap = parameter.getValue();

    final GridLayout mapLayout = new GridLayout(5, (valueMap.size() != 0 ? valueMap.size() : 1) + 1);
    mapLayout.setColumnExpandRatio(0, .05f);
    mapLayout.setColumnExpandRatio(1, .425f);
    mapLayout.setColumnExpandRatio(2, .05f);
    mapLayout.setColumnExpandRatio(3, .425f);
    mapLayout.setColumnExpandRatio(4, .05f);

    mapLayout.setMargin(true);
    mapLayout.setSpacing(true);
    mapLayout.setWidth("100%");

    int i = 0;

    for (final String key : valueMap.keySet()) {
        final Label keyLabel = new Label("Name:");
        final Label valueLabel = new Label("Value:");

        final TextField keyField = new TextField();
        keyField.setValue(key);
        keyField.setWidth("100%");
        keyField.setNullSettingAllowed(false);
        keyField.addValidator(
                new NonZeroLengthStringValidator("Then configuration value name cannot be empty!"));
        keyField.setValidationVisible(false);

        final TextField valueField = new TextField();
        valueField.setWidth("100%");
        valueField.setValue(valueMap.get(key));
        valueField.setNullSettingAllowed(false);
        valueField.addValidator(new NonZeroLengthStringValidator("Then configuration value cannot be empty!"));
        valueField.setValidationVisible(false);

        mapLayout.addComponent(keyLabel, 0, i);
        mapLayout.setComponentAlignment(keyLabel, Alignment.MIDDLE_RIGHT);
        mapLayout.addComponent(keyField, 1, i);
        mapLayout.addComponent(valueLabel, 2, i);
        mapLayout.setComponentAlignment(valueLabel, Alignment.MIDDLE_RIGHT);
        mapLayout.addComponent(valueField, 3, i);
        final String mapKey = parameter.getName() + i;
        TextFieldKeyValuePair pair = new TextFieldKeyValuePair();
        pair.key = keyField;
        pair.value = valueField;

        this.mapTextFields.put(mapKey, pair);

        final Button removeButton = new Button("remove");
        removeButton.setStyleName(ValoTheme.BUTTON_LINK);
        removeButton.addClickListener(new Button.ClickListener() {
            public void buttonClick(ClickEvent event) {
                valueMap.remove(key);
                mapLayout.removeComponent(keyLabel);
                mapLayout.removeComponent(valueLabel);
                mapLayout.removeComponent(keyField);
                mapLayout.removeComponent(valueField);
                mapLayout.removeComponent(removeButton);

                mapTextFields.remove(mapKey);
            }
        });

        mapLayout.addComponent(removeButton, 4, i);

        i++;
    }

    final Button addButton = new Button("add");
    addButton.setStyleName(ValoTheme.BUTTON_LINK);
    addButton.addClickListener(new Button.ClickListener() {
        public void buttonClick(ClickEvent event) {
            final Label keyLabel = new Label("Name:");
            final Label valueLabel = new Label("Value:");

            final TextField keyField = new TextField();
            keyField.setWidth("100%");
            keyField.setNullSettingAllowed(false);
            keyField.addValidator(
                    new NonZeroLengthStringValidator("Then configuration value name cannot be empty!"));
            keyField.setValidationVisible(false);

            final TextField valueField = new TextField();
            valueField.setWidth("100%");
            valueField.setNullSettingAllowed(false);
            valueField.addValidator(
                    new NonZeroLengthStringValidator("Then configuration value cannot be empty!"));
            valueField.setValidationVisible(false);

            mapLayout.insertRow(mapLayout.getRows());

            mapLayout.removeComponent(addButton);
            mapLayout.addComponent(keyLabel, 0, mapLayout.getRows() - 2);
            mapLayout.setComponentAlignment(keyLabel, Alignment.MIDDLE_RIGHT);
            mapLayout.addComponent(keyField, 1, mapLayout.getRows() - 2);
            mapLayout.addComponent(valueLabel, 2, mapLayout.getRows() - 2);
            mapLayout.setComponentAlignment(valueLabel, Alignment.MIDDLE_RIGHT);
            mapLayout.addComponent(valueField, 3, mapLayout.getRows() - 2);

            final String mapKey = parameter.getName() + mapTextFields.size();
            TextFieldKeyValuePair pair = new TextFieldKeyValuePair();
            pair.key = keyField;
            pair.value = valueField;

            mapTextFields.put(mapKey, pair);

            final Button removeButton = new Button("remove");
            removeButton.setStyleName(ValoTheme.BUTTON_LINK);
            removeButton.addClickListener(new Button.ClickListener() {
                public void buttonClick(ClickEvent event) {
                    mapLayout.removeComponent(keyLabel);
                    mapLayout.removeComponent(valueLabel);
                    mapLayout.removeComponent(keyField);
                    mapLayout.removeComponent(valueField);

                    mapLayout.removeComponent(removeButton);

                    mapTextFields.remove(mapKey);
                }
            });

            mapLayout.addComponent(removeButton, 4, mapLayout.getRows() - 2);

            mapLayout.addComponent(addButton, 0, mapLayout.getRows() - 1);
        }
    });

    mapLayout.addComponent(addButton, 0, mapLayout.getRows() - 1);

    Panel mapPanel = new Panel();
    mapPanel.setStyleName(ValoTheme.PANEL_BORDERLESS);
    mapPanel.setContent(mapLayout);

    Button saveButton = new Button("Save");
    saveButton.addStyleName(ValoTheme.BUTTON_SMALL);
    saveButton.addClickListener(new Button.ClickListener() {
        public void buttonClick(ClickEvent event) {
            try {
                for (TextFieldKeyValuePair textField : mapTextFields.values()) {
                    textField.key.validate();
                    textField.value.validate();
                }
            } catch (InvalidValueException e) {
                for (TextFieldKeyValuePair textField : mapTextFields.values()) {
                    textField.key.setValidationVisible(true);
                    textField.value.setValidationVisible(true);
                }

                Notification.show("Validation errors have occurred!", Type.ERROR_MESSAGE);

                return;
            }

            HashMap<String, String> map = new HashMap<String, String>();

            logger.info("Saving map: " + mapTextFields.size());

            for (String key : mapTextFields.keySet()) {
                if (key.startsWith(parameter.getName())) {
                    TextFieldKeyValuePair pair = mapTextFields.get(key);

                    logger.info("Saving for key: " + key);

                    if (pair.key.getValue() != "") {
                        map.put(pair.key.getValue(), pair.value.getValue());
                    }
                }
            }

            parameter.setValue(map);

            PlatformConfigurationPanel.this.configurationManagement.saveConfiguration(platformConfiguration);

            Notification notification = new Notification("Saved",
                    "The configuration has been saved successfully!", Type.HUMANIZED_MESSAGE);
            notification.setStyleName(ValoTheme.NOTIFICATION_CLOSABLE);
            notification.show(Page.getCurrent());
        }
    });

    paramLayout.addComponent(mapPanel, 0, 1, 1, 1);
    paramLayout.setComponentAlignment(mapPanel, Alignment.TOP_CENTER);
    paramLayout.addComponent(saveButton, 0, 2, 1, 2);
    paramLayout.setComponentAlignment(saveButton, Alignment.TOP_CENTER);
    paramPanel.setContent(paramLayout);

    return paramPanel;
}

From source file:org.ikasan.dashboard.ui.administration.panel.PolicyManagementPanel.java

License:BSD License

@SuppressWarnings({ "serial" })
protected void init() {
    this.setWidth("100%");
    this.setHeight("100%");

    this.createAssociatedRolesPanel();
    this.createPolicyDropPanel();

    VerticalLayout layout = new VerticalLayout();
    layout.setMargin(true);/*from   w w  w  . j  a va  2 s.c  om*/
    layout.setSpacing(true);
    layout.setWidth("100%");

    Panel policyAdministrationPanel = new Panel();
    policyAdministrationPanel.addStyleName(ValoTheme.PANEL_BORDERLESS);
    policyAdministrationPanel.setHeight("100%");
    policyAdministrationPanel.setWidth("100%");

    GridLayout gridLayout = new GridLayout(2, 6);
    gridLayout.setSizeFull();

    Label roleManagementLabel = new Label("Policy Management");
    roleManagementLabel.setStyleName(ValoTheme.LABEL_HUGE);
    gridLayout.addComponent(roleManagementLabel, 0, 0, 1, 0);

    Label roleSearchHintLabel = new Label();
    roleSearchHintLabel.setCaptionAsHtml(true);
    roleSearchHintLabel.setCaption(
            VaadinIcons.QUESTION_CIRCLE_O.getHtml() + " Type into the Policy Name field to find a policy.");
    roleSearchHintLabel.addStyleName(ValoTheme.LABEL_TINY);
    roleSearchHintLabel.addStyleName(ValoTheme.LABEL_LIGHT);
    gridLayout.addComponent(roleSearchHintLabel, 0, 1, 1, 1);

    Layout controlLayout = this.initControlLayout();

    gridLayout.addComponent(controlLayout, 0, 2, 1, 2);

    GridLayout formLayout = new GridLayout(2, 4);
    formLayout.setWidth("100%");
    formLayout.setSpacing(true);
    formLayout.setColumnExpandRatio(0, 1);
    formLayout.setColumnExpandRatio(1, 5);

    Label policyNameLabel = new Label("Policy Name:");
    policyNameLabel.setSizeUndefined();
    final DragAndDropWrapper policyNameFieldWrap = initPolicyNameField();

    formLayout.addComponent(policyNameLabel, 0, 0);
    formLayout.setComponentAlignment(policyNameLabel, Alignment.MIDDLE_RIGHT);
    formLayout.addComponent(policyNameFieldWrap, 1, 0);

    Label descriptionLabel = new Label("Description:");
    descriptionLabel.setSizeUndefined();
    this.descriptionField = new TextArea();
    this.descriptionField.setWidth("70%");
    this.descriptionField.setHeight("60px");
    formLayout.addComponent(descriptionLabel, 0, 1);
    formLayout.setComponentAlignment(descriptionLabel, Alignment.TOP_RIGHT);
    formLayout.addComponent(this.descriptionField, 1, 1);

    this.linkTypeLabel.setSizeUndefined();
    formLayout.addComponent(this.linkTypeLabel, 0, 2);
    formLayout.setComponentAlignment(this.linkTypeLabel, Alignment.MIDDLE_RIGHT);
    this.linkType.setWidth("70%");
    formLayout.addComponent(this.linkType, 1, 2);
    this.linkTypeLabel.setVisible(false);
    this.linkType.setVisible(false);

    this.linkedEntityLabel.setSizeUndefined();
    this.linkedEntity = new TextArea();
    this.linkedEntity.setWidth("70%");
    this.linkedEntity.setHeight("60px");

    formLayout.addComponent(this.linkedEntityLabel, 0, 3);
    formLayout.setComponentAlignment(this.linkedEntityLabel, Alignment.MIDDLE_RIGHT);
    formLayout.addComponent(linkedEntity, 1, 3);
    this.linkedEntityLabel.setVisible(false);
    this.linkedEntity.setVisible(false);

    gridLayout.addComponent(formLayout, 0, 3, 1, 3);

    Label roleTableHintLabel = new Label();
    roleTableHintLabel.setCaptionAsHtml(true);
    roleTableHintLabel.setCaption(VaadinIcons.QUESTION_CIRCLE_O.getHtml()
            + " The Roles table below displays the roles that are assigned the current policy.");
    roleTableHintLabel.addStyleName(ValoTheme.LABEL_TINY);
    roleTableHintLabel.addStyleName(ValoTheme.LABEL_LIGHT);
    gridLayout.addComponent(roleTableHintLabel, 0, 4, 1, 4);

    gridLayout.addComponent(this.roleTable, 0, 5, 1, 5);

    policyAdministrationPanel.setContent(gridLayout);
    layout.addComponent(policyAdministrationPanel);

    HorizontalLayout roleMemberPanelLayout = new HorizontalLayout();
    roleMemberPanelLayout.setMargin(true);
    roleMemberPanelLayout.addComponent(this.policyDropPanel);
    roleMemberPanelLayout.setSizeFull();

    HorizontalSplitPanel hsplit = new HorizontalSplitPanel();
    hsplit.setFirstComponent(layout);
    hsplit.setSecondComponent(roleMemberPanelLayout);

    // Set the position of the splitter as percentage
    hsplit.setSplitPosition(65, Unit.PERCENTAGE);
    hsplit.setLocked(true);

    this.setContent(hsplit);
}