Example usage for com.vaadin.ui HorizontalLayout setExpandRatio

List of usage examples for com.vaadin.ui HorizontalLayout setExpandRatio

Introduction

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

Prototype

public void setExpandRatio(Component component, float ratio) 

Source Link

Document

This method is used to control how excess space in layout is distributed among components.

Usage

From source file:it.vige.greenarea.bpm.custom.ui.form.GreenareaFormPropertiesForm.java

License:Apache License

private void addButtons() {
    GreenareaFormPropertiesComponent greenareaFormPropertiesComponent = (GreenareaFormPropertiesComponent) formPropertiesComponent;
    List<String> operationsFromRenderers = getOperationsFromRenderers(greenareaFormPropertiesComponent);
    FormProperty operations = greenareaFormPropertiesComponent.getOperations();
    if (operations != null) {
        @SuppressWarnings("unchecked")
        Map<String, String> mapOperations = (Map<String, String>) operations.getType().getInformation("values");

        buttons = new HorizontalLayout();
        buttons.setSpacing(true);//ww  w. j a  v  a  2s.  com
        buttons.setWidth(100, UNITS_PERCENTAGE);
        buttons.addStyleName(STYLE_DETAIL_BLOCK);
        for (String operation : mapOperations.keySet()) {
            if (!operationsFromRenderers.contains(operation)) {
                final String finalOperation = operation;
                final Button button = new Button();
                button.setCaption(i18nManager.getMessage(operation));
                buttons.addComponent(button);
                buttons.setComponentAlignment(button, BOTTOM_RIGHT);
                button.addListener(new ClickListener() {

                    private static final long serialVersionUID = -6091586145870618870L;

                    public void buttonClick(ClickEvent event) {
                        // Extract the submitted values from the form.
                        // Throws
                        // exception
                        // when validation fails.
                        try {
                            Map<String, String> formProperties = formPropertiesComponent
                                    .getFormPropertyValues();
                            setOperation(formProperties, finalOperation);
                            mainTitle.setPropertyDataSource(new ObjectProperty<String>(
                                    mainTitle.getValue() + " > " + finalOperation, String.class));
                            fireEvent(new FormPropertiesEvent(GreenareaFormPropertiesForm.this, TYPE_SUBMIT,
                                    formProperties));
                            button.setComponentError(null);
                        } catch (InvalidValueException ive) {
                            // Error is presented to user by the form
                            // component
                        }
                    }
                });
            }
        }

        Label buttonSpacer = new Label();
        buttons.addComponent(buttonSpacer);
        buttons.setExpandRatio(buttonSpacer, 1.0f);
        addComponent(buttons);
    } else {
        submitFormButton = new Button();
        cancelFormButton = new Button();

        HorizontalLayout buttons = new HorizontalLayout();
        buttons.setSpacing(true);
        buttons.setWidth(100, UNITS_PERCENTAGE);
        buttons.addStyleName(STYLE_DETAIL_BLOCK);
        buttons.addComponent(submitFormButton);
        buttons.setComponentAlignment(submitFormButton, BOTTOM_RIGHT);

        // buttons.addComponent(cancelFormButton);
        // buttons.setComponentAlignment(cancelFormButton, BOTTOM_RIGHT);

        Label buttonSpacer = new Label();
        buttons.addComponent(buttonSpacer);
        buttons.setExpandRatio(buttonSpacer, 1.0f);
        addComponent(buttons);
        setSubmitButtonCaption(i18nManager.getMessage(TASK_COMPLETE));
        // setCancelButtonCaption(i18nManager.getMessage(TASK_RESET_FORM));
    }
}

From source file:it.vige.greenarea.bpm.custom.ui.form.GreenareaPagedTable.java

License:Apache License

@Override
public HorizontalLayout createControls() {
    I18nManager I18nManager = get().getI18nManager();
    final PagedTableContainer container = (PagedTableContainer) getContainerDataSource();
    Label itemsPerPageLabel = new Label(I18nManager.getMessage(PAGINAZIONE_PER_PAGINA));
    final ComboBox itemsPerPageSelect = new ComboBox();

    itemsPerPageSelect.addItem("3");
    itemsPerPageSelect.addItem("10");
    itemsPerPageSelect.addItem("25");
    itemsPerPageSelect.addItem("50");
    itemsPerPageSelect.setImmediate(true);
    itemsPerPageSelect.setNullSelectionAllowed(false);
    itemsPerPageSelect.setWidth("50px");
    itemsPerPageSelect.addListener(new ValueChangeListener() {
        private static final long serialVersionUID = -2255853716069800092L;

        public void valueChange(com.vaadin.data.Property.ValueChangeEvent event) {
            setPageLength(Integer.valueOf(String.valueOf(event.getProperty().getValue())));
        }/* w ww.  j a v  a  2s .c om*/
    });
    itemsPerPageSelect.select(maxRecords + "");
    Label pageLabel = new Label(I18nManager.getMessage(PAGINAZIONE_PAG) + "&nbsp;", Label.CONTENT_XHTML);
    final TextField currentPageTextField = new TextField();
    currentPageTextField.setValue(String.valueOf(getCurrentPage()));
    currentPageTextField.addValidator(new IntegerValidator(null));
    Label separatorLabel = new Label("&nbsp;/&nbsp;", Label.CONTENT_XHTML);
    final Label totalPagesLabel = new Label(String.valueOf(getTotalAmountOfPages()), Label.CONTENT_XHTML);
    currentPageTextField.setStyleName(Reindeer.TEXTFIELD_SMALL);
    currentPageTextField.setImmediate(true);
    currentPageTextField.addListener(new ValueChangeListener() {
        private static final long serialVersionUID = -2255853716069800092L;

        public void valueChange(com.vaadin.data.Property.ValueChangeEvent event) {
            if (currentPageTextField.isValid() && currentPageTextField.getValue() != null) {
                int page = Integer.valueOf(String.valueOf(currentPageTextField.getValue()));
                setCurrentPage(page);
            }
        }
    });
    pageLabel.setWidth(null);
    currentPageTextField.setWidth("20px");
    separatorLabel.setWidth(null);
    totalPagesLabel.setWidth(null);

    HorizontalLayout controlBar = new HorizontalLayout();
    HorizontalLayout pageSize = new HorizontalLayout();
    HorizontalLayout pageManagement = new HorizontalLayout();
    final Button first = new Button("<<", new ClickListener() {
        private static final long serialVersionUID = -355520120491283992L;

        public void buttonClick(ClickEvent event) {
            setCurrentPage(0);
            if (values != null && !values.isEmpty() && values.iterator().next() instanceof Selectable) {
                Selectable selectable = (Selectable) values.toArray()[container.getStartIndex()];
                GreenareaFormPropertiesComponent greenareaFormPropertiesComponent = (GreenareaFormPropertiesComponent) greenareaFormPropertiesForm
                        .getComponent(1);
                FormProperty formProperty = greenareaFormPropertiesComponent.getFormProperties().get(0);
                FormPropertyRenderer formPropertyRenderer = greenareaFormPropertiesComponent
                        .getRenderer(formProperty);
                greenareaFormPropertiesComponent.getForm()
                        .getField(greenareaFormPropertiesComponent.getFormProperties().get(0).getId())
                        .setValue(formPropertyRenderer.getPropertyLabel(formProperty) + " "
                                + selectable.getValue());
            }
        }
    });
    final Button previous = new Button("<", new ClickListener() {
        private static final long serialVersionUID = -355520120491283992L;

        public void buttonClick(ClickEvent event) {
            previousPage();
            if (values != null && !values.isEmpty() && values.iterator().next() instanceof Selectable) {
                Selectable selectable = (Selectable) values.toArray()[container.getStartIndex()];
                GreenareaFormPropertiesComponent greenareaFormPropertiesComponent = (GreenareaFormPropertiesComponent) greenareaFormPropertiesForm
                        .getComponent(1);
                FormProperty formProperty = greenareaFormPropertiesComponent.getFormProperties().get(0);
                FormPropertyRenderer formPropertyRenderer = greenareaFormPropertiesComponent
                        .getRenderer(formProperty);
                greenareaFormPropertiesComponent.getForm()
                        .getField(greenareaFormPropertiesComponent.getFormProperties().get(0).getId())
                        .setValue(formPropertyRenderer.getPropertyLabel(formProperty) + " "
                                + selectable.getValue());
            }
        }
    });
    final Button next = new Button(">", new ClickListener() {
        private static final long serialVersionUID = -1927138212640638452L;

        public void buttonClick(ClickEvent event) {
            nextPage();
            if (values != null && !values.isEmpty() && values.iterator().next() instanceof Selectable) {
                Selectable selectable = (Selectable) values.toArray()[container.getStartIndex()];
                GreenareaFormPropertiesComponent greenareaFormPropertiesComponent = (GreenareaFormPropertiesComponent) greenareaFormPropertiesForm
                        .getComponent(1);
                FormProperty formProperty = greenareaFormPropertiesComponent.getFormProperties().get(0);
                FormPropertyRenderer formPropertyRenderer = greenareaFormPropertiesComponent
                        .getRenderer(formProperty);
                greenareaFormPropertiesComponent.getForm()
                        .getField(greenareaFormPropertiesComponent.getFormProperties().get(0).getId())
                        .setValue(formPropertyRenderer.getPropertyLabel(formProperty) + " "
                                + selectable.getValue());
            }
        }
    });
    final Button last = new Button(">>", new ClickListener() {
        private static final long serialVersionUID = -355520120491283992L;

        public void buttonClick(ClickEvent event) {
            setCurrentPage(getTotalAmountOfPages());
            if (values != null && !values.isEmpty() && values.iterator().next() instanceof Selectable) {
                Selectable selectable = (Selectable) values.toArray()[container.getStartIndex()];
                GreenareaFormPropertiesComponent greenareaFormPropertiesComponent = (GreenareaFormPropertiesComponent) greenareaFormPropertiesForm
                        .getComponent(1);
                FormProperty formProperty = greenareaFormPropertiesComponent.getFormProperties().get(0);
                FormPropertyRenderer formPropertyRenderer = greenareaFormPropertiesComponent
                        .getRenderer(formProperty);
                greenareaFormPropertiesComponent.getForm()
                        .getField(greenareaFormPropertiesComponent.getFormProperties().get(0).getId())
                        .setValue(formPropertyRenderer.getPropertyLabel(formProperty) + " "
                                + selectable.getValue());
            }
        }
    });
    first.setStyleName(Reindeer.BUTTON_LINK);
    previous.setStyleName(Reindeer.BUTTON_LINK);
    next.setStyleName(Reindeer.BUTTON_LINK);
    last.setStyleName(Reindeer.BUTTON_LINK);

    itemsPerPageLabel.addStyleName("pagedtable-itemsperpagecaption");
    itemsPerPageSelect.addStyleName("pagedtable-itemsperpagecombobox");
    pageLabel.addStyleName("pagedtable-pagecaption");
    currentPageTextField.addStyleName("pagedtable-pagefield");
    separatorLabel.addStyleName("pagedtable-separator");
    totalPagesLabel.addStyleName("pagedtable-total");
    first.addStyleName("pagedtable-first");
    previous.addStyleName("pagedtable-previous");
    next.addStyleName("pagedtable-next");
    last.addStyleName("pagedtable-last");

    itemsPerPageLabel.addStyleName("pagedtable-label");
    itemsPerPageSelect.addStyleName("pagedtable-combobox");
    pageLabel.addStyleName("pagedtable-label");
    currentPageTextField.addStyleName("pagedtable-label");
    separatorLabel.addStyleName("pagedtable-label");
    totalPagesLabel.addStyleName("pagedtable-label");
    first.addStyleName("pagedtable-button");
    previous.addStyleName("pagedtable-button");
    next.addStyleName("pagedtable-button");
    last.addStyleName("pagedtable-button");

    pageSize.addComponent(itemsPerPageLabel);
    pageSize.addComponent(itemsPerPageSelect);
    pageSize.setComponentAlignment(itemsPerPageLabel, Alignment.MIDDLE_LEFT);
    pageSize.setComponentAlignment(itemsPerPageSelect, Alignment.MIDDLE_LEFT);
    pageSize.setSpacing(true);
    pageManagement.addComponent(first);
    pageManagement.addComponent(previous);
    pageManagement.addComponent(pageLabel);
    pageManagement.addComponent(currentPageTextField);
    pageManagement.addComponent(separatorLabel);
    pageManagement.addComponent(totalPagesLabel);
    pageManagement.addComponent(next);
    pageManagement.addComponent(last);
    pageManagement.setComponentAlignment(first, Alignment.MIDDLE_LEFT);
    pageManagement.setComponentAlignment(previous, Alignment.MIDDLE_LEFT);
    pageManagement.setComponentAlignment(pageLabel, Alignment.MIDDLE_LEFT);
    pageManagement.setComponentAlignment(currentPageTextField, Alignment.MIDDLE_LEFT);
    pageManagement.setComponentAlignment(separatorLabel, Alignment.MIDDLE_LEFT);
    pageManagement.setComponentAlignment(totalPagesLabel, Alignment.MIDDLE_LEFT);
    pageManagement.setComponentAlignment(next, Alignment.MIDDLE_LEFT);
    pageManagement.setComponentAlignment(last, Alignment.MIDDLE_LEFT);
    pageManagement.setWidth(null);
    pageManagement.setSpacing(true);
    controlBar.addComponent(pageSize);
    controlBar.addComponent(pageManagement);
    controlBar.setComponentAlignment(pageManagement, Alignment.MIDDLE_CENTER);
    controlBar.setWidth("100%");
    controlBar.setExpandRatio(pageSize, 1);
    addListener(new PageChangeListener() {
        public void pageChanged(PagedTableChangeEvent event) {
            first.setEnabled(container.getStartIndex() > 0);
            previous.setEnabled(container.getStartIndex() > 0);
            next.setEnabled(container.getStartIndex() < container.getRealSize() - getPageLength());
            last.setEnabled(container.getStartIndex() < container.getRealSize() - getPageLength());
            currentPageTextField.setValue(String.valueOf(getCurrentPage()));
            totalPagesLabel.setValue(getTotalAmountOfPages());
            itemsPerPageSelect.setValue(String.valueOf(getPageLength()));
        }
    });
    controlBar.setStyleName("pagination");
    return controlBar;
}

From source file:it.vige.greenarea.bpm.custom.ui.form.MissioniCollectionFormPropertyRenderer.java

License:Apache License

@Override
protected HorizontalLayout getButtons(final String item, final Table table) {
    FormProperty operations = getOperations();
    @SuppressWarnings("unchecked")
    Map<String, String> mapOperations = (Map<String, String>) operations.getType().getInformation("values");

    HorizontalLayout buttons = new HorizontalLayout();
    buttons.setSpacing(true);/*www .  j a v a  2s  .c  om*/
    buttons.setWidth(20, UNITS_PIXELS);
    buttons.addStyleName(STYLE_DETAIL_BLOCK);
    for (String operation : mapOperations.keySet()) {
        if (operation.equals(MODIFICA.name()) || operation.equals(CANCELLAZIONE.name())
                || operation.equals(DETTAGLIO.name())) {
            addButton(operation, buttons, item, table);
        }
    }

    Label buttonSpacer = new Label();
    buttons.addComponent(buttonSpacer);
    buttons.setExpandRatio(buttonSpacer, 1.0f);
    return buttons;
}

From source file:it.vige.greenarea.bpm.custom.ui.form.ParametriAggiuntiCollectionFormPropertyRenderer.java

License:Apache License

@Override
protected HorizontalLayout getButtons(final String item, final Table table) {
    FormProperty operations = getOperations();
    @SuppressWarnings("unchecked")
    Map<String, String> mapOperations = (Map<String, String>) operations.getType().getInformation("values");

    HorizontalLayout buttons = new HorizontalLayout();
    buttons.setSpacing(true);/*from  w w w. j a  va  2  s  .co m*/
    buttons.setWidth(53, UNITS_PIXELS);
    buttons.addStyleName(STYLE_DETAIL_BLOCK);
    for (String operation : mapOperations.keySet()) {
        if (operation.equals(MODIFICA.name()) || operation.equals(CANCELLAZIONE.name())) {
            addButton(operation, buttons, item, table);
        }
    }

    Label buttonSpacer = new Label();
    buttons.addComponent(buttonSpacer);
    buttons.setExpandRatio(buttonSpacer, 1.0f);
    return buttons;
}

From source file:it.vige.greenarea.bpm.custom.ui.form.ParametriTsCollectionFormPropertyRenderer.java

License:Apache License

@Override
protected HorizontalLayout getButtons(final String item, final Table table) {
    FormProperty operations = getOperations();
    @SuppressWarnings("unchecked")
    Map<String, String> mapOperations = (Map<String, String>) operations.getType().getInformation("values");

    HorizontalLayout buttons = new HorizontalLayout();
    buttons.setSpacing(true);/*from w ww  .j  ava  2s .com*/
    buttons.setWidth(20, UNITS_PIXELS);
    buttons.addStyleName(STYLE_DETAIL_BLOCK);
    for (String operation : mapOperations.keySet()) {
        if (operation.equals(INSERIMENTO.name())) {
            addButton(operation, buttons, item, table);
        }
    }

    Label buttonSpacer = new Label();
    buttons.addComponent(buttonSpacer);
    buttons.setExpandRatio(buttonSpacer, 1.0f);
    return buttons;
}

From source file:it.vige.greenarea.bpm.custom.ui.form.VeicoliCollectionFormPropertyRenderer.java

License:Apache License

@Override
protected HorizontalLayout getButtons(final String item, final Table table) {
    FormProperty operations = getOperations();
    @SuppressWarnings("unchecked")
    Map<String, String> mapOperations = (Map<String, String>) operations.getType().getInformation("values");

    HorizontalLayout buttons = new HorizontalLayout();
    buttons.setSpacing(true);/*from  w w  w  .jav  a2 s. c o  m*/
    buttons.setWidth(20, UNITS_PIXELS);
    buttons.addStyleName(STYLE_DETAIL_BLOCK);
    for (String operation : mapOperations.keySet()) {
        if (operation.equals(MODIFICA.name())) {
            addButton(operation, buttons, item, table);
        }
    }

    Label buttonSpacer = new Label();
    buttons.addComponent(buttonSpacer);
    buttons.setExpandRatio(buttonSpacer, 1.0f);
    return buttons;
}

From source file:jp.primecloud.auto.ui.MyCloudManage.java

License:Open Source License

MyCloudManage(Application ap) {

    apl = ap;/*from  w ww .  j a va2s.c o m*/
    //
    setIcon(Icons.EDITMINI.resource());

    setCaption(ViewProperties.getCaption("window.myCloudManage"));
    setModal(true);
    setWidth("550px");

    VerticalLayout layout = (VerticalLayout) getContent();
    layout.setMargin(true);

    // ?
    HorizontalLayout tbar = new HorizontalLayout();
    tbar.setWidth("100%");
    tbar.setSpacing(true);

    // ?
    Label tcaption = new Label(ViewProperties.getCaption("table.cloud"));
    tcaption.setWidth("300px");
    tbar.addComponent(tcaption);
    tbar.setComponentAlignment(tcaption, Alignment.MIDDLE_LEFT);

    // Edit
    Button editButton = new Button(ViewProperties.getCaption("button.editCloud"));
    editButton.setDescription(ViewProperties.getCaption("description.editCloud"));
    editButton.setIcon(Icons.EDITMINI.resource());
    editButton.setWidth("85px");
    editButton.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            MyCloudManage.this.editButtonClick(event);
        }
    });
    tbar.addComponent(editButton);
    tbar.setComponentAlignment(editButton, Alignment.BOTTOM_RIGHT);

    // Delete
    Button deleteButton = new Button(ViewProperties.getCaption("button.delete"));
    deleteButton.setDescription(ViewProperties.getCaption("description.delete"));
    deleteButton.setWidth("85px");
    deleteButton.setIcon(Icons.DELETEMINI.resource());
    deleteButton.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {

            MyCloudManage.this.deleteButtonClick(event);
        }
    });
    tbar.addComponent(deleteButton);
    tbar.setComponentAlignment(deleteButton, Alignment.BOTTOM_RIGHT);
    tbar.setExpandRatio(tcaption, 10);
    layout.addComponent(tbar);

    // ?
    Label spacer1 = new Label("");
    spacer1.setHeight("5px");
    layout.addComponent(spacer1);

    // 
    cloudTable = new CloudTable();
    layout.addComponent(cloudTable);

    // ?
    Label spacer2 = new Label("");
    spacer2.setHeight("7px");
    layout.addComponent(spacer2);

    // ??
    HorizontalLayout bbar = new HorizontalLayout();
    bbar.setWidth("100%");
    HorizontalLayout rlay = new HorizontalLayout();
    rlay.setSpacing(true);

    // New
    Button addButton = new Button(ViewProperties.getCaption("button.newCloud"));
    addButton.setDescription(ViewProperties.getCaption("description.newCloud"));
    addButton.setIcon(Icons.ADD.resource());
    addButton.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            MyCloudManage.this.addButtonClick(event);
        }
    });
    bbar.addComponent(addButton);
    bbar.setComponentAlignment(addButton, Alignment.MIDDLE_LEFT);

    // Switch
    Button switchButton = new Button(ViewProperties.getCaption("button.switch"));
    switchButton.setDescription(ViewProperties.getCaption("description.mycloud.switch"));
    switchButton.setWidth("85px");
    switchButton.setIcon(Icons.SELECTMINI.resource());
    switchButton.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            MyCloudManage.this.switchButtonClick(event);
        }
    });
    // [Enter]?switchButton
    switchButton.setClickShortcut(KeyCode.ENTER);
    switchButton.focus();
    rlay.addComponent(switchButton);

    // Cancel
    Button cancelButton = new Button(ViewProperties.getCaption("button.cancel"));
    cancelButton.setDescription(ViewProperties.getCaption("description.cancel"));
    cancelButton.setWidth("85px");
    cancelButton.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            MyCloudManage.this.close();
        }
    });
    rlay.addComponent(cancelButton);

    bbar.addComponent(rlay);
    bbar.setComponentAlignment(rlay, Alignment.MIDDLE_RIGHT);

    layout.addComponent(bbar);

    // ???
    initData();

    //???/?
    if (ViewContext.getPowerUser()) {
        addButton.setEnabled(true);
        deleteButton.setEnabled(true);
        editButton.setEnabled(true);
        //??????????????
        if (ViewContext.getPowerUser()
                && !ViewContext.getPowerDefaultMaster().equals(ViewContext.getLoginUser())) {
            addButton.setEnabled(false);
        }

    } else if (ViewContext.getUserNo().equals(ViewContext.getLoginUser())) {
        addButton.setEnabled(true);
        deleteButton.setEnabled(true);
        editButton.setEnabled(true);
    } else {
        addButton.setEnabled(false);
        deleteButton.setEnabled(false);
        editButton.setEnabled(false);
    }

    // 
    showClouds();
}

From source file:jp.primecloud.auto.ui.ServerDescBasic.java

License:Open Source License

public ServerDescBasic() {
    setHeight("100%");
    addStyleName(Reindeer.PANEL_LIGHT);//w  w w.  jav a2s .c o  m

    VerticalLayout panel = (VerticalLayout) getContent();
    panel.setWidth("100%");
    panel.setHeight("100%");
    panel.setMargin(true);
    panel.setSpacing(false);
    panel.addStyleName("server-desc-basic");

    HorizontalLayout hlPanels = new HorizontalLayout();
    hlPanels.setWidth("100%");
    hlPanels.setHeight("100%");
    hlPanels.setMargin(true);
    hlPanels.setSpacing(true);
    hlPanels.addStyleName("server-desc-basic");
    //        setContent(hlPanels);

    left.setWidth("100%");
    right.setHeight("100%");
    right.setWidth("100%");

    //????
    Label padding = new Label(" ");
    padding.setWidth("7px");
    padding.setHeight("99%");
    padding.addStyleName("desc-padding");

    Label padding2 = new Label("");
    padding2.setWidth("1px");

    hlPanels.addComponent(left);
    hlPanels.addComponent(padding);
    hlPanels.addComponent(padding2);
    hlPanels.addComponent(right);
    hlPanels.setExpandRatio(left, 40);
    hlPanels.setExpandRatio(right, 60);

    panel.addComponent(hlPanels);
    panel.setExpandRatio(hlPanels, 1.0f);

}

From source file:jp.primecloud.auto.ui.ServerDescDetail.java

License:Open Source License

public ServerDescDetail() {
    setHeight("100%");
    addStyleName(Reindeer.PANEL_LIGHT);/*from  w w  w.  j a v  a  2 s  .c o m*/

    VerticalLayout panel = (VerticalLayout) getContent();
    panel.setWidth("100%");
    panel.setHeight("100%");
    panel.setMargin(true);
    panel.setSpacing(false);
    panel.addStyleName("server-desc-detail");

    HorizontalLayout hlPanels = new HorizontalLayout();
    hlPanels.setWidth("100%");
    hlPanels.setHeight("100%");
    hlPanels.setMargin(true);
    hlPanels.setSpacing(true);
    hlPanels.addStyleName("server-desc-detail");
    //        setContent(hlPanels);

    left.setWidth("200px");
    right.setWidth("100%");
    right.setHeight("100%");

    hlPanels.addComponent(left);
    hlPanels.addComponent(right);

    hlPanels.setExpandRatio(right, 100);

    panel.addComponent(hlPanels);
    panel.setExpandRatio(hlPanels, 1.0f);
}

From source file:jp.primecloud.auto.ui.ServiceDescBasic.java

License:Open Source License

public ServiceDescBasic() {

    addStyleName(Reindeer.PANEL_LIGHT);/* w w w .j  a  v a2s  .c  o  m*/

    setHeight("100%");

    HorizontalLayout hlPanels = new HorizontalLayout();
    hlPanels.setWidth("100%");
    hlPanels.setHeight("100%");
    hlPanels.setMargin(true);
    hlPanels.setSpacing(true);
    hlPanels.addStyleName("service-desc-basic");
    setContent(hlPanels);

    left.setWidth("100%");
    right.setWidth("100%");

    //????
    Label padding = new Label(" ");
    padding.setWidth("7px");
    padding.setHeight("99%");
    padding.addStyleName("desc-padding");

    Label padding2 = new Label("");
    padding2.setWidth("1px");

    VerticalLayout layLeft = new VerticalLayout();
    layLeft.setMargin(false);
    layLeft.setSpacing(false);
    layLeft.setWidth("100%");
    layLeft.setHeight("100%");
    layLeft.addComponent(left);
    layLeft.setExpandRatio(left, 1.0f);

    VerticalLayout layRight = new VerticalLayout();
    layRight.setMargin(false);
    layRight.setSpacing(false);
    layRight.setWidth("100%");
    layRight.setHeight("100%");
    layRight.addComponent(right);
    layRight.addComponent(serverOpe);
    layRight.setExpandRatio(right, 1.0f);

    hlPanels.addComponent(layLeft);
    hlPanels.addComponent(padding);
    hlPanels.addComponent(padding2);
    hlPanels.addComponent(layRight);
    hlPanels.setExpandRatio(layLeft, 40);
    hlPanels.setExpandRatio(layRight, 60);
}