Example usage for com.vaadin.ui HorizontalLayout setSpacing

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

Introduction

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

Prototype

@Override
    public void setSpacing(boolean spacing) 

Source Link

Usage

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

/**
 * ? (18:00 - 23:59 )/* ww w .jav  a  2  s. c  om*/
 * @param panelContent
 */
private void createRunRedirectTime(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);

    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.mgr.system.tabsheet.MgrPhone2PhoneSettingView.java

/**
 *  (noanswer?unonline?busy?force)/*from w w w .  j a  v a 2  s .co 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  www .j  ava 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

/**
 *  ????//from  ww w.j a  v a 2  s .c  o  m
 * @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

/**
 *  ?(??)/*ww w . j a  va 2s  . 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

/**
 * ??(????)/*from   w w w.  j a  va  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.jiangyifen.ec2.ui.mgr.system.tabsheet.MgrPhone2PhoneSettingView.java

/**
 * ?//from w  w w  .ja v  a  2 s .  c o m
 * @return
 */
private HorizontalLayout createOperatorButtons() {
    HorizontalLayout layout = new HorizontalLayout();
    layout.setSpacing(true);

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

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

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

    return layout;
}

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

/**
 * added by chb 20140520//from  ww  w .  j  ava2s  . 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

/**
 * /*from   w w  w .  j  a  va 2 s.c  om*/
 * @return
 */
private HorizontalLayout buildButtonsLayout() {
    HorizontalLayout buttonsLayout = new HorizontalLayout();
    buttonsLayout.setSpacing(true);
    // ?
    save = new Button("?");
    save.setStyleName("default");
    save.addListener(this);
    buttonsLayout.addComponent(save);

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

    return buttonsLayout;
}

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

License:Apache License

private void initLayoutContent() {
    initNavigationButtons();/*from   w ww .  ja v  a 2  s .  c o  m*/
    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);
}