List of usage examples for com.vaadin.ui HorizontalLayout addComponent
@Override public void addComponent(Component c)
From source file:com.jiangyifen.ec2.ui.mgr.system.tabsheet.MgrPhone2PhoneSettingView.java
/** * ?//from ww w .j a v a 2s . 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 w w w . j a v a 2s . 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 www . ja va 2 s.co m*/ * @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();/* ww w .j a v a 2s . 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); }
From source file:com.klwork.explorer.project.MyCalendarView.java
License:Apache License
private void createCalendarEventPopup() { VerticalLayout layout = new VerticalLayout(); layout.setMargin(true);/*www . ja v a 2 s. co m*/ layout.setSpacing(true); scheduleEventPopup = new Window(null, layout); scheduleEventPopup.setWidth("400px"); scheduleEventPopup.setModal(true); scheduleEventPopup.center(); layout.addComponent(scheduleEventFieldLayout); applyEventButton = new Button("?", new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { try { commitCalendarEvent(); } catch (CommitException e) { e.printStackTrace(); } } }); Button cancel = new Button("?", new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { discardCalendarEvent(); } }); deleteEventButton = new Button("", new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { deleteCalendarEvent(); } }); scheduleEventPopup.addCloseListener(new Window.CloseListener() { private static final long serialVersionUID = 1L; @Override public void windowClose(Window.CloseEvent e) { discardCalendarEvent(); } }); HorizontalLayout buttons = new HorizontalLayout(); buttons.setSpacing(true); buttons.addComponent(deleteEventButton); buttons.addComponent(applyEventButton); buttons.addComponent(cancel); layout.addComponent(buttons); layout.setComponentAlignment(buttons, Alignment.BOTTOM_RIGHT); }
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);/*from w w w .ja v a 2 s . c om*/ 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 ?/*from ww w. j av 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);/*ww w . ja va 2s . com*/ 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.business.project.MyCalendarView.java
License:Apache License
private void createCalendarEventPopup() { VerticalLayout layout = new VerticalLayout(); layout.setMargin(true);/*from w w w .ja v a2 s . c o m*/ layout.setSpacing(true); layout.addStyleName("social"); scheduleEventPopup = new Window(null, layout); scheduleEventPopup.setWidth("400px"); scheduleEventPopup.setModal(true); scheduleEventPopup.center(); layout.addComponent(scheduleEventFieldLayout); applyEventButton = new Button("?", new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { try { commitCalendarEvent(); } catch (CommitException e) { e.printStackTrace(); } } }); Button cancel = new Button("?", new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { discardCalendarEvent(); } }); deleteEventButton = new Button("", new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { deleteCalendarEvent(); } }); scheduleEventPopup.addCloseListener(new Window.CloseListener() { private static final long serialVersionUID = 1L; @Override public void windowClose(Window.CloseEvent e) { discardCalendarEvent(); } }); HorizontalLayout buttons = new HorizontalLayout(); buttons.setSpacing(true); buttons.addComponent(deleteEventButton); buttons.addComponent(applyEventButton); buttons.addComponent(cancel); layout.addComponent(buttons); layout.setComponentAlignment(buttons, Alignment.BOTTOM_RIGHT); }
From source file:com.klwork.explorer.ui.business.query.SocialListQuery.java
License:Apache License
public void initReAuthorButton(SocialUserAccount sc, HorizontalLayout buttonLayout) { if (checkExpried(sc)) {//?? Integer scType = sc.getType(); Button authorButton = new Button("?"); authorButton.setDescription("?????"); authorButton.addStyleName(Reindeer.BUTTON_LINK); authorButton.addClickListener(new ClickListener() { public void buttonClick(ClickEvent event) { //socialAccountList.openReAuthorityBrowserWindow(opener); }/*w w w .j a v a 2s . c o m*/ }); //??button? socialAccountList.initButtonByBrowWindow(scType, authorButton); buttonLayout.addComponent(authorButton); } }