Example usage for com.vaadin.ui Component setWidth

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

Introduction

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

Prototype

public void setWidth(String width);

Source Link

Document

Sets the width of the component using String presentation.

Usage

From source file:org.metawidget.vaadin.ui.layout.VerticalLayout.java

License:LGPL

public void layoutWidget(Component component, String elementName, Map<String, String> attributes,
        ComponentContainer container, VaadinMetawidget metawidget) {

    // Do not render empty stubs

    if (component instanceof Stub && !((Stub) component).getComponentIterator().hasNext()) {
        return;/*from   w  w  w  .j  a v a2  s . c  o m*/
    }

    // Add it

    com.vaadin.ui.VerticalLayout layout = (com.vaadin.ui.VerticalLayout) container.getComponentIterator()
            .next();
    component.setWidth("100%");
    layout.addComponent(component);
}

From source file:org.processbase.ui.bpm.generator.GeneratedWindow.java

License:Open Source License

protected void generateWindow() throws Exception {
    prepareAttachmentDefinitions();//from   www.j ava2s . c o  m
    prepareGroovyScripts();
    for (Page page : pageFlow.getPages().getPages()) {
        TableStyle ts = barResource.getTableStyle(page);
        GridLayout gridLayout = new GridLayout(ts.getColumns(), ts.getRows());
        gridLayout.setMargin(false, true, true, true);
        gridLayout.setSpacing(true);
        for (Object wg : page.getWidgets().getWidgetsAndGroups()) {
            Component component = null;
            if (wg instanceof Widget) {
                Widget widget = (Widget) wg;
                component = getComponent(widget);
                components.put(component, widget);
                fields.put("field_" + widget.getId(), component);
                ComponentStyle componentStyle = ts.getElements().get(widget.getId());
                int fColumn = componentStyle.getPosition().getFColumn();
                int fRow = componentStyle.getPosition().getFRow();
                int tColumn = componentStyle.getPosition().getTColumn();
                int tRow = componentStyle.getPosition().getTRow();
                //                    System.out.println(widget.getId() + " " + fColumn + " " + tColumn + " " + fRow + " " + tRow);
                CSSProperty cssProperty = componentStyle.getCss();
                if (cssProperty != null) {
                    //                        System.out.print(widget.getId() + " H:" + cssProperty.getHeigth());
                    //                        System.out.print(" W:" + cssProperty.getWidth());
                    //                        System.out.println(" A:" + cssProperty.getAlign());
                } else {
                    if (!(component instanceof Table) && !(component instanceof Button)
                            && (fColumn == tColumn)) {
                        component.setWidth("200px");
                    }
                }
                gridLayout.addComponent(component, fColumn, fRow, tColumn, tRow);
            } else if (wg instanceof WidgetGroup) {
            }
        }
        pages.add(gridLayout);
    }
    taskPanel.setContent(pages.get(currentPage));
    taskPanel.setCaption(pageFlow.getPages().getPages().get(currentPage).getPageLabel());
}

From source file:org.rapidpm.jumpstart.vaadin.ui.basics.MainWindowImpl.java

License:Apache License

@PostConstruct
private void buildMainLayout() {
    this.setSizeFull();
    workingAreaContainer.setSizeFull();/*from  ww  w  . j a  v a  2  s. c o  m*/
    workingAreaContainer.setId(WORKING_AREA_CONTAINER);
    menubar.setSizeUndefined();
    Component topPanel = this.topPanel.getComponent();
    topPanel.setSizeUndefined();
    topPanel.setWidth("100%");
    menubar.setWidth("100%");
    workingAreaContainer.setSizeFull();
    this.setSpacing(false);
    this.addComponent(topPanel);
    this.addComponent(menubar);
    this.addComponent(workingAreaContainer);
    this.setExpandRatio(workingAreaContainer, 1);
    this.setComponentAlignment(workingAreaContainer, Alignment.MIDDLE_CENTER);
    this.setSpacing(false);
}

From source file:org.semanticsoft.vaaclipse.widgets.TopbarComponent.java

License:Open Source License

public void setContent(Component content) {
    layout.removeComponent(this.content);
    layout.addComponent(content, 1, 1);//from  w w  w .  j  a v a  2 s. c o m

    this.content = content;
    content.setSizeUndefined();
    content.setWidth("100%");
}

From source file:org.semanticsoft.vaaclipse.widgets.WorkbenchWindow.java

License:Open Source License

public void setLeftBar(Component bar) {
    if (bar == null) {
        leftBarContainer.removeAllComponents();
        return;/*from  ww w. j  a va  2 s.c  om*/
    }

    bar.setWidth(-1);
    bar.setHeight("100%");

    leftBarContainer.removeAllComponents();
    leftBarContainer.addComponent(bar);
}

From source file:org.semanticsoft.vaaclipse.widgets.WorkbenchWindow.java

License:Open Source License

public void setRightBar(Component bar) {
    if (bar == null) {
        rightBarContainer.removeAllComponents();
        return;//from  w  w  w . ja va 2s.c o  m
    }

    bar.setWidth(-1);
    bar.setHeight("100%");

    rightBarContainer.removeAllComponents();
    rightBarContainer.addComponent(bar);
}

From source file:org.semanticsoft.vaaclipse.widgets.WorkbenchWindow.java

License:Open Source License

public void setBottomBar(Component bar) {
    if (bar == null) {
        bottomBarContainer.removeAllComponents();
        return;//from  w  w  w.  j a va  2s .c om
    }

    bar.setWidth("100%");
    bar.setHeight(-1);

    bottomBarContainer.removeAllComponents();
    bottomBarContainer.addComponent(bar);
}

From source file:org.vaadin.addons.portallayout.portlet.Portlet.java

License:Apache License

private void delegateSizeManagement(boolean initial) {
    final Component c = getParent();
    String width = String.format("%d%s", (int) c.getWidth(), c.getWidthUnits().getSymbol());

    if (c.getWidth() >= 0 && !"100%".equals(width)) {
        c.setWidth("100%");
        getState().width = width;/*  w  w w .  j a v a 2  s .  c  om*/
    }

    String height = String.format("%d%s", (int) c.getHeight(), c.getHeightUnits().getSymbol());
    if (c.getHeight() >= 0 && !"100%".equals(height)) {
        c.setHeight("100%");
        getState().height = height;
    }
    getParent().beforeClientResponse(initial);
}