List of usage examples for com.vaadin.ui HorizontalLayout setStyleName
@Override public void setStyleName(String style)
From source file:ac.uk.icl.dell.vaadin.glycanbuilder.VaadinGlycanCanvas.java
License:Open Source License
public void appendGeneralToolBar(Panel theToolBarPanel) { HorizontalLayout toolBar = new HorizontalLayout(); toolBar.setWidth("100%"); toolBar.setStyleName("toolbar"); NativeButton deleteButton = new NativeButton("Delete"); deleteButton.setIcon(new ThemeResource("icons/deleteNew.png")); deleteButton.addListener(new ClickListener() { private static final long serialVersionUID = 1289257412952359727L; @Override/*from w w w . j a v a2 s.c o m*/ public void buttonClick(ClickEvent event) { theCanvas.delete(); } }); deleteButton.setEnabled(false); NativeButton copyButton = new NativeButton("Copy"); final NativeButton pasteButton = new NativeButton("Paste"); copyButton.setIcon(new ThemeResource("icons/editcopy.png")); copyButton.addListener(new ClickListener() { private static final long serialVersionUID = -1740735587078805580L; @Override public void buttonClick(ClickEvent event) { theCanvas.copy(); pasteButton.setEnabled(true); } }); copyButton.setEnabled(false); pasteButton.setIcon(new ThemeResource("icons/editpaste.png")); pasteButton.addListener(new ClickListener() { private static final long serialVersionUID = -8732259244009686729L; @Override public void buttonClick(ClickEvent event) { theCanvas.paste(); pasteButton.setEnabled(false); } }); pasteButton.setEnabled(false); final NativeButton bracketButton = new NativeButton("Bracket"); bracketButton.setIcon(new ThemeResource("icons/bracket.png")); bracketButton.addListener(new ClickListener() { private static final long serialVersionUID = 5201094306113759901L; @Override public void buttonClick(ClickEvent event) { theCanvas.addBracket(); } }); bracketButton.setEnabled(false); final NativeButton repeatButton = new NativeButton("Repeat"); repeatButton.setIcon(new ThemeResource("icons/repeat.png")); repeatButton.addListener(new ClickListener() { private static final long serialVersionUID = -23302591439643695L; @Override public void buttonClick(ClickEvent event) { try { theCanvas.addRepeat(); } catch (Exception ex) { showMessage(ex.getMessage(), "400px", "100px", "Error creating repeat"); } } }); repeatButton.setEnabled(false); componentsWithResidueSelectionDependency.add(repeatButton); componentsWithResidueSelectionDependency.add(bracketButton); componentsWithResidueSelectionDependency.add(deleteButton); componentsWithResidueSelectionDependency.add(copyButton); final NativeButton orientationButton = new NativeButton("Orientation"); orientationButton.setIcon(new ThemeResource("icons/" + theCanvas.getOrientationIcon())); orientationButton.addListener(new ClickListener() { private static final long serialVersionUID = 6621021858668446143L; @Override public void buttonClick(ClickEvent event) { theCanvas.changeOrientation(); orientationButton.setIcon(new ThemeResource("icons/" + theCanvas.getOrientationIcon())); } }); final NativeButton selectAllButton = new NativeButton("Select all"); selectAllButton.setIcon(new ThemeResource("icons/selectall.png")); selectAllButton.addListener(new ClickListener() { private static final long serialVersionUID = -5848923636575805154L; @Override public void buttonClick(ClickEvent event) { theCanvas.selectAll(); theCanvas.documentUpdated(); } }); final NativeButton deSelectAllButton = new NativeButton("Select none"); deSelectAllButton.setIcon(new ThemeResource("icons/deselect.png")); deSelectAllButton.addListener(new ClickListener() { private static final long serialVersionUID = 8339468775345706027L; @Override public void buttonClick(ClickEvent event) { theCanvas.resetSelection(); theCanvas.documentUpdated(); } }); final NativeButton moveCWButton = new NativeButton("Move CW"); moveCWButton.setIcon(new ThemeResource("icons/rotatecw.png")); moveCWButton.addListener(new ClickListener() { private static final long serialVersionUID = -6061975045440741204L; @Override public void buttonClick(ClickEvent event) { theCanvas.onMoveCW(); } }); componentsWithResidueSelectionDependency.add(moveCWButton); final NativeButton moveCCWButton = new NativeButton("Move CCW"); moveCCWButton.setIcon(new ThemeResource("icons/rotateccw.png")); moveCCWButton.addListener(new ClickListener() { private static final long serialVersionUID = 3555726070782377309L; @Override public void buttonClick(ClickEvent event) { theCanvas.onMoveCCW(); } }); componentsWithResidueSelectionDependency.add(moveCCWButton); toolBar.addComponent(deleteButton); toolBar.addComponent(copyButton); toolBar.addComponent(pasteButton); toolBar.addComponent(orientationButton); toolBar.addComponent(selectAllButton); toolBar.addComponent(deSelectAllButton); toolBar.addComponent(bracketButton); toolBar.addComponent(repeatButton); toolBar.addComponent(moveCWButton); toolBar.addComponent(moveCCWButton); HorizontalLayout layout = new HorizontalLayout(); layout.setSizeFull(); toolBar.addComponent(layout); toolBar.setExpandRatio(layout, 1); theToolBarPanel.setContent(toolBar); }
From source file:at.peppol.webgui.app.MainWindow.java
License:Mozilla Public License
private HorizontalLayout createTopBarButtons() { final HorizontalLayout topBarBtns = new HorizontalLayout(); final Button homeBtn = new Button("Home"); homeBtn.addStyleName("first"); homeBtn.addStyleName("down"); final Button aboutBtn = new Button("About"); final Button contactBtn = new Button("Contact"); contactBtn.addStyleName("last"); topBarBtns.setStyleName("segment"); topBarBtns.addStyleName("tall"); topBarBtns.addComponent(homeBtn);/*from w w w . ja v a 2 s . co m*/ topBarBtns.addComponent(aboutBtn); topBarBtns.addComponent(contactBtn); return topBarBtns; }
From source file:ch.bfh.ti.soed.hs16.srs.white.view.LogInView.java
License:Open Source License
@Override public Component load() { final VerticalLayout formContainer = new VerticalLayout(); formContainer.setStyleName("login-form"); formContainer.setWidthUndefined();/*from w ww .j av a 2 s . c om*/ fieldMail.setCaption("Type your mail here:"); fieldMail.setStyleName("textfield-form"); fieldMail.setTabIndex(1); fieldMail.focus(); fieldPassword.setCaption("Type your password here:"); fieldPassword.setTabIndex(2); fieldPassword.setStyleName("textfield-form"); btnLogin.setClickShortcut(ShortcutAction.KeyCode.ENTER); btnLogin.setTabIndex(3); btnLogin.addClickListener(e -> { switch (logInController.login()) { case ADMIN: AbstractView adminView = new AdminView(); ApplicationController appController = ApplicationController.getInstance(); appController.loadView(adminView); break; case USER: // Load the user view here default: break; } }); btnLogin.setStyleName("button-center"); btnLogin.setTabIndex(4); btnLogin.setWidth("91px"); btnRegister.addClickListener(e -> { RegistrationView rView = new RegistrationView(this); ApplicationController applicationController = ApplicationController.getInstance(); applicationController.loadView(rView); }); btnRegister.setStyleName("button-center"); btnRegister.setWidth("91px"); labelMessage.setStyleName("horizontal-center"); labelMessage.setSizeUndefined(); final HorizontalLayout layoutButtons = new HorizontalLayout(); layoutButtons.addComponents(btnLogin, btnRegister); layoutButtons.setStyleName("horizontal-center"); layoutButtons.setMargin(true); layoutButtons.setSpacing(true); formContainer.addComponents(fieldMail, fieldPassword, layoutButtons, labelMessage); formContainer.setMargin(true); formContainer.setSpacing(true); Responsive.makeResponsive(formContainer); return formContainer; }
From source file:ch.bfh.ti.soed.hs16.srs.white.view.RegistrationView.java
License:Open Source License
@Override public Component load() { final VerticalLayout layout = new VerticalLayout(); layout.setStyleName("registration-form"); fieldFirstName.setStyleName("textfield-form"); fieldLastName.setStyleName("textfield-form"); fieldEmail.setStyleName("textfield-form"); fieldConfirmEmail.setStyleName("textfield-form"); fieldPassword.setStyleName("textfield-form"); fieldConfirmPassword.setStyleName("textfield-form"); btnSubmit.setStyleName("button-center"); btnSubmit.setWidth("91px"); btnSubmit.addClickListener(e -> registrationController.register()); btnCancel.setStyleName("button-center"); btnCancel.setWidth("91px"); btnCancel.addClickListener(e -> registrationController.goBack(getLastView())); final HorizontalLayout layoutButtons = new HorizontalLayout(); layoutButtons.addComponents(btnSubmit, btnCancel); layoutButtons.setStyleName("horizontal-center"); layoutButtons.setMargin(true);/* w w w .ja va 2 s .c o m*/ layoutButtons.setSpacing(true); labelMessage.setStyleName("horizontal-center"); labelMessage.setSizeUndefined(); layout.addComponents(fieldFirstName, fieldLastName, fieldEmail, fieldConfirmEmail, fieldPassword, fieldConfirmPassword, layoutButtons, labelMessage); return layout; }
From source file:com.dungnv.streetfood.ui.ArticleItemUI.java
private void init() { this.addStyleName("item-interator"); this.setSpacing(true); this.setWidth("100%"); CssLayout horizontal = new CssLayout(); horizontal.setStyleName("padding-5"); horizontal.setWidth("100%"); Responsive.makeResponsive(horizontal); this.addComponent(horizontal); Image imag = new Image(); if (!StringUtils.isNullOrEmpty(item.getImageUrl())) { imag.setSource(new ExternalResource(item.getImageUrl())); }/*from www . j a va 2s . c o m*/ horizontal.addComponent(imag); VerticalLayout vlInfo = new VerticalLayout(); vlInfo.setStyleName("padding-5"); vlInfo.setWidth("70%"); horizontal.addComponent(vlInfo); lbTitle = new Label(item.getTitle()); lbTitle.addStyleName("lb-title"); vlInfo.addComponent(lbTitle); lbIntroduce = new Label(item.getShortContent()); lbIntroduce.setStyleName("lb-description"); vlInfo.addComponent(lbIntroduce); HorizontalLayout htInfo = new HorizontalLayout(); vlInfo.addComponent(htInfo); lbInfo = new Label(); lbInfo.setCaptionAsHtml(true); htInfo.addComponent(lbInfo); HorizontalLayout htToolBar = new HorizontalLayout(); htToolBar.setStyleName("lb-toolbar"); horizontal.addComponent(htToolBar); btnLink = new Button(); btnLink.setIcon(FontAwesome.LINK); btnLink.addStyleName(ValoTheme.BUTTON_ICON_ONLY); btnLink.addStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED); btnLink.setWidth("25px"); btnLink.setHeight("25px"); htToolBar.addComponent(btnLink); htToolBar.setComponentAlignment(btnLink, Alignment.BOTTOM_RIGHT); btnEdit = new Button(); btnEdit.setIcon(FontAwesome.EDIT); btnEdit.addStyleName(ValoTheme.BUTTON_ICON_ONLY); btnEdit.addStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED); btnEdit.setWidth("25px"); btnEdit.setHeight("25px"); htToolBar.addComponent(btnEdit); htToolBar.setComponentAlignment(btnEdit, Alignment.BOTTOM_RIGHT); btnDelete = new Button(); btnDelete.setIcon(FontAwesome.TIMES); btnDelete.addStyleName(ValoTheme.BUTTON_ICON_ONLY); btnDelete.addStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED); btnDelete.setWidth("25px"); btnDelete.setHeight("25px"); htToolBar.addComponent(btnDelete); htToolBar.setComponentAlignment(btnDelete, Alignment.BOTTOM_RIGHT); }
From source file:com.dungnv.streetfood.ui.CategoryItemUI.java
private void init() { this.addStyleName("item-interator"); this.setSpacing(true); this.setWidth("100%"); CssLayout horizontal = new CssLayout(); horizontal.setStyleName("padding-5"); horizontal.setWidth("100%"); Responsive.makeResponsive(horizontal); this.addComponent(horizontal); Image imag = new Image(); if (!StringUtils.isNullOrEmpty(item.getImageUrl())) { imag.setSource(new ExternalResource(item.getImageUrl())); }/*from ww w.j a va 2 s.c o m*/ horizontal.addComponent(imag); VerticalLayout vlInfo = new VerticalLayout(); vlInfo.setStyleName("padding-5"); vlInfo.setWidth("70%"); horizontal.addComponent(vlInfo); lbTitle = new Label(item.getName()); lbTitle.addStyleName("lb-title"); if ("1".equals(item.getCategoryStatus())) { lbTitle.addStyleName("lb-status-active"); } else { lbTitle.addStyleName("lb-status-inActive"); } vlInfo.addComponent(lbTitle); lbDesc = new Label(item.getDescription()); lbDesc.setStyleName("lb-description"); vlInfo.addComponent(lbDesc); HorizontalLayout htInfo = new HorizontalLayout(); vlInfo.addComponent(htInfo); lbInfo = new Label(); lbInfo.setCaptionAsHtml(true); htInfo.addComponent(lbInfo); HorizontalLayout htToolBar = new HorizontalLayout(); htToolBar.setStyleName("lb-toolbar"); horizontal.addComponent(htToolBar); btnLock = new Button(); if ("1".equals(item.getCategoryStatus())) { btnLock.setIcon(FontAwesome.LOCK); } else { btnLock.setIcon(FontAwesome.UNLOCK); } btnLock.addStyleName(ValoTheme.BUTTON_ICON_ONLY); btnLock.addStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED); btnLock.setWidth("25px"); btnLock.setHeight("25px"); htToolBar.addComponent(btnLock); htToolBar.setComponentAlignment(btnLock, Alignment.BOTTOM_RIGHT); btnLink = new Button(); btnLink.setIcon(FontAwesome.LINK); btnLink.addStyleName(ValoTheme.BUTTON_ICON_ONLY); btnLink.addStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED); btnLink.setWidth("25px"); btnLink.setHeight("25px"); htToolBar.addComponent(btnLink); htToolBar.setComponentAlignment(btnLink, Alignment.BOTTOM_RIGHT); btnEdit = new Button(); btnEdit.setIcon(FontAwesome.EDIT); btnEdit.addStyleName(ValoTheme.BUTTON_ICON_ONLY); btnEdit.addStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED); btnEdit.setWidth("25px"); btnEdit.setHeight("25px"); htToolBar.addComponent(btnEdit); htToolBar.setComponentAlignment(btnEdit, Alignment.BOTTOM_RIGHT); btnDelete = new Button(); btnDelete.setIcon(FontAwesome.TIMES); btnDelete.addStyleName(ValoTheme.BUTTON_ICON_ONLY); btnDelete.addStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED); btnDelete.setWidth("25px"); btnDelete.setHeight("25px"); htToolBar.addComponent(btnDelete); htToolBar.setComponentAlignment(btnDelete, Alignment.BOTTOM_RIGHT); }
From source file:com.dungnv.streetfood.ui.DishItemUI.java
private void init() { this.addStyleName("item-interator"); this.setSpacing(true); this.setWidth("100%"); CssLayout horizontal = new CssLayout(); horizontal.setStyleName("padding-5"); horizontal.setWidth("100%"); Responsive.makeResponsive(horizontal); this.addComponent(horizontal); Image imag = new Image(); if (!StringUtils.isNullOrEmpty(item.getImageUrl())) { imag.setSource(new ExternalResource(item.getImageUrl())); }/*from www .j av a 2 s . c o m*/ horizontal.addComponent(imag); VerticalLayout vlInfo = new VerticalLayout(); vlInfo.setStyleName("padding-5"); vlInfo.setWidth("70%"); horizontal.addComponent(vlInfo); lbTitle = new Label(item.getName()); lbTitle.addStyleName("lb-title"); vlInfo.addComponent(lbTitle); lbDesc = new Label(item.getShortDescription()); lbDesc.setStyleName("lb-description"); vlInfo.addComponent(lbDesc); HorizontalLayout htInfo = new HorizontalLayout(); vlInfo.addComponent(htInfo); lbInfo = new Label(); lbInfo.setCaptionAsHtml(true); htInfo.addComponent(lbInfo); HorizontalLayout htToolBar = new HorizontalLayout(); htToolBar.setStyleName("lb-toolbar"); horizontal.addComponent(htToolBar); btnLock = new Button(); if ("1".equals(item.getDishStatus())) { btnLock.setIcon(FontAwesome.LOCK); } else { btnLock.setIcon(FontAwesome.UNLOCK); } btnLock.addStyleName(ValoTheme.BUTTON_ICON_ONLY); btnLock.addStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED); btnLock.setWidth("25px"); btnLock.setHeight("25px"); htToolBar.addComponent(btnLock); htToolBar.setComponentAlignment(btnLock, Alignment.BOTTOM_RIGHT); btnLink = new Button(); btnLink.setIcon(FontAwesome.LINK); btnLink.addStyleName(ValoTheme.BUTTON_ICON_ONLY); btnLink.addStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED); btnLink.setWidth("25px"); btnLink.setHeight("25px"); htToolBar.addComponent(btnLink); htToolBar.setComponentAlignment(btnLink, Alignment.BOTTOM_RIGHT); btnEdit = new Button(); btnEdit.setIcon(FontAwesome.EDIT); btnEdit.addStyleName(ValoTheme.BUTTON_ICON_ONLY); btnEdit.addStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED); btnEdit.setWidth("25px"); btnEdit.setHeight("25px"); htToolBar.addComponent(btnEdit); htToolBar.setComponentAlignment(btnEdit, Alignment.BOTTOM_RIGHT); btnDelete = new Button(); btnDelete.setIcon(FontAwesome.TIMES); btnDelete.addStyleName(ValoTheme.BUTTON_ICON_ONLY); btnDelete.addStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED); btnDelete.setWidth("25px"); btnDelete.setHeight("25px"); htToolBar.addComponent(btnDelete); htToolBar.setComponentAlignment(btnDelete, Alignment.BOTTOM_RIGHT); }
From source file:com.dungnv.streetfood.ui.RestaurantItemUI.java
private void init() { this.addStyleName("item-interator"); this.setSpacing(true); this.setWidth("100%"); CssLayout horizontal = new CssLayout(); horizontal.setStyleName("padding-5"); horizontal.setWidth("100%"); Responsive.makeResponsive(horizontal); this.addComponent(horizontal); Image imag = new Image(); if (!StringUtils.isNullOrEmpty(item.getImageUrl())) { imag.setSource(new ExternalResource(item.getImageUrl())); }// www.j a v a2 s . c o m horizontal.addComponent(imag); VerticalLayout vlInfo = new VerticalLayout(); vlInfo.setStyleName("padding-5"); vlInfo.setWidth("70%"); horizontal.addComponent(vlInfo); lbTitle = new Label(item.getName()); lbTitle.addStyleName("lb-title"); vlInfo.addComponent(lbTitle); lbIntroduce = new Label(item.getAddress()); lbIntroduce.setStyleName("lb-description"); vlInfo.addComponent(lbIntroduce); HorizontalLayout htInfo = new HorizontalLayout(); vlInfo.addComponent(htInfo); lbInfo = new Label(); lbInfo.setCaptionAsHtml(true); htInfo.addComponent(lbInfo); HorizontalLayout htToolBar = new HorizontalLayout(); htToolBar.setStyleName("lb-toolbar"); horizontal.addComponent(htToolBar); btnLock = new Button(); if ("1".equals(item.getRestaurantStatus())) { btnLock.setIcon(FontAwesome.LOCK); } else { btnLock.setIcon(FontAwesome.UNLOCK); } btnLock.addStyleName(ValoTheme.BUTTON_ICON_ONLY); btnLock.addStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED); btnLock.setWidth("25px"); btnLock.setHeight("25px"); htToolBar.addComponent(btnLock); htToolBar.setComponentAlignment(btnLock, Alignment.BOTTOM_RIGHT); btnLink = new Button(); btnLink.setIcon(FontAwesome.LINK); btnLink.addStyleName(ValoTheme.BUTTON_ICON_ONLY); btnLink.addStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED); btnLink.setWidth("25px"); btnLink.setHeight("25px"); htToolBar.addComponent(btnLink); htToolBar.setComponentAlignment(btnLink, Alignment.BOTTOM_RIGHT); btnEdit = new Button(); btnEdit.setIcon(FontAwesome.EDIT); btnEdit.addStyleName(ValoTheme.BUTTON_ICON_ONLY); btnEdit.addStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED); btnEdit.setWidth("25px"); btnEdit.setHeight("25px"); htToolBar.addComponent(btnEdit); htToolBar.setComponentAlignment(btnEdit, Alignment.BOTTOM_RIGHT); btnDelete = new Button(); btnDelete.setIcon(FontAwesome.TIMES); btnDelete.addStyleName(ValoTheme.BUTTON_ICON_ONLY); btnDelete.addStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED); btnDelete.setWidth("25px"); btnDelete.setHeight("25px"); htToolBar.addComponent(btnDelete); htToolBar.setComponentAlignment(btnDelete, Alignment.BOTTOM_RIGHT); }
From source file:com.dungnv.streetfood.ui.SlideShowItemUI.java
private void init() { this.addStyleName("item-interator"); this.setSpacing(true); this.setWidth("100%"); CssLayout horizontal = new CssLayout(); horizontal.setStyleName("padding-5"); horizontal.setWidth("100%"); Responsive.makeResponsive(horizontal); this.addComponent(horizontal); Image imag = new Image(); if (!StringUtils.isNullOrEmpty(item.getImageUrl())) { imag.setSource(new ExternalResource(item.getImageUrl())); }/* w w w . j a va 2 s . c om*/ horizontal.addComponent(imag); VerticalLayout vlInfo = new VerticalLayout(); vlInfo.setStyleName("padding-5"); vlInfo.setWidth("70%"); horizontal.addComponent(vlInfo); lbTitle = new Label(item.getName()); lbTitle.addStyleName("lb-title"); vlInfo.addComponent(lbTitle); lbIntroduce = new Label(item.getDescription()); lbIntroduce.setStyleName("lb-description"); vlInfo.addComponent(lbIntroduce); HorizontalLayout htInfo = new HorizontalLayout(); vlInfo.addComponent(htInfo); lbInfo = new Label(); lbInfo.setCaptionAsHtml(true); htInfo.addComponent(lbInfo); HorizontalLayout htToolBar = new HorizontalLayout(); htToolBar.setStyleName("lb-toolbar"); horizontal.addComponent(htToolBar); btnEdit = new Button(); btnEdit.setIcon(FontAwesome.EDIT); btnEdit.addStyleName(ValoTheme.BUTTON_ICON_ONLY); btnEdit.addStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED); btnEdit.setWidth("25px"); btnEdit.setHeight("25px"); htToolBar.addComponent(btnEdit); htToolBar.setComponentAlignment(btnEdit, Alignment.BOTTOM_RIGHT); btnDelete = new Button(); btnDelete.setIcon(FontAwesome.TIMES); btnDelete.addStyleName(ValoTheme.BUTTON_ICON_ONLY); btnDelete.addStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED); btnDelete.setWidth("25px"); btnDelete.setHeight("25px"); htToolBar.addComponent(btnDelete); htToolBar.setComponentAlignment(btnDelete, Alignment.BOTTOM_RIGHT); }
From source file:com.esofthead.mycollab.mobile.module.crm.ui.NotesList.java
License:Open Source License
private void initUI() { noteList = new BeanList<NoteService, NoteSearchCriteria, SimpleNote>(noteService, NoteRowDisplayHandler.class); noteList.setDisplayEmptyListText(false); noteList.setStyleName("noteList"); noteListContainer = new VerticalLayout(); this.setContent(noteListContainer); displayNotes();/* www. j a va 2s.com*/ HorizontalLayout commentBox = new HorizontalLayout(); commentBox.setSizeFull(); commentBox.setStyleName("comment-box"); commentBox.setSpacing(true); commentBox.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); final TextArea noteInput = new TextArea(); noteInput.setInputPrompt(AppContext.getMessage(GenericI18Enum.M_NOTE_INPUT_PROMPT)); noteInput.setSizeFull(); commentBox.addComponent(noteInput); commentBox.setExpandRatio(noteInput, 1.0f); Button postBtn = new Button(AppContext.getMessage(GenericI18Enum.M_BUTTON_SEND)); postBtn.setStyleName("submit-btn"); postBtn.setWidthUndefined(); postBtn.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = -5095455325725786794L; @Override public void buttonClick(Button.ClickEvent event) { final Note note = new Note(); note.setCreateduser(AppContext.getUsername()); note.setNote(noteInput.getValue()); note.setSaccountid(AppContext.getAccountId()); note.setSubject(""); note.setType(type); note.setTypeid(typeid); note.setCreatedtime(new GregorianCalendar().getTime()); note.setLastupdatedtime(new GregorianCalendar().getTime()); noteService.saveWithSession(note, AppContext.getUsername()); // Save Relay Email -- having time must refact to // Aop // ------------------------------------------------------ RelayEmailNotification relayNotification = new RelayEmailNotification(); relayNotification.setChangeby(AppContext.getUsername()); relayNotification.setChangecomment(noteInput.getValue()); relayNotification.setSaccountid(AppContext.getAccountId()); relayNotification.setType(type); relayNotification.setAction(MonitorTypeConstants.ADD_COMMENT_ACTION); relayNotification.setTypeid("" + typeid); if (type.equals(CrmTypeConstants.ACCOUNT)) { relayNotification.setEmailhandlerbean(AccountRelayEmailNotificationAction.class.getName()); } else if (type.equals(CrmTypeConstants.CONTACT)) { relayNotification.setEmailhandlerbean(ContactRelayEmailNotificationAction.class.getName()); } else if (type.equals(CrmTypeConstants.CAMPAIGN)) { relayNotification.setEmailhandlerbean(CampaignRelayEmailNotificationAction.class.getName()); } else if (type.equals(CrmTypeConstants.LEAD)) { relayNotification.setEmailhandlerbean(LeadRelayEmailNotificationAction.class.getName()); } else if (type.equals(CrmTypeConstants.OPPORTUNITY)) { relayNotification.setEmailhandlerbean(OpportunityRelayEmailNotificationAction.class.getName()); } else if (type.equals(CrmTypeConstants.CASE)) { relayNotification.setEmailhandlerbean(CaseRelayEmailNotificationAction.class.getName()); } else if (type.equals(CrmTypeConstants.TASK)) { relayNotification.setEmailhandlerbean(TaskRelayEmailNotificationAction.class.getName()); } else if (type.equals(CrmTypeConstants.MEETING)) { relayNotification.setEmailhandlerbean(MeetingRelayEmailNotificationAction.class.getName()); } else if (type.equals(CrmTypeConstants.CALL)) { relayNotification.setEmailhandlerbean(CallRelayEmailNotificationAction.class.getName()); } RelayEmailNotificationService relayEmailNotificationService = ApplicationContextUtil .getSpringBean(RelayEmailNotificationService.class); relayEmailNotificationService.saveWithSession(relayNotification, AppContext.getUsername()); noteInput.setValue(""); displayNotes(); } }); commentBox.addComponent(postBtn); this.setToolbar(commentBox); }