Example usage for com.vaadin.ui HorizontalLayout HorizontalLayout

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

Introduction

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

Prototype

public HorizontalLayout() 

Source Link

Document

Constructs an empty HorizontalLayout.

Usage

From source file:com.javalego.ui.vaadin.component.util.MessageBox.java

License:Apache License

/**
 * Similar to//from   w w w.  j  av  a 2s  . c om
 * {@link #MessageBox(Window, String, Icon, String, Alignment, ButtonConfig...)}
 * , but the message component is defined explicitly. The component can be
 * even a composite of a layout manager and manager further Vaadin
 * components.
 * 
 * @param messageComponent
 *            a Vaadin component
 */
public MessageBox(String dialogCaption, Icon dialogIcon, Component messageComponent, Alignment buttonsAlignment,
        ButtonConfig... buttonConfigs) {

    super();

    setResizable(false);
    setClosable(false);

    setCaption(dialogCaption);

    GridLayout mainLayout = new GridLayout(2, 2);
    mainLayout.setMargin(true);
    mainLayout.setSpacing(true);

    mainLayout.setSizeUndefined();
    messageComponent.setSizeUndefined();

    // Add Content
    if (dialogIcon == null || Icon.NONE.equals(dialogIcon)) {

        mainLayout.addComponent(messageComponent, 0, 0, 1, 0);
        mainLayout.setRowExpandRatio(0, 1.0f);
        mainLayout.setColumnExpandRatio(0, 1.0f);
    } else {
        mainLayout.addComponent(messageComponent, 1, 0);

        mainLayout.setRowExpandRatio(0, 1.0f);
        mainLayout.setColumnExpandRatio(1, 1.0f);

        //         Label icon = new Label();
        //         switch (dialogIcon) {
        //         case QUESTION:
        //            icon.setIcon(FontAwesome.QUESTION);
        //            break;
        //         case INFO:
        //            icon.setIcon(FontAwesome.INFO);
        //            break;
        //         case WARN:
        //            icon.setIcon(FontAwesome.WARNING);
        //            break;
        //         case ERROR:
        //            icon.setIcon(FontAwesome.STOP);
        //            break;
        //         default:
        //            break;
        //         }
        //         mainLayout.addComponent(icon, 0, 0);
    }

    // Add Buttons
    HorizontalLayout buttonLayout = new HorizontalLayout();
    buttonLayout.setSpacing(true);
    buttonLayout.setMargin(true);
    mainLayout.addComponent(buttonLayout, 0, 1, 1, 1);
    mainLayout.setComponentAlignment(buttonLayout, buttonsAlignment);

    for (ButtonConfig buttonConfig : buttonConfigs) {

        ButtonExt button = new ButtonExt(buttonConfig.getCaption());

        //         if (buttonConfig.buttonType == ButtonType.YES || buttonConfig.buttonType == ButtonType.OK) {
        //            button.blue();
        //         }

        button.addClickListener(new ButtonClickListener(buttonConfig.getButtonType()));
        buttonLayout.addComponent(button);
    }

    setContent(mainLayout);
}

From source file:com.jiangyifen.ec2.ui.csr.toolbar.CsrPhone2PhoneSettingWindow.java

/**
 * ?/*from   w  w w  . j  av  a2 s  .co m*/
 * @param mainLayout
 */
private void createlStartSetting(VerticalLayout mainLayout) {
    HorizontalLayout layout = new HorizontalLayout();
    layout.setSpacing(true);
    mainLayout.addComponent(layout);

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

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

From source file:com.jiangyifen.ec2.ui.csr.toolbar.CsrPhone2PhoneSettingWindow.java

/**
 *  (????)/*  ww  w.java 2 s  .co m*/
 * @param mainLayout
 */
private void createlDaysOfWeekType(VerticalLayout mainLayout) {
    HorizontalLayout layout = new HorizontalLayout();
    layout.setSpacing(true);
    mainLayout.addComponent(layout);

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

    dayOfWeekTypeSelector = new ComboBox();
    dayOfWeekTypeSelector.addItem("weekday");
    dayOfWeekTypeSelector.setItemCaption("weekday", "");
    dayOfWeekTypeSelector.addItem("weekend");
    dayOfWeekTypeSelector.setItemCaption("weekend", "");
    dayOfWeekTypeSelector.addItem("custom");
    dayOfWeekTypeSelector.setItemCaption("custom", "");
    dayOfWeekTypeSelector.setWidth("200px");
    dayOfWeekTypeSelector.setImmediate(true);
    dayOfWeekTypeSelector.setReadOnly(true);
    dayOfWeekTypeSelector.setDescription("<B>?</B>");
    dayOfWeekTypeSelector.setNullSelectionAllowed(false);
    dayOfWeekTypeSelector.addListener(this);
    layout.addComponent(dayOfWeekTypeSelector);
}

From source file:com.jiangyifen.ec2.ui.csr.toolbar.CsrPhone2PhoneSettingWindow.java

/**
 * (??...) ???/*from   w  w w  .j av a2 s.c o m*/
 * @param mainLayout
 */
private void createlDayOfWeek(VerticalLayout mainLayout) {
    dayOfWeekLayout = new HorizontalLayout();
    dayOfWeekLayout.setSpacing(true);
    dayOfWeekLayout.setVisible(false);
    mainLayout.addComponent(dayOfWeekLayout);

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

    BeanItemContainer<DayOfWeek> container = new BeanItemContainer<DayOfWeek>(DayOfWeek.class);
    container.addBean(DayOfWeek.sun);
    container.addBean(DayOfWeek.mon);
    container.addBean(DayOfWeek.tue);
    container.addBean(DayOfWeek.wen);
    container.addBean(DayOfWeek.thu);
    container.addBean(DayOfWeek.fri);
    container.addBean(DayOfWeek.sat);

    daysOfWeekOption = new OptionGroup();
    daysOfWeekOption.setContainerDataSource(container);
    daysOfWeekOption.setItemCaptionPropertyId("name");
    daysOfWeekOption.setMultiSelect(true);
    daysOfWeekOption.setNullSelectionAllowed(false);
    daysOfWeekOption.setImmediate(true);
    daysOfWeekOption.setReadOnly(true);
    daysOfWeekOption.setDescription("<B>?</B>");
    daysOfWeekOption.addStyleName("threecol300");
    daysOfWeekOption.addStyleName("myopacity");
    dayOfWeekLayout.addComponent(daysOfWeekOption);
}

From source file:com.jiangyifen.ec2.ui.csr.toolbar.CsrPhone2PhoneSettingWindow.java

/**
 * ? (18:00 - 23:59 )/*w  w w. j  a  va  2  s. co  m*/
 * @param mainLayout
 */
private void createRunRedirectTime(VerticalLayout mainLayout) {
    HorizontalLayout layout = new HorizontalLayout();
    layout.setSpacing(true);
    mainLayout.addComponent(layout);

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

    startRedirectHour = new ComboBox();
    startRedirectHour.setImmediate(true);
    startRedirectHour.setWidth("50px");
    startRedirectHour.setNullSelectionAllowed(false);
    layout.addComponent(startRedirectHour);

    Label space1 = new Label(" ");
    space1.setWidth("-1px");
    layout.addComponent(space1);

    startRedirectMinute = new ComboBox();
    startRedirectMinute.setImmediate(true);
    startRedirectMinute.setWidth("50px");
    startRedirectMinute.setNullSelectionAllowed(false);
    layout.addComponent(startRedirectMinute);

    Label to = new Label(" - ");
    to.setWidth("-1px");
    layout.addComponent(to);

    stopRedirectHour = new ComboBox();
    stopRedirectHour.setImmediate(true);
    stopRedirectHour.setWidth("50px");
    stopRedirectHour.setNullSelectionAllowed(false);
    layout.addComponent(stopRedirectHour);

    Label space2 = new Label(" ");
    space2.setWidth("-1px");
    layout.addComponent(space2);

    stopRedirectMinute = new ComboBox();
    stopRedirectMinute.setImmediate(true);
    stopRedirectMinute.setWidth("50px");
    stopRedirectMinute.setNullSelectionAllowed(false);
    layout.addComponent(stopRedirectMinute);

    for (int hour = 0; hour < 24; hour++) {
        startRedirectHour.addItem(hour);
        stopRedirectHour.addItem(hour);
    }

    for (int minute = 0; minute < 60; minute++) {
        startRedirectMinute.addItem(minute);
        stopRedirectMinute.addItem(minute);
    }

    startRedirectHour.setValue(18);
    stopRedirectHour.setValue(23);
    startRedirectMinute.setValue(0);
    stopRedirectMinute.setValue(59);

    startRedirectHour.setReadOnly(true);
    startRedirectMinute.setReadOnly(true);
    stopRedirectHour.setReadOnly(true);
    stopRedirectMinute.setReadOnly(true);
}

From source file:com.jiangyifen.ec2.ui.csr.toolbar.CsrPhone2PhoneSettingWindow.java

/**
 *  (noanswer?unonline?busy?force)//from   w w  w .j  a  v a2  s  .  c  om
 * @param mainLayout
 */
private void createlRedirectType(VerticalLayout mainLayout) {
    HorizontalLayout layout = new HorizontalLayout();
    layout.setSpacing(true);
    mainLayout.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("threecol300");
    redirectTypeOption.addStyleName("myopacity");
    redirectTypeOption.setReadOnly(true);
    redirectTypeOption
            .setDescription("<B>????</B>");
    layout.addComponent(redirectTypeOption);
}

From source file:com.jiangyifen.ec2.ui.csr.toolbar.CsrPhone2PhoneSettingWindow.java

/**
 * ?? /*  www  .j ava2  s  .c o  m*/
 * @param mainLayout
 */
private void createNoanwserTimeout(VerticalLayout mainLayout) {
    noanswerLayout = new HorizontalLayout();
    noanswerLayout.setSpacing(true);
    noanswerLayout.setVisible(false);
    mainLayout.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.csr.toolbar.CsrPhone2PhoneSettingWindow.java

/**
 * ?// w  ww. j a  v  a2  s.  c o m
 * @return
 */
private void createOperatorButtons(VerticalLayout mainLayout) {
    operatorLayout = new HorizontalLayout();
    operatorLayout.setSpacing(true);
    mainLayout.addComponent(operatorLayout);

    // 
    edit = new Button(" ", this);
    edit.setStyleName("default");
    edit.setVisible(true);
    edit.setImmediate(true);
    operatorLayout.addComponent(edit);

    // ?
    save = new Button("? ", this);
    save.setStyleName("default");
    save.setVisible(false);
    save.setImmediate(true);
    operatorLayout.addComponent(save);

    // ?
    cancel = new Button("? ", this);
    operatorLayout.addComponent(cancel);
    cancel.setVisible(false);
    cancel.setImmediate(true);
}

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

/**
 * ?//from w  w  w.j  a  v  a  2 s.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("&nbsp;&nbsp;&nbsp;&nbsp;??", 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("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;?", 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("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;",
                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.LoginLayout.java

/**
 * ??? (?, ?)//  w w w.ja v  a 2 s. co m
 */
private void createConflictManageWindow() {
    conflictManageWindow = new Window("?");
    conflictManageWindow.setModal(true);
    conflictManageWindow.setResizable(false);

    VerticalLayout mainLayout = new VerticalLayout();
    mainLayout.setSpacing(true);
    mainLayout.setMargin(true);
    mainLayout.setSizeUndefined();
    mainLayout.setWidth("400px");
    conflictManageWindow.setContent(mainLayout);

    Label captionLabel = new Label("<font color='blue'><B>??</B></font>",
            Label.CONTENT_XHTML);
    captionLabel.setWidth("-1px");
    mainLayout.addComponent(captionLabel);

    conflictNotice = new RichTextArea();
    conflictNotice.setReadOnly(true);
    conflictNotice.setWriteThrough(false);
    conflictNotice.setWidth("-1px");
    mainLayout.addComponent(conflictNotice);

    String placeholder = "&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp";
    Label noticeLabel = new Label(
            "<font color='red'><B>" + placeholder
                    + "?</B></font>",
            Label.CONTENT_XHTML);
    noticeLabel.setWidth("-1px");
    mainLayout.addComponent(noticeLabel);

    Label confirmLabel = new Label("<B>" + placeholder + "??</B>",
            Label.CONTENT_XHTML);
    confirmLabel.setWidth("-1px");
    mainLayout.addComponent(confirmLabel);

    // ???
    HorizontalLayout operatorHLayout = new HorizontalLayout();
    operatorHLayout.setSpacing(true);
    mainLayout.addComponent(operatorHLayout);

    confirm = new Button("", this);
    confirm.setImmediate(true);
    cancel = new Button("?", this);
    cancel.setStyleName("default");
    cancel.setImmediate(true);
    operatorHLayout.addComponent(confirm);
    operatorHLayout.addComponent(cancel);
}