Example usage for com.vaadin.ui Component setHeight

List of usage examples for com.vaadin.ui Component setHeight

Introduction

In this page you can find the example usage for com.vaadin.ui Component setHeight.

Prototype

public void setHeight(float height, Unit unit);

Source Link

Document

Sets the height of the object.

Usage

From source file:com.expressui.core.view.page.DashboardPage.java

License:Open Source License

private void setWidthAndHeightIfNotNull(Component component) {
    if (cellPixelWidth != null) {
        component.setWidth(cellPixelWidth, Sizeable.UNITS_PIXELS);
        if (component instanceof VisualizationComponent) {
            ((VisualizationComponent) component).setOption("width", cellPixelWidth);
        }//from ww w .j a  va  2 s .co  m
    }
    if (cellPixelHeight != null) {
        component.setHeight(cellPixelHeight, Sizeable.UNITS_PIXELS);
        if (component instanceof VisualizationComponent) {
            ((VisualizationComponent) component).setOption("height", cellPixelHeight);
        }
    }
}

From source file:com.google.code.vaadin.internal.preconfigured.VaadinComponentsInjector.java

License:Apache License

private void configureComponentApi(Component component, Preconfigured preconfigured) {
    component.setEnabled(preconfigured.enabled());
    component.setVisible(preconfigured.visible());
    component.setReadOnly(preconfigured.readOnly());

    String[] styleName = preconfigured.styleName();
    if (styleName.length > 0) {
        for (String style : styleName) {
            component.addStyleName(style);
        }/*from   w w  w  .j a  va2 s .  c om*/
    }

    configureLocalization(component, preconfigured);

    String id = preconfigured.id();
    if (!id.isEmpty()) {
        component.setId(id);
    }

    if (preconfigured.sizeFull()) {
        component.setSizeFull();
    } else if (preconfigured.sizeUndefined()) {
        component.setSizeUndefined();
    } else {
        float width = preconfigured.width();
        if (width > -1.0f) {
            Sizeable.Unit widthUnits = preconfigured.widthUnits();
            component.setWidth(width, widthUnits);
        }
        float height = preconfigured.height();
        if (height > -1.0f) {
            Sizeable.Unit heightUnits = preconfigured.heightUnits();
            component.setHeight(height, heightUnits);
        }
    }
}

From source file:de.kaiserpfalzEdv.vaadin.ui.defaultviews.editor.impl.BaseEditorViewImpl.java

License:Apache License

private void initializeLayout() {
    layout = new HorizontalLayout();
    layout.setWidth(100f, PERCENTAGE);/* w w  w. j  av  a2  s .c o m*/
    layout.setHeight(97f, PERCENTAGE);
    layout.setMargin(true);
    layout.setSpacing(true);
    layout.setResponsive(true);

    editorLayout = new VerticalLayout();
    editorLayout.setResponsive(true);
    layout.addComponent(editorLayout);

    Component data = getEditor(presenter.getData());
    data.setWidth(87f, PERCENTAGE);
    data.setHeight(100f, PERCENTAGE);

    Label fillSpace = new Label();
    fillSpace.setSizeFull();

    editorLayout.addComponent(data);
    editorLayout.addComponent(fillSpace);

    editorLayout.setExpandRatio(data, 10f);
    editorLayout.setExpandRatio(fillSpace, 90f);

    layout.setExpandRatio(editorLayout, 90f);
    setCompositionRoot(layout);
}

From source file:org.activiti.explorer.ui.reports.ChartComponent.java

License:Apache License

public void addChart(String description, Component chart, String errorMessage) {

    addComponent(new Label(" ", Label.CONTENT_XHTML));
    addComponent(new Label(" ", Label.CONTENT_XHTML));

    // Description
    if (description != null) {
        Label label = new Label(description);
        label.addStyleName(Reindeer.LABEL_H2);
        addComponent(label);//from   w  ww  .j  av  a 2 s. c  o  m

        addComponent(new Label(" ", Label.CONTENT_XHTML));
    }

    // Chart
    if (chart != null) {
        if (chart instanceof DCharts) {
            // DCharts doesn't know how to size itself
            chart.setWidth(600, UNITS_PIXELS);
            chart.setHeight(450, UNITS_PIXELS);
            ((DCharts) chart).show();
        }
        addComponent(chart);
    }

    // Error message
    if (errorMessage != null) {
        Label errorLabel = new Label(errorMessage);
        addComponent(errorLabel);
    }
}

From source file:org.hip.vif.web.components.VIFBody.java

License:Open Source License

@Override
protected Component createToolbar(final Label inSeparator) {
    final Component out = super.createToolbar(inSeparator);
    out.setHeight(23, Unit.PIXELS);
    return out;/*from  w  ww  .  j  ava  2 s  .  c o m*/
}

From source file:org.jdal.vaadin.auth.LoginView.java

License:Apache License

@Override
protected Component buildPanel() {
    Label greeting = new Label(getMessage("loginView.greeting"));
    greeting.addStyleName("jd-login-greeting");
    greeting.addStyleName(Reindeer.LABEL_H2);
    Label applicationNameLabel = new Label(getMessage(applicationName));
    applicationNameLabel.addStyleName("jd-login-appname");
    applicationNameLabel.addStyleName(Reindeer.LABEL_H2);
    applicationNameLabel.setSizeUndefined();

    loginButton.addClickListener(this);
    loginButton.setCaption(getMessage("loginView.loginButtonCaption"));
    loginButton.addStyleName("jd-login-button");

    // add shortcut listener for enter key
    loginButton.addShortcutListener(new ShortcutListener("Sign In", KeyCode.ENTER, null) {
        @Override// w  w w  .  j a  va2 s  . co  m
        public void handleAction(Object sender, Object target) {
            loginButton.click();
        }
    });

    Image image = null;
    HorizontalLayout imageWrapper = null;

    if (applicationIcon != null) {
        image = new Image(null, applicationIcon);
        image.setSizeUndefined();
        image.setStyleName("jd-login-icon");
        imageWrapper = new HorizontalLayout();
        imageWrapper.setMargin(false);
        imageWrapper.addComponent(image);
        imageWrapper.setComponentAlignment(image, Alignment.MIDDLE_CENTER);
    }

    BoxFormBuilder fb = new BoxFormBuilder();
    fb.setDefaultWidth(BoxFormBuilder.SIZE_FULL);
    fb.row();
    fb.startBox();
    fb.setFixedHeight();
    fb.row(false);
    fb.add(greeting, Alignment.TOP_LEFT);
    fb.add(applicationNameLabel, Alignment.TOP_RIGHT);
    fb.endBox();
    // add application icon
    if (image != null) {
        fb.row(BoxFormBuilder.SIZE_FULL);
        fb.add(imageWrapper, BoxFormBuilder.SIZE_FULL, Alignment.MIDDLE_CENTER);
    }
    fb.row();
    fb.startBox();
    fb.row(30);
    fb.add(errorLabel, BoxFormBuilder.SIZE_FULL, Alignment.BOTTOM_CENTER);
    fb.endBox();
    fb.row();
    fb.startBox();
    fb.setFixedHeight();
    fb.row();
    fb.add(username, getMessage("loginView.username"), Alignment.BOTTOM_CENTER);
    fb.add(password, getMessage("loginView.password"), Alignment.BOTTOM_CENTER);
    fb.add(loginButton, 100, Alignment.BOTTOM_CENTER);
    fb.endBox();

    Component form = fb.getForm();
    form.setWidth(this.getWidth(), Unit.PIXELS);
    form.setHeight(getHeight(), Unit.PIXELS);
    form.setStyleName("jd-login");

    return form;
}

From source file:org.jdal.vaadin.ui.form.SimpleBoxFormBuilder.java

License:Apache License

/**
 * Builds the panel form.//  w  w w .j  a va 2s. c  o  m
 * @return the form component
 */
public Component getForm() {

    for (int i = 0; i < columns.size(); i++) {
        VerticalLayout box = columns.get(i);
        int width = columnsWidth.get(i);

        if (width > SIZE_UNDEFINED && width < SIZE_FULL) {
            box.setWidth(width, Unit.PIXELS);
            // shrink container
            container.setExpandRatio(box, 0);
        } else if (width == SIZE_FULL) {
            box.setWidth("100%");
            container.setExpandRatio(box, 1);
        } else {
            container.setExpandRatio(box, 0);
            box.setWidth(Sizeable.SIZE_UNDEFINED, Unit.PIXELS);
        }

        for (int j = 0; j < rowsHeight.size(); j++) {
            Component c = box.getComponent(j);
            int height = rowsHeight.get(j);

            if (height > SIZE_UNDEFINED && height < SIZE_FULL) {
                c.setHeight(height, Unit.PIXELS);
                box.setExpandRatio(c, 0);
            } else if (height == SIZE_FULL) {
                c.setHeight("100%");
                box.setExpandRatio(c, 1);
            } else {
                box.setExpandRatio(c, 0);
            }
        }
    }

    if (fixedHeight) {
        container.setHeight(getFormHeight(), Unit.PIXELS);
    } else {
        container.setHeight(100, Unit.PERCENTAGE);
    }

    if (fixedWidth) {
        container.setWidth(Sizeable.SIZE_UNDEFINED, Unit.PIXELS);
    } else {
        container.setWidth(100, Unit.PERCENTAGE);
    }

    container.addStyleName("jd-box");

    if (debug)
        container.addStyleName("jd-box-debug");

    return container;
}

From source file:org.lucidj.renderer.DefaultObjectRenderer.java

License:Apache License

private void apply_renderer(Object obj) {
    Component new_component = null;

    log.info("apply_renderer: obj={}", obj);
    current_object = obj;/*from   w  w w  .ja  va  2  s  .  c  o  m*/

    if (obj == null) {
        // Will use the default component to display 'null'
        current_renderer = null;
    } else if ((current_renderer = renderer_factory.locateAndBindRenderer(this, obj)) != null) {
        // Issue initial update
        current_renderer.objectUpdated();
        new_component = current_renderer.renderingComponent();
    }

    // Fallback to default renderer if we fail to get proper renderer or its instance
    if (current_renderer == null) {
        default_component.setValue(obj == null ? "null" : obj.getClass().getSimpleName());
        new_component = default_component;
    }

    if (current_component != null) {
        // Copy current component dimensions
        new_component.setWidth(current_component.getWidth(), current_component.getWidthUnits());
        new_component.setHeight(current_component.getHeight(), current_component.getHeightUnits());
    }

    current_component = new_component;
    setCompositionRoot(new_component);

    log.info("apply_renderer: current_renderer={} current_component={}", current_renderer, current_component);
}

From source file:org.primaldev.ppm.util.ChartTypeComponent.java

License:Apache License

public void addChart(String description, Component chart, String errorMessage) {

    addComponent(new Label("&nbsp;", ContentMode.HTML));
    addComponent(new Label("&nbsp;", ContentMode.HTML));

    // Description
    if (description != null) {
        Label label = new Label(description);
        label.addStyleName(Reindeer.LABEL_H2);
        addComponent(label);// w w  w.  j  av  a  2s.  com

        addComponent(new Label("&nbsp;", ContentMode.HTML));
    }

    // Chart
    if (chart != null) {
        if (chart instanceof DCharts) {
            // DCharts doesn't know how to size itself
            chart.setWidth(400, Unit.PIXELS);
            chart.setHeight(250, Unit.PIXELS);
            ((DCharts) chart).show();
        }
        addComponent(chart);
    }

    // Error message
    if (errorMessage != null) {
        Label errorLabel = new Label(errorMessage);
        addComponent(errorLabel);
    }
}

From source file:org.vaadin.tori.component.Breadcrumbs.java

License:Apache License

private Component getCategoryLink(final Category category) {
    HorizontalLayout result = new HorizontalLayout();
    result.setSpacing(true);/*from ww  w  .j a  v  a 2  s.c  o  m*/
    result.setHeight(100.0f, Unit.PERCENTAGE);
    result.addStyleName("categorylink");
    final Link crumb = new Link(category.getName(), new ExternalResource(
            "#" + ToriNavigator.ApplicationView.CATEGORIES.getUrl() + "/" + category.getId()));
    crumb.setHeight(100.0f, Unit.PERCENTAGE);
    result.addComponent(crumb);
    result.setComponentAlignment(crumb, Alignment.MIDDLE_CENTER);
    Component siblingMenu = getSiblingMenuBar(category);
    siblingMenu.setHeight(100.0f, Unit.PERCENTAGE);
    result.addComponent(siblingMenu);
    result.setComponentAlignment(siblingMenu, Alignment.MIDDLE_CENTER);
    return result;
}