List of usage examples for com.vaadin.ui VerticalLayout VerticalLayout
public VerticalLayout()
From source file:com.esofthead.mycollab.module.crm.ui.components.AbstractPreviewItemComp.java
License:Open Source License
public AbstractPreviewItemComp(Resource iconResource) { previewItemContainer = new CrmVerticalTabsheet(false); this.addComponent(previewItemContainer); previewItemContainer.setSizeFull();//from w ww . j a v a 2 s. c o m previewItemContainer.setNavigatorWidth("100%"); previewItemContainer.setNavigatorStyleName("sidebar-menu"); previewItemContainer.setContainerStyleName("tab-content"); previewItemContainer.setHeight(null); CssLayout navigatorWrapper = previewItemContainer.getNavigatorWrapper(); navigatorWrapper.setWidth("250px"); previewItemContainer.addSelectedTabChangeListener(new SelectedTabChangeListener() { private static final long serialVersionUID = 1L; @Override public void selectedTabChange(SelectedTabChangeEvent event) { Tab tab = ((VerticalTabsheet) event.getSource()).getSelectedTab(); previewItemContainer.selectTab(((TabImpl) tab).getTabId()); } }); previewLayout = new AddViewLayout2("", iconResource); previewContent = new VerticalLayout(); previewContent.setWidth("100%"); previewForm = initPreviewForm(); previewForm.addStyleName("preview-form"); previewLayout.setStyleName("readview-layout"); previewLayout.setMargin(new MarginInfo(false, true, true, true)); ComponentContainer actionControls = createButtonControls(); if (actionControls != null) { previewLayout.addHeaderRight(actionControls); } previewItemContainer.replaceContainer(previewLayout, previewLayout.getBody()); initRelatedComponents(); previewContent.addComponent(previewForm); previewContent.addComponent(createBottomPanel()); }
From source file:com.esofthead.mycollab.module.crm.ui.components.CommentInput.java
License:Open Source License
@SuppressWarnings("rawtypes") CommentInput(final ReloadableComponent component, final CommentType typeVal, final String typeidVal, final Integer extraTypeIdVal, final boolean cancelButtonEnable, final boolean isSendingEmailRelay, final Class emailHandler) { this.setWidth("600px"); setSpacing(true);//from ww w . j ava2 s . c om type = typeVal; typeid = typeidVal; extraTypeId = extraTypeIdVal; commentArea = new RichTextArea(); commentArea.setWidth("100%"); commentArea.setHeight("200px"); final AttachmentPanel attachments = new AttachmentPanel(); final MHorizontalLayout controlsLayout = new MHorizontalLayout().withWidth("100%"); final MultiFileUploadExt uploadExt = new MultiFileUploadExt(attachments); uploadExt.addComponent(attachments); controlsLayout.with(uploadExt).withAlign(uploadExt, Alignment.TOP_LEFT).expand(uploadExt); final Button saveBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_POST), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final Button.ClickEvent event) { final Comment comment = new Comment(); comment.setComment(Jsoup.clean(commentArea.getValue(), Whitelist.relaxed())); comment.setCreatedtime(new GregorianCalendar().getTime()); comment.setCreateduser(AppContext.getUsername()); comment.setSaccountid(AppContext.getAccountId()); comment.setType(type.toString()); comment.setTypeid(typeid); comment.setExtratypeid(extraTypeId); final CommentService commentService = ApplicationContextUtil .getSpringBean(CommentService.class); int commentId; if (isSendingEmailRelay) { commentId = commentService.saveWithSession(comment, AppContext.getUsername(), isSendingEmailRelay, emailHandler); } else { commentId = commentService.saveWithSession(comment, AppContext.getUsername(), false, emailHandler); } String attachmentPath = ""; if (CommentType.CRM_NOTE.equals(type)) { attachmentPath = AttachmentUtils.getCrmNoteCommentAttachmentPath( AppContext.getAccountId(), Integer.parseInt(typeid), commentId); } else { // do nothing } if (!"".equals(attachmentPath)) { attachments.saveContentsToRepo(attachmentPath); } // save success, clear comment area and load list // comments again commentArea.setValue(""); attachments.removeAllAttachmentsDisplay(); component.reload(); } }); saveBtn.setStyleName(UIConstants.THEME_GREEN_LINK); saveBtn.setIcon(FontAwesome.SEND); controlsLayout.with(saveBtn).withAlign(saveBtn, Alignment.TOP_RIGHT); if (cancelButtonEnable) { final Button cancelBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_CANCEL), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { component.cancel(); } }); cancelBtn.setStyleName(UIConstants.THEME_GRAY_LINK); controlsLayout.addComponent(cancelBtn); controlsLayout.setComponentAlignment(cancelBtn, Alignment.TOP_RIGHT); } MVerticalLayout editBox = new MVerticalLayout(); MHorizontalLayout commentWrap = new MHorizontalLayout().withWidth("100%"); commentWrap.addStyleName("message"); SimpleUser currentUser = AppContext.getSession(); VerticalLayout userBlock = new VerticalLayout(); userBlock.setDefaultComponentAlignment(Alignment.TOP_CENTER); userBlock.setWidth("80px"); userBlock.setSpacing(true); userBlock.addComponent(UserAvatarControlFactory.createUserAvatarButtonLink(currentUser.getAvatarid(), currentUser.getDisplayName())); Label userName = new Label(currentUser.getDisplayName()); userName.setStyleName("user-name"); userBlock.addComponent(userName); commentWrap.addComponent(userBlock); VerticalLayout textAreaWrap = new VerticalLayout(); textAreaWrap.setStyleName("message-container"); textAreaWrap.setWidth("100%"); textAreaWrap.addComponent(editBox); commentWrap.addComponent(textAreaWrap); commentWrap.setExpandRatio(textAreaWrap, 1.0f); editBox.addComponent(commentArea); editBox.addComponent(controlsLayout); this.addComponent(commentWrap); }
From source file:com.esofthead.mycollab.module.crm.ui.components.NoteListItems.java
License:Open Source License
private void initUI() { noteWrapper = new MVerticalLayout().withSpacing(true).withMargin(new MarginInfo(true, true, false, true)) .withWidth("100%").withStyleName("note-view"); this.addComponent(noteWrapper); addStyleName("note-list"); createBtn = new Button(AppContext.getMessage(CrmCommonI18nEnum.BUTTON_NEW_NOTE), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override//ww w. j ava 2s . c o m public void buttonClick(final ClickEvent event) { NoteEditor addCommentEditor = new NoteEditor(); noteWrapper.replaceComponent(createBtn, addCommentEditor); noteWrapper.setComponentAlignment(addCommentEditor, Alignment.TOP_LEFT); } }); createBtn.setStyleName(UIConstants.THEME_GREEN_LINK); createBtn.setIcon(FontAwesome.PLUS); noteWrapper.addComponent(createBtn); noteWrapper.setComponentAlignment(createBtn, Alignment.TOP_RIGHT); noteList = new BeanList<>(noteService, NoteRowDisplayHandler.class); noteList.setDisplayEmptyListText(false); noteList.setStyleName("noteList"); noteListContainer = new VerticalLayout(); noteWrapper.addComponent(noteListContainer); }
From source file:com.esofthead.mycollab.module.crm.ui.components.RelatedItemSelectionWindow.java
License:Open Source License
public RelatedItemSelectionWindow(String title, RelatedListComp2 relatedList) { super(title); center();/* w w w . java 2s . c o m*/ bodyContent = new VerticalLayout(); bodyContent.setMargin(true); bodyContent.setSpacing(true); this.setContent(bodyContent); this.relatedListComp = relatedList; this.setModal(true); this.setResizable(false); initUI(); tableItem.addTableListener(new TableClickListener() { private static final long serialVersionUID = 1L; @SuppressWarnings("unchecked") @Override public void itemClick(TableClickEvent event) { try { Object rowItem = event.getData(); Boolean selectedVal = (Boolean) PropertyUtils.getProperty(rowItem, selectedFieldName); if (selectedVal) { selectedItems.remove(rowItem); PropertyUtils.setProperty(rowItem, selectedFieldName, false); } else { selectedItems.add(rowItem); PropertyUtils.setProperty(rowItem, selectedFieldName, true); } } catch (Exception ex) { throw new MyCollabException(ex); } } }); }
From source file:com.esofthead.mycollab.module.crm.view.account.AccountContactListComp.java
License:Open Source License
@Override protected Component generateTopControls() { VerticalLayout controlsBtnWrap = new VerticalLayout(); controlsBtnWrap.setWidth("100%"); final SplitButton controlsBtn = new SplitButton(); controlsBtn.setSizeUndefined();//ww w .j a va 2 s .com controlsBtn.setEnabled(AppContext.canWrite(RolePermissionCollections.CRM_CONTACT)); controlsBtn.addStyleName(UIConstants.THEME_GREEN_LINK); controlsBtn.setCaption(AppContext.getMessage(ContactI18nEnum.BUTTON_NEW_CONTACT)); controlsBtn.setIcon(FontAwesome.PLUS); controlsBtn.addClickListener(new SplitButton.SplitButtonClickListener() { private static final long serialVersionUID = 1L; @Override public void splitButtonClick(final SplitButton.SplitButtonClickEvent event) { fireNewRelatedItem(""); } }); final Button selectBtn = new Button("Select from existing contacts", new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { final AccountContactSelectionWindow contactsWindow = new AccountContactSelectionWindow( AccountContactListComp.this); final ContactSearchCriteria criteria = new ContactSearchCriteria(); criteria.setSaccountid(new NumberSearchField(AppContext.getAccountId())); UI.getCurrent().addWindow(contactsWindow); contactsWindow.setSearchCriteria(criteria); controlsBtn.setPopupVisible(false); } }); selectBtn.setIcon(MyCollabResource.newResource(WebResourceIds._16_select)); selectBtn.setStyleName("link"); VerticalLayout buttonControlLayout = new VerticalLayout(); buttonControlLayout.addComponent(selectBtn); controlsBtn.setContent(buttonControlLayout); controlsBtnWrap.addComponent(controlsBtn); controlsBtnWrap.setComponentAlignment(controlsBtn, Alignment.MIDDLE_RIGHT); return controlsBtnWrap; }
From source file:com.esofthead.mycollab.module.crm.view.account.AccountLeadListComp.java
License:Open Source License
@Override protected Component generateTopControls() { VerticalLayout controlsBtnWrap = new VerticalLayout(); controlsBtnWrap.setWidth("100%"); final SplitButton controlsBtn = new SplitButton(); controlsBtn.setSizeUndefined();/* www .j a v a 2s. c o m*/ controlsBtn.setEnabled(AppContext.canWrite(RolePermissionCollections.CRM_LEAD)); controlsBtn.addStyleName(UIConstants.THEME_GREEN_LINK); controlsBtn.setCaption(AppContext.getMessage(LeadI18nEnum.BUTTON_NEW_LEAD)); controlsBtn.setIcon(FontAwesome.PLUS); controlsBtn.addClickListener(new SplitButton.SplitButtonClickListener() { private static final long serialVersionUID = 1L; @Override public void splitButtonClick(final SplitButton.SplitButtonClickEvent event) { fireNewRelatedItem(""); } }); final Button selectBtn = new Button("Select from existing leads", new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { final AccountLeadSelectionWindow leadsWindow = new AccountLeadSelectionWindow( AccountLeadListComp.this); final LeadSearchCriteria criteria = new LeadSearchCriteria(); criteria.setSaccountid(new NumberSearchField(AppContext.getAccountId())); UI.getCurrent().addWindow(leadsWindow); leadsWindow.setSearchCriteria(criteria); controlsBtn.setPopupVisible(false); } }); selectBtn.setIcon(MyCollabResource.newResource(WebResourceIds._16_select)); selectBtn.setStyleName("link"); VerticalLayout buttonControlLayout = new VerticalLayout(); buttonControlLayout.addComponent(selectBtn); controlsBtn.setContent(buttonControlLayout); controlsBtnWrap.addComponent(controlsBtn); controlsBtnWrap.setComponentAlignment(controlsBtn, Alignment.MIDDLE_RIGHT); return controlsBtnWrap; }
From source file:com.esofthead.mycollab.module.crm.view.account.AccountListDashlet.java
License:Open Source License
public AccountListDashlet() { super("My Accounts", new VerticalLayout()); tableItem = new AccountTableDisplay(Arrays.asList(AccountTableFieldDef.accountname, AccountTableFieldDef.phoneoffice, AccountTableFieldDef.email)); tableItem.addTableListener(new TableClickListener() { private static final long serialVersionUID = 1L; @Override//from w w w . j a v a 2 s .c om public void itemClick(final TableClickEvent event) { final SimpleAccount account = (SimpleAccount) event.getData(); if ("accountname".equals(event.getFieldName())) { EventBusFactory.getInstance() .post(new AccountEvent.GotoRead(AccountListDashlet.this, account.getId())); } } }); bodyContent.addComponent(tableItem); Button customizeViewBtn = new Button("", new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { UI.getCurrent() .addWindow(new AccountListCustomizeWindow(AccountListDashlet.VIEW_DEF_ID, tableItem)); } }); customizeViewBtn.setIcon(FontAwesome.ADJUST); customizeViewBtn.setDescription("Layout Options"); customizeViewBtn.setStyleName(UIConstants.BUTTON_ICON_ONLY); this.addHeaderElement(customizeViewBtn); }
From source file:com.esofthead.mycollab.module.crm.view.account.AccountListNoItemView.java
License:Open Source License
public AccountListNoItemView() { VerticalLayout layout = new VerticalLayout(); layout.addStyleName("case-noitem"); layout.setWidth("800px"); layout.setSpacing(true);/*from w w w .j a v a 2s .c o m*/ layout.setDefaultComponentAlignment(Alignment.TOP_CENTER); layout.setMargin(true); Image image = new Image(null, MyCollabResource.newResource("icons/48/crm/account.png")); layout.addComponent(image); Label title = new Label(AppContext.getMessage(AccountI18nEnum.VIEW_NO_ITEM_TITLE)); title.addStyleName("h2"); title.setWidthUndefined(); layout.addComponent(title); Label body = new Label(AppContext.getMessage(AccountI18nEnum.VIEW_NO_ITEM_HINT)); body.setWidthUndefined(); layout.addComponent(body); Button createAccountBtn = new Button(AppContext.getMessage(AccountI18nEnum.BUTTON_NEW_ACCOUNT), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { EventBusFactory.getInstance().post(new AccountEvent.GotoAdd(this, null)); } }); HorizontalLayout links = new HorizontalLayout(); links.addComponent(createAccountBtn); createAccountBtn.addStyleName(UIConstants.THEME_GREEN_LINK); /* * Label or = new Label("Or"); or.setStyleName("h2"); * links.addComponent(or); * * Button btImportContact = new Button("Import Accounts", new * Button.ClickListener() { private static final long serialVersionUID = * 1L; * * @Override public void buttonClick(ClickEvent arg0) { * UI.getCurrent().addWindow(new CaseImportWindow()); } }); * * btImportContact.addStyleName(UIConstants.THEME_GRAY_LINK); * * * links.addComponent(btImportContact); */ links.setSpacing(true); layout.addComponent(links); this.addComponent(layout); this.setComponentAlignment(layout, Alignment.TOP_CENTER); }
From source file:com.esofthead.mycollab.module.crm.view.activity.ActivityCalendarViewImpl.java
License:Open Source License
private void initContent() { MHorizontalLayout contentWrapper = new MHorizontalLayout().withSpacing(false).withWidth("100%"); this.addComponent(contentWrapper); /* Content cheat */ MVerticalLayout mainContent = new MVerticalLayout().withMargin(new MarginInfo(false, true, true, true)) .withWidth("100%").withStyleName("readview-layout"); contentWrapper.with(mainContent).expand(mainContent); MVerticalLayout rightColumn = new MVerticalLayout().withMargin(new MarginInfo(true, false, true, false)) .withWidth("250px"); rightColumn.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER); contentWrapper.addComponent(rightColumn); MHorizontalLayout actionPanel = new MHorizontalLayout().withMargin(new MarginInfo(true, false, true, false)) .withWidth("100%").withStyleName(UIConstants.HEADER_VIEW); actionPanel.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); Label headerText = new CrmViewHeader(CrmTypeConstants.ACTIVITY, "Calendar"); headerText.setStyleName(UIConstants.HEADER_TEXT); actionPanel.with(headerText).expand(headerText); mainContent.addComponent(actionPanel); this.dateHdr = new Label(); this.dateHdr.setSizeUndefined(); this.dateHdr.setStyleName("h2"); mainContent.addComponent(this.dateHdr); mainContent.setComponentAlignment(this.dateHdr, Alignment.MIDDLE_CENTER); toggleViewBtn = new PopupButton("Monthly"); toggleViewBtn.setWidth("200px"); toggleViewBtn.addStyleName("calendar-view-switcher"); MVerticalLayout popupLayout = new MVerticalLayout().withMargin(new MarginInfo(false, true, false, true)) .withWidth("190px"); monthViewBtn = new Button("Monthly", new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override/*from w w w .j ava 2 s. c o m*/ public void buttonClick(ClickEvent event) { toggleViewBtn.setPopupVisible(false); toggleViewBtn.setCaption(monthViewBtn.getCaption()); calendarComponent.switchToMonthView(new Date(), true); datePicker.selectDate(new Date()); monthViewBtn.addStyleName("selected-style"); initLabelCaption(); } }); monthViewBtn.setStyleName("link"); popupLayout.addComponent(monthViewBtn); weekViewBtn = new Button("Weekly", new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { toggleViewBtn.setPopupVisible(false); toggleViewBtn.setCaption(weekViewBtn.getCaption()); calendarComponent.switchToWeekView(new Date()); datePicker.selectWeek(new Date()); } }); weekViewBtn.setStyleName("link"); popupLayout.addComponent(weekViewBtn); dailyViewBtn = new Button("Daily", new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { toggleViewBtn.setPopupVisible(false); toggleViewBtn.setCaption(dailyViewBtn.getCaption()); Date currentDate = new Date(); datePicker.selectDate(currentDate); calendarComponent.switchToDateView(currentDate); } }); dailyViewBtn.setStyleName("link"); popupLayout.addComponent(dailyViewBtn); toggleViewBtn.setContent(popupLayout); CssLayout toggleBtnWrap = new CssLayout(); toggleBtnWrap.setStyleName("switcher-wrap"); toggleBtnWrap.addComponent(toggleViewBtn); rightColumn.addComponent(toggleBtnWrap); rightColumn.setComponentAlignment(toggleBtnWrap, Alignment.MIDDLE_CENTER); rightColumn.addComponent(this.datePicker); initLabelCaption(); addCalendarEvent(); actionPanel.addComponent(calendarActionBtn); actionPanel.setComponentAlignment(calendarActionBtn, Alignment.MIDDLE_RIGHT); VerticalLayout actionBtnLayout = new VerticalLayout(); actionBtnLayout.setMargin(true); actionBtnLayout.setSpacing(true); actionBtnLayout.setWidth("150px"); Button.ClickListener listener = new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { calendarActionBtn.setPopupVisible(false); String caption = event.getButton().getCaption(); if (caption.equals("New Task")) { EventBusFactory.getInstance().post(new ActivityEvent.TaskAdd(this, null)); } else if (caption.equals("New Call")) { EventBusFactory.getInstance().post(new ActivityEvent.CallAdd(this, null)); } else if (caption.equals("New Event")) { EventBusFactory.getInstance().post(new ActivityEvent.MeetingAdd(this, null)); } } }; ButtonLink todoBtn = new ButtonLink("New Task", listener); actionBtnLayout.addComponent(todoBtn); todoBtn.setIcon(CrmAssetsManager.getAsset(CrmTypeConstants.TASK)); todoBtn.setEnabled(AppContext.canWrite(RolePermissionCollections.CRM_TASK)); Button callBtn = new ButtonLink("New Call", listener); actionBtnLayout.addComponent(callBtn); callBtn.setIcon(CrmAssetsManager.getAsset(CrmTypeConstants.CALL)); callBtn.setEnabled(AppContext.canWrite(RolePermissionCollections.CRM_CALL)); ButtonLink meetingBtn = new ButtonLink("New Meeting", listener); actionBtnLayout.addComponent(meetingBtn); meetingBtn.setIcon(CrmAssetsManager.getAsset(CrmTypeConstants.MEETING)); meetingBtn.setEnabled(AppContext.canWrite(RolePermissionCollections.CRM_MEETING)); calendarActionBtn.setContent(actionBtnLayout); ButtonGroup viewSwitcher = new ButtonGroup(); Button calendarViewBtn = new Button("Calendar"); calendarViewBtn.setStyleName("selected"); calendarViewBtn.addStyleName(UIConstants.THEME_GREEN_LINK); viewSwitcher.addButton(calendarViewBtn); Button activityListBtn = new Button("Activities", new Button.ClickListener() { private static final long serialVersionUID = 2156576556541398934L; @Override public void buttonClick(ClickEvent evt) { ActivitySearchCriteria criteria = new ActivitySearchCriteria(); criteria.setSaccountid(new NumberSearchField(AppContext.getAccountId())); EventBusFactory.getInstance().post(new ActivityEvent.GotoTodoList(this, null)); } }); activityListBtn.addStyleName(UIConstants.THEME_GREEN_LINK); viewSwitcher.addButton(activityListBtn); actionPanel.addComponent(viewSwitcher); actionPanel.setComponentAlignment(viewSwitcher, Alignment.MIDDLE_RIGHT); calendarComponent = new CalendarDisplay(); mainContent.addComponent(calendarComponent); mainContent.setExpandRatio(calendarComponent, 1); mainContent.setComponentAlignment(calendarComponent, Alignment.MIDDLE_CENTER); HorizontalLayout spacing = new HorizontalLayout(); spacing.setHeight("30px"); mainContent.addComponent(spacing); HorizontalLayout noteInfoLayout = new HorizontalLayout(); noteInfoLayout.setSpacing(true); HorizontalLayout noteWapper = new HorizontalLayout(); noteWapper.setHeight("30px"); Label noteLbl = new Label("Note:"); noteWapper.addComponent(noteLbl); noteWapper.setComponentAlignment(noteLbl, Alignment.MIDDLE_CENTER); noteInfoLayout.addComponent(noteWapper); HorizontalLayout completeWapper = new HorizontalLayout(); completeWapper.setWidth("100px"); completeWapper.setHeight("30px"); completeWapper.addStyleName("eventLblcompleted"); Label completeLabel = new Label("Completed"); completeWapper.addComponent(completeLabel); completeWapper.setComponentAlignment(completeLabel, Alignment.MIDDLE_CENTER); noteInfoLayout.addComponent(completeWapper); HorizontalLayout overdueWapper = new HorizontalLayout(); overdueWapper.setWidth("100px"); overdueWapper.setHeight("30px"); overdueWapper.addStyleName("eventLbloverdue"); Label overdueLabel = new Label("Overdue"); overdueWapper.addComponent(overdueLabel); overdueWapper.setComponentAlignment(overdueLabel, Alignment.MIDDLE_CENTER); noteInfoLayout.addComponent(overdueWapper); HorizontalLayout futureWapper = new HorizontalLayout(); futureWapper.setWidth("100px"); futureWapper.setHeight("30px"); futureWapper.addStyleName("eventLblfuture"); Label futureLabel = new Label("Future"); futureWapper.addComponent(futureLabel); futureWapper.setComponentAlignment(futureLabel, Alignment.MIDDLE_CENTER); noteInfoLayout.addComponent(futureWapper); mainContent.addComponent(noteInfoLayout); mainContent.setComponentAlignment(noteInfoLayout, Alignment.MIDDLE_CENTER); }
From source file:com.esofthead.mycollab.module.crm.view.activity.ActivitySearchPanel.java
License:Open Source License
private HorizontalLayout createSearchTopPanel() { final MHorizontalLayout layout = new MHorizontalLayout().withWidth("100%").withSpacing(true) .withMargin(new MarginInfo(true, false, true, false)); layout.setSizeUndefined();/*from w w w .j a va 2 s . c o m*/ layout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); final Label searchtitle = new CrmViewHeader(CrmTypeConstants.ACTIVITY, "Events"); searchtitle.setStyleName(Reindeer.LABEL_H2); layout.with(searchtitle).withAlign(searchtitle, Alignment.MIDDLE_LEFT).expand(searchtitle); final SplitButton controlsBtn = new SplitButton(); controlsBtn.setSizeUndefined(); controlsBtn.setEnabled(AppContext.canWrite(RolePermissionCollections.CRM_CALL) || AppContext.canWrite(RolePermissionCollections.CRM_MEETING)); controlsBtn.addStyleName(UIConstants.THEME_GREEN_LINK); controlsBtn.setIcon(FontAwesome.PLUS); controlsBtn.setCaption("New Task"); controlsBtn.addClickListener(new SplitButton.SplitButtonClickListener() { private static final long serialVersionUID = 1L; @Override public void splitButtonClick(final SplitButton.SplitButtonClickEvent event) { EventBusFactory.getInstance().post(new ActivityEvent.TaskAdd(this, null)); } }); final VerticalLayout btnControlsLayout = new VerticalLayout(); controlsBtn.setContent(btnControlsLayout); final Button createMeetingBtn = new Button("New Meeting", new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final Button.ClickEvent event) { controlsBtn.setPopupVisible(false); EventBusFactory.getInstance().post(new ActivityEvent.MeetingAdd(this, null)); } }); createMeetingBtn.setStyleName("link"); btnControlsLayout.addComponent(createMeetingBtn); createMeetingBtn.setEnabled(AppContext.canWrite(RolePermissionCollections.CRM_MEETING)); final Button createCallBtn = new Button("New Call", new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final Button.ClickEvent event) { controlsBtn.setPopupVisible(false); EventBusFactory.getInstance().post(new ActivityEvent.CallAdd(this, null)); } }); createCallBtn.setStyleName("link"); createCallBtn.setEnabled(AppContext.canWrite(RolePermissionCollections.CRM_CALL)); btnControlsLayout.addComponent(createCallBtn); layout.with(controlsBtn).withAlign(controlsBtn, Alignment.MIDDLE_RIGHT); ButtonGroup viewSwitcher = new ButtonGroup(); Button calendarViewBtn = new Button("Calendar", new Button.ClickListener() { private static final long serialVersionUID = -793215433929884575L; @Override public void buttonClick(ClickEvent evt) { EventBusFactory.getInstance().post(new ActivityEvent.GotoCalendar(this, null)); } }); calendarViewBtn.addStyleName(UIConstants.THEME_GREEN_LINK); viewSwitcher.addButton(calendarViewBtn); Button activityListBtn = new Button("Activitities"); activityListBtn.setStyleName("selected"); activityListBtn.addStyleName(UIConstants.THEME_GREEN_LINK); viewSwitcher.addButton(activityListBtn); layout.with(viewSwitcher).withAlign(viewSwitcher, Alignment.MIDDLE_RIGHT); return layout; }