List of usage examples for com.vaadin.ui Button.ClickListener Button.ClickListener
Button.ClickListener
From source file:com.esofthead.mycollab.module.project.ui.components.ProjectFollowersComp.java
License:Open Source License
public void displayFollowers(final V bean) { this.bean = bean; this.removeAllComponents(); this.withSpacing(true).withMargin(new MarginInfo(false, false, false, true)); MHorizontalLayout header = new MHorizontalLayout().withSpacing(true); Label followerHeader = new Label( FontAwesome.EYE.getHtml() + " " + AppContext.getMessage(FollowerI18nEnum.OPT_SUB_INFO_WATCHERS), ContentMode.HTML);//from w w w . ja v a 2 s .c om followerHeader.setStyleName("info-hdr"); header.addComponent(followerHeader); if (hasEditPermission()) { Button editBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_EDIT), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { showEditWatchersWindow(bean); } }); editBtn.setStyleName("link"); editBtn.addStyleName("info-hdr"); header.addComponent(editBtn); } this.addComponent(header); Label sep = new Label("/"); sep.setStyleName("info-hdr"); header.addComponent(sep); currentUserFollow = isUserWatching(bean); final Button toogleWatching = new Button(""); toogleWatching.setStyleName("link"); toogleWatching.addStyleName("info-hdr"); toogleWatching.addClickListener(new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { if (currentUserFollow) { unfollowItem(AppContext.getUsername(), bean); currentUserFollow = false; toogleWatching.setCaption(AppContext.getMessage(FollowerI18nEnum.BUTTON_FOLLOW)); } else { followItem(AppContext.getUsername(), bean); toogleWatching.setCaption(AppContext.getMessage(FollowerI18nEnum.BUTTON_UNFOLLOW)); currentUserFollow = true; } updateTotalFollowers(bean); } }); header.addComponent(toogleWatching); if (currentUserFollow) { toogleWatching.setCaption(AppContext.getMessage(FollowerI18nEnum.BUTTON_UNFOLLOW)); } else { toogleWatching.setCaption(AppContext.getMessage(FollowerI18nEnum.BUTTON_FOLLOW)); } MVerticalLayout layout = new MVerticalLayout().withWidth("100%").withSpacing(true) .withMargin(new MarginInfo(false, false, false, true)); this.addComponent(layout); int totalFollowers = getTotalFollowers(bean); followersBtn = new Button(AppContext.getMessage(FollowerI18nEnum.OPT_NUM_FOLLOWERS, totalFollowers), new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { if (hasReadPermission()) { showEditWatchersWindow(bean); } } }); followersBtn.setStyleName("link"); layout.addComponent(followersBtn); }
From source file:com.esofthead.mycollab.module.project.ui.components.TimeLogEditWindow.java
License:Open Source License
private void initUI() { this.setWidth("900px"); headerPanel = new MHorizontalLayout().withWidth("100%"); content.addComponent(headerPanel);//w ww . j a v a 2 s. com constructSpentTimeEntryPanel(); constructRemainTimeEntryPanel(); this.tableItem = new DefaultPagedBeanTable<>( ApplicationContextUtil.getSpringBean(ItemTimeLoggingService.class), SimpleItemTimeLogging.class, Arrays.asList(TimeTableFieldDef.logUser, TimeTableFieldDef.logForDate, TimeTableFieldDef.logValue, TimeTableFieldDef.billable, new TableViewField(null, "id", UIConstants.TABLE_CONTROL_WIDTH))); this.tableItem.addGeneratedColumn("logUserFullName", new Table.ColumnGenerator() { private static final long serialVersionUID = 1L; @Override public com.vaadin.ui.Component generateCell(final Table source, final Object itemId, final Object columnId) { final SimpleItemTimeLogging timeLoggingItem = TimeLogEditWindow.this.tableItem .getBeanByIndex(itemId); return new ProjectUserLink(timeLoggingItem.getLoguser(), timeLoggingItem.getLogUserAvatarId(), timeLoggingItem.getLogUserFullName()); } }); this.tableItem.addGeneratedColumn("logforday", new ColumnGenerator() { private static final long serialVersionUID = 1L; @Override public com.vaadin.ui.Component generateCell(final Table source, final Object itemId, final Object columnId) { final SimpleItemTimeLogging monitorItem = TimeLogEditWindow.this.tableItem.getBeanByIndex(itemId); final Label l = new Label(); l.setValue(AppContext.formatDate(monitorItem.getLogforday())); return l; } }); this.tableItem.addGeneratedColumn("logvalue", new ColumnGenerator() { private static final long serialVersionUID = 1L; @Override public com.vaadin.ui.Component generateCell(final Table source, final Object itemId, final Object columnId) { final SimpleItemTimeLogging itemTimeLogging = TimeLogEditWindow.this.tableItem .getBeanByIndex(itemId); final Label l = new Label(); l.setValue(itemTimeLogging.getLogvalue() + ""); return l; } }); this.tableItem.addGeneratedColumn("isbillable", new ColumnGenerator() { private static final long serialVersionUID = 1L; @Override public Object generateCell(Table source, Object itemId, Object columnId) { final SimpleItemTimeLogging monitorItem = tableItem.getBeanByIndex(itemId); FontIconLabel icon; if (monitorItem.getIsbillable()) { icon = new FontIconLabel(FontAwesome.CHECK); } else { icon = new FontIconLabel(FontAwesome.TIMES); } icon.setStyleName(UIConstants.BUTTON_ICON_ONLY); return icon; } }); this.tableItem.addGeneratedColumn("id", new ColumnGenerator() { private static final long serialVersionUID = 1L; @Override public com.vaadin.ui.Component generateCell(final Table source, final Object itemId, final Object columnId) { final SimpleItemTimeLogging itemTimeLogging = TimeLogEditWindow.this.tableItem .getBeanByIndex(itemId); final Button deleteBtn = new Button(null, new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { TimeLogEditWindow.this.itemTimeLoggingService.removeWithSession(itemTimeLogging.getId(), AppContext.getUsername(), AppContext.getAccountId()); TimeLogEditWindow.this.loadTimeValue(); } }); deleteBtn.setIcon(FontAwesome.TRASH_O); deleteBtn.addStyleName(UIConstants.BUTTON_ICON_ONLY); itemTimeLogging.setExtraData(deleteBtn); deleteBtn.setEnabled(CurrentProjectVariables.isAdmin() || AppContext.getUsername().equals(itemTimeLogging.getLoguser())); return deleteBtn; } }); this.tableItem.setWidth("100%"); content.addComponent(tableItem); }
From source file:com.esofthead.mycollab.module.project.ui.components.TimeLogEditWindow.java
License:Open Source License
private void constructSpentTimeEntryPanel() { VerticalLayout spentTimePanel = new VerticalLayout(); spentTimePanel.setSpacing(true);//from w w w . ja v a 2 s. c om headerPanel.addComponent(spentTimePanel); final VerticalLayout totalLayout = new VerticalLayout(); totalLayout.setMargin(true); totalLayout.addStyleName("boxTotal"); totalLayout.setWidth("100%"); spentTimePanel.addComponent(totalLayout); final Label lbTimeInstructTotal = new Label( AppContext.getMessage(TimeTrackingI18nEnum.OPT_TOTAL_SPENT_HOURS)); totalLayout.addComponent(lbTimeInstructTotal); this.totalSpentTimeLbl = new Label("_"); this.totalSpentTimeLbl.addStyleName("numberTotal"); totalLayout.addComponent(this.totalSpentTimeLbl); final MHorizontalLayout addLayout = new MHorizontalLayout(); addLayout.setSizeUndefined(); addLayout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); spentTimePanel.addComponent(addLayout); this.newTimeInputField = new NumericTextField(); this.newTimeInputField.setWidth("80px"); this.forDateField = new DateFieldExt(); this.forDateField.setValue(new GregorianCalendar().getTime()); this.isBillableField = new CheckBox(AppContext.getMessage(TimeTrackingI18nEnum.FORM_IS_BILLABLE), true); btnAdd = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_ADD), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { double d = 0; try { d = Double.parseDouble(newTimeInputField.getValue()); } catch (NumberFormatException e) { NotificationUtil.showWarningNotification("You must enter a positive number value"); } if (d > 0) { saveTimeInvest(); loadTimeValue(); newTimeInputField.setValue("0.0"); } } }); btnAdd.setEnabled(TimeLogEditWindow.this.isEnableAdd()); btnAdd.setStyleName(UIConstants.THEME_GREEN_LINK); btnAdd.setIcon(FontAwesome.PLUS); addLayout.with(this.newTimeInputField, this.forDateField, this.isBillableField, btnAdd); }
From source file:com.esofthead.mycollab.module.project.ui.components.TimeLogEditWindow.java
License:Open Source License
private void constructRemainTimeEntryPanel() { VerticalLayout remainTimePanel = new VerticalLayout(); remainTimePanel.setSpacing(true);// www .j a va2 s .c om this.headerPanel.addComponent(remainTimePanel); final VerticalLayout updateLayout = new VerticalLayout(); updateLayout.setMargin(true); updateLayout.addStyleName("boxTotal"); updateLayout.setWidth("100%"); remainTimePanel.addComponent(updateLayout); final Label lbTimeInstructTotal = new Label( AppContext.getMessage(TimeTrackingI18nEnum.OPT_REMAINING_WORK_HOURS)); updateLayout.addComponent(lbTimeInstructTotal); this.remainTimeLbl = new Label("_"); this.remainTimeLbl.addStyleName("numberTotal"); updateLayout.addComponent(this.remainTimeLbl); final MHorizontalLayout addLayout = new MHorizontalLayout(); addLayout.setSizeUndefined(); remainTimePanel.addComponent(addLayout); this.remainTimeInputField = new NumericTextField(); this.remainTimeInputField.setWidth("80px"); addLayout.addComponent(this.remainTimeInputField); addLayout.setComponentAlignment(this.remainTimeInputField, Alignment.MIDDLE_LEFT); btnAdd = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_UPDATE_LABEL), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { try { double d = 0; try { d = Double.parseDouble(remainTimeInputField.getValue()); } catch (Exception e) { NotificationUtil.showWarningNotification("You must enter a positive number value"); } if (d >= 0) { updateTimeRemain(); remainTimeLbl.setValue(remainTimeInputField.getValue()); remainTimeInputField.setValue("0.0"); } } catch (final Exception e) { remainTimeInputField.setValue("0.0"); } } }); btnAdd.setEnabled(TimeLogEditWindow.this.isEnableAdd()); btnAdd.setStyleName(UIConstants.THEME_GREEN_LINK); addLayout.addComponent(btnAdd); addLayout.setComponentAlignment(btnAdd, Alignment.MIDDLE_LEFT); }
From source file:com.esofthead.mycollab.module.project.view.assignments.gantt.PredecessorWindow.java
License:Open Source License
PredecessorWindow(final GanttTreeTable taskTreeTable, final GanttItemWrapper ganttItemWrapper) { super("Edit predecessors"); this.setModal(true); this.setResizable(false); this.setWidth("650px"); this.center(); this.taskTreeTable = taskTreeTable; this.ganttItemWrapper = ganttItemWrapper; MVerticalLayout content = new MVerticalLayout(); this.setContent(content); Label headerLbl = new Label( String.format("Row %d: %s", ganttItemWrapper.getGanttIndex(), ganttItemWrapper.getName())); headerLbl.addStyleName(ValoTheme.LABEL_H2); content.add(headerLbl);/*from w ww .ja v a2s . c o m*/ CssLayout preWrapper = new CssLayout(); content.with(preWrapper); MHorizontalLayout headerLayout = new MHorizontalLayout(); headerLayout.addComponent(new ELabel("Row").withWidth(ROW_WDITH)); headerLayout.addComponent(new ELabel("Task").withWidth(TASK_WIDTH)); headerLayout.addComponent(new ELabel("Dependency").withWidth(PRE_TYPE_WIDTH)); headerLayout.addComponent(new ELabel("Lag").withWidth(LAG_WIDTH)); predecessorsLayout = new PredecessorsLayout(); new Restrain(predecessorsLayout).setMaxHeight("600px"); preWrapper.addComponent(headerLayout); preWrapper.addComponent(predecessorsLayout); MHorizontalLayout buttonControls = new MHorizontalLayout(); content.with(buttonControls).withAlign(buttonControls, Alignment.MIDDLE_RIGHT); Button cancelBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_CANCEL), new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { PredecessorWindow.this.close(); } }); cancelBtn.addStyleName(UIConstants.BUTTON_OPTION); Button saveBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_SAVE), new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { List<TaskPredecessor> predecessors = predecessorsLayout.buildPredecessors(); EventBusFactory.getInstance() .post(new GanttEvent.ModifyPredecessors(ganttItemWrapper, predecessors)); PredecessorWindow.this.close(); } }); saveBtn.addStyleName(UIConstants.BUTTON_ACTION); buttonControls.with(cancelBtn, saveBtn); }
From source file:com.esofthead.mycollab.module.project.view.bug.BugKanbanViewImpl.java
License:Open Source License
public BugKanbanViewImpl() { this.setSizeFull(); this.withSpacing(true).withMargin(new MarginInfo(false, true, true, true)); searchPanel = new BugSearchPanel(); MHorizontalLayout groupWrapLayout = new MHorizontalLayout(); groupWrapLayout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); searchPanel.addHeaderRight(groupWrapLayout); Button advanceDisplayBtn = new Button("List", new Button.ClickListener() { @Override// w w w .j a v a 2 s. c o m public void buttonClick(Button.ClickEvent clickEvent) { EventBusFactory.getInstance().post(new BugEvent.GotoList(BugKanbanViewImpl.this, null)); } }); advanceDisplayBtn.setWidth("100px"); advanceDisplayBtn.setIcon(FontAwesome.SITEMAP); advanceDisplayBtn.setDescription("Detail"); Button kanbanBtn = new Button("Kanban"); kanbanBtn.setWidth("100px"); kanbanBtn.setDescription("Kanban View"); kanbanBtn.setIcon(FontAwesome.TH); ToggleButtonGroup viewButtons = new ToggleButtonGroup(); viewButtons.addButton(advanceDisplayBtn); viewButtons.addButton(kanbanBtn); viewButtons.withDefaultButton(kanbanBtn); groupWrapLayout.addComponent(viewButtons); kanbanLayout = new MHorizontalLayout().withMargin(new MarginInfo(true, false, true, false)) .withFullHeight(); kanbanLayout.addStyleName("kanban-layout"); this.with(searchPanel, kanbanLayout).expand(kanbanLayout); }
From source file:com.esofthead.mycollab.module.project.view.bug.BugListViewImpl.java
License:Open Source License
private ComponentContainer constructTableActionControls() { final MHorizontalLayout layout = new MHorizontalLayout().withWidth("100%"); final Label lbEmpty = new Label(""); layout.with(lbEmpty).expand(lbEmpty); MHorizontalLayout buttonControls = new MHorizontalLayout(); layout.addComponent(buttonControls); Button customizeViewBtn = new Button("", new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override//from ww w . j a v a 2s . c o m public void buttonClick(ClickEvent event) { UI.getCurrent().addWindow(new BugListCustomizeWindow(BugListView.VIEW_DEF_ID, tableItem)); } }); customizeViewBtn.setIcon(FontAwesome.COG); customizeViewBtn.setDescription("Layout Options"); customizeViewBtn.setStyleName(UIConstants.THEME_GRAY_LINK); buttonControls.addComponent(customizeViewBtn); PopupButton exportButtonControl = new PopupButton(); exportButtonControl.addStyleName(UIConstants.THEME_GRAY_LINK); exportButtonControl.setIcon(FontAwesome.EXTERNAL_LINK); exportButtonControl.setDescription(AppContext.getMessage(FileI18nEnum.EXPORT_FILE)); VerticalLayout popupButtonsControl = new VerticalLayout(); exportButtonControl.setContent(popupButtonsControl); Button exportPdfBtn = new Button(AppContext.getMessage(FileI18nEnum.PDF)); StreamWrapperFileDownloader fileDownloader = new StreamWrapperFileDownloader(new StreamResourceFactory() { @Override public StreamResource getStreamResource() { String title = "Bugs of Project " + ((CurrentProjectVariables.getProject() != null && CurrentProjectVariables.getProject().getName() != null) ? CurrentProjectVariables.getProject().getName() : ""); BugSearchCriteria searchCriteria = new BugSearchCriteria(); searchCriteria.setProjectId( new NumberSearchField(SearchField.AND, CurrentProjectVariables.getProject().getId())); return new StreamResource(new SimpleGridExportItemsStreamResource.AllItems<>(title, new RpParameterBuilder(tableItem.getDisplayColumns()), ReportExportType.PDF, ApplicationContextUtil.getSpringBean(BugService.class), searchCriteria, SimpleBug.class), "export.pdf"); } }); fileDownloader.extend(exportPdfBtn); exportPdfBtn.setIcon(FontAwesome.FILE_PDF_O); exportPdfBtn.setStyleName("link"); popupButtonsControl.addComponent(exportPdfBtn); Button exportExcelBtn = new Button(AppContext.getMessage(FileI18nEnum.EXCEL)); StreamWrapperFileDownloader excelDownloader = new StreamWrapperFileDownloader(new StreamResourceFactory() { @Override public StreamResource getStreamResource() { String title = "Bugs of Project " + ((CurrentProjectVariables.getProject() != null && CurrentProjectVariables.getProject().getName() != null) ? CurrentProjectVariables.getProject().getName() : ""); BugSearchCriteria searchCriteria = new BugSearchCriteria(); searchCriteria.setProjectId( new NumberSearchField(SearchField.AND, CurrentProjectVariables.getProject().getId())); return new StreamResource(new SimpleGridExportItemsStreamResource.AllItems<>(title, new RpParameterBuilder(tableItem.getDisplayColumns()), ReportExportType.EXCEL, ApplicationContextUtil.getSpringBean(BugService.class), searchCriteria, SimpleBug.class), "export.xlsx"); } }); excelDownloader.extend(exportExcelBtn); exportExcelBtn.setIcon(FontAwesome.FILE_EXCEL_O); exportExcelBtn.setStyleName("link"); popupButtonsControl.addComponent(exportExcelBtn); Button exportCsvBtn = new Button(AppContext.getMessage(FileI18nEnum.CSV)); StreamWrapperFileDownloader csvFileDownloader = new StreamWrapperFileDownloader( new StreamResourceFactory() { @Override public StreamResource getStreamResource() { String title = "Bugs of Project " + ((CurrentProjectVariables.getProject() != null && CurrentProjectVariables.getProject().getName() != null) ? CurrentProjectVariables.getProject().getName() : ""); BugSearchCriteria searchCriteria = new BugSearchCriteria(); searchCriteria.setProjectId(new NumberSearchField(SearchField.AND, CurrentProjectVariables.getProject().getId())); return new StreamResource(new SimpleGridExportItemsStreamResource.AllItems<>(title, new RpParameterBuilder(tableItem.getDisplayColumns()), ReportExportType.CSV, ApplicationContextUtil.getSpringBean(BugService.class), searchCriteria, SimpleBug.class), "export.csv"); } }); csvFileDownloader.extend(exportCsvBtn); exportCsvBtn.setIcon(FontAwesome.FILE_TEXT_O); exportCsvBtn.setStyleName("link"); popupButtonsControl.addComponent(exportCsvBtn); buttonControls.addComponent(exportButtonControl); return layout; }
From source file:com.esofthead.mycollab.module.project.view.bug.BugReadViewImpl.java
License:Open Source License
private void displayWorkflowControl() { if (BugStatus.Open.name().equals(this.beanItem.getStatus()) || BugStatus.ReOpened.name().equals(this.beanItem.getStatus())) { this.bugWorkflowControl.removeAllComponents(); final ButtonGroup navButton = new ButtonGroup(); final Button startProgressBtn = new Button(AppContext.getMessage(BugI18nEnum.BUTTON_START_PROGRESS), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override//from w w w. j a va 2 s. c o m public void buttonClick(final ClickEvent event) { beanItem.setStatus(BugStatus.InProgress.name()); final BugService bugService = ApplicationContextUtil.getSpringBean(BugService.class); bugService.updateSelectiveWithSession(beanItem, AppContext.getUsername()); displayWorkflowControl(); } }); startProgressBtn.addStyleName(UIConstants.THEME_BROWN_LINK); navButton.addButton(startProgressBtn); final Button resolveBtn = new Button(AppContext.getMessage(BugI18nEnum.BUTTON_RESOLVED), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { UI.getCurrent().addWindow(new ResolvedInputWindow(BugReadViewImpl.this, beanItem)); } }); resolveBtn.addStyleName(UIConstants.THEME_BROWN_LINK); navButton.addButton(resolveBtn); final Button wontFixBtn = new Button(AppContext.getMessage(BugI18nEnum.BUTTON_WONTFIX), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { UI.getCurrent().addWindow(new WontFixExplainWindow(BugReadViewImpl.this, beanItem)); } }); wontFixBtn.addStyleName(UIConstants.THEME_BROWN_LINK); navButton.addButton(wontFixBtn); this.bugWorkflowControl.addComponent(navButton); } else if (BugStatus.InProgress.name().equals(this.beanItem.getStatus())) { this.bugWorkflowControl.removeAllComponents(); final ButtonGroup navButton = new ButtonGroup(); final Button stopProgressBtn = new Button(AppContext.getMessage(BugI18nEnum.BUTTON_STOP_PROGRESS), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { beanItem.setStatus(BugStatus.Open.name()); final BugService bugService = ApplicationContextUtil.getSpringBean(BugService.class); bugService.updateSelectiveWithSession(beanItem, AppContext.getUsername()); displayWorkflowControl(); } }); stopProgressBtn.addStyleName(UIConstants.THEME_BROWN_LINK); navButton.addButton(stopProgressBtn); final Button resolveBtn = new Button(AppContext.getMessage(BugI18nEnum.BUTTON_RESOLVED), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { UI.getCurrent().addWindow(new ResolvedInputWindow(BugReadViewImpl.this, beanItem)); } }); resolveBtn.addStyleName(UIConstants.THEME_BROWN_LINK); navButton.addButton(resolveBtn); this.bugWorkflowControl.addComponent(navButton); } else if (BugStatus.Verified.name().equals(this.beanItem.getStatus())) { this.bugWorkflowControl.removeAllComponents(); final ButtonGroup navButton = new ButtonGroup(); final Button reopenBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_REOPEN), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { UI.getCurrent().addWindow(new ReOpenWindow(BugReadViewImpl.this, beanItem)); } }); reopenBtn.addStyleName(UIConstants.THEME_BROWN_LINK); navButton.addButton(reopenBtn); this.bugWorkflowControl.addComponent(navButton); } else if (BugStatus.Resolved.name().equals(this.beanItem.getStatus())) { this.bugWorkflowControl.removeAllComponents(); final ButtonGroup navButton = new ButtonGroup(); final Button reopenBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_REOPEN), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { UI.getCurrent().addWindow(new ReOpenWindow(BugReadViewImpl.this, beanItem)); } }); reopenBtn.addStyleName(UIConstants.THEME_BROWN_LINK); navButton.addButton(reopenBtn); final Button approveNCloseBtn = new Button(AppContext.getMessage(BugI18nEnum.BUTTON_APPROVE_CLOSE), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { UI.getCurrent().addWindow(new ApproveInputWindow(BugReadViewImpl.this, beanItem)); } }); approveNCloseBtn.addStyleName(UIConstants.THEME_BROWN_LINK); navButton.addButton(approveNCloseBtn); this.bugWorkflowControl.addComponent(navButton); } else if (BugStatus.Resolved.name().equals(this.beanItem.getStatus())) { this.bugWorkflowControl.removeAllComponents(); final ButtonGroup navButton = new ButtonGroup(); final Button reopenBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_REOPEN), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { UI.getCurrent().addWindow(new ReOpenWindow(BugReadViewImpl.this, beanItem)); } }); reopenBtn.setStyleName(UIConstants.THEME_BROWN_LINK); navButton.addButton(reopenBtn); this.bugWorkflowControl.addComponent(navButton); } this.bugWorkflowControl.setEnabled(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.BUGS)); }
From source file:com.esofthead.mycollab.module.project.view.bug.BugReadViewImpl.java
License:Open Source License
@Override protected ComponentContainer createButtonControls() { ProjectPreviewFormControlsGenerator<SimpleBug> bugPreviewFormControls = new ProjectPreviewFormControlsGenerator<>( previewForm);//from w w w . j a v a 2 s . c om MButton linkBtn = new MButton("Link", new Button.ClickListener() { @Override public void buttonClick(ClickEvent clickEvent) { UI.getCurrent().addWindow(new LinkIssueWindow(beanItem)); } }).withIcon(FontAwesome.LINK); linkBtn.addStyleName("black"); bugPreviewFormControls.addOptionButton(linkBtn); final HorizontalLayout topPanel = bugPreviewFormControls.createButtonControls( ProjectPreviewFormControlsGenerator.ADD_BTN_PRESENTED | ProjectPreviewFormControlsGenerator.DELETE_BTN_PRESENTED | ProjectPreviewFormControlsGenerator.EDIT_BTN_PRESENTED | ProjectPreviewFormControlsGenerator.CLONE_BTN_PRESENTED, ProjectRolePermissionCollections.BUGS); final Button assignBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_ASSIGN), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { UI.getCurrent().addWindow(new AssignBugWindow(BugReadViewImpl.this, beanItem)); } }); assignBtn.setEnabled(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.BUGS)); assignBtn.setIcon(FontAwesome.SHARE); assignBtn.setStyleName(UIConstants.THEME_GREEN_LINK); this.bugWorkflowControl = new HorizontalLayout(); this.bugWorkflowControl.setMargin(false); this.bugWorkflowControl.addStyleName("workflow-controls"); bugPreviewFormControls.insertToControlBlock(bugWorkflowControl); bugPreviewFormControls.insertToControlBlock(assignBtn); topPanel.setSizeUndefined(); return topPanel; }
From source file:com.esofthead.mycollab.module.project.view.bug.BugSearchPanel.java
License:Open Source License
private ComponentContainer constructHeader() { Label headerText = new ProjectViewHeader(ProjectTypeConstants.BUG, AppContext.getMessage(BugI18nEnum.VIEW_LIST_TITLE)); final Button createBtn = new Button(AppContext.getMessage(BugI18nEnum.BUTTON_NEW_BUG), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override/*from w ww. j a v a2 s .c o m*/ public void buttonClick(final ClickEvent event) { EventBusFactory.getInstance().post(new BugEvent.GotoAdd(this, null)); } }); createBtn.setStyleName(UIConstants.THEME_GREEN_LINK); createBtn.setIcon(FontAwesome.PLUS); createBtn.setEnabled(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.BUGS)); headerText.setStyleName(UIConstants.HEADER_TEXT); rightComponent = new MHorizontalLayout(); MHorizontalLayout header = new MHorizontalLayout().withStyleName(UIConstants.HEADER_VIEW).withWidth("100%") .withSpacing(true).withMargin(new MarginInfo(true, false, true, false)); header.with(headerText, createBtn, rightComponent).withAlign(headerText, Alignment.MIDDLE_LEFT) .withAlign(createBtn, Alignment.MIDDLE_RIGHT).withAlign(rightComponent, Alignment.MIDDLE_RIGHT) .expand(headerText); return header; }