List of usage examples for com.vaadin.ui Button setIcon
@Override public void setIcon(Resource icon)
From source file:com.esofthead.mycollab.mobile.module.project.ui.ProjectCommentInputView.java
License:Open Source License
private Component createAttachmentRow(String fileName) { final MHorizontalLayout uploadSucceedLayout = new MHorizontalLayout().withFullWidth(); Label uploadResult = new Label(fileName); uploadSucceedLayout.with(uploadResult).expand(uploadResult); Button removeAttachment = new Button("", new Button.ClickListener() { @Override//from w w w . j a va 2 s. c o m public void buttonClick(ClickEvent event) { statusWrapper.removeComponent(uploadSucceedLayout); } }); removeAttachment.setIcon(FontAwesome.TRASH); removeAttachment.setHtmlContentAllowed(true); removeAttachment.setStyleName("link"); uploadSucceedLayout.addComponent(removeAttachment); return uploadSucceedLayout; }
From source file:com.esofthead.mycollab.mobile.module.project.ui.ProjectMobileMenuPageView.java
License:Open Source License
@Override protected void buildNavigateMenu() { getMenu().setWidth("80%"); addSection("Views:"); Button prjButton = new Button("Projects", new Button.ClickListener() { @Override/* ww w . j ava 2 s . co m*/ public void buttonClick(Button.ClickEvent clickEvent) { closeMenu(); EventBusFactory.getInstance().post(new ProjectEvent.GotoProjectList(this, null)); } }); prjButton.setIcon(FontAwesome.BUILDING); addMenuItem(prjButton); // Buttons with styling (slightly smaller with left-aligned text) Button activityBtn = new Button("Activities", new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent clickEvent) { closeMenu(); EventBusFactory.getInstance() .post(new ProjectEvent.MyProjectActivities(this, CurrentProjectVariables.getProjectId())); } }); activityBtn.setIcon(FontAwesome.INBOX); addMenuItem(activityBtn); // add more buttons for a more realistic look. Button messageBtn = new Button("Messages", new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent clickEvent) { closeMenu(); EventBusFactory.getInstance().post(new MessageEvent.GotoList(this, null)); } }); messageBtn.setIcon(ProjectAssetsManager.getAsset(ProjectTypeConstants.MESSAGE)); addMenuItem(messageBtn); Button phaseBtn = new Button("Phases", new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent clickEvent) { closeMenu(); EventBusFactory.getInstance().post(new MilestoneEvent.GotoList(this, null)); } }); phaseBtn.setIcon(ProjectAssetsManager.getAsset(ProjectTypeConstants.MILESTONE)); addMenuItem(phaseBtn); Button taskBtn = new Button("Tasks", new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent clickEvent) { closeMenu(); EventBusFactory.getInstance().post(new TaskEvent.GotoList(this, null)); } }); taskBtn.setIcon(ProjectAssetsManager.getAsset(ProjectTypeConstants.TASK)); addMenuItem(taskBtn); Button bugBtn = new Button("Bugs", new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent clickEvent) { closeMenu(); EventBusFactory.getInstance().post(new BugEvent.GotoList(this, null)); } }); bugBtn.setIcon(ProjectAssetsManager.getAsset(ProjectTypeConstants.BUG)); addMenuItem(bugBtn); Button userBtn = new Button("Users", new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent clickEvent) { closeMenu(); EventBusFactory.getInstance().post(new ProjectMemberEvent.GotoList(this, null)); } }); userBtn.setIcon(ProjectAssetsManager.getAsset(ProjectTypeConstants.MEMBER)); addMenuItem(userBtn); addSection("Settings:"); Button logoutBtn = new Button("Logout", new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent clickEvent) { closeMenu(); EventBusFactory.getInstance().post(new ShellEvent.LogOut(this)); } }); logoutBtn.setIcon(FontAwesome.SIGN_OUT); addMenuItem(logoutBtn); }
From source file:com.esofthead.mycollab.mobile.module.project.view.UserProjectListViewImpl.java
License:Open Source License
@Override protected void buildNavigateMenu() { addSection("Views:"); // Buttons with styling (slightly smaller with left-aligned text) Button activityBtn = new Button("Activities", new Button.ClickListener() { @Override/*from w w w. ja va2s . c o m*/ public void buttonClick(Button.ClickEvent clickEvent) { closeMenu(); EventBusFactory.getInstance().post(new ProjectEvent.AllActivities(this)); } }); activityBtn.setIcon(FontAwesome.INBOX); addMenuItem(activityBtn); Button prjBtn = new Button("Projects", new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent clickEvent) { closeMenu(); EventBusFactory.getInstance().post(new ProjectEvent.GotoProjectList(this, null)); } }); prjBtn.setIcon(FontAwesome.BUILDING); addMenuItem(prjBtn); addSection("Settings:"); Button logoutBtn = new Button("Logout", new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent clickEvent) { closeMenu(); EventBusFactory.getInstance().post(new ShellEvent.LogOut(this)); } }); logoutBtn.setIcon(FontAwesome.SIGN_OUT); addMenuItem(logoutBtn); }
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 w ww . j a v a2s .c o m 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.CommentRowDisplayHandler.java
License:Open Source License
@Override public Component generateRow(final SimpleComment comment, int rowIndex) { final MHorizontalLayout layout = new MHorizontalLayout() .withMargin(new MarginInfo(true, false, true, false)).withWidth("100%").withStyleName("message"); UserBlock memberBlock = new UserBlock(comment.getCreateduser(), comment.getOwnerAvatarId(), comment.getOwnerFullName()); layout.addComponent(memberBlock);/* w w w .j a v a2 s. c o m*/ CssLayout rowLayout = new CssLayout(); rowLayout.setStyleName("message-container"); rowLayout.setWidth("100%"); MHorizontalLayout messageHeader = new MHorizontalLayout() .withMargin(new MarginInfo(true, true, false, true)).withWidth("100%") .withStyleName("message-header"); messageHeader.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); ELabel timePostLbl = new ELabel(AppContext.getMessage(GenericI18Enum.EXT_ADDED_COMMENT, comment.getOwnerFullName(), AppContext.formatPrettyTime(comment.getCreatedtime())), ContentMode.HTML).withDescription(AppContext.formatDateTime(comment.getCreatedtime())); timePostLbl.setSizeUndefined(); timePostLbl.setStyleName("time-post"); messageHeader.with(timePostLbl).expand(timePostLbl); // Message delete button Button msgDeleteBtn = new Button(); msgDeleteBtn.setIcon(FontAwesome.TRASH_O); msgDeleteBtn.setStyleName(UIConstants.BUTTON_ICON_ONLY); messageHeader.addComponent(msgDeleteBtn); if (hasDeletePermission(comment)) { msgDeleteBtn.setVisible(true); msgDeleteBtn.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(Button.ClickEvent event) { ConfirmDialogExt.show(UI.getCurrent(), AppContext.getMessage(GenericI18Enum.DIALOG_DELETE_TITLE, SiteConfiguration.getSiteName()), AppContext.getMessage(GenericI18Enum.DIALOG_DELETE_SINGLE_ITEM_MESSAGE), AppContext.getMessage(GenericI18Enum.BUTTON_YES), AppContext.getMessage(GenericI18Enum.BUTTON_NO), new ConfirmDialog.Listener() { private static final long serialVersionUID = 1L; @Override public void onClose(ConfirmDialog dialog) { if (dialog.isConfirmed()) { CommentService commentService = ApplicationContextUtil .getSpringBean(CommentService.class); commentService.removeWithSession(comment.getId(), AppContext.getUsername(), AppContext.getAccountId()); CommentRowDisplayHandler.this.owner.removeRow(layout); } } }); } }); } else { msgDeleteBtn.setVisible(false); } rowLayout.addComponent(messageHeader); Label messageContent = new SafeHtmlLabel(comment.getComment()); messageContent.setStyleName("message-body"); rowLayout.addComponent(messageContent); List<Content> attachments = comment.getAttachments(); if (!CollectionUtils.isEmpty(attachments)) { MVerticalLayout messageFooter = new MVerticalLayout().withSpacing(false).withWidth("100%") .withStyleName("message-footer"); AttachmentDisplayComponent attachmentDisplay = new AttachmentDisplayComponent(attachments); attachmentDisplay.setWidth("100%"); messageFooter.with(attachmentDisplay).withAlign(attachmentDisplay, Alignment.MIDDLE_RIGHT); rowLayout.addComponent(messageFooter); } layout.with(rowLayout).expand(rowLayout); return layout; }
From source file:com.esofthead.mycollab.module.crm.ui.components.CrmActivityComponent.java
License:Open Source License
private Component buildCommentBlock(final SimpleComment comment) { final MHorizontalLayout layout = new MHorizontalLayout() .withMargin(new MarginInfo(true, false, true, false)).withFullWidth().withStyleName("message"); ProjectMemberBlock memberBlock = new ProjectMemberBlock(comment.getCreateduser(), comment.getOwnerAvatarId(), comment.getOwnerFullName()); layout.addComponent(memberBlock);//ww w . j a v a 2 s . co m MVerticalLayout rowLayout = new MVerticalLayout().withFullWidth().withStyleName("message-container"); MHorizontalLayout messageHeader = new MHorizontalLayout().withFullWidth(); messageHeader.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); ELabel timePostLbl = new ELabel(AppContext.getMessage(GenericI18Enum.EXT_ADDED_COMMENT, comment.getOwnerFullName(), AppContext.formatPrettyTime(comment.getCreatedtime())), ContentMode.HTML).withDescription(AppContext.formatDateTime(comment.getCreatedtime())); timePostLbl.setStyleName(UIConstants.META_INFO); if (hasDeletePermission(comment)) { Button msgDeleteBtn = new Button(); msgDeleteBtn.setIcon(FontAwesome.TRASH_O); msgDeleteBtn.setStyleName(UIConstants.BUTTON_ICON_ONLY); msgDeleteBtn.setVisible(true); msgDeleteBtn.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(Button.ClickEvent event) { ConfirmDialogExt.show(UI.getCurrent(), AppContext.getMessage(GenericI18Enum.DIALOG_DELETE_TITLE, AppContext.getSiteName()), AppContext.getMessage(GenericI18Enum.DIALOG_DELETE_SINGLE_ITEM_MESSAGE), AppContext.getMessage(GenericI18Enum.BUTTON_YES), AppContext.getMessage(GenericI18Enum.BUTTON_NO), new ConfirmDialog.Listener() { private static final long serialVersionUID = 1L; @Override public void onClose(ConfirmDialog dialog) { if (dialog.isConfirmed()) { CommentService commentService = AppContextUtil .getSpringBean(CommentService.class); commentService.removeWithSession(comment, AppContext.getUsername(), AppContext.getAccountId()); activityBox.removeComponent(layout); } } }); } }); messageHeader.with(timePostLbl, msgDeleteBtn).expand(timePostLbl); } else { messageHeader.with(timePostLbl).expand(timePostLbl); } rowLayout.addComponent(messageHeader); Label messageContent = new SafeHtmlLabel(comment.getComment()); rowLayout.addComponent(messageContent); List<Content> attachments = comment.getAttachments(); if (!CollectionUtils.isEmpty(attachments)) { MVerticalLayout messageFooter = new MVerticalLayout().withMargin(false).withSpacing(false) .withFullWidth(); AttachmentDisplayComponent attachmentDisplay = new AttachmentDisplayComponent(attachments); attachmentDisplay.setWidth("100%"); messageFooter.with(attachmentDisplay); rowLayout.addComponent(messageFooter); } layout.with(rowLayout).expand(rowLayout); return layout; }
From source file:com.esofthead.mycollab.module.crm.ui.components.CrmCommentInput.java
License:Open Source License
CrmCommentInput(final ReloadableComponent component, final String typeVal) { super();//from ww w. ja v a2 s . c o m this.withMargin(new MarginInfo(true, true, false, true)).withFullWidth().withStyleName("message"); SimpleUser currentUser = AppContext.getUser(); UserBlock userBlock = new UserBlock(currentUser.getUsername(), currentUser.getAvatarid(), currentUser.getDisplayName()); MVerticalLayout textAreaWrap = new MVerticalLayout().withFullWidth().withStyleName("message-container"); this.with(userBlock, textAreaWrap).expand(textAreaWrap); type = typeVal; commentArea = new RichTextArea(); commentArea.setWidth("100%"); commentArea.setHeight("200px"); final AttachmentPanel attachments = new AttachmentPanel(); final MHorizontalLayout controlsLayout = new MHorizontalLayout().withFullWidth(); controlsLayout.setDefaultComponentAlignment(Alignment.TOP_RIGHT); final MultiFileUploadExt uploadExt = new MultiFileUploadExt(attachments); uploadExt.addComponent(attachments); controlsLayout.with(uploadExt).withAlign(uploadExt, Alignment.TOP_LEFT).expand(uploadExt); final Button cancelBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_CLEAR), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { commentArea.setValue(""); } }); cancelBtn.setStyleName(UIConstants.BUTTON_OPTION); final Button newCommentBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_POST), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final Button.ClickEvent event) { CommentWithBLOBs comment = new CommentWithBLOBs(); comment.setComment(Jsoup.clean(commentArea.getValue(), Whitelist.relaxed())); comment.setCreatedtime(new GregorianCalendar().getTime()); comment.setCreateduser(AppContext.getUsername()); comment.setSaccountid(AppContext.getAccountId()); comment.setType(type); comment.setTypeid(typeId); CommentService commentService = AppContextUtil.getSpringBean(CommentService.class); int commentId = commentService.saveWithSession(comment, AppContext.getUsername()); String attachmentPath = AttachmentUtils.getCommentAttachmentPath(typeVal, AppContext.getAccountId(), null, typeId, commentId); if (!"".equals(attachmentPath)) { attachments.saveContentsToRepo(attachmentPath); } // save success, clear comment area and load list // comments again commentArea.setValue(""); attachments.removeAllAttachmentsDisplay(); component.reload(); } }); newCommentBtn.setStyleName(UIConstants.BUTTON_ACTION); newCommentBtn.setIcon(FontAwesome.SEND); controlsLayout.with(cancelBtn, newCommentBtn); textAreaWrap.with(commentArea, controlsLayout); }
From source file:com.esofthead.mycollab.module.crm.ui.components.CrmPreviewFormControlsGenerator.java
License:Open Source License
public HorizontalLayout createButtonControls(int buttonEnableFlags, final String permissionItem) { layout.setStyleName("control-buttons"); layout.setSpacing(true);// w w w . j a v a 2 s. c om layout.setSizeUndefined(); boolean canRead = true; boolean canWrite = true; boolean canAccess = true; if (permissionItem != null) { canRead = AppContext.canRead(permissionItem); canWrite = AppContext.canWrite(permissionItem); canAccess = AppContext.canAccess(permissionItem); } MVerticalLayout popupButtonsControl = new MVerticalLayout() .withMargin(new MarginInfo(false, true, false, true)); if ((buttonEnableFlags & ADD_BTN_PRESENTED) == ADD_BTN_PRESENTED) { Button addBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_ADD), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { optionBtn.setPopupVisible(false); final T item = previewForm.getBean(); previewForm.fireAddForm(item); } }); addBtn.setIcon(FontAwesome.PLUS); addBtn.setStyleName(UIConstants.THEME_GREEN_LINK); addBtn.setEnabled(canWrite); layout.addComponent(addBtn); } if ((buttonEnableFlags & EDIT_BTN_PRESENTED) == EDIT_BTN_PRESENTED) { Button editBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_EDIT), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { optionBtn.setPopupVisible(false); final T item = previewForm.getBean(); previewForm.fireEditForm(item); } }); editBtn.setIcon(FontAwesome.EDIT); editBtn.setStyleName(UIConstants.THEME_GREEN_LINK); editBtn.setEnabled(canWrite); layout.addComponent(editBtn); } if ((buttonEnableFlags & DELETE_BTN_PRESENTED) == DELETE_BTN_PRESENTED) { Button deleteBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_DELETE), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { final T item = previewForm.getBean(); previewForm.fireDeleteForm(item); } }); deleteBtn.setIcon(FontAwesome.TRASH_O); deleteBtn.setStyleName(UIConstants.THEME_RED_LINK); layout.addComponent(deleteBtn); deleteBtn.setEnabled(canAccess); } if ((buttonEnableFlags & CLONE_BTN_PRESENTED) == CLONE_BTN_PRESENTED) { Button cloneBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_CLONE), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { optionBtn.setPopupVisible(false); final T item = previewForm.getBean(); previewForm.fireCloneForm(item); } }); cloneBtn.setIcon(FontAwesome.ROAD); cloneBtn.setStyleName("link"); popupButtonsControl.addComponent(cloneBtn); } if ((buttonEnableFlags & HISTORY_BTN_PRESENTED) == HISTORY_BTN_PRESENTED) { Button historyBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_HISTORY), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { optionBtn.setPopupVisible(false); previewForm.showHistory(); } }); historyBtn.setIcon(FontAwesome.HISTORY); historyBtn.setStyleName("link"); popupButtonsControl.addComponent(historyBtn); } optionBtn.setContent(popupButtonsControl); if ((buttonEnableFlags & CLONE_BTN_PRESENTED) == CLONE_BTN_PRESENTED | (buttonEnableFlags & EDIT_BTN_PRESENTED) == EDIT_BTN_PRESENTED) { layout.addComponent(optionBtn); } ButtonGroup navigationBtns = new ButtonGroup(); navigationBtns.setStyleName("navigation-btns"); if ((buttonEnableFlags & PREVIOUS_BTN_PRESENTED) == PREVIOUS_BTN_PRESENTED) { Button previousItem = new Button(null, new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { final T item = previewForm.getBean(); previewForm.fireGotoPrevious(item); } }); previousItem.setStyleName(UIConstants.THEME_GREEN_LINK); previousItem.setIcon(FontAwesome.CHEVRON_LEFT); previousItem.setDescription(AppContext.getMessage(GenericI18Enum.TOOLTIP_SHOW_PREVIOUS_ITEM)); navigationBtns.addButton(previousItem); previousItem.setEnabled(canRead); } if ((buttonEnableFlags & NEXT_BTN_PRESENTED) == NEXT_BTN_PRESENTED) { Button nextItemBtn = new Button(null, new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { final T item = previewForm.getBean(); previewForm.fireGotoNextItem(item); } }); nextItemBtn.setStyleName(UIConstants.THEME_GREEN_LINK); nextItemBtn.setIcon(FontAwesome.CHEVRON_RIGHT); nextItemBtn.setDescription(AppContext.getMessage(GenericI18Enum.TOOLTIP_SHOW_NEXT_ITEM)); navigationBtns.addButton(nextItemBtn); nextItemBtn.setEnabled(canRead); } layout.addComponent(navigationBtns); return layout; }
From source file:com.esofthead.mycollab.module.crm.view.account.AccountCaseListComp.java
License:Open Source License
@Override protected Component generateTopControls() { HorizontalLayout controlsBtnWrap = new HorizontalLayout(); controlsBtnWrap.setWidth("100%"); HorizontalLayout notesWrap = new HorizontalLayout(); notesWrap.setWidth("100%"); notesWrap.setSpacing(true);/* www . ja v a 2 s . c o m*/ Label noteLbl = new Label("Note: "); noteLbl.setSizeUndefined(); noteLbl.setStyleName("list-note-lbl"); notesWrap.addComponent(noteLbl); CssLayout noteBlock = new CssLayout(); noteBlock.setWidth("100%"); noteBlock.setStyleName("list-note-block"); for (int i = 0; i < CrmDataTypeFactory.getCasesStatusList().length; i++) { Label note = new Label(CrmDataTypeFactory.getCasesStatusList()[i]); note.setStyleName("note-label"); note.addStyleName(colorsMap.get(CrmDataTypeFactory.getCasesStatusList()[i])); note.setSizeUndefined(); noteBlock.addComponent(note); } notesWrap.addComponent(noteBlock); notesWrap.setExpandRatio(noteBlock, 1.0f); controlsBtnWrap.addComponent(notesWrap); controlsBtnWrap.setWidth("100%"); final Button createBtn = new Button(); createBtn.setSizeUndefined(); createBtn.setEnabled(AppContext.canWrite(RolePermissionCollections.CRM_CASE)); createBtn.addStyleName(UIConstants.THEME_GREEN_LINK); createBtn.setCaption(AppContext.getMessage(CaseI18nEnum.BUTTON_NEW_CASE)); createBtn.setIcon(FontAwesome.PLUS); createBtn.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = -8725970955325733072L; @Override public void buttonClick(final Button.ClickEvent event) { fireNewRelatedItem(""); } }); controlsBtnWrap.addComponent(createBtn); controlsBtnWrap.setComponentAlignment(createBtn, Alignment.MIDDLE_RIGHT); return controlsBtnWrap; }
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();//from www. ja v a 2 s.c om 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; }