Example usage for com.vaadin.ui Alignment MIDDLE_CENTER

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

Introduction

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

Prototype

Alignment MIDDLE_CENTER

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

Click Source Link

Usage

From source file:com.jain.addon.component.upload.JImage.java

License:Apache License

protected Component initContent() {
    layout = new HorizontalLayout();
    layout.setSpacing(true);//from   w w w .jav a  2 s .  co m
    layout.setWidth("100%");

    if (super.getInternalValue() != null) {
        createImage();
        SimpleDateFormat df = new SimpleDateFormat("yyyyMMddHHmmssSSS");
        String fileName = "myfilename-" + df.format(new Date()) + ".png";
        JStreamSource source = new JStreamSource(new ByteArrayInputStream(super.getInternalValue()));
        image.setSource(new StreamResource(source, fileName));
        image.markAsDirty();
    }

    if (!isReadOnly()) {
        layout.addComponent(uploader);
        layout.setComponentAlignment(uploader, Alignment.MIDDLE_CENTER);
    }
    return layout;
}

From source file:com.jain.common.authenticate.LoginAction.java

License:Apache License

private void createActions(VerticalLayout layout) {
    ButtonSegment hLayout = new ButtonSegment(ApplicationTheme.FIRST, ApplicationTheme.LAST);
    hLayout.setStyleName(ApplicationTheme.HEADER_SEGMENT_SMALL);
    hLayout.createSegment(this, JAction.LOGIN, JAction.CANCEL);

    VerticalLayout vLayout = new VerticalLayout();
    vLayout.setSizeUndefined();/*from w  w  w  .  j  a  v a  2s .com*/
    vLayout.setStyleName(ApplicationTheme.VIEW);
    vLayout.addComponent(hLayout);

    layout.addComponent(vLayout);
    layout.setComponentAlignment(vLayout, Alignment.MIDDLE_CENTER);
    layout.setExpandRatio(vLayout, 1);
}

From source file:com.jain.i18N.definition.PersonDefinitionForm.java

License:Apache License

private void createActions(VerticalLayout layout) {
    if (!viewOnly) {
        JainEditClickListener clickListner = new JainEditClickListener(this);
        HorizontalLayout hLayout = VaadinHelper.createButtonSegment(clickListner, JAction.SAVE, JAction.CANCEL);

        VerticalLayout vLayout = new VerticalLayout();
        vLayout.setSizeUndefined();//from   w w w  .  j  a  v a  2 s  .c o m
        vLayout.setStyleName(ApplicationTheme.VIEW);
        vLayout.addComponent(hLayout);

        layout.addComponent(vLayout);
        layout.setComponentAlignment(vLayout, Alignment.MIDDLE_CENTER);
        layout.setExpandRatio(vLayout, 1);
    }
}

From source file:com.jiangyifen.ec2.ui.LoginLayout.java

/**
 * ?/*from w w w.j a v  a 2s . c  o  m*/
 * 
 * @param panelContent ????
 * @param roleType      ?
 */
private void createLoginMainComponents(VerticalLayout panelContent, RoleType roleType) {
    GridLayout gridLayout = new GridLayout(2, 5);
    gridLayout.setSpacing(true);
    gridLayout.setMargin(true);
    panelContent.addComponent(gridLayout);
    panelContent.setComponentAlignment(gridLayout, Alignment.MIDDLE_CENTER);

    // ??
    Label username_lb = new Label("    ??", Label.CONTENT_XHTML);
    gridLayout.addComponent(username_lb, 0, 0);
    usernameTextField = new TextField();
    usernameTextField.setWidth("170px");
    usernameTextField.setValue(username);
    gridLayout.addComponent(usernameTextField, 1, 0);

    // ?
    Label password = new Label("       ?", Label.CONTENT_XHTML);
    gridLayout.addComponent(password, 0, 1);
    passwordTextField = new PasswordField();
    passwordTextField.setWidth("170px");
    gridLayout.addComponent(passwordTextField, 1, 1);

    //  ?Csr ?
    if (roleType.equals(RoleType.csr)) {
        Label extenNoLabel = new Label("       ",
                Label.CONTENT_XHTML);
        gridLayout.addComponent(extenNoLabel, 0, 2);
        extenNoField = new TextField();
        extenNoField.setWidth("170px");
        extenNoField.setValue(exten);
        gridLayout.addComponent(extenNoField, 1, 2);
    }

    // ?????
    String warningMsg = "<font color='red'>?????</font>";
    warningLabel = new Label(warningMsg, Label.CONTENT_XHTML);
    warningLabel.setVisible(false);

    gridLayout.addComponent(warningLabel, 1, 3);
    gridLayout.setComponentAlignment(warningLabel, Alignment.MIDDLE_CENTER);

    // ?
    login = new Button("  ", this);
    forget = new NativeButton("?", this);

    //???
    Map<String, String> licenseMap = LicenseManager.licenseValidate();
    String validateResult = licenseMap.get(LicenseManager.LICENSE_VALIDATE_RESULT);
    if (LicenseManager.LICENSE_VALID.equals(validateResult)) {
        SpringContextHolder.getHttpSession().removeAttribute("businessModels");
        String licensedDate = licenseMap.get(LicenseManager.LICENSE_DATE);
        try {
            Date stopDate = LicenseManager.simpleDateFormat.parse(licensedDate);
            Long times = stopDate.getTime() - new Date().getTime();
            int outdateWarnDay = (int) (times / (24 * 3600 * 1000));

            if (outdateWarnDay < 7) {
                isValid = true;
                warningLabel.setValue("<font color='red'>" + outdateWarnDay
                        + ",???</font>");
                if (outdateWarnDay < 0) {
                    warningLabel.setValue("<font color='red'>?,???</font>");
                    isValid = false;
                } else if (outdateWarnDay == 0) {
                    warningLabel.setValue(
                            "<font color='red'>?,???</font>");
                }
                warningLabel.setVisible(true);
            }
            //            //??
            //            if(roleType==RoleType.manager){
            //               login.setEnabled(true);
            //            }
            //            
        } catch (Exception e) {
            e.printStackTrace();
            login.setEnabled(false);
            forget.setEnabled(false);
        }

    } else {
        warningLabel.setVisible(true);
        warningLabel.setValue("<font color='red'>??,???</font>");
        login.setEnabled(false);
        forget.setEnabled(false);
        isValid = false;

        //chb ???
        if (roleType == RoleType.manager) {
            if (isValid == false) {
                login.setEnabled(true);
            } else {
                //normal login
            }
        }

    }

    HorizontalLayout operatorHLayout = new HorizontalLayout();
    operatorHLayout.setSpacing(true);
    operatorHLayout.addComponent(login);
    operatorHLayout.addComponent(forget);
    gridLayout.addComponent(operatorHLayout, 1, 4);
}

From source file:com.jiangyifen.ec2.ui.mgr.outlinemanage.AddOutline.java

/**
 * Form ?//from w ww .j  a va 2 s.co  m
 * @return HorizontalLayout ?
 */
private HorizontalLayout creatFormFooterComponents() {
    HorizontalLayout buttonsLayout = new HorizontalLayout();
    buttonsLayout.setSpacing(true);
    buttonsLayout.setWidth("100%");

    // ?
    save = new Button("?", this);
    save.setStyleName("default");
    buttonsLayout.addComponent(save);

    // ?
    cancel = new Button("?", this);
    buttonsLayout.addComponent(cancel);

    // ??
    Label settingTypeLabel = new Label("??");
    settingTypeLabel.setWidth("-1px");
    buttonsLayout.addComponent(settingTypeLabel);
    buttonsLayout.setComponentAlignment(settingTypeLabel, Alignment.MIDDLE_CENTER);

    // ??
    settingType = new OptionGroup();
    settingType.addItem("typical");
    settingType.addItem("advanced");
    settingType.select("typical");
    settingType.setItemCaption("typical", "?");
    settingType.setItemCaption("advanced", "");
    settingType.setImmediate(true);
    settingType.setStyleName("twocol100");
    settingType.addListener((ValueChangeListener) this);
    buttonsLayout.addComponent(settingType);
    buttonsLayout.setComponentAlignment(settingType, Alignment.MIDDLE_CENTER);

    return buttonsLayout;
}

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

/**
 * ?  /*from   w w  w .j  a  va 2  s  .  c o  m*/
 */
private void createQueueSelectComponents() {
    HorizontalLayout maintopLayout = new HorizontalLayout();
    maintopLayout.setSpacing(true);
    this.addComponent(maintopLayout);
    this.setComponentAlignment(maintopLayout, Alignment.MIDDLE_CENTER);

    Label caption = new Label("<B></B>", Label.CONTENT_XHTML);
    caption.setWidth("-1px");
    maintopLayout.addComponent(caption);

    queueSelector = new ComboBox();
    queueSelector.setNullSelectionAllowed(false);
    queueSelector.setImmediate(true);
    queueSelector.setContainerDataSource(queueContainer);
    queueSelector.setItemCaptionPropertyId("descriptionAndName");
    queueSelector.addListener(this);
    maintopLayout.addComponent(queueSelector);
}

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

/** 
 * ?(?????)/*from ww w  . j  a v  a 2  s.c o  m*/
 * @return HorizontalLayout
 */
private HorizontalLayout createCenterHLayout() {
    HorizontalLayout centerHLayout = new HorizontalLayout();
    centerHLayout.setSpacing(true);
    centerHLayout.setWidth("100%");

    // ?(??)
    VerticalLayout leftComponents = createLeftComponents();
    centerHLayout.addComponent(leftComponents);
    centerHLayout.setExpandRatio(leftComponents, 0.4f);

    // ??("?")
    VerticalLayout middleComponents = createMiddleComponents();
    centerHLayout.addComponent(middleComponents);
    centerHLayout.setComponentAlignment(middleComponents, Alignment.MIDDLE_CENTER);
    centerHLayout.setExpandRatio(middleComponents, 0.2f);

    // ??(????)
    VerticalLayout rightComponents = createRightComponents();
    centerHLayout.addComponent(rightComponents);
    centerHLayout.setExpandRatio(rightComponents, 0.4f);

    return centerHLayout;
}

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

/**
 *  ?(??)/* w  w  w .ja v a 2  s  . co m*/
 * @return
 */

private VerticalLayout createLeftComponents() {
    VerticalLayout leftVLayout = new VerticalLayout();
    leftVLayout.setSpacing(true);
    leftVLayout.setWidth("100%");

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

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

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

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

    // 
    // 
    leftTable = new Table("??");
    leftTable.setStyleName("striped");
    leftTable.setSelectable(true);
    leftTable.setMultiSelect(true);
    leftTable.setWidth("100%");
    leftTable.setRowHeaderMode(Table.ROW_HEADER_MODE_INDEX);
    leftVLayout.addComponent(leftTable);

    leftTableContainer = new BeanItemContainer<User>(User.class);
    leftTableContainer.addNestedContainerProperty("department.name");
    leftTable.setContainerDataSource(leftTableContainer);
    leftTable.setPageLength(20);
    leftTable.setVisibleColumns(VISIBLE_PROPERTIES);
    leftTable.setColumnHeaders(COL_HEADERS);

    return leftVLayout;
}

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

/**
 * ??("?")//  w w  w.j  a  v  a 2s. com
 * return 
 */
private VerticalLayout createMiddleComponents() {
    VerticalLayout operatorVLayout = new VerticalLayout();
    operatorVLayout.setSpacing(true);
    operatorVLayout.setSizeFull();

    // ??
    operatorVLayout.addComponent(new Label("&nbsp&nbsp", Label.CONTENT_XHTML));
    operatorVLayout.addComponent(new Label("&nbsp&nbsp", Label.CONTENT_XHTML));
    operatorVLayout.addComponent(new Label("&nbsp&nbsp", Label.CONTENT_XHTML));

    // 
    addAll = new Button(">>>", this);
    operatorVLayout.addComponent(addAll);
    operatorVLayout.setComponentAlignment(addAll, Alignment.MIDDLE_CENTER);

    add = new Button(">>", this);
    operatorVLayout.addComponent(add);
    operatorVLayout.setComponentAlignment(add, Alignment.MIDDLE_CENTER);

    remove = new Button("<<", this);
    operatorVLayout.addComponent(remove);
    operatorVLayout.setComponentAlignment(remove, Alignment.MIDDLE_CENTER);

    removeAll = new Button("<<<", this);
    operatorVLayout.addComponent(removeAll);
    operatorVLayout.setComponentAlignment(removeAll, Alignment.MIDDLE_CENTER);

    // ??
    operatorVLayout.addComponent(new Label("&nbsp&nbsp", Label.CONTENT_XHTML));
    operatorVLayout.addComponent(new Label("&nbsp&nbsp", Label.CONTENT_XHTML));

    return operatorVLayout;
}

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

/**
 * ??(????)//from ww w  .  j a v  a  2 s . c om
 * 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);
    searchHLayout.addComponent(rightKeyword);
    searchHLayout.setComponentAlignment(rightKeyword, Alignment.MIDDLE_CENTER);

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

    // 
    // 
    rightTable = new Table("?");
    rightTable.setStyleName("striped");
    rightTable.setSelectable(true);
    rightTable.setMultiSelect(true);
    rightTable.setWidth("100%");
    rightTable.setPageLength(16);
    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);
    rightTable.addGeneratedColumn("priority", new PriorityColumnGenerate());
    rightTable.setColumnHeader("priority", "");

    return rightVLayout;
}