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.icrisat.gdms.ui.GDMSMain.java

/** Following method updates the contents of the Upload tab */
protected void updateUploadTabComponent() {
    Component newUploadTabComponent = (Component) new UploadComponent(this);
    newUploadTabComponent.setWidth("100%");
    Component currentUploadTabComponent = _tabsheet.getSelectedTab();
    _tabsheet.replaceComponent(currentUploadTabComponent, newUploadTabComponent);

    _tabsheet.requestRepaint();//from  www  .  java 2 s . co  m
}

From source file:org.icrisat.gdms.ui.GDMSMain.java

/** Following method updates the contents of the Retrieve tab */
protected void updateRetrieveTabComponent() {

    Component newRetrieveTabComponent = (Component) new RetrieveComponent(this);
    newRetrieveTabComponent.setWidth("100%");
    Component currentRetrieveTabComponent = _tabsheet.getSelectedTab();

    _tabsheet.replaceComponent(currentRetrieveTabComponent, newRetrieveTabComponent);
    _tabsheet.requestRepaint();// www  .ja v  a2  s  .  c om
}

From source file:org.icrisat.gdms.ui.GDMSMain.java

/** Following method updates the contents of the Delete tab */
protected void updateDeleteTabComponent() {

    Component newDeleteTabComponent = (Component) new DeleteComponent(this);
    newDeleteTabComponent.setWidth("100%");
    Component currentDeleteTabComponent = _tabsheet.getSelectedTab();

    _tabsheet.replaceComponent(currentDeleteTabComponent, newDeleteTabComponent);
    _tabsheet.requestRepaint();/*  w  w  w .j  a va  2  s.c om*/
}

From source file:org.icrisat.gdms.ui.GDMSMain.java

/** 
 *  Following method updates the contents of Upload, Retrieve and Delete tabs in the TabSheet
 *  to display the default data, if no MenuItem is selected
 *  /*from  w w w  . j a  v  a  2  s.c o m*/
 */
protected void updateAllTabComponents() {
    Component newUploadTabComponent = (Component) new UploadComponent(this);
    newUploadTabComponent.setWidth("100%");
    Component existingUploadTabcomponent = _tabsheet.getTab(1).getComponent();
    _tabsheet.replaceComponent(existingUploadTabcomponent, newUploadTabComponent);

    Component newRetrieveTabComponent = (Component) new RetrieveComponent(this);
    newRetrieveTabComponent.setWidth("100%");
    Component existingRetrieveTabcomponent = _tabsheet.getTab(2).getComponent();
    _tabsheet.replaceComponent(existingRetrieveTabcomponent, newRetrieveTabComponent);

    Component newDeleteTabComponent = (Component) new DeleteComponent(this);
    newDeleteTabComponent.setWidth("100%");
    Component existingDeleteTabcomponent = _tabsheet.getTab(3).getComponent();
    _tabsheet.replaceComponent(existingDeleteTabcomponent, newDeleteTabComponent);

    _tabsheet.requestRepaint();

}

From source file:org.lunifera.mobile.vaadin.ecview.presentation.internal.NavigationPagePresentation.java

License:Open Source License

/**
 * Sets the alignment to the component.//from w w  w  . j  a  va2  s . c  o  m
 * 
 * @param child
 * @param yAlignment
 */
protected void applyAlignment(Component child, YAlignment yAlignment) {

    if (yAlignment != null) {
        child.setSizeUndefined();
        switch (yAlignment) {
        case BOTTOM_CENTER:
            verticalLayout.setComponentAlignment(child, Alignment.BOTTOM_CENTER);
            break;
        case BOTTOM_FILL:
            verticalLayout.setComponentAlignment(child, Alignment.BOTTOM_LEFT);
            child.setWidth("100%");
            break;
        case BOTTOM_LEFT:
            verticalLayout.setComponentAlignment(child, Alignment.BOTTOM_LEFT);
            break;
        case BOTTOM_RIGHT:
            verticalLayout.setComponentAlignment(child, Alignment.BOTTOM_RIGHT);
            break;
        case MIDDLE_CENTER:
            verticalLayout.setComponentAlignment(child, Alignment.MIDDLE_CENTER);
            break;
        case MIDDLE_FILL:
            verticalLayout.setComponentAlignment(child, Alignment.MIDDLE_LEFT);
            child.setWidth("100%");
            break;
        case MIDDLE_LEFT:
            verticalLayout.setComponentAlignment(child, Alignment.MIDDLE_LEFT);
            break;
        case MIDDLE_RIGHT:
            verticalLayout.setComponentAlignment(child, Alignment.MIDDLE_RIGHT);
            break;
        case TOP_CENTER:
            verticalLayout.setComponentAlignment(child, Alignment.TOP_CENTER);
            break;
        case TOP_FILL:
            verticalLayout.setComponentAlignment(child, Alignment.TOP_LEFT);
            child.setWidth("100%");
            break;
        case TOP_LEFT:
            verticalLayout.setComponentAlignment(child, Alignment.TOP_LEFT);
            break;
        case TOP_RIGHT:
            verticalLayout.setComponentAlignment(child, Alignment.TOP_RIGHT);
            break;
        case FILL_CENTER:
            verticalLayout.setComponentAlignment(child, Alignment.TOP_CENTER);
            child.setHeight("100%");
            break;
        case FILL_FILL:
            verticalLayout.setComponentAlignment(child, Alignment.TOP_LEFT);
            child.setWidth("100%");
            child.setHeight("100%");
            break;
        case FILL_LEFT:
            verticalLayout.setComponentAlignment(child, Alignment.TOP_LEFT);
            child.setHeight("100%");
            break;
        case FILL_RIGHT:
            verticalLayout.setComponentAlignment(child, Alignment.TOP_RIGHT);
            child.setHeight("100%");
            break;
        default:
            break;
        }
    }
}

From source file:org.lunifera.runtime.web.ecview.presentation.vaadin.internal.FormLayoutPresentation.java

License:Open Source License

/**
 * Sets the alignment to the component.//w  ww.j a v  a  2  s  .co m
 * 
 * @param child
 * @param yAlignment
 */
protected void applyAlignment(Component child, YAlignment yAlignment) {

    if (yAlignment != null) {
        child.setWidth("-1%");
        child.setHeight("-1%");
        switch (yAlignment) {
        case BOTTOM_CENTER:
            formLayout.setComponentAlignment(child, Alignment.BOTTOM_CENTER);
            break;
        case BOTTOM_FILL:
            formLayout.setComponentAlignment(child, Alignment.BOTTOM_LEFT);
            child.setWidth("100%");
            break;
        case BOTTOM_LEFT:
            formLayout.setComponentAlignment(child, Alignment.BOTTOM_LEFT);
            break;
        case BOTTOM_RIGHT:
            formLayout.setComponentAlignment(child, Alignment.BOTTOM_RIGHT);
            break;
        case MIDDLE_CENTER:
            formLayout.setComponentAlignment(child, Alignment.MIDDLE_CENTER);
            break;
        case MIDDLE_FILL:
            formLayout.setComponentAlignment(child, Alignment.MIDDLE_LEFT);
            child.setWidth("100%");
            break;
        case MIDDLE_LEFT:
            formLayout.setComponentAlignment(child, Alignment.MIDDLE_LEFT);
            break;
        case MIDDLE_RIGHT:
            formLayout.setComponentAlignment(child, Alignment.MIDDLE_RIGHT);
            break;
        case TOP_CENTER:
            formLayout.setComponentAlignment(child, Alignment.TOP_CENTER);
            break;
        case TOP_FILL:
            formLayout.setComponentAlignment(child, Alignment.TOP_LEFT);
            child.setWidth("100%");
            break;
        case TOP_LEFT:
            formLayout.setComponentAlignment(child, Alignment.TOP_LEFT);
            break;
        case TOP_RIGHT:
            formLayout.setComponentAlignment(child, Alignment.TOP_RIGHT);
            break;
        case FILL_CENTER:
            formLayout.setComponentAlignment(child, Alignment.TOP_CENTER);
            child.setHeight("100%");
            break;
        case FILL_FILL:
            formLayout.setComponentAlignment(child, Alignment.TOP_LEFT);
            child.setWidth("100%");
            child.setHeight("100%");
            break;
        case FILL_LEFT:
            formLayout.setComponentAlignment(child, Alignment.TOP_LEFT);
            child.setHeight("100%");
            break;
        case FILL_RIGHT:
            formLayout.setComponentAlignment(child, Alignment.TOP_RIGHT);
            child.setHeight("100%");
            break;
        default:
            break;
        }
    }
}

From source file:org.lunifera.runtime.web.ecview.presentation.vaadin.internal.GridLayoutPresentation.java

License:Open Source License

/**
 * Sets the alignment to the component.//  w  w w  .  j a v  a  2s.com
 * 
 * @param child
 * @param yAlignment
 */
protected void applyAlignment(Component child, YAlignment yAlignment) {

    if (yAlignment != null) {
        child.setWidth("-1%");
        child.setHeight("-1%");
        switch (yAlignment) {
        case BOTTOM_CENTER:
            gridlayout.setComponentAlignment(child, Alignment.BOTTOM_CENTER);
            break;
        case BOTTOM_FILL:
            gridlayout.setComponentAlignment(child, Alignment.BOTTOM_LEFT);
            child.setWidth("100%");
            break;
        case BOTTOM_LEFT:
            gridlayout.setComponentAlignment(child, Alignment.BOTTOM_LEFT);
            break;
        case BOTTOM_RIGHT:
            gridlayout.setComponentAlignment(child, Alignment.BOTTOM_RIGHT);
            break;
        case MIDDLE_CENTER:
            gridlayout.setComponentAlignment(child, Alignment.MIDDLE_CENTER);
            break;
        case MIDDLE_FILL:
            gridlayout.setComponentAlignment(child, Alignment.MIDDLE_LEFT);
            child.setWidth("100%");
            break;
        case MIDDLE_LEFT:
            gridlayout.setComponentAlignment(child, Alignment.MIDDLE_LEFT);
            break;
        case MIDDLE_RIGHT:
            gridlayout.setComponentAlignment(child, Alignment.MIDDLE_RIGHT);
            break;
        case TOP_CENTER:
            gridlayout.setComponentAlignment(child, Alignment.TOP_CENTER);
            break;
        case TOP_FILL:
            gridlayout.setComponentAlignment(child, Alignment.TOP_LEFT);
            child.setWidth("100%");
            break;
        case TOP_LEFT:
            gridlayout.setComponentAlignment(child, Alignment.TOP_LEFT);
            break;
        case TOP_RIGHT:
            gridlayout.setComponentAlignment(child, Alignment.TOP_RIGHT);
            break;
        case FILL_CENTER:
            gridlayout.setComponentAlignment(child, Alignment.TOP_CENTER);
            child.setHeight("100%");
            break;
        case FILL_FILL:
            gridlayout.setComponentAlignment(child, Alignment.TOP_LEFT);
            child.setWidth("100%");
            child.setHeight("100%");
            break;
        case FILL_LEFT:
            gridlayout.setComponentAlignment(child, Alignment.TOP_LEFT);
            child.setHeight("100%");
            break;
        case FILL_RIGHT:
            gridlayout.setComponentAlignment(child, Alignment.TOP_RIGHT);
            child.setHeight("100%");
            break;
        default:
            break;
        }
    }
}

From source file:org.lunifera.runtime.web.ecview.presentation.vaadin.internal.HorizontalLayoutPresentation.java

License:Open Source License

/**
 * Sets the alignment to the component./*from  w w w .j  av  a 2  s  . c  o  m*/
 * 
 * @param child
 * @param yAlignment
 */
protected void applyAlignment(Component child, YAlignment yAlignment) {

    if (yAlignment != null) {
        child.setWidth("-1%");
        child.setHeight("-1%");
        switch (yAlignment) {
        case BOTTOM_CENTER:
            horizontalLayout.setComponentAlignment(child, Alignment.BOTTOM_CENTER);
            break;
        case BOTTOM_FILL:
            horizontalLayout.setComponentAlignment(child, Alignment.BOTTOM_LEFT);
            child.setWidth("100%");
            break;
        case BOTTOM_LEFT:
            horizontalLayout.setComponentAlignment(child, Alignment.BOTTOM_LEFT);
            break;
        case BOTTOM_RIGHT:
            horizontalLayout.setComponentAlignment(child, Alignment.BOTTOM_RIGHT);
            break;
        case MIDDLE_CENTER:
            horizontalLayout.setComponentAlignment(child, Alignment.MIDDLE_CENTER);
            break;
        case MIDDLE_FILL:
            horizontalLayout.setComponentAlignment(child, Alignment.MIDDLE_LEFT);
            child.setWidth("100%");
            break;
        case MIDDLE_LEFT:
            horizontalLayout.setComponentAlignment(child, Alignment.MIDDLE_LEFT);
            break;
        case MIDDLE_RIGHT:
            horizontalLayout.setComponentAlignment(child, Alignment.MIDDLE_RIGHT);
            break;
        case TOP_CENTER:
            horizontalLayout.setComponentAlignment(child, Alignment.TOP_CENTER);
            break;
        case TOP_FILL:
            horizontalLayout.setComponentAlignment(child, Alignment.TOP_LEFT);
            child.setWidth("100%");
            break;
        case TOP_LEFT:
            horizontalLayout.setComponentAlignment(child, Alignment.TOP_LEFT);
            break;
        case TOP_RIGHT:
            horizontalLayout.setComponentAlignment(child, Alignment.TOP_RIGHT);
            break;
        case FILL_CENTER:
            horizontalLayout.setComponentAlignment(child, Alignment.TOP_CENTER);
            child.setHeight("100%");
            break;
        case FILL_FILL:
            horizontalLayout.setComponentAlignment(child, Alignment.TOP_LEFT);
            child.setWidth("100%");
            child.setHeight("100%");
            break;
        case FILL_LEFT:
            horizontalLayout.setComponentAlignment(child, Alignment.TOP_LEFT);
            child.setHeight("100%");
            break;
        case FILL_RIGHT:
            horizontalLayout.setComponentAlignment(child, Alignment.TOP_RIGHT);
            child.setHeight("100%");
            break;
        default:
            break;
        }
    }
}

From source file:org.lunifera.runtime.web.ecview.presentation.vaadin.internal.VerticalLayoutPresentation.java

License:Open Source License

/**
 * Sets the alignment to the component./*from   ww  w. j ava  2 s  .co  m*/
 * 
 * @param child
 * @param yAlignment
 */
protected void applyAlignment(Component child, YAlignment yAlignment) {

    if (yAlignment != null) {
        child.setWidth("-1%");
        child.setHeight("-1%");
        switch (yAlignment) {
        case BOTTOM_CENTER:
            verticalLayout.setComponentAlignment(child, Alignment.BOTTOM_CENTER);
            break;
        case BOTTOM_FILL:
            verticalLayout.setComponentAlignment(child, Alignment.BOTTOM_LEFT);
            child.setWidth("100%");
            break;
        case BOTTOM_LEFT:
            verticalLayout.setComponentAlignment(child, Alignment.BOTTOM_LEFT);
            break;
        case BOTTOM_RIGHT:
            verticalLayout.setComponentAlignment(child, Alignment.BOTTOM_RIGHT);
            break;
        case MIDDLE_CENTER:
            verticalLayout.setComponentAlignment(child, Alignment.MIDDLE_CENTER);
            break;
        case MIDDLE_FILL:
            verticalLayout.setComponentAlignment(child, Alignment.MIDDLE_LEFT);
            child.setWidth("100%");
            break;
        case MIDDLE_LEFT:
            verticalLayout.setComponentAlignment(child, Alignment.MIDDLE_LEFT);
            break;
        case MIDDLE_RIGHT:
            verticalLayout.setComponentAlignment(child, Alignment.MIDDLE_RIGHT);
            break;
        case TOP_CENTER:
            verticalLayout.setComponentAlignment(child, Alignment.TOP_CENTER);
            break;
        case TOP_FILL:
            verticalLayout.setComponentAlignment(child, Alignment.TOP_LEFT);
            child.setWidth("100%");
            break;
        case TOP_LEFT:
            verticalLayout.setComponentAlignment(child, Alignment.TOP_LEFT);
            break;
        case TOP_RIGHT:
            verticalLayout.setComponentAlignment(child, Alignment.TOP_RIGHT);
            break;
        case FILL_CENTER:
            verticalLayout.setComponentAlignment(child, Alignment.TOP_CENTER);
            child.setHeight("100%");
            break;
        case FILL_FILL:
            verticalLayout.setComponentAlignment(child, Alignment.TOP_LEFT);
            child.setWidth("100%");
            child.setHeight("100%");
            break;
        case FILL_LEFT:
            verticalLayout.setComponentAlignment(child, Alignment.TOP_LEFT);
            child.setHeight("100%");
            break;
        case FILL_RIGHT:
            verticalLayout.setComponentAlignment(child, Alignment.TOP_RIGHT);
            child.setHeight("100%");
            break;
        default:
            break;
        }
    }
}

From source file:org.metawidget.vaadin.ui.layout.FormLayout.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;/* w  ww .j  a  v  a 2s.  com*/
    }

    // Fix caption

    if (component.getCaption() != null && component.getCaption().length() != 0 && mLabelSuffix != null
            && mLabelSuffix.length() != 0) {
        if (!(component instanceof Button) || component instanceof CheckBox) {
            component.setCaption(component.getCaption() + mLabelSuffix);
        }
    }

    // Add it

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