List of usage examples for com.vaadin.ui Button Button
public Button(Resource icon, ClickListener listener)
From source file:com.esofthead.mycollab.mobile.module.project.view.bug.ReOpenView.java
License:Open Source License
private void constructUI() { VerticalLayout contentLayout = new VerticalLayout(); contentLayout.setWidth("100%"); contentLayout.addComponent(this.editForm); final Button reOpenBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_REOPEN), new Button.ClickListener() { @Override// ww w . j a v a 2s . co m public void buttonClick(final Button.ClickEvent event) { if (editForm.validateForm()) { ReOpenView.this.bug.setStatus(BugStatus.ReOpened.name()); // Save bug status and assignee final BugService bugService = ApplicationContextUtil.getSpringBean(BugService.class); bugService.updateSelectiveWithSession(ReOpenView.this.bug, AppContext.getUsername()); // Save comment final String commentValue = editForm.commentArea.getValue(); if (commentValue != null && !commentValue.trim().equals("")) { final Comment comment = new Comment(); comment.setComment(commentValue); comment.setCreatedtime(new GregorianCalendar().getTime()); comment.setCreateduser(AppContext.getUsername()); comment.setSaccountid(AppContext.getAccountId()); comment.setType(CommentType.PRJ_BUG.toString()); comment.setTypeid("" + ReOpenView.this.bug.getId()); comment.setExtratypeid(CurrentProjectVariables.getProjectId()); final CommentService commentService = ApplicationContextUtil .getSpringBean(CommentService.class); commentService.saveWithSession(comment, AppContext.getUsername()); } ReOpenView.this.callbackForm.previewItem(bug); EventBusFactory.getInstance().post(new ShellEvent.NavigateBack(this, null)); } } }); reOpenBtn.setStyleName("save-btn"); this.setRightComponent(reOpenBtn); this.setContent(contentLayout); }
From source file:com.esofthead.mycollab.mobile.module.project.view.bug.ResolvedInputView.java
License:Open Source License
private void constructUI() { final Button resolvedBtn = new Button(AppContext.getMessage(BugI18nEnum.BUTTON_RESOLVED), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override// w w w . j av a 2 s. c o m public void buttonClick(final Button.ClickEvent event) { if (editForm.validateForm()) { ResolvedInputView.this.bug.setStatus(BugStatus.Resolved.name()); // Save bug status and assignee final BugService bugService = ApplicationContextUtil.getSpringBean(BugService.class); bugService.updateSelectiveWithSession(ResolvedInputView.this.bug, AppContext.getUsername()); // Save comment final String commentValue = editForm.commentArea.getValue(); if (commentValue != null && !commentValue.trim().equals("")) { final Comment comment = new Comment(); comment.setComment(commentValue); comment.setCreatedtime(new GregorianCalendar().getTime()); comment.setCreateduser(AppContext.getUsername()); comment.setSaccountid(AppContext.getAccountId()); comment.setType(CommentType.PRJ_BUG.toString()); comment.setTypeid("" + ResolvedInputView.this.bug.getId()); comment.setExtratypeid(CurrentProjectVariables.getProjectId()); final CommentService commentService = ApplicationContextUtil .getSpringBean(CommentService.class); commentService.saveWithSession(comment, AppContext.getUsername()); } ResolvedInputView.this.callbackForm.previewItem(bug); EventBusFactory.getInstance().post(new ShellEvent.NavigateBack(this, null)); } } }); resolvedBtn.setStyleName("save-btn"); this.setRightComponent(resolvedBtn); this.setContent(this.editForm); }
From source file:com.esofthead.mycollab.mobile.module.project.view.bug.WontFixExplainView.java
License:Open Source License
private void constructUI() { this.editForm.setBean(bug); final Button wonFixBtn = new Button(AppContext.getMessage(BugI18nEnum.BUTTON_WONT_FIX), new Button.ClickListener() { @Override/*from ww w. j a v a 2 s . c om*/ public void buttonClick(final ClickEvent event) { if (editForm.validateForm()) { WontFixExplainView.this.bug.setStatus(BugStatus.Resolved.name()); final String commentValue = editForm.commentArea.getValue(); if (commentValue != null && !commentValue.trim().equals("")) { // Save bug status and assignee final BugService bugService = ApplicationContextUtil .getSpringBean(BugService.class); bugService.updateSelectiveWithSession(WontFixExplainView.this.bug, AppContext.getUsername()); // Save comment final Comment comment = new Comment(); comment.setComment(commentValue); comment.setCreatedtime(new GregorianCalendar().getTime()); comment.setCreateduser(AppContext.getUsername()); comment.setSaccountid(AppContext.getAccountId()); comment.setType(CommentType.PRJ_BUG.toString()); comment.setTypeid("" + WontFixExplainView.this.bug.getId()); comment.setExtratypeid(CurrentProjectVariables.getProjectId()); final CommentService commentService = ApplicationContextUtil .getSpringBean(CommentService.class); commentService.saveWithSession(comment, AppContext.getUsername()); WontFixExplainView.this.callbackForm.previewItem(bug); } else { NotificationUtil.showErrorNotification( AppContext.getMessage(BugI18nEnum.ERROR_WONT_FIX_EXPLAIN_REQUIRE_MSG)); return; } EventBusFactory.getInstance().post(new ShellEvent.NavigateBack(this, null)); } } }); wonFixBtn.setStyleName("save-btn"); this.setRightComponent(wonFixBtn); this.setContent(this.editForm); }
From source file:com.esofthead.mycollab.mobile.module.project.view.settings.ProjectMemberInviteViewImpl.java
License:Open Source License
private void constructUI() { this.roleComboBox = new ProjectRoleComboBox(); this.roleComboBox.addValueChangeListener(new ValueChangeListener() { private static final long serialVersionUID = 1L; @Override//from w ww . j a v a 2s .c om public void valueChange(ValueChangeEvent event) { Integer roleId = (Integer) roleComboBox.getValue(); displayRolePermission(roleId); } }); roleComboBox.setCaption(AppContext.getMessage(ProjectMemberI18nEnum.FORM_ROLE)); final VerticalLayout mainLayout = new VerticalLayout(); mainLayout.setStyleName("main-layout"); mainLayout.addStyleName("editview-layout"); mainLayout.setWidth("100%"); inviteFormLayout = new VerticalComponentGroup(); inviteFormLayout.setWidth("100%"); inviteEmailField = new EmailField(); inviteEmailField.setCaption(AppContext.getMessage(ProjectMemberI18nEnum.M_FORM_EMAIL)); inviteFormLayout.addComponent(inviteEmailField); messageArea = new TextArea(); messageArea.setValue(AppContext.getMessage(ProjectMemberI18nEnum.MSG_DEFAULT_INVITATION_COMMENT)); messageArea.setCaption(AppContext.getMessage(ProjectMemberI18nEnum.FORM_MESSAGE)); inviteFormLayout.addComponent(messageArea); inviteFormLayout.addComponent(roleComboBox); mainLayout.addComponent(inviteFormLayout); Label permissionSectionHdr = new Label(AppContext.getMessage(ProjectRoleI18nEnum.SECTION_PERMISSIONS)); permissionSectionHdr.setStyleName("h2"); mainLayout.addComponent(permissionSectionHdr); permissionsPanel = new VerticalComponentGroup(); mainLayout.addComponent(permissionsPanel); Button inviteBtn = new Button(AppContext.getMessage(ProjectMemberI18nEnum.BUTTON_NEW_INVITEE), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { if (inviteEmailField.getValue() == "") { return; } ProjectMemberInviteViewImpl.this.roleId = (Integer) roleComboBox.getValue(); ProjectMemberInviteViewImpl.this .fireEvent(new ViewEvent<ProjectMemberEvent.InviteProjectMembers>( ProjectMemberInviteViewImpl.this, new ProjectMemberEvent.InviteProjectMembers( Arrays.asList(inviteEmailField.getValue()), ProjectMemberInviteViewImpl.this.roleId, messageArea.getValue()))); } }); inviteBtn.addStyleName("save-btn"); this.setRightComponent(inviteBtn); this.setContent(mainLayout); }
From source file:com.esofthead.mycollab.mobile.module.project.view.task.TaskGroupListViewImpl.java
License:Open Source License
@Override protected Component createRightComponent() { Button addTaskList = new Button("", new Button.ClickListener() { private static final long serialVersionUID = 2067641610209145531L; @Override/*from ww w.ja va 2s . c o m*/ public void buttonClick(Button.ClickEvent event) { EventBusFactory.getInstance().post(new TaskEvent.GotoListAdd(this, null)); } }); addTaskList.setStyleName("add-btn"); return addTaskList; }
From source file:com.esofthead.mycollab.mobile.module.project.view.task.TaskListViewImpl.java
License:Open Source License
@Override protected Component createRightComponent() { NavigationBarQuickMenu editBtn = new NavigationBarQuickMenu(); editBtn.setButtonCaption(null);//from w w w . j a v a 2s . co m editBtn.setStyleName("edit-btn"); ProjectPreviewFormControlsGenerator<SimpleTaskList> controlsGenerator = new ProjectPreviewFormControlsGenerator<>( this); VerticalLayout menuContent = controlsGenerator.createButtonControls(ProjectRolePermissionCollections.TASKS); Button viewTaskList = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_VIEW), new Button.ClickListener() { private static final long serialVersionUID = 150675475815367481L; @Override public void buttonClick(Button.ClickEvent event) { EventBusFactory.getInstance() .post(new TaskEvent.GotoListView(this, currentTaskList.getId())); } }); viewTaskList.setWidth("100%"); viewTaskList.setEnabled(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.TASKS)); Button addNewTask = new Button(AppContext.getMessage(TaskI18nEnum.BUTTON_NEW_TASK), new Button.ClickListener() { private static final long serialVersionUID = -8074297964143853121L; @Override public void buttonClick(Button.ClickEvent event) { EventBusFactory.getInstance().post(new TaskEvent.GotoAdd(this, currentTaskList.getId())); } }); addNewTask.setWidth("100%"); addNewTask.setEnabled(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.TASKS)); Button closeBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_CLOSE), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { currentTaskList.setStatus(StatusI18nEnum.Closed.name()); final ProjectTaskListService taskListService = ApplicationContextUtil .getSpringBean(ProjectTaskListService.class); taskListService.updateWithSession(currentTaskList, AppContext.getUsername()); EventBusFactory.getInstance().post(new ShellEvent.NavigateBack(this, null)); } }); closeBtn.setWidth("100%"); closeBtn.setEnabled(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.TASKS)); controlsGenerator.insertToControlBlock(closeBtn); controlsGenerator.insertToControlBlock(viewTaskList); controlsGenerator.insertToControlBlock(addNewTask); editBtn.setContent(menuContent); return editBtn; }
From source file:com.esofthead.mycollab.mobile.module.project.view.task.TaskReadViewImpl.java
License:Open Source License
@Override protected ComponentContainer createButtonControls() { ProjectPreviewFormControlsGenerator<SimpleTask> taskPreviewForm = new ProjectPreviewFormControlsGenerator<SimpleTask>( previewForm);/*from w w w. j a v a2s . c o m*/ final VerticalLayout topPanel = taskPreviewForm.createButtonControls( ProjectPreviewFormControlsGenerator.ASSIGN_BTN_PRESENTED | ProjectPreviewFormControlsGenerator.CLONE_BTN_PRESENTED | ProjectPreviewFormControlsGenerator.DELETE_BTN_PRESENTED | ProjectPreviewFormControlsGenerator.EDIT_BTN_PRESENTED, ProjectRolePermissionCollections.TASKS); quickActionStatusBtn = new Button("", new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { if (beanItem.getStatus() != null && beanItem.getStatus().equals(StatusI18nEnum.Closed.name())) { beanItem.setStatus(StatusI18nEnum.Open.name()); beanItem.setPercentagecomplete(0d); TaskReadViewImpl.this.removeStyleName(UIConstants.STATUS_DISABLED); quickActionStatusBtn.setCaption(AppContext.getMessage(GenericI18Enum.BUTTON_CLOSE)); } else { beanItem.setStatus(StatusI18nEnum.Closed.name()); beanItem.setPercentagecomplete(100d); TaskReadViewImpl.this.addStyleName(UIConstants.STATUS_DISABLED); quickActionStatusBtn.setCaption(AppContext.getMessage(GenericI18Enum.BUTTON_REOPEN)); } ProjectTaskService service = ApplicationContextUtil.getSpringBean(ProjectTaskService.class); service.updateWithSession(beanItem, AppContext.getUsername()); } }); quickActionStatusBtn.setWidth("100%"); taskPreviewForm.insertToControlBlock(quickActionStatusBtn); if (!CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.TASKS)) { quickActionStatusBtn.setEnabled(false); } return topPanel; }
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.j a va2 s . co 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.mobile.module.project.view.UserProjectListViewImpl.java
License:Open Source License
@Override protected Component buildRightComponent() { NavigationBarQuickMenu menu = new NavigationBarQuickMenu(); menu.setButtonCaption("..."); MVerticalLayout content = new MVerticalLayout(); content.with(new Button(AppContext.getMessage(ProjectI18nEnum.NEW), new Button.ClickListener() { @Override/*w ww . j a v a2s. c o m*/ public void buttonClick(Button.ClickEvent clickEvent) { EventBusFactory.getInstance().post(new ProjectEvent.GotoAdd(this, null)); } })); menu.setContent(content); return menu; }
From source file:com.esofthead.mycollab.mobile.shell.view.MainView.java
License:Open Source License
public MainView() { super();/*from www. j ava2 s .c o m*/ this.setSizeFull(); MVerticalLayout contentLayout = new MVerticalLayout().withStyleName("content-wrapper").withFullWidth(); contentLayout.setDefaultComponentAlignment(Alignment.TOP_CENTER); Image mainLogo = new Image(null, new ThemeResource("icons/logo_m.png")); contentLayout.addComponent(mainLogo); Label introText = new Label( "MyCollab helps you do all your office jobs on the computers, phones and tablets you use"); introText.setStyleName("intro-text"); contentLayout.addComponent(introText); CssLayout welcomeTextWrapper = new CssLayout(); welcomeTextWrapper.setStyleName("welcometext-wrapper"); welcomeTextWrapper.setWidth("100%"); welcomeTextWrapper.setHeight("15px"); contentLayout.addComponent(welcomeTextWrapper); Button crmButton = new Button(AppContext.getMessage(GenericI18Enum.MODULE_CRM), new Button.ClickListener() { @Override public void buttonClick(ClickEvent clickEvent) { EventBusFactory.getInstance().post(new ShellEvent.GotoCrmModule(this, null)); } }); crmButton.addStyleName(UIConstants.BUTTON_ACTION); crmButton.setWidth("100%"); contentLayout.addComponent(crmButton); Button pmButton = new Button(AppContext.getMessage(GenericI18Enum.MODULE_PROJECT), new Button.ClickListener() { @Override public void buttonClick(ClickEvent clickEvent) { EventBusFactory.getInstance().post(new ShellEvent.GotoProjectModule(this, null)); } }); pmButton.setWidth("100%"); pmButton.addStyleName(UIConstants.BUTTON_ACTION); contentLayout.addComponent(pmButton); this.addComponent(contentLayout); }