List of usage examples for com.vaadin.ui HorizontalLayout HorizontalLayout
public HorizontalLayout()
From source file:com.klwork.explorer.ui.business.project.TodoSharePopupWindow.java
License:Apache License
public TodoSharePopupWindow(String projectId) { super("0"); this.socialUserWeiboService = ViewToolManager.getBean("socialUserWeiboService"); this.socialSinaService = ViewToolManager.getBean("socialSinaService"); this.socialUserAccountService = ViewToolManager.getBean("socialUserAccountService"); this.socialMainService = ViewToolManager.getBean("socialMainService"); this.i18nManager = ViewToolManager.getI18nManager(); this.projectId = projectId;//id initTodoListImage(projectId);//w w w.ja va2 s . com mainLayout = new VerticalLayout() { { setSizeFull(); setSpacing(true); setMargin(new MarginInfo(true, true, false, true)); addComponent(new HorizontalLayout() {// ?,? { // setSizeFull(); // setSpacing(true); setWidth("100%"); // setSpacing(true); // setMargin(true); /*Image image = initFaceComponet(); addComponent(image); setExpandRatio(image, 1.2f); setComponentAlignment(image, Alignment.MIDDLE_LEFT);*/ // Label inputFontField = initInputFontField(); addComponent(inputFontField); // setExpandRatio(image, 1.0f); setComponentAlignment(inputFontField, Alignment.MIDDLE_RIGHT); setExpandRatio(inputFontField, 0.2f); } }); // ? weiboContentTA.setWidth("100%"); weiboContentTA.setColumns(25); weiboContentTA.focus(); addComponent(weiboContentTA); /*Label descriptionField = new Label(); descriptionField.addStyleName("wb_text"); descriptionField.setContentMode(ContentMode.HTML); descriptionField.setValue(); addComponent(descriptionField);*/ accountGroup = new OptionGroup("?????"); accountGroup.setMultiSelect(true); accountGroup.setStyleName("horizontal"); addComponent(accountGroup); SocialUserAccountQuery query = new SocialUserAccountQuery(); query.setOwnUser(LoginHandler.getLoggedInUser().getId()); List<SocialUserAccount> list = socialUserAccountService.findSocialUserAccountByQueryCriteria(query, null); for (Iterator iterator = list.iterator(); iterator.hasNext();) { SocialUserAccount s = (SocialUserAccount) iterator.next(); String p = s.getId(); Item i = accountGroup.addItem(p); accountGroup.setItemCaption(p, s.queryTypeName() + "_" + s.getName()); } // HorizontalLayout buttonLayout = new HorizontalLayout() { { setSpacing(true); setSizeFull(); Image image = initFaceComponet();// addComponent(image); setComponentAlignment(image, Alignment.TOP_LEFT); // setMargin(true); Button okButton = new Button("?"); addComponent(okButton); setComponentAlignment(okButton, Alignment.TOP_RIGHT); okButton.addClickListener(new ClickListener() { public void buttonClick(ClickEvent event) { handlerSendWeibo(); Notification.show("??", Notification.Type.HUMANIZED_MESSAGE); close(); } }); setExpandRatio(okButton, 1.0f); Button cancleButton = new Button(i18nManager.getMessage(Messages.BUTTON_CANCEL)); addComponent(cancleButton); setComponentAlignment(cancleButton, Alignment.TOP_RIGHT); cancleButton.addClickListener(new ClickListener() { public void buttonClick(ClickEvent event) { // handleFormSubmit(); close(); } }); } }; addComponent(buttonLayout); setExpandRatio(buttonLayout, 1f); } }; setContent(mainLayout); setMainLayout(mainLayout); setWeiboContentTextArea(weiboContentTA); }
From source file:com.klwork.explorer.ui.business.social.DiscussPopupWindow.java
License:Apache License
public VerticalLayout initMainLayout(final SocialUserWeibo userWeibo) { return new VerticalLayout() { {//from w w w . j av a 2 s . c om setSizeFull(); setSpacing(true); setMargin(new MarginInfo(true, true, false, true)); Label descriptionField = new Label(); descriptionField.addStyleName("wb_text"); descriptionField.setContentMode(ContentMode.HTML); descriptionField.setValue( "@" + userWeibo.getUserScreenName() + ":" + mainPage.textTranslate(userWeibo.getText())); addComponent(descriptionField); addComponent(new HorizontalLayout() {// ?,? { setWidth("100%"); // Label inputFontField = initInputFontField(); addComponent(inputFontField); // setExpandRatio(image, 1.0f); setComponentAlignment(inputFontField, Alignment.MIDDLE_RIGHT); setExpandRatio(inputFontField, 0.2f); } }); // ? weiboContentTA = new TextArea(""); weiboContentTA.setWidth("100%"); weiboContentTA.setColumns(25); weiboContentTA.focus(); addComponent(weiboContentTA); scheduleEventFieldGroup.bind(weiboContentTA, "content"); // ? addComponent(new HorizontalLayout() { { setSpacing(true); // setSizeFull(); // setMargin(true); CheckBox simuField = CommonFieldHandler.createCheckBox(""); simuField.addValueChangeListener(new Property.ValueChangeListener() { private static final long serialVersionUID = -7104996493482558021L; @Override public void valueChange(ValueChangeEvent event) { Object value = event.getProperty().getValue(); } }); addComponent(simuField); // setExpandRatio(image, 1.0f); setComponentAlignment(simuField, Alignment.MIDDLE_LEFT); Label commentLable = new Label(); commentLable.setContentMode(ContentMode.HTML); commentLable.setValue("????"); addComponent(commentLable); // setExpandRatio(image, 1.0f); setComponentAlignment(commentLable, Alignment.MIDDLE_LEFT); Image image = initFaceComponet();// addComponent(image); } }); // HorizontalLayout buttonLayout = new HorizontalLayout() { { setSpacing(true); setSizeFull(); // setMargin(true); Button okButton = new Button(i18nManager.getMessage(Messages.BUTTON_OK)); addComponent(okButton); setComponentAlignment(okButton, Alignment.TOP_RIGHT); okButton.addClickListener(new ClickListener() { public void buttonClick(ClickEvent event) { BinderHandler.commit(scheduleEventFieldGroup); int ret = socialService.discussWeibo(weiboForwardSend); if (ret == 1) { Notification.show("??", Notification.Type.HUMANIZED_MESSAGE); } close(); } }); setExpandRatio(okButton, 1.0f); Button cancleButton = new Button(i18nManager.getMessage(Messages.BUTTON_CANCEL)); addComponent(cancleButton); setComponentAlignment(cancleButton, Alignment.TOP_RIGHT); cancleButton.addClickListener(new ClickListener() { public void buttonClick(ClickEvent event) { close(); } }); } }; addComponent(buttonLayout); setExpandRatio(buttonLayout, 1f); } }; }
From source file:com.klwork.explorer.ui.business.social.SaveToNotePopupWindow.java
License:Apache License
public VerticalLayout initMainLayout(final SocialUserWeibo userWeibo) { return new VerticalLayout() { {// w ww . ja va2 s . c o m setSizeFull(); setSpacing(true); setMargin(new MarginInfo(true, true, false, true)); Label descriptionField = new Label(); descriptionField.addStyleName("wb_text"); descriptionField.setContentMode(ContentMode.HTML); descriptionField.setValue(""); addComponent(descriptionField); // ? weiboContentTA = new TextArea(""); weiboContentTA.setWidth("100%"); weiboContentTA.setColumns(25); weiboContentTA.focus(); addComponent(weiboContentTA); scheduleEventFieldGroup.bind(weiboContentTA, "content"); if (hasOrginWeibo) {// weiboContentTA.setValue("//@" + userWeibo.getUserScreenName() + ": " + userWeibo.getText()); } else { weiboContentTA.setValue(userWeibo.getText()); //+ mainPage.textTranslate(userWeibo.getText())); } //, addComponent(new VerticalLayout() { { setSpacing(true); TextField titleField = CommonFieldHandler.createTextField(""); scheduleEventFieldGroup.bind(titleField, "title"); //??? if (userWeibo.getText() != null && userWeibo.getText().length() > 10) { titleField.setValue(userWeibo.getText().substring(0, 10)); } addComponent(titleField); // setSizeFull(); // setMargin(true); SocialUserAccount noteAccount = socialUserAccountService .findSocialUserByType(socialUserAccount.getOwnUser(), DictDef.dictInt("evernote")); if (noteAccount != null) { noteEntity.setUserAccountId(noteAccount.getId()); } Map<String, String> map = socialEvernoteService.queryNotebook(noteAccount); ComboBox noteMap = CommonFieldHandler.createComBox("", map, ""); addComponent(noteMap); setComponentAlignment(noteMap, Alignment.MIDDLE_LEFT); } }); // HorizontalLayout buttonLayout = new HorizontalLayout() { { setSpacing(true); setSizeFull(); // setMargin(true); Button okButton = new Button(i18nManager.getMessage(Messages.BUTTON_OK)); addComponent(okButton); setComponentAlignment(okButton, Alignment.TOP_RIGHT); okButton.addClickListener(new ClickListener() { public void buttonClick(ClickEvent event) { BinderHandler.commit(scheduleEventFieldGroup); //? int ret = socialEvernoteService.saveWeiboToNotes(noteEntity); if (ret == 1) { Notification.show("??", Notification.Type.HUMANIZED_MESSAGE); } else { Notification.show("??!", Notification.Type.HUMANIZED_MESSAGE); } close(); } }); setExpandRatio(okButton, 1.0f); Button cancleButton = new Button(i18nManager.getMessage(Messages.BUTTON_CANCEL)); addComponent(cancleButton); setComponentAlignment(cancleButton, Alignment.TOP_RIGHT); cancleButton.addClickListener(new ClickListener() { public void buttonClick(ClickEvent event) { close(); } }); } }; addComponent(buttonLayout); setExpandRatio(buttonLayout, 1f); } }; }
From source file:com.klwork.explorer.ui.business.social.TransmitPopupWindow.java
License:Apache License
public TransmitPopupWindow(final SocialUserWeibo userWeibo, final AbstractWeiboDisplayPage mainPage) { super(mainPage.getSocialType()); this.socialUserWeiboService = ViewToolManager.getBean("socialUserWeiboService"); this.socialService = AbstractSocialService.querySocialClass(mainPage.getSocialType()); this.i18nManager = ViewToolManager.getI18nManager(); weiboForwardSend.setWeibId(userWeibo.getWeiboId()); weiboForwardSend.setUserAccountId(userWeibo.getUserAccountId()); this.userWeibo = userWeibo; if (userWeibo.getRetweetedId() != null) { orginWeibo = socialUserWeiboService.findSocialUserWeiboById(userWeibo.getRetweetedId()); hasOrginWeibo = true;/*from www .j a va 2 s . c om*/ weiboForwardSend.setWeibId(orginWeibo.getId()); } scheduleEventFieldGroup.setBuffered(true); if (currentBeanItem != null) { scheduleEventFieldGroup.setItemDataSource(currentBeanItem); } mainLayout = new VerticalLayout() { { setSizeFull(); setSpacing(true); setMargin(new MarginInfo(true, true, false, true)); Label descriptionField = new Label(); descriptionField.addStyleName("wb_text"); descriptionField.setContentMode(ContentMode.HTML); descriptionField.setValue( "@" + userWeibo.getUserScreenName() + ":" + mainPage.textTranslate(userWeibo.getText())); if (hasOrginWeibo) { descriptionField.setValue("@" + orginWeibo.getUserScreenName() + ":" + mainPage.textTranslate(orginWeibo.getText())); } addComponent(descriptionField); addComponent(new HorizontalLayout() {// ?,? { // setSizeFull(); // setSpacing(true); setWidth("100%"); // setSpacing(true); // setMargin(true); /*Image image = initFaceComponet(); addComponent(image); setExpandRatio(image, 1.2f); setComponentAlignment(image, Alignment.MIDDLE_LEFT);*/ // Label inputFontField = initInputFontField(); addComponent(inputFontField); // setExpandRatio(image, 1.0f); setComponentAlignment(inputFontField, Alignment.MIDDLE_RIGHT); setExpandRatio(inputFontField, 0.2f); } }); // ? weiboContentTA.setWidth("100%"); weiboContentTA.setColumns(25); weiboContentTA.focus(); addComponent(weiboContentTA); scheduleEventFieldGroup.bind(weiboContentTA, "content"); if (hasOrginWeibo) {// weiboContentTA.setValue("//@" + userWeibo.getUserScreenName() + ": " + userWeibo.getText()); } // ? addComponent(new HorizontalLayout() { { setSpacing(true); // setSizeFull(); // setMargin(true); CheckBox simuField = CommonFieldHandler.createCheckBox(""); simuField.addValueChangeListener(new Property.ValueChangeListener() { private static final long serialVersionUID = -7104996493482558021L; @Override public void valueChange(ValueChangeEvent event) { Object value = event.getProperty().getValue(); } }); addComponent(simuField); // setExpandRatio(image, 1.0f); setComponentAlignment(simuField, Alignment.MIDDLE_LEFT); Label commentLable = new Label(); commentLable.setContentMode(ContentMode.HTML); commentLable.setValue("? " + "" + userWeibo.getUserScreenName()); addComponent(commentLable); // setExpandRatio(image, 1.0f); setComponentAlignment(commentLable, Alignment.MIDDLE_LEFT); Image image = initFaceComponet();// addComponent(image); } }); if (hasOrginWeibo) { // ? addComponent(new HorizontalLayout() { { // setSizeFull(); setSpacing(true); // setMargin(true); CheckBox simuOriginalField = CommonFieldHandler.createCheckBox(""); simuOriginalField.addValueChangeListener(new Property.ValueChangeListener() { private static final long serialVersionUID = -7104996493482558021L; @Override public void valueChange(ValueChangeEvent event) { Object value = event.getProperty().getValue(); } }); addComponent(simuOriginalField); // setExpandRatio(image, 1.0f); setComponentAlignment(simuOriginalField, Alignment.MIDDLE_LEFT); Label commentLable = new Label(); commentLable.setContentMode(ContentMode.HTML); commentLable .setValue("? " + "" + orginWeibo.getUserScreenName()); addComponent(commentLable); // setExpandRatio(image, 1.0f); setComponentAlignment(commentLable, Alignment.MIDDLE_LEFT); } }); } // HorizontalLayout buttonLayout = new HorizontalLayout() { { setSpacing(true); setSizeFull(); // setMargin(true); Button okButton = new Button(i18nManager.getMessage(Messages.BUTTON_OK)); addComponent(okButton); setComponentAlignment(okButton, Alignment.TOP_RIGHT); okButton.addClickListener(new ClickListener() { public void buttonClick(ClickEvent event) { BinderHandler.commit(scheduleEventFieldGroup); int ret = socialService.forwardWeibo(weiboForwardSend); if (ret == 1) { Notification.show("??", Notification.Type.HUMANIZED_MESSAGE); } close(); } }); setExpandRatio(okButton, 1.0f); Button cancleButton = new Button(i18nManager.getMessage(Messages.BUTTON_CANCEL)); addComponent(cancleButton); setComponentAlignment(cancleButton, Alignment.TOP_RIGHT); cancleButton.addClickListener(new ClickListener() { public void buttonClick(ClickEvent event) { // handleFormSubmit(); close(); } }); } }; addComponent(buttonLayout); setExpandRatio(buttonLayout, 1f); } }; setContent(mainLayout); setMainLayout(mainLayout); setWeiboContentTextArea(weiboContentTA); }
From source file:com.klwork.explorer.ui.business.social.WeiboSendPopupWindow.java
License:Apache License
public WeiboSendPopupWindow(final SocialUserAccount socialUserAccount) { super(socialUserAccount.getType().toString()); this.socialUserWeiboService = ViewToolManager.getBean("socialUserWeiboService"); this.socialSinaService = ViewToolManager.getBean("socialSinaService"); this.socialUserAccountService = ViewToolManager.getBean("socialUserAccountService"); this.socialMainService = ViewToolManager.getBean("socialMainService"); this.i18nManager = ViewToolManager.getI18nManager(); this.socialUserAccount = socialUserAccount; scheduleEventFieldGroup.setBuffered(true); if (currentBeanItem != null) { scheduleEventFieldGroup.setItemDataSource(currentBeanItem); }//from ww w. j a v a2 s. c om mainLayout = new VerticalLayout() { { setSizeFull(); setSpacing(true); setMargin(new MarginInfo(true, true, false, true)); addComponent(new HorizontalLayout() {// ?,? { // setSizeFull(); // setSpacing(true); setWidth("100%"); // setSpacing(true); // setMargin(true); /* * Image image = initFaceComponet(); * addComponent(image); setExpandRatio(image, 1.2f); * setComponentAlignment(image, Alignment.MIDDLE_LEFT); */ // Label inputFontField = initInputFontField(); addComponent(inputFontField); // setExpandRatio(image, 1.0f); setComponentAlignment(inputFontField, Alignment.MIDDLE_RIGHT); setExpandRatio(inputFontField, 0.2f); } }); // ? weiboContentTA.setWidth("100%"); weiboContentTA.setColumns(25); weiboContentTA.focus(); addComponent(weiboContentTA); scheduleEventFieldGroup.bind(weiboContentTA, "content"); /* * Label descriptionField = new Label(); * descriptionField.addStyleName("wb_text"); * descriptionField.setContentMode(ContentMode.HTML); * descriptionField.setValue(); addComponent(descriptionField); */ accountGroup = new OptionGroup("?????"); accountGroup.setMultiSelect(true); accountGroup.setStyleName("horizontal"); addComponent(accountGroup); SocialUserAccountQuery query = new SocialUserAccountQuery(); query.setOwnUser(socialUserAccount.getOwnUser()); List<SocialUserAccount> list = socialUserAccountService.findSocialUserAccountByQueryCriteria(query, null); for (Iterator iterator = list.iterator(); iterator.hasNext();) { SocialUserAccount s = (SocialUserAccount) iterator.next(); String p = s.getId(); if (p.equals(socialUserAccount.getId())) { continue; } Item i = accountGroup.addItem(p); accountGroup.setItemCaption(p, s.queryTypeName() + "_" + s.getName()); } // HorizontalLayout buttonLayout = new HorizontalLayout() { { setSpacing(true); setSizeFull(); Image image = initFaceComponet();// addComponent(image); setComponentAlignment(image, Alignment.TOP_LEFT); // setMargin(true); Button okButton = new Button("?"); addComponent(okButton); setComponentAlignment(okButton, Alignment.TOP_RIGHT); okButton.addClickListener(new ClickListener() { public void buttonClick(ClickEvent event) { BinderHandler.commit(scheduleEventFieldGroup); handlerSendWeibo(); Notification.show("??", Notification.Type.HUMANIZED_MESSAGE); close(); } }); setExpandRatio(okButton, 1.0f); Button cancleButton = new Button(i18nManager.getMessage(Messages.BUTTON_CANCEL)); addComponent(cancleButton); setComponentAlignment(cancleButton, Alignment.TOP_RIGHT); cancleButton.addClickListener(new ClickListener() { public void buttonClick(ClickEvent event) { // handleFormSubmit(); close(); } }); } }; addComponent(buttonLayout); setExpandRatio(buttonLayout, 1f); } }; setContent(mainLayout); setMainLayout(mainLayout); setWeiboContentTextArea(weiboContentTA); }
From source file:com.klwork.explorer.ui.content.CreateAttachmentPopupWindow.java
License:Apache License
public CreateAttachmentPopupWindow(List types) { this.includeTypes = types; this.i18nManager = ViewToolManager.getI18nManager(); this.attachmentRendererManager = ViewToolManager.getAttachmentRendererManager(); this.taskService = ProcessEngines.getDefaultProcessEngine().getTaskService(); setCaption(i18nManager.getMessage(Messages.RELATED_CONTENT_ADD)); setWidth(700, Unit.PIXELS);/* www. j av a 2 s .c o m*/ setHeight(430, Unit.PIXELS); center(); setModal(true); addStyleName(Reindeer.WINDOW_LIGHT); layout = new HorizontalLayout(); layout.setSpacing(false); layout.setMargin(true); layout.setSizeFull(); setContent(layout); initTable(); // ? detailLayout = new GridLayout(1, 2); detailLayout.setSizeFull(); detailLayout.setMargin(true); detailLayout.setSpacing(true); detailLayout.addStyleName(ExplorerLayout.STYLE_RELATED_CONTENT_CREATE_DETAIL); layout.addComponent(detailLayout); layout.setExpandRatio(detailLayout, 1.0f); detailLayout.setRowExpandRatio(0, 1.0f); detailLayout.setColumnExpandRatio(0, 1.0f); // initActions(); }
From source file:com.klwork.explorer.ui.content.file.ImageAttachmentRenderer.java
License:Apache License
@Override public Component getDetailComponent(Attachment attachment) { VerticalLayout verticalLayout = new VerticalLayout(); verticalLayout.setSizeUndefined();//from w w w .j a va 2 s . co m verticalLayout.setSpacing(true); verticalLayout.setMargin(true); Label description = new Label(attachment.getDescription()); description.setSizeUndefined(); verticalLayout.addComponent(description); // Image TaskService taskService = ProcessEngines.getDefaultProcessEngine().getTaskService(); String mimeType = extractMineType(attachment.getType()); InputStream imageStream = ImageUtil.resizeImage(taskService.getAttachmentContent(attachment.getId()), mimeType, 900, 550); Resource resource = new StreamResource(new InputStreamStreamSource(imageStream), attachment.getName() + extractExtention(attachment.getType())); Embedded image = new Embedded(null, resource); verticalLayout.addComponent(image); // Linke HorizontalLayout LinkLayout = new HorizontalLayout(); LinkLayout.setSpacing(true); verticalLayout.addComponent(LinkLayout); verticalLayout.setComponentAlignment(LinkLayout, Alignment.MIDDLE_CENTER); Label fullSizeLabel = new Label( ViewToolManager.getI18nManager().getMessage(Messages.RELATED_CONTENT_SHOW_FULL_SIZE)); LinkLayout.addComponent(fullSizeLabel); Link link = null; if (attachment.getUrl() != null) { link = new Link(attachment.getUrl(), new ExternalResource(attachment.getUrl())); } else { taskService = ProcessEngines.getDefaultProcessEngine().getTaskService(); Resource res = new StreamResource( new InputStreamStreamSource(taskService.getAttachmentContent(attachment.getId())), attachment.getName() + extractExtention(attachment.getType())); link = new Link(attachment.getName(), res); } link.setIcon(Images.RELATED_CONTENT_PICTURE); link.setTargetName(ExplorerLayout.LINK_TARGET_BLANK); LinkLayout.addComponent(link); return verticalLayout; }
From source file:com.klwork.explorer.ui.content.GenericAttachmentRenderer.java
License:Apache License
public Component getDetailComponent(Attachment attachment) { VerticalLayout verticalLayout = new VerticalLayout(); verticalLayout.setSizeUndefined();/*from www . j av a2 s. c om*/ verticalLayout.setSpacing(true); verticalLayout.setMargin(true); Label description = new Label(attachment.getDescription()); description.setSizeUndefined(); verticalLayout.addComponent(description); HorizontalLayout linkLayout = new HorizontalLayout(); linkLayout.setSpacing(true); verticalLayout.addComponent(linkLayout); // Image linkLayout.addComponent(new Embedded(null, getImage(attachment))); // Link Link link = null; if (attachment.getUrl() != null) { link = new Link(attachment.getUrl(), new ExternalResource(attachment.getUrl())); } else { TaskService taskService = ProcessEngines.getDefaultProcessEngine().getTaskService(); Resource res = new StreamResource( new InputStreamStreamSource(taskService.getAttachmentContent(attachment.getId())), attachment.getName() + extractExtention(attachment.getType())); link = new Link(attachment.getName(), res); } // Set generic image and external window link.setTargetName(ExplorerLayout.LINK_TARGET_BLANK); linkLayout.addComponent(link); return verticalLayout; }
From source file:com.klwork.explorer.ui.content.url.UrlAttachmentRenderer.java
License:Apache License
public Component getDetailComponent(Attachment attachment) { VerticalLayout verticalLayout = new VerticalLayout(); verticalLayout.setSpacing(true);// ww w. j av a2 s . co m verticalLayout.setMargin(true); verticalLayout.addComponent(new Label(attachment.getDescription())); HorizontalLayout linkLayout = new HorizontalLayout(); linkLayout.setSpacing(true); verticalLayout.addComponent(linkLayout); // Icon linkLayout.addComponent(new Embedded(null, Images.RELATED_CONTENT_URL)); // Link Link link = new Link(attachment.getUrl(), new ExternalResource(attachment.getUrl())); link.setTargetName(ExplorerLayout.LINK_TARGET_BLANK); linkLayout.addComponent(link); return verticalLayout; }