Example usage for com.vaadin.ui VerticalLayout addComponent

List of usage examples for com.vaadin.ui VerticalLayout addComponent

Introduction

In this page you can find the example usage for com.vaadin.ui VerticalLayout addComponent.

Prototype

@Override
public void addComponent(Component c) 

Source Link

Document

Add a component into this container.

Usage

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

/**
 *  (noanswer?unonline?busy?force)/*w  w  w  .j av a  2 s.c  o  m*/
 * @param panelContent
 */
private void createRedirectType(VerticalLayout panelContent) {
    HorizontalLayout layout = new HorizontalLayout();
    layout.setSpacing(true);
    panelContent.addComponent(layout);

    Label caption = new Label("");
    caption.setWidth("-1px");
    caption.setDescription("<B>????</B>");
    layout.addComponent(caption);

    redirectTypeOption = new OptionGroup();
    redirectTypeOption.addItem("noanswer");
    redirectTypeOption.setItemCaption("noanswer", "?");
    redirectTypeOption.addItem("busy");
    redirectTypeOption.setItemCaption("busy", "");
    redirectTypeOption.addItem("unonline");
    redirectTypeOption.setItemCaption("unonline", "");
    redirectTypeOption.setNullSelectionAllowed(false);
    redirectTypeOption.addListener(this);
    redirectTypeOption.setImmediate(true);
    redirectTypeOption.setMultiSelect(true);
    redirectTypeOption.addStyleName("threecol");
    redirectTypeOption.addStyleName("myopacity");
    redirectTypeOption.setReadOnly(true);
    redirectTypeOption
            .setDescription("<B>????</B>");
    layout.addComponent(redirectTypeOption);
}

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

/**
 * ?? /*from w  ww.  j  av  a 2 s .  c om*/
 * @param panelContent
 */
private void createNoanwserTimeout(VerticalLayout panelContent) {
    noanswerLayout = new HorizontalLayout();
    noanswerLayout.setSpacing(true);
    noanswerLayout.setVisible(false);
    panelContent.addComponent(noanswerLayout);

    Label freCaption = new Label("?");
    freCaption.setWidth("-1px");
    freCaption.setDescription(
            "<B>'?'??</B>");
    noanswerLayout.addComponent(freCaption);

    noanswerTimeoutSelector = new ComboBox();
    noanswerTimeoutSelector.setImmediate(true);
    noanswerTimeoutSelector.setWidth("50px");
    noanswerTimeoutSelector.setNullSelectionAllowed(false);
    noanswerTimeoutSelector.setDescription(
            "<B>'?'??</B>");
    noanswerLayout.addComponent(noanswerTimeoutSelector);

    for (int seconds = 3; seconds < 61; seconds++) {
        noanswerTimeoutSelector.addItem(seconds);
    }
    noanswerTimeoutSelector.setValue(10);
    noanswerTimeoutSelector.setReadOnly(true);

    Label postCaption = new Label(" ");
    postCaption.setWidth("-1px");
    postCaption.setDescription(
            "<B>'?'??</B>");
    noanswerLayout.addComponent(postCaption);
}

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

/**
 * ???/*from   ww  w . j av a 2s  .  c  om*/
 * @param panelContent
 */
private void createSpecifiedPhone(VerticalLayout panelContent) {
    HorizontalLayout layout = new HorizontalLayout();
    layout.setSpacing(true);
    panelContent.addComponent(layout);

    Label caption = new Label("??");
    caption.setWidth("-1px");
    caption.setDescription(
            "<B>'?'??'??'</B>");
    layout.addComponent(caption);

    specifiedOption = new OptionGroup();
    specifiedOption.addItem(false);
    specifiedOption.addItem(true);
    specifiedOption.setItemCaption(false, "?");
    specifiedOption.setItemCaption(true, "??");
    specifiedOption.addListener(this);
    specifiedOption.setImmediate(true);
    specifiedOption.setReadOnly(true);
    specifiedOption.setNullSelectionAllowed(false);
    specifiedOption.addStyleName("twocol200");
    specifiedOption.addStyleName("myopacity");
    specifiedOption.setDescription(
            "<B>'?'??'??'</B>");
    layout.addComponent(specifiedOption);
}

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

/**
 * ??/* ww w  .  jav  a2  s .c o m*/
 * @param panelContent
 */
private void createPhoneArea(VerticalLayout panelContent) {
    phoneAreaLayout = new HorizontalLayout();
    phoneAreaLayout.setWidth("100%");
    phoneAreaLayout.setVisible(false);
    phoneAreaLayout.setSpacing(true);
    panelContent.addComponent(phoneAreaLayout);

    Label caption = new Label("");
    caption.setWidth("-1px");
    caption.setDescription(
            "<B>'??'???</B>");
    phoneAreaLayout.addComponent(caption);

    phoneArea = new TextArea();
    phoneArea.setRows(6);
    phoneArea.setWidth("100%");
    phoneArea.setImmediate(true);
    phoneArea.setReadOnly(true);
    phoneArea.setInputPrompt(
            "???, ???(,)?");
    phoneArea.setDescription(
            "<B>'??'???</B>");
    phoneAreaLayout.addComponent(phoneArea);
    phoneAreaLayout.setExpandRatio(phoneArea, 1.0f);
}

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

/**
 *  ????/*from w  w w  .  j av  a 2  s. c om*/
 * @param panelContent
 */
private void createCsrSelectTables(VerticalLayout panelContent) {
    csrSelectHLayout = new HorizontalLayout();
    csrSelectHLayout.setSpacing(true);
    csrSelectHLayout.setVisible(false);
    csrSelectHLayout.setWidth("100%");
    panelContent.addComponent(csrSelectHLayout);

    Label caption = new Label("");
    caption.setWidth("-1px");
    caption.setDescription("<B>??</B>");
    csrSelectHLayout.addComponent(caption);

    // ???
    HorizontalLayout panelLayout = new HorizontalLayout();
    panelLayout.setSpacing(true);
    panelLayout.setMargin(false, true, false, true);
    panelLayout.setWidth("100%");

    Panel tablePanel = new Panel();
    tablePanel.setContent(panelLayout);
    csrSelectHLayout.addComponent(tablePanel);
    csrSelectHLayout.setExpandRatio(tablePanel, 1.0f);

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

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

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

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

/**
 *  ?(??)/*  w ww  .  j a  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);
    leftKeyword.setEnabled(false);
    searchHLayout.addComponent(leftKeyword);
    searchHLayout.setComponentAlignment(leftKeyword, Alignment.MIDDLE_CENTER);

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

    // 
    leftTable = new Table("?");
    leftTable.addStyleName("striped");
    leftTable.addStyleName("mydisabled");
    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(10);
    leftTable.setVisibleColumns(VISIBLE_PROPERTIES);
    leftTable.setColumnHeaders(COL_HEADERS);

    return leftVLayout;
}

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

/**
 * ??("?")// ww  w.  j  av  a 2 s .c  o  m
 * 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);
    addAll.setEnabled(false);
    operatorVLayout.addComponent(addAll);
    operatorVLayout.setComponentAlignment(addAll, Alignment.MIDDLE_CENTER);

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

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

    removeAll = new Button("<<<", this);
    removeAll.setEnabled(false);
    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.MgrPhone2PhoneSettingView.java

/**
 * ??(????)// ww w. j  av a 2  s .  com
 * 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.jiangyifen.ec2.ui.mgr.system.tabsheet.SystemLicence.java

/**
 * added by chb 20140520/*from   w w  w.  j av a  2  s. c om*/
 * @return
 */
private VerticalLayout updateLicenseComponent() {
    VerticalLayout licenseUpdateLayout = new VerticalLayout();
    final VerticalLayout textAreaPlaceHolder = new VerticalLayout();
    final HorizontalLayout buttonPlaceHolder = new HorizontalLayout();
    buttonPlaceHolder.setSpacing(true);

    //
    final Button updateButton = new Button("License");
    updateButton.setData("show");

    //
    final Button cancelButton = new Button("?");

    //
    final TextArea licenseTextArea = new TextArea();
    licenseTextArea.setColumns(30);
    licenseTextArea.setRows(5);
    licenseTextArea.setWordwrap(true);
    licenseTextArea.setInputPrompt("??");

    //Layout
    buttonPlaceHolder.addComponent(updateButton);
    licenseUpdateLayout.addComponent(textAreaPlaceHolder);
    licenseUpdateLayout.addComponent(buttonPlaceHolder);

    //
    cancelButton.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            textAreaPlaceHolder.removeAllComponents();
            buttonPlaceHolder.removeComponent(cancelButton);
            updateButton.setData("show");
            updateButton.setCaption("License");
        }
    });

    updateButton.addListener(new Button.ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            if (((String) event.getButton().getData()).equals("show")) {
                textAreaPlaceHolder.removeAllComponents();
                textAreaPlaceHolder.addComponent(licenseTextArea);
                buttonPlaceHolder.addComponent(cancelButton);
                event.getButton().setData("updateAndHide");
                event.getButton().setCaption("??");
            } else if (((String) event.getButton().getData()).equals("updateAndHide")) {
                StringReader stringReader = new StringReader(
                        StringUtils.trimToEmpty((String) licenseTextArea.getValue()));
                Properties props = new Properties();
                try {
                    props.load(stringReader);
                } catch (IOException e) {
                    e.printStackTrace();
                }
                stringReader.close();
                //               Boolean isValidvalidateLicense(licenseTextArea.getValue());
                String license_date = props.getProperty(LicenseManager.LICENSE_DATE);
                String license_count = props.getProperty(LicenseManager.LICENSE_COUNT);
                String license_localmd5 = props.getProperty(LicenseManager.LICENSE_LOCALMD5);
                //
                Boolean isMatch = regexMatchCheck(license_date, license_count, license_localmd5);
                if (isMatch) {

                    Map<String, String> licenseMap = new HashMap<String, String>();
                    //??
                    //                  String license_count = (String)props.get(LicenseManager.LICENSE_COUNT);
                    license_count = license_count == null ? "" : license_count;
                    licenseMap.put(LicenseManager.LICENSE_COUNT, license_count);

                    //?
                    //                  String license_date = (String)props.get(LicenseManager.LICENSE_DATE);
                    license_date = license_date == null ? "" : license_date;
                    licenseMap.put(LicenseManager.LICENSE_DATE, license_date);

                    //???
                    //                  String license_localmd5 = (String)props.get(LicenseManager.LICENSE_LOCALMD5);
                    license_localmd5 = license_localmd5 == null ? "" : license_localmd5;
                    licenseMap.put(LicenseManager.LICENSE_LOCALMD5, license_localmd5);

                    //?License
                    Map<String, String> resultMap = LicenseManager.licenseValidate(licenseMap);

                    String validateResult = resultMap.get(LicenseManager.LICENSE_VALIDATE_RESULT);
                    if (LicenseManager.LICENSE_VALID.equals(validateResult)) {
                        //continue
                    } else {
                        NotificationUtil.showWarningNotification(SystemLicence.this,
                                "License ?License");
                        return;
                    }

                    try {
                        URL resourceurl = SystemLicence.class.getResource(LicenseManager.LICENSE_FILE);
                        //System.err.println("chb: SystemLicense"+resourceurl.getPath());
                        OutputStream fos = new FileOutputStream(resourceurl.getPath());
                        props.store(fos, "license");
                    } catch (Exception e) {
                        e.printStackTrace();
                        NotificationUtil.showWarningNotification(SystemLicence.this, "License ");
                        return;
                    }
                    textAreaPlaceHolder.removeAllComponents();
                    buttonPlaceHolder.removeComponent(cancelButton);
                    updateButton.setData("show");
                    updateButton.setCaption("License");
                    LicenseManager.loadLicenseFile(LicenseManager.LICENSE_FILE.substring(1));
                    //                  LicenseManager.loadLicenseFile(licenseFilename)
                    refreshLicenseInfo();
                    NotificationUtil.showWarningNotification(SystemLicence.this,
                            "License ?,?");
                } else {
                    NotificationUtil.showWarningNotification(SystemLicence.this,
                            "License ??");
                }
            }
        }

        /**
         * license ?
         * @param license_date
         * @param license_count
         * @param license_localmd5
         * @return
         */
        private Boolean regexMatchCheck(String license_date, String license_count, String license_localmd5) {
            if (StringUtils.isEmpty(license_date) || StringUtils.isEmpty(license_count)
                    || StringUtils.isEmpty(license_localmd5)) {
                return false;
            }
            String date_regex = "^\\d{4}-\\d{2}-\\d{2}\\s\\d{2}:\\d{2}:\\d{2}$"; //?
            String count_regex = "^\\d+$"; //?
            String md5_32_regex = "^\\w{32}$"; //?
            return license_localmd5.matches(md5_32_regex) && license_date.matches(date_regex)
                    && license_count.matches(count_regex);
        }
    });

    return licenseUpdateLayout;
}

From source file:com.jiangyifen.ec2.ui.mgr.usermanage.EditUser.java

/**
 * User//from w ww .j a  v  a2s  . co m
 * @param project
 */
public EditUser(UserManagement userManagement) {
    this.center();
    this.setModal(true);
    this.userManagement = userManagement;

    domain = SpringContextHolder.getDomain();
    loginUser = SpringContextHolder.getLoginUser();

    //Service?
    userService = SpringContextHolder.getBean("userService");
    departmentService = SpringContextHolder.getBean("departmentService");
    roleService = SpringContextHolder.getBean("roleService");
    queueService = SpringContextHolder.getBean("queueService");
    queueMemberRelationService = SpringContextHolder.getBean("queueMemberRelationService");
    phone2PhoneSettingService = SpringContextHolder.getBean("phone2PhoneSettingService");
    userQueueService = SpringContextHolder.getBean("userQueueService");

    //WindowLayout
    VerticalLayout windowContent = new VerticalLayout();
    windowContent.setSizeUndefined();
    windowContent.setMargin(false, true, true, true);
    windowContent.setSpacing(true);
    windowContent.setStyleName(StyleConfig.VERTICAL_STYLE);
    this.setContent(windowContent);

    //From
    form = new Form();
    form.setValidationVisibleOnCommit(true);
    form.setValidationVisible(false);
    form.addStyleName("chb");
    //Form?????
    allRoles = roleService.getAll(domain);
    form.setFormFieldFactory(new MyFieldFactory());
    form.setFooter(buildButtonsLayout());
    windowContent.addComponent(form);
}