Example usage for com.vaadin.ui VerticalLayout setExpandRatio

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

Introduction

In this page you can find the example usage for com.vaadin.ui VerticalLayout 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:com.peergreen.webconsole.scope.deployment.internal.deployed.DeployedPanel.java

License:Open Source License

@PostConstruct
public void init() {
    setSizeFull();//  w  ww. j  av  a 2s  . co  m
    Table table = new Table();

    VerticalLayout mainContent = new VerticalLayout();
    mainContent.setSpacing(true);
    mainContent.setMargin(true);
    mainContent.setStyleName("deployable-style");
    mainContent.setSizeFull();

    setContent(mainContent);

    HorizontalLayout toolBar = new HorizontalLayout();
    toolBar.setMargin(true);
    toolBar.setSpacing(true);
    toolBar.setWidth("100%");

    // Select all deployed artifacts
    CheckBox selectAll = new CheckBox("All");
    selectAll.addValueChangeListener(new SelectAll(table));
    toolBar.addComponent(selectAll);
    toolBar.setExpandRatio(selectAll, 1);

    // Filter
    TextField filter = new TextField();
    filter.setInputPrompt("Filter deployed artifacts");
    filter.setWidth("100%");
    filter.addTextChangeListener(new FilterFiles(TREE_ITEM_ID, container));
    toolBar.addComponent(filter);
    toolBar.setComponentAlignment(filter, Alignment.TOP_LEFT);
    toolBar.setExpandRatio(filter, 3);

    HorizontalLayout actionArea = new HorizontalLayout();
    final NativeSelect actionSelection = new NativeSelect();
    actionSelection.addItem(DeploymentActions.UNDEPLOY);
    actionSelection.addItem(DeploymentActions.DELETE);
    actionSelection.addItem(DeploymentActions.DEPLOYMENT_PLAN);
    actionSelection.setWidth("100px");
    actionSelection.setNullSelectionAllowed(false);

    Button doButton = new Button("Do");
    doButton.addStyleName("default");
    doButton.addClickListener(
            new DoClickListener(artifactBuilder, table, actionSelection, deploymentViewManager));

    actionArea.addComponent(actionSelection);
    actionArea.addComponent(doButton);
    toolBar.addComponent(actionArea);
    toolBar.setComponentAlignment(actionArea, Alignment.TOP_RIGHT);
    mainContent.addComponent(toolBar);

    VerticalLayout deployedContainer = new VerticalLayout();
    DragAndDropWrapper deployedContainerWrapper = new DragAndDropWrapper(deployedContainer);
    deployedContainerWrapper
            .setDropHandler(new DeploymentDropHandler(deploymentViewManager, this, notifierService));
    deployedContainerWrapper.setSizeFull();
    mainContent.addComponent(deployedContainerWrapper);
    mainContent.setExpandRatio(deployedContainerWrapper, 1.5f);

    container.addContainerProperty(TREE_ITEM_ID, String.class, null);
    table.setSizeFull();
    table.setImmediate(true);
    table.setMultiSelect(true);
    table.setSelectable(true);
    table.setColumnHeaderMode(Table.ColumnHeaderMode.HIDDEN);
    table.setContainerDataSource(container);
    table.setDragMode(Table.TableDragMode.MULTIROW);
    table.setItemCaptionPropertyId(TREE_ITEM_ID);
    table.setCellStyleGenerator(new ItemStyle(DeployableContainerType.DEPLOYED, deploymentManager));
    table.addShortcutListener(new DeleteFileShortcutListener(deploymentViewManager, table, "Delete",
            ShortcutAction.KeyCode.DELETE, null));
    table.setItemDescriptionGenerator(new ItemDescription());
    table.addItemClickListener(new ItemClickEvent.ItemClickListener() {
        @Override
        public void itemClick(ItemClickEvent event) {
            if (event.isDoubleClick()) {
                DeployableEntry deployableEntry = (DeployableEntry) event.getItemId();
                try {
                    ArtifactStatusReport report = deploymentManager
                            .getReport(deployableEntry.getUri().toString());
                    event.getComponent().getUI()
                            .addWindow(new DeployableWindow(deployableEntry, report).getWindow());
                } catch (ArtifactStatusReportException e) {
                    LOGGER.warn("Cannot get artifact status report for ''{0}''", deployableEntry.getUri(), e);
                    event.getComponent().getUI().addWindow(new DeployableWindow(deployableEntry).getWindow());
                }
            }
        }
    });
    deployedContainer.addComponent(table);
    deployedContainer.setExpandRatio(table, 1.5f);

    refresh();
}

From source file:com.peergreen.webconsole.scope.deployment.internal.deploymentplan.DeploymentPlanPanel.java

License:Open Source License

@PostConstruct
public void init() {
    setSizeFull();// w ww.j a  v  a  2  s.  c  o  m

    TreeTable table = new TreeTable();

    VerticalLayout mainContent = new VerticalLayout();
    mainContent.setSpacing(true);
    mainContent.setMargin(true);
    mainContent.setStyleName("deployable-style");
    mainContent.setSizeFull();

    setContent(mainContent);

    HorizontalLayout toolBar = new HorizontalLayout();
    toolBar.setMargin(true);
    toolBar.setSpacing(true);
    toolBar.setWidth("100%");

    // Deployment Plan name
    Label deploymentPlanNameLabel = new Label("Plan");
    toolBar.addComponent(deploymentPlanNameLabel);
    toolBar.setExpandRatio(deploymentPlanNameLabel, 1);

    deploymentPlanName = new TextField();
    deploymentPlanName.setInputPrompt(getDefaultName());
    deploymentPlanName.setWidth("100%");
    toolBar.addComponent(deploymentPlanName);
    toolBar.setComponentAlignment(deploymentPlanName, Alignment.TOP_LEFT);
    toolBar.setExpandRatio(deploymentPlanName, 3);

    error = new Label("", ContentMode.HTML);
    error.addStyleName("error");
    error.setSizeUndefined();
    error.addStyleName("light");
    error.addStyleName("v-animate-reveal");
    error.setVisible(false);
    toolBar.addComponent(error);
    toolBar.setComponentAlignment(error, Alignment.TOP_RIGHT);
    toolBar.setExpandRatio(error, 1);
    mainContent.addComponent(toolBar);
    mainContent.setComponentAlignment(toolBar, Alignment.TOP_LEFT);
    mainContent.setExpandRatio(toolBar, 1);

    VerticalLayout deploymentPlanContainer = new VerticalLayout();
    DragAndDropWrapper deploymentPlanContainerWrapper = new DragAndDropWrapper(deploymentPlanContainer);
    DropHandler deploymentPlanDropHandler = new DeploymentDropHandler(deploymentViewManager, this,
            notifierService);
    deploymentPlanContainerWrapper.setDropHandler(deploymentPlanDropHandler);
    deploymentPlanContainerWrapper.setSizeFull();
    mainContent.addComponent(deploymentPlanContainerWrapper);
    mainContent.setExpandRatio(deploymentPlanContainerWrapper, 10);

    container.addContainerProperty(TREE_ITEM_ID, String.class, null);
    table.setSizeFull();
    table.setImmediate(true);
    table.setMultiSelect(true);
    table.setSelectable(true);
    table.setContainerDataSource(container);
    table.setDragMode(Table.TableDragMode.MULTIROW);
    table.setItemCaptionPropertyId(TREE_ITEM_ID);
    table.setCellStyleGenerator(new ItemStyle(DeployableContainerType.DEPLOYED));
    table.setColumnHeaderMode(Table.ColumnHeaderMode.HIDDEN);
    table.setDropHandler(new OrderedContainerDropHandler(table, deploymentPlanDropHandler));
    table.addShortcutListener(new ShortcutListener("Delete", ShortcutAction.KeyCode.DELETE, null) {
        @Override
        public void handleAction(Object sender, Object target) {
            Table table = (Table) target;
            Collection<DeployableEntry> deployableEntries = (Collection<DeployableEntry>) table.getValue();
            for (DeployableEntry deployableEntry : deployableEntries) {
                removeDeployable(deployableEntry);
            }
        }
    });
    deploymentPlanContainer.addComponent(table);

    HorizontalLayout footer = new HorizontalLayout();
    footer.setSizeFull();
    footer.setSpacing(true);
    footer.setMargin(true);
    footer.addStyleName("footer");
    footer.setWidth("100%");

    deployIt = new CheckBox("Deploy this deployment plan");
    footer.addComponent(deployIt);
    footer.setComponentAlignment(deployIt, Alignment.TOP_LEFT);

    HorizontalLayout buttons = new HorizontalLayout();
    buttons.setSpacing(true);
    buttons.setMargin(true);
    Button cancel = new Button("Cancel");
    cancel.addClickListener(new CancelButtonListener());
    Button create = new Button("Create");
    create.addClickListener(new CreateButtonListener());
    create.addStyleName("wide");
    create.addStyleName("default");
    buttons.addComponent(cancel);
    buttons.addComponent(create);
    footer.addComponent(buttons);
    footer.setComponentAlignment(buttons, Alignment.TOP_RIGHT);

    mainContent.addComponent(footer);
    mainContent.setComponentAlignment(footer, Alignment.BOTTOM_RIGHT);
    mainContent.setExpandRatio(footer, 1);
}

From source file:com.pms.component.ganttchart.DemoUI.java

License:Apache License

public Component init() {
    ganttListener = null;/*w  w  w .  j  a v  a  2  s .  c o  m*/
    createGantt();

    MenuBar menu = controlsMenuBar();
    Panel controls = createControls();

    TabSheet tabsheet = new TabSheet();
    tabsheet.setSizeFull();

    Component wrapper = UriFragmentWrapperFactory.wrapByUriFragment(UI.getCurrent().getPage().getUriFragment(),
            gantt);
    if (wrapper instanceof GanttListener) {
        ganttListener = (GanttListener) wrapper;
    }

    final VerticalLayout layout = new VerticalLayout();
    layout.setStyleName("demoContentLayout");
    layout.setSizeFull();
    layout.addComponent(menu);
    layout.addComponent(controls);
    layout.addComponent(wrapper);
    layout.setExpandRatio(wrapper, 1);

    return layout;
}

From source file:com.pms.component.ganttchart.GanttChart.java

License:Apache License

public Component init(Project project) {
    ganttListener = null;// w ww . j  a va2  s  .  c o  m
    createGantt(project);

    MenuBar menu = controlsMenuBar();
    Panel controls = createControls();

    TabSheet tabsheet = new TabSheet();
    tabsheet.setSizeFull();

    Component wrapper = UriFragmentWrapperFactory.wrapByUriFragment(UI.getCurrent().getPage().getUriFragment(),
            gantt);
    if (wrapper instanceof GanttListener) {
        ganttListener = (GanttListener) wrapper;
    }

    final VerticalLayout layout = new VerticalLayout();
    layout.setStyleName("demoContentLayout");
    layout.setSizeFull();
    //layout.addComponent(menu);
    layout.addComponent(controls);
    layout.addComponent(wrapper);
    layout.setExpandRatio(wrapper, 1);

    return layout;
}

From source file:com.pms.component.ganttchart.scheduletask.TaskGanntChart.java

License:Apache License

public Component init(Project project) {

    this.project = project;

    ganttListener = null;/* ww  w  .ja va 2s  .c o m*/
    createGantt(project);

    MenuBar menu = controlsMenuBar();
    Panel controls = createControls();

    TabSheet tabsheet = new TabSheet();
    tabsheet.setSizeFull();

    /*  Component wrapper = UriFragmentWrapperFactory.wrapByUriFragment(UI
        .getCurrent().getPage().getUriFragment(), gantt);
    if (wrapper instanceof GanttListener) {
    ganttListener = (GanttListener) wrapper;
    }*/

    //to show table
    Component wrapper = UriFragmentWrapperFactory.wrapByUriFragment("table", gantt);
    if (wrapper instanceof GanttListener) {
        ganttListener = (GanttListener) wrapper;
    }

    final VerticalLayout layout = new VerticalLayout();
    layout.setStyleName("demoContentLayout");
    layout.setSizeFull();
    //layout.addComponent(menu);
    layout.addComponent(controls);
    layout.addComponent(wrapper);
    layout.setExpandRatio(wrapper, 1);

    controls.setVisible(false);

    return layout;
}

From source file:com.pms.component.ganttchart.scheduletask.UserStoryGanntChart.java

License:Apache License

public Component init(Project project) {

    this.project = project;

    ganttListener = null;//w  w w  .  ja va2 s . c om
    createGantt(project);

    MenuBar menu = controlsMenuBar();
    Panel controls = createControls();

    TabSheet tabsheet = new TabSheet();
    tabsheet.setSizeFull();

    /*        Component wrapper = UriFragmentWrapperFactory.wrapByUriFragment(UI.getCurrent().getPage().getUriFragment(), gantt);
            if (wrapper instanceof GanttListener) {
    ganttListener = (GanttListener) wrapper;
            }*/

    //to show table
    Component wrapper = UriFragmentWrapperFactory.wrapByUriFragment("table", gantt);
    if (wrapper instanceof GanttListener) {
        ganttListener = (GanttListener) wrapper;
    }

    final VerticalLayout layout = new VerticalLayout();
    layout.setStyleName("demoContentLayout");
    layout.setSizeFull();
    //layout.addComponent(menu);
    layout.addComponent(controls);
    layout.addComponent(wrapper);
    layout.setExpandRatio(wrapper, 1);

    controls.setVisible(false);

    return layout;
}

From source file:com.pms.component.member.taskganntchart.TaskGanttChart.java

License:Apache License

public Component init(Project project) {

    this.project = project;

    ganttListener = null;/*from   ww w .j a v a2 s  .  c  o  m*/
    createGantt(project);

    //MenuBar menu = controlsMenuBar();
    Panel controls = createControls();

    TabSheet tabsheet = new TabSheet();
    tabsheet.setSizeFull();

    //to show table
    Component wrapper = UriFragmentWrapperFactory.wrapByUriFragment("table", gantt);
    if (wrapper instanceof GanttListener) {
        ganttListener = (GanttListener) wrapper;
    }

    final VerticalLayout layout = new VerticalLayout();
    layout.setStyleName("demoContentLayout");
    layout.setSizeFull();
    //layout.addComponent(menu);
    layout.addComponent(controls);
    layout.addComponent(wrapper);
    layout.setExpandRatio(wrapper, 1);

    return layout;
}

From source file:com.rdonasco.config.web.ConfigApplication.java

License:Apache License

@Override
public void init() {
    Window mainWindow = new Window("rdonasco Config");
    setMainWindow(mainWindow);//from   w  w  w  .j av a  2s  .  c om
    final ConfigDataView controlledView = getConfigDataViewController().getControlledView();
    //      controlledView.setSizeFull();
    final VerticalLayout mainWindowLayout = (VerticalLayout) mainWindow.getContent();
    Button logoutButton = new Button("Refresh");
    logoutButton.addListener(new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(Button.ClickEvent event) {
            try {
                getConfigDataViewController().refreshView();
            } catch (WidgetException ex) {
                LOG.log(Level.WARNING, ex.getMessage(), ex);
            }
        }
    });
    setTheme("config");
    mainWindowLayout.setMargin(true);
    mainWindowLayout.setSpacing(true);
    mainWindowLayout.addStyleName("mainWindow");
    mainWindowLayout.setSizeFull();

    mainWindowLayout.addComponent(logoutButton);
    mainWindowLayout.addComponent(controlledView);
    mainWindowLayout.setExpandRatio(controlledView, 1);
}

From source file:com.rdonasco.datamanager.listeditor.view.ListEditorView.java

License:Apache License

@Override
public void initWidget() throws WidgetInitalizeException {
    setCaption(I18NResource.localize("List Editor"));
    setStyleName(ListEditorTheme.CSS_PANEL_BUBBLE);
    addItemButton.setCaption(I18NResource.localize("Add new item"));
    addItemButton.setWidth(100f, UNITS_PERCENTAGE);
    addItemButton.addStyleName(ListEditorTheme.CSS_SMALL);
    editorTable.addStyleName(ListEditorTheme.CSS_TABLE_SMALL_STRIPED);
    editorTable.addStyleName(ListEditorTheme.CSS_TABLE_BORDERLESS);
    VerticalLayout layout = (VerticalLayout) getContent();
    if (!isReadOnly()) {
        layout.addComponent(addItemButton);
    }/*from   www  .  java2s  .  co  m*/
    layout.addComponent(editorTable);
    editorTable.setSizeFull();
    layout.setExpandRatio(editorTable, 1);
    layout.setSpacing(true);
}

From source file:com.rdonasco.security.application.views.ApplicationListPanelView.java

License:Apache License

@Override
public void initWidget() throws WidgetInitalizeException {
    getAddButton().setCaption(I18NResource.localize("Add new"));
    getAddButton().setDescription(I18NResource.localize("Add new application"));
    getAddButton().setIcon(new ThemeResource(SecurityDefaultTheme.ICON_16x16_ADD));
    getAddButton().setWidth(100, UNITS_PERCENTAGE);
    getAddButton().addStyleName(SecurityDefaultTheme.CSS_SMALL);
    getRefreshButton().setCaption(I18NResource.localize("Refresh"));
    getRefreshButton().setIcon(new ThemeResource(SecurityDefaultTheme.ICON_16x16_REFRESH));
    getRefreshButton().addStyleName(SecurityDefaultTheme.CSS_SMALL);
    VerticalLayout content = ((VerticalLayout) getContent());
    content.setMargin(true);/*  w  w  w.  j a  va 2s  .  c  o m*/
    content.setHeight(600, UNITS_PIXELS);
    content.removeAllComponents();
    if (null != getDataViewListTable()) {
        getDataViewListTable().setSizeFull();
        HorizontalLayout buttonLayout = new HorizontalLayout();
        buttonLayout.setSpacing(true);
        buttonLayout.setWidth(100F, UNITS_PERCENTAGE);
        buttonLayout.addComponent(getAddButton());
        buttonLayout.addComponent(getRefreshButton());
        buttonLayout.setExpandRatio(getAddButton(), 1);
        content.addComponent(buttonLayout);
        content.addComponent(getDataViewListTable());
        content.setExpandRatio(getDataViewListTable(), 1);
        content.setSpacing(true);
    }
}