Example usage for com.vaadin.ui HorizontalLayout setComponentAlignment

List of usage examples for com.vaadin.ui HorizontalLayout setComponentAlignment

Introduction

In this page you can find the example usage for com.vaadin.ui HorizontalLayout setComponentAlignment.

Prototype

@Override
    public void setComponentAlignment(Component childComponent, Alignment alignment) 

Source Link

Usage

From source file:com.jiangyifen.ec2.ui.mgr.system.tabsheet.MgrPhone2PhoneSettingView.java

/**
 * ??(????)/*from   ww w. j ava  2s  . c o  m*/
 * return 
 */
private VerticalLayout createRightComponents() {
    VerticalLayout rightVLayout = new VerticalLayout();
    rightVLayout.setSpacing(true);
    rightVLayout.setWidth("100%");

    // ?
    HorizontalLayout searchHLayout = new HorizontalLayout();
    searchHLayout.setSpacing(true);
    rightVLayout.addComponent(searchHLayout);

    Label caption = new Label("");
    caption.setWidth("-1px");
    searchHLayout.addComponent(caption);
    searchHLayout.setComponentAlignment(caption, Alignment.MIDDLE_CENTER);

    rightKeyword = new TextField();
    rightKeyword.setImmediate(true);
    rightKeyword.setInputPrompt("?");
    rightKeyword.setDescription("?????????????");
    rightKeyword.setStyleName("search");
    rightKeyword.addListener(this);
    rightKeyword.setEnabled(false);
    searchHLayout.addComponent(rightKeyword);
    searchHLayout.setComponentAlignment(rightKeyword, Alignment.MIDDLE_CENTER);

    rightSearch = new Button("?", this);
    rightSearch.setImmediate(true);
    rightSearch.setEnabled(false);
    searchHLayout.addComponent(rightSearch);
    searchHLayout.setComponentAlignment(rightSearch, Alignment.MIDDLE_CENTER);

    // 
    rightTable = new Table("");
    rightTable.addStyleName("striped");
    rightTable.addStyleName("mydisabled");
    rightTable.setSelectable(true);
    rightTable.setMultiSelect(true);
    rightTable.setWidth("100%");
    rightTable.setPageLength(10);
    rightTable.setRowHeaderMode(Table.ROW_HEADER_MODE_INDEX);
    rightVLayout.addComponent(rightTable);

    rightTableContainer = new BeanItemContainer<User>(User.class);
    rightTableContainer.addNestedContainerProperty("department.name");
    rightTable.setContainerDataSource(rightTableContainer);
    rightTable.setVisibleColumns(VISIBLE_PROPERTIES);
    rightTable.setColumnHeaders(COL_HEADERS);

    return rightVLayout;
}

From source file:com.klwork.explorer.project.MyCalendarView.java

License:Apache License

private void initLayoutContent() {
    initNavigationButtons();/* ww  w. j a v a  2 s .  c om*/
    initHideWeekEndButton();
    initReadOnlyButton();
    initDisabledButton();
    initAddNewEventButton();

    HorizontalLayout hl = new HorizontalLayout();
    hl.setWidth("100%");
    hl.setSpacing(true);
    hl.setMargin(new MarginInfo(false, false, true, false));
    hl.addComponent(prevButton);
    hl.addComponent(captionLabel);
    hl.addComponent(monthButton);
    hl.addComponent(weekButton);
    hl.addComponent(nextButton);
    hl.setComponentAlignment(prevButton, Alignment.MIDDLE_LEFT);
    hl.setComponentAlignment(captionLabel, Alignment.MIDDLE_CENTER);
    hl.setComponentAlignment(monthButton, Alignment.MIDDLE_CENTER);
    hl.setComponentAlignment(weekButton, Alignment.MIDDLE_CENTER);
    hl.setComponentAlignment(nextButton, Alignment.MIDDLE_RIGHT);

    monthButton.setVisible(viewMode == Mode.WEEK);
    weekButton.setVisible(viewMode == Mode.DAY);

    HorizontalLayout controlPanel = new HorizontalLayout();
    controlPanel.setSpacing(true);
    controlPanel.setMargin(new MarginInfo(false, false, true, false));
    controlPanel.setWidth("100%");
    //controlPanel.addComponent(localeSelect);
    //controlPanel.addComponent(timeZoneSelect);
    controlPanel.addComponent(formatSelect);
    controlPanel.addComponent(hideWeekendsButton);
    //controlPanel.addComponent(readOnlyButton);
    //controlPanel.addComponent(disabledButton);
    controlPanel.addComponent(addNewEvent);

    /*controlPanel.setComponentAlignment(timeZoneSelect,
        Alignment.MIDDLE_LEFT);*/
    controlPanel.setComponentAlignment(formatSelect, Alignment.MIDDLE_LEFT);
    /*controlPanel.setComponentAlignment(localeSelect, Alignment.MIDDLE_LEFT);*/
    controlPanel.setComponentAlignment(hideWeekendsButton, Alignment.MIDDLE_LEFT);
    /* controlPanel.setComponentAlignment(readOnlyButton,
        Alignment.MIDDLE_LEFT);
     controlPanel.setComponentAlignment(disabledButton,
        Alignment.MIDDLE_LEFT);*/
    controlPanel.setComponentAlignment(addNewEvent, Alignment.MIDDLE_LEFT);

    GridLayout layout = (GridLayout) getContent();
    layout.addComponent(controlPanel);
    layout.addComponent(hl);
    layout.addComponent(calendarComponent);
    layout.setRowExpandRatio(layout.getRows() - 1, 1.0f);
}

From source file:com.klwork.explorer.ui.base.AbstractSecondMainPage.java

License:Apache License

protected void addSelectComponent() {
    VerticalLayout secondMenuLayout = new VerticalLayout();
    secondMenuLayout.addStyleName("sidebar");
    secondMenuLayout.addStyleName("menu");
    //secondMenuLayout.setMargin(new MarginInfo(true,false,false,false));
    secondMenuLayout.setSpacing(true);//  w  w  w . j av a 2 s.co m
    secondMenuLayout.setSizeFull();

    HorizontalLayout tableHeadLayout = new HorizontalLayout();
    tableHeadLayout.setStyleName("tableHead");
    tableHeadLayout.setHeight("20px");
    Label nameLabel = new Label("hello,word");
    tableHeadLayout.addComponent(nameLabel);
    tableHeadLayout.setComponentAlignment(nameLabel, Alignment.BOTTOM_CENTER);

    secondMenuLayout.addComponent(tableHeadLayout);
    //secondMenuLayout.setExpandRatio(tableHeadLayout, 0.1f);
    //table
    AbstractSelect select = createSelectComponent();
    secondMenuLayout.addComponent(select);
    secondMenuLayout.setExpandRatio(select, 1.0f);
    if (select != null) {
        grid.addComponent(secondMenuLayout, 0, 0);
    }
}

From source file:com.klwork.explorer.ui.business.flow.act.MyTaskRelatedContentComponent.java

License:Apache License

protected void initActions() {
    // WW_TODO ?/*w  w  w .  jav a2s  .  c  o  m*/
    HorizontalLayout actionsContainer = new HorizontalLayout();
    actionsContainer.setSizeFull();

    Label processTitle = new Label(relatedContentTitle);
    processTitle.addStyleName(ExplorerLayout.STYLE_H3);
    processTitle.setSizeFull();
    actionsContainer.addComponent(processTitle);
    actionsContainer.setComponentAlignment(processTitle, Alignment.MIDDLE_LEFT);
    actionsContainer.setExpandRatio(processTitle, 1.0f);
    actionsContainer.setComponentAlignment(processTitle, Alignment.MIDDLE_RIGHT);
    //?
    if (!readOnly) {
        Button addRelatedContentButton = getAddButton();
        actionsContainer.addComponent(addRelatedContentButton);
    }

    addComponent(actionsContainer);
}

From source file:com.klwork.explorer.ui.business.outproject.AbstractFlowManagerPage.java

License:Apache License

@Override
public HorizontalLayout createSelectHead() {
    HorizontalLayout tableHeadLayout = new HorizontalLayout();
    // tableHeadLayout.setSizeFull();
    tableHeadLayout.setSpacing(true);/*from w w  w . j  a v a2s  . co m*/
    tableHeadLayout.setMargin(true);
    Resource pictureResource = Images.TASK_LIST;
    Embedded picture = new Embedded(null, pictureResource);
    picture.addStyleName(ExplorerLayout.STYLE_TASK_EVENT_PICTURE);
    picture.setType(Embedded.TYPE_IMAGE);
    tableHeadLayout.addComponent(picture);
    tableHeadLayout.setComponentAlignment(picture, Alignment.MIDDLE_LEFT);

    Label nameLabel = createTitleLabel();
    nameLabel.addStyleName("taskListLabel");
    // nameLabel.addStyleName(ExplorerLayout.STYLE_LABEL_BOLD);
    tableHeadLayout.addComponent(nameLabel);
    tableHeadLayout.setComponentAlignment(nameLabel, Alignment.MIDDLE_LEFT);
    return tableHeadLayout;
}

From source file:com.klwork.explorer.ui.custom.SelectUsersPopupWindow.java

License:Apache License

protected void initSelectMyselfButton(HorizontalLayout searchLayout) {
    final LoggedInUser loggedInUser = LoginHandler.getLoggedInUser();
    if (ignoredUserIds == null || !ignoredUserIds.contains(loggedInUser.getId())) {
        Button meButton = new Button(i18nManager.getMessage(Messages.PEOPLE_SELECT_MYSELF));
        meButton.setIcon(Images.USER_16);
        searchLayout.addComponent(meButton);
        searchLayout.setComponentAlignment(meButton, Alignment.MIDDLE_LEFT);

        if (multiSelect) {
            meButton.addClickListener(new ClickListener() {
                public void buttonClick(ClickEvent event) {
                    selectUser(loggedInUser.getId(), loggedInUser.getFullName());
                }/*from  w  w w.  j  a  v  a  2 s . c o  m*/
            });
        } else {
            meButton.addClickListener(new ClickListener() {
                public void buttonClick(ClickEvent event) {
                    addMatchingUser(loggedInUser.getId(), loggedInUser.getFullName());
                    matchingUsersTable.select(loggedInUser.getId());
                    fireEvent(new SubmitEvent(doneButton, SubmitEvent.SUBMITTED));
                    close();
                }
            });
        }
    }
}

From source file:com.klwork.explorer.ui.form.FormPropertiesForm.java

License:Apache License

protected void initButtons() {
    submitFormButton = new Button();
    cancelFormButton = new Button();

    HorizontalLayout buttons = new HorizontalLayout();
    buttons.setSpacing(true);/*from www. j  ava  2  s  . c o m*/
    buttons.setWidth(100, Unit.PERCENTAGE);
    buttons.addStyleName(ExplorerLayout.STYLE_DETAIL_BLOCK);
    buttons.addComponent(submitFormButton);
    buttons.setComponentAlignment(submitFormButton, Alignment.BOTTOM_RIGHT);

    buttons.addComponent(cancelFormButton);
    buttons.setComponentAlignment(cancelFormButton, Alignment.BOTTOM_RIGHT);

    Label buttonSpacer = new Label();
    buttons.addComponent(buttonSpacer);
    buttons.setExpandRatio(buttonSpacer, 1.0f);
    addComponent(buttons);
}

From source file:com.klwork.explorer.ui.task.AbstractTaskPage.java

License:Apache License

@Override
public HorizontalLayout createSelectHead() {
    HorizontalLayout tableHeadLayout = new HorizontalLayout();
    // tableHeadLayout.setSizeFull();
    tableHeadLayout.setSpacing(true);//  www.ja  v a2s . co m
    tableHeadLayout.setMargin(true);
    Resource pictureResource = Images.TASK_LIST;
    Embedded picture = new Embedded(null, pictureResource);
    picture.addStyleName(ExplorerLayout.STYLE_TASK_EVENT_PICTURE);
    picture.setType(Embedded.TYPE_IMAGE);
    tableHeadLayout.addComponent(picture);
    tableHeadLayout.setComponentAlignment(picture, Alignment.MIDDLE_LEFT);

    Label nameLabel = null;
    nameLabel = new Label("");
    nameLabel.addStyleName("taskListLabel");
    // nameLabel.addStyleName(ExplorerLayout.STYLE_LABEL_BOLD);
    tableHeadLayout.addComponent(nameLabel);
    tableHeadLayout.setComponentAlignment(nameLabel, Alignment.MIDDLE_LEFT);
    return tableHeadLayout;
}

From source file:com.klwork.explorer.ui.task.NewTaskPopupWindow.java

License:Apache License

protected void initCreateTaskButton() {
    HorizontalLayout buttonLayout = new HorizontalLayout();
    buttonLayout.setWidth(100, UNITS_PERCENTAGE);
    form.getFooter().setWidth(100, UNITS_PERCENTAGE);
    form.getFooter().addComponent(buttonLayout);

    Button createButton = new Button(i18nManager.getMessage(Messages.BUTTON_CREATE));
    buttonLayout.addComponent(createButton);
    buttonLayout.setComponentAlignment(createButton, Alignment.BOTTOM_RIGHT);

    createButton.addListener(new ClickListener() {
        public void buttonClick(ClickEvent event) {
            handleFormSubmit();/*  w w  w. jav  a  2  s.co m*/
        }
    });
}

From source file:com.klwork.explorer.ui.task.NewTodoToTaskPopupWindow.java

License:Apache License

protected void initCreateTaskButton() {
    HorizontalLayout buttonLayout = new HorizontalLayout();
    buttonLayout.setWidth(100, Unit.PERCENTAGE);
    form.addComponent(buttonLayout);/*  w ww.j  av  a  2s  .  c  o m*/

    Button createButton = new Button(i18nManager.getMessage(Messages.BUTTON_CREATE));
    buttonLayout.addComponent(createButton);
    buttonLayout.setComponentAlignment(createButton, Alignment.BOTTOM_RIGHT);

    createButton.addClickListener(new ClickListener() {
        public void buttonClick(ClickEvent event) {
            handleFormSubmit();
        }
    });
}