Example usage for com.vaadin.ui Alignment TOP_RIGHT

List of usage examples for com.vaadin.ui Alignment TOP_RIGHT

Introduction

In this page you can find the example usage for com.vaadin.ui Alignment TOP_RIGHT.

Prototype

Alignment TOP_RIGHT

To view the source code for com.vaadin.ui Alignment TOP_RIGHT.

Click Source Link

Usage

From source file:org.ikasan.dashboard.ui.topology.window.ServerWindow.java

License:BSD License

public void init() {
    this.setModal(true);
    this.setResizable(false);

    GridLayout gridLayout = new GridLayout(2, 7);
    gridLayout.setWidth("480px");
    gridLayout.setColumnExpandRatio(0, .15f);
    gridLayout.setColumnExpandRatio(1, .85f);

    gridLayout.setSpacing(true);//from w ww  . j a v  a 2 s .c  o  m
    gridLayout.setMargin(true);

    Label newBusinessStreamLabel = new Label("Server");
    newBusinessStreamLabel.addStyleName(ValoTheme.LABEL_HUGE);

    gridLayout.addComponent(newBusinessStreamLabel, 0, 0, 1, 0);

    Label nameLabel = new Label("Name:");
    nameLabel.setSizeUndefined();
    this.name = new TextField();
    this.name.addValidator(new StringLengthValidator("A name must be entered.", 1, null, false));
    this.name.setWidth("90%");

    gridLayout.addComponent(nameLabel, 0, 1);
    gridLayout.setComponentAlignment(nameLabel, Alignment.MIDDLE_RIGHT);
    gridLayout.addComponent(name, 1, 1);

    Label urlLabel = new Label("URL:");
    urlLabel.setSizeUndefined();
    this.url = new TextField();
    this.url.addValidator(new StringLengthValidator("A url must be entered.", 1, null, false));
    this.url.setWidth("90%");

    gridLayout.addComponent(urlLabel, 0, 3);
    gridLayout.setComponentAlignment(urlLabel, Alignment.MIDDLE_RIGHT);
    gridLayout.addComponent(url, 1, 3);

    Label portLabel = new Label("Port Number:");
    portLabel.setSizeUndefined();
    this.port = new TextField();
    this.port.addValidator(new IntegerValidator("A port number and must be a valid number."));
    this.port.setWidth("45%");

    StringToIntegerConverter plainIntegerConverter = new StringToIntegerConverter() {
        protected java.text.NumberFormat getFormat(Locale locale) {
            NumberFormat format = super.getFormat(locale);
            format.setGroupingUsed(false);
            return format;
        };
    };
    // either set for the field or in your field factory for multiple fields
    this.port.setConverter(plainIntegerConverter);

    gridLayout.addComponent(portLabel, 0, 4);
    gridLayout.setComponentAlignment(portLabel, Alignment.MIDDLE_RIGHT);
    gridLayout.addComponent(port, 1, 4);

    Label descriptionLabel = new Label("Description:");
    descriptionLabel.setSizeUndefined();
    this.description = new TextArea();
    this.description.addValidator(new StringLengthValidator("A description must be entered.", 1, null, false));
    this.description.setWidth("90%");
    this.description.setRows(4);

    this.name.setValidationVisible(false);
    this.description.setValidationVisible(false);
    this.url.setValidationVisible(false);
    this.port.setValidationVisible(false);

    gridLayout.addComponent(descriptionLabel, 0, 5);
    gridLayout.setComponentAlignment(descriptionLabel, Alignment.TOP_RIGHT);
    gridLayout.addComponent(description, 1, 5);

    Button saveButton = new Button("Save");
    Button cancelButton = new Button("Cancel");

    GridLayout buttonLayout = new GridLayout(2, 1);
    buttonLayout.setSpacing(true);

    buttonLayout.addComponent(saveButton);
    buttonLayout.setComponentAlignment(saveButton, Alignment.MIDDLE_CENTER);
    buttonLayout.addComponent(cancelButton);
    buttonLayout.setComponentAlignment(cancelButton, Alignment.MIDDLE_CENTER);

    gridLayout.addComponent(buttonLayout, 0, 6, 1, 6);
    gridLayout.setComponentAlignment(buttonLayout, Alignment.MIDDLE_CENTER);

    BeanItem<Server> serverItem = new BeanItem<Server>(this.server);

    name.setPropertyDataSource(serverItem.getItemProperty("name"));
    description.setPropertyDataSource(serverItem.getItemProperty("description"));
    url.setPropertyDataSource(serverItem.getItemProperty("url"));
    this.port.setPropertyDataSource(serverItem.getItemProperty("port"));

    saveButton.addClickListener(new Button.ClickListener() {
        public void buttonClick(ClickEvent event) {
            try {
                ServerWindow.this.name.validate();
                ServerWindow.this.description.validate();
                ServerWindow.this.url.validate();
                ServerWindow.this.port.validate();
            } catch (InvalidValueException e) {
                ServerWindow.this.name.setValidationVisible(true);
                ServerWindow.this.description.setValidationVisible(true);
                ServerWindow.this.url.setValidationVisible(true);
                ServerWindow.this.port.setValidationVisible(true);

                return;
            }

            ServerWindow.this.name.setValidationVisible(false);
            ServerWindow.this.description.setValidationVisible(false);
            ServerWindow.this.url.setValidationVisible(false);
            ServerWindow.this.port.setValidationVisible(false);

            topologyService.save(server);

            Notification.show("New Server Created!");

            UI.getCurrent().removeWindow(ServerWindow.this);
        }
    });

    cancelButton.addClickListener(new Button.ClickListener() {
        public void buttonClick(ClickEvent event) {
            UI.getCurrent().removeWindow(ServerWindow.this);
        }
    });

    this.setContent(gridLayout);
}

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  v a  2s .c  o 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.jpos.qi.login.LoginView.java

License:Open Source License

private HorizontalLayout createTitle() {
    HorizontalLayout labels = new HorizontalLayout();
    labels.setWidth("100%");
    labels.setMargin(new MarginInfo(false, false, true, false));
    labels.addStyleName("labels");

    Label title = new Label(app.getMessage("login.title"));
    title.setSizeUndefined();//  ww  w  .  ja v  a  2 s.c o m
    title.addStyleName(ValoTheme.LABEL_H4);
    title.addStyleName(ValoTheme.LABEL_COLORED);
    labels.addComponent(title);
    labels.setComponentAlignment(title, Alignment.BOTTOM_LEFT);

    Embedded logo = new Embedded("", QIResources.JPOS_LOGO);
    logo.setHeight("80px");
    labels.addComponent(logo);
    labels.setComponentAlignment(logo, Alignment.TOP_RIGHT);

    return labels;
}

From source file:org.jpos.qi.system.MemoryUsageView.java

License:Open Source License

public MemoryUsageView() {
    super();// w  w w. ja v  a  2s. co m
    qi = (QI) UI.getCurrent();
    setSpacing(false);
    setMargin(true);
    setSizeFull();
    available = createLabel();
    allocated = createLabel();
    used = createLabel();
    forceGC = new Button(qi.getMessage("memory-usage.force.gc"));

    GridLayout gl = new GridLayout(3, 3);
    gl.addComponent(strong(qi.getMessage("memory-usage.availableMemory")));
    gl.addComponent(available);
    gl.setComponentAlignment(available, Alignment.TOP_RIGHT);
    gl.addComponent(createMBLabel());

    gl.addComponent(strong(qi.getMessage("memory-usage.allocatedMemory")));
    gl.addComponent(allocated);
    gl.setComponentAlignment(allocated, Alignment.TOP_RIGHT);
    gl.addComponent(createMBLabel());

    gl.addComponent(strong(qi.getMessage("memory-usage.usedMemory")));
    gl.addComponent(used);
    gl.setComponentAlignment(used, Alignment.TOP_RIGHT);
    gl.addComponent(createMBLabel());

    HorizontalLayout hl = new HorizontalLayout();
    hl.setWidth("75%");
    hl.addComponent(gl);
    hl.setComponentAlignment(gl, Alignment.MIDDLE_CENTER);
    hl.addComponent(memoryGauge = createGauge("Memory", 0));
    hl.setComponentAlignment(memoryGauge, Alignment.MIDDLE_CENTER);
    hl.addComponent(forceGC);
    hl.setComponentAlignment(forceGC, Alignment.MIDDLE_CENTER);
    forceGC.addClickListener((Button.ClickListener) event -> gc());

    addComponent(hl);
    setComponentAlignment(hl, Alignment.MIDDLE_CENTER);
    Label l = new Label("");
    l.setHeight("30px");
    addComponent(l);

    chart = new DCharts();
    ds = new DataSeries();

    AxesDefaults axesDefaults = new AxesDefaults().setLabelRenderer(LabelRenderers.CANVAS);

    Axes axes = new Axes()
            .addAxis(new XYaxis(XYaxes.X).setLabel("Time (last 300 seconds)")
                    .setLabelRenderer(LabelRenderers.AXIS).setPad(0))
            .addAxis(new XYaxis(XYaxes.Y).setLabel("In use memory percentage").setPad(0)
                    .setTickOptions(new AxisTickRenderer().setFormatString("%.2f%")));
    Cursor cursor = new Cursor().setShow(true);

    Series series = new Series().addSeries(new XYseries().setLineWidth(0.5f)
            .setMarkerOptions(new MarkerRenderer().setStyle(MarkerStyles.CIRCLE).setShadow(true)));

    Options options = new Options().setAxesDefaults(axesDefaults).setCursor(cursor).setSeries(series)
            .setAxes(axes);

    chart.setDataSeries(ds).show();
    chart.setOptions(options);
    chart.setSizeFull();
    // chart.setHeight("450px");
    // chart.setWidth("450px");
    addComponent(chart);
    // setComponentAlignment(chart, Alignment.BOTTOM_CENTER);
}

From source file:org.lunifera.example.vaadin.osgi.jpacontainer.AddressBookMainView.java

License:Apache License

@SuppressWarnings("deprecation")
private void buildMainArea() {
    VerticalLayout verticalLayout = new VerticalLayout();
    setSecondComponent(verticalLayout);//from  ww w  . j  a  v a2s  . co m

    personTable = new Table(null, persons);
    personTable.setSelectable(true);
    personTable.setImmediate(true);
    personTable.addListener(new Property.ValueChangeListener() {
        @Override
        public void valueChange(ValueChangeEvent event) {
            setModificationsEnabled(event.getProperty().getValue() != null);
        }

        private void setModificationsEnabled(boolean b) {
            deleteButton.setEnabled(b);
            editButton.setEnabled(b);
        }
    });

    personTable.setSizeFull();
    // personTable.setSelectable(true);
    personTable.addListener(new ItemClickListener() {
        @Override
        public void itemClick(ItemClickEvent event) {
            if (event.isDoubleClick()) {
                personTable.select(event.getItemId());
            }
        }
    });

    personTable.setVisibleColumns(
            new Object[] { "firstName", "lastName", "department", "phoneNumber", "street", "city", "zipCode" });

    HorizontalLayout toolbar = new HorizontalLayout();
    newButton = new Button("Add");
    newButton.addClickListener(new Button.ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            final BeanItem<Person> newPersonItem = new BeanItem<Person>(new Person());
            PersonEditor personEditor = new PersonEditor(newPersonItem);
            personEditor.addListener(new EditorSavedListener() {
                @Override
                public void editorSaved(EditorSavedEvent event) {
                    persons.addEntity(newPersonItem.getBean());
                }
            });
            UI.getCurrent().addWindow(personEditor);
        }
    });

    deleteButton = new Button("Delete");
    deleteButton.addClickListener(new Button.ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            persons.removeItem(personTable.getValue());
        }
    });
    deleteButton.setEnabled(false);

    editButton = new Button("Edit");
    editButton.addClickListener(new Button.ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            UI.getCurrent().addWindow(new PersonEditor(personTable.getItem(personTable.getValue())));
        }
    });
    editButton.setEnabled(false);

    searchField = new TextField();
    searchField.setInputPrompt("Search by name");
    searchField.addTextChangeListener(new TextChangeListener() {

        @Override
        public void textChange(TextChangeEvent event) {
            textFilter = event.getText();
            updateFilters();
        }
    });

    toolbar.addComponent(newButton);
    toolbar.addComponent(deleteButton);
    toolbar.addComponent(editButton);
    toolbar.addComponent(searchField);
    toolbar.setWidth("100%");
    toolbar.setExpandRatio(searchField, 1);
    toolbar.setComponentAlignment(searchField, Alignment.TOP_RIGHT);

    verticalLayout.addComponent(toolbar);
    verticalLayout.addComponent(personTable);
    verticalLayout.setExpandRatio(personTable, 1);
    verticalLayout.setSizeFull();

}

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

License:Open Source License

/**
 * Sets the alignment to the component./*from  w ww . ja v a  2s.  co 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 w  w.j  a  v a2s  . 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:
            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 av  a 2s  .c  om
 * 
 * @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  ww  . j a  v 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  a v  a2s .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:
            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;
        }
    }
}