Example usage for com.vaadin.ui AbstractComponent setSizeFull

List of usage examples for com.vaadin.ui AbstractComponent setSizeFull

Introduction

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

Prototype

@Override
    public void setSizeFull() 

Source Link

Usage

From source file:de.mhus.lib.vaadin.layouter.LayUtil.java

License:Apache License

public static void configure(AbstractComponent layout, ResourceNode config) throws MException {
    if (config.getBoolean(LayoutBuilder.FULL_SIZE, false))
        layout.setSizeFull();
    else {/*  w w w  .j  a  v a2  s.c  o  m*/
        String width = config.getString(LayoutBuilder.WIDTH, null);
        if (width != null)
            layout.setWidth(width);
        String height = config.getString(LayoutBuilder.HEIGHT, null);
        if (height != null)
            layout.setHeight(height);
    }

    // margin
    //TODO      if (layout instanceof Layout && config.isProperty(LayoutBuilder.MARGIN))
    //         ((Layout)layout).setMargin(config.getBoolean(LayoutBuilder.MARGIN, false));
    // spacing
    if (layout instanceof Layout.SpacingHandler && config.isProperty(LayoutBuilder.SPACING))
        ((Layout.SpacingHandler) layout).setSpacing(config.getBoolean(LayoutBuilder.SPACING, false));
    // styles
    if (config.isProperty(LayoutBuilder.STYLE)) {
        layout.setStyleName(config.getExtracted(LayoutBuilder.STYLE));
    }
    // hidden
    if (config.getBoolean(LayoutBuilder.HIDDEN, false))
        layout.setVisible(false);

    // split
    if (layout instanceof AbstractSplitPanel) {
        String a = config.getString(LayoutBuilder.SPLIT_MIN, null);
        if (a != null) {
            float[] s = parseStringSize(a);
            if (s[0] >= 0)
                ((AbstractSplitPanel) layout).setMinSplitPosition(s[0], Unit.values()[(int) s[1]]);
        }
        a = config.getString(LayoutBuilder.SPLIT_MAX, null);
        if (a != null) {
            float[] s = parseStringSize(a);
            if (s[0] >= 0)
                ((AbstractSplitPanel) layout).setMaxSplitPosition(s[0], Unit.values()[(int) s[1]]);
        }
        a = config.getString(LayoutBuilder.SPLIT_POS, null);
        if (a != null) {
            float[] s = parseStringSize(a);
            if (s[0] >= 0)
                ((AbstractSplitPanel) layout).setSplitPosition(s[0], Unit.values()[(int) s[1]]);
        }
    }

}

From source file:eu.lod2.LOD2Demo.java

License:Apache License

private void resetSizeFull(AbstractComponentContainer comp) {

    Iterator<Component> it = comp.getComponentIterator();
    while (it.hasNext()) {
        Component c = it.next();/*from w  ww.  ja  va2s .co  m*/
        if (c instanceof AbstractComponent) {
            AbstractComponent ac = (AbstractComponent) c;
            ac.setSizeFull();
            if (ac.getHeight() < 0) {
                ac.setHeight("100%");
            }
            ;
        }
        ;
        if (c instanceof AbstractComponentContainer) {
            AbstractComponentContainer acc = (AbstractComponentContainer) c;
            resetSizeFull(acc);
        }
        ;
    }
    ;

}

From source file:eu.lod2.LOD2Demo.java

License:Apache License

public void showInWorkspace(AbstractComponent component) {
    workspace.removeAllComponents();//from w  w w .  j  a  va 2  s  . com
    workspace.addComponent(component);
    // stretch the content to the full workspace area
    welcome.setHeight("110px");
    component.setSizeFull();
    workspace.setSizeFull();
    workspace.setExpandRatio(component, 1.0f);
    mainContainer.setExpandRatio(workspace, 2.0f);
    mainWindow.getContent().setSizeFull();
}

From source file:org.hoot.HootView.java

License:Apache License

/**
 * {@inheritDoc}/* w w  w  . j a  va  2  s  .c  o  m*/
 */
@Override
protected void initializeComponents() {
    final int columnCount = 5;
    final int rowCount = 3;

    final GridLayout layout = this;
    layout.setMargin(true);
    layout.setSpacing(true);
    layout.setColumns(columnCount);
    layout.setRows(rowCount);
    //layout.setColumnExpandRatio(0, MARGIN_COLUMN_EXPAND_RATIO);
    //layout.setColumnExpandRatio(MARGIN_COLUMN_RIGTH_INDEX, MARGIN_COLUMN_EXPAND_RATIO);
    layout.setRowExpandRatio(1, 1.0f);
    layout.setColumnExpandRatio(2, 1.0f);
    layout.setSizeFull();

    final AbstractComponent logoComponent = getComponent("logo");
    logoComponent.setWidth(NAVIGATION_COLUMN_WIDTH, Unit.PIXELS);
    layout.addComponent(logoComponent, 1, 0);

    final AbstractComponent navigationComponent = getComponent("navigation");
    navigationComponent.setWidth(NAVIGATION_COLUMN_WIDTH, Unit.PIXELS);
    navigationComponent.setHeight(NAVIGATION_HEIGHT, Unit.PIXELS);
    layout.addComponent(navigationComponent, 1, 1);

    //final AbstractComponent headerComponent = getComponent("header");
    //headerComponent.setWidth(CONTENT_COLUMN_WIDTH, Unit.PIXELS);
    //headerComponent.setSizeFull();
    //layout.addComponent(headerComponent, 2, 0);

    final AbstractComponent contentComponent = getComponent("content");
    //contentComponent.setWidth(CONTENT_COLUMN_WIDTH, Unit.PIXELS);
    contentComponent.setSizeFull();
    layout.addComponent(contentComponent, 2, 0, 2, 2);

    //final AbstractComponent footerComponent = getComponent("footer");
    //headerComponent.setWidth(CONTENT_COLUMN_WIDTH, Unit.PIXELS);
    //layout.addComponent(footerComponent, 2, 2);
}

From source file:org.vaadin.addons.sitekit.site.FixedWidthView.java

License:Apache License

/**
 * {@inheritDoc}//from w w w .j a va  2  s.c  o  m
 */
@Override
protected void initializeComponents() {
    final int columnCount = 5;
    final int rowCount = 3;

    final GridLayout layout = this;
    layout.setMargin(true);
    layout.setColumns(columnCount);
    layout.setRows(rowCount);
    layout.setColumnExpandRatio(0, MARGIN_COLUMN_EXPAND_RATIO);
    layout.setColumnExpandRatio(MARGIN_COLUMN_RIGTH_INDEX, MARGIN_COLUMN_EXPAND_RATIO);
    layout.setRowExpandRatio(1, 1.0f);
    layout.setSizeFull();
    layout.setMargin(false);
    layout.setSpacing(true);

    final AbstractComponent logoComponent = getComponent("logo");
    logoComponent.setWidth(NAVIGATION_COLUMN_WIDTH, Unit.PIXELS);
    layout.addComponent(logoComponent, 1, 0);

    final AbstractComponent navigationComponent = getComponent("navigation");
    navigationComponent.setWidth(NAVIGATION_COLUMN_WIDTH, Unit.PIXELS);
    navigationComponent.setHeight(NAVIGATION_HEIGHT, Unit.PIXELS);
    layout.addComponent(navigationComponent, 1, 1);

    final AbstractComponent headerComponent = getComponent("header");
    headerComponent.setWidth(CONTENT_COLUMN_WIDTH, Unit.PIXELS);
    headerComponent.setSizeFull();
    layout.addComponent(headerComponent, 2, 0);

    final AbstractComponent contentComponent = getComponent("content");
    contentComponent.setWidth(CONTENT_COLUMN_WIDTH, Unit.PIXELS);
    contentComponent.setSizeFull();
    layout.addComponent(contentComponent, 2, 1);

    final AbstractComponent footerComponent = getComponent("footer");
    headerComponent.setWidth(CONTENT_COLUMN_WIDTH, Unit.PIXELS);
    layout.addComponent(footerComponent, 2, 2);
}