List of usage examples for com.vaadin.ui Button.ClickListener Button.ClickListener
Button.ClickListener
From source file:com.esofthead.mycollab.module.project.view.bug.BugSimpleSearchPanel.java
License:Open Source License
private void createBasicSearchLayout() { layoutSearchPane = new GridLayout(5, 3); layoutSearchPane.setSpacing(true);/* w ww . j a va 2s. c o m*/ addTextFieldSearch(); final CheckBox chkIsOpenBug = new CheckBox("Only Open Bugs"); layoutSearchPane.addComponent(chkIsOpenBug, 2, 0); layoutSearchPane.setComponentAlignment(chkIsOpenBug, Alignment.MIDDLE_CENTER); Button searchBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_SEARCH)); searchBtn.setStyleName(UIConstants.THEME_GREEN_LINK); searchBtn.setIcon(FontAwesome.SEARCH); searchBtn.addClickListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { searchCriteria = new BugSearchCriteria(); searchCriteria.setProjectId( new NumberSearchField(SearchField.AND, CurrentProjectVariables.getProject().getId())); searchCriteria.setSummary(new StringSearchField(textValueField.getValue().trim())); if (chkIsOpenBug.getValue()) { searchCriteria.setStatuses(new SetSearchField<>(SearchField.AND, new String[] { BugStatus.InProgress.name(), BugStatus.Open.name(), BugStatus.ReOpened.name() })); } BugSimpleSearchPanel.this.notifySearchHandler(searchCriteria); } }); layoutSearchPane.addComponent(searchBtn, 3, 0); layoutSearchPane.setComponentAlignment(searchBtn, Alignment.MIDDLE_CENTER); Button clearBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_CLEAR)); clearBtn.setStyleName(UIConstants.THEME_GRAY_LINK); clearBtn.addClickListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { textValueField.setValue(""); } }); layoutSearchPane.addComponent(clearBtn, 4, 0); layoutSearchPane.setComponentAlignment(clearBtn, Alignment.MIDDLE_CENTER); this.setCompositionRoot(layoutSearchPane); }
From source file:com.esofthead.mycollab.module.project.view.bug.BugTableDisplay.java
License:Open Source License
public BugTableDisplay(String viewId, TableViewField requiredColumn, List<TableViewField> displayColumns) { super(ApplicationContextUtil.getSpringBean(BugService.class), SimpleBug.class, viewId, requiredColumn, displayColumns);/* w ww. j a va 2s . com*/ this.addGeneratedColumn("id", new Table.ColumnGenerator() { private static final long serialVersionUID = 1L; @Override public Object generateCell(final Table source, final Object itemId, Object columnId) { final SimpleBug bug = BugTableDisplay.this.getBeanByIndex(itemId); final Button bugSettingBtn = new Button(null, FontAwesome.COG); bugSettingBtn.addStyleName(UIConstants.BUTTON_ICON_ONLY); final ContextMenu contextMenu = new ContextMenu(); contextMenu.setAsContextMenuOf(bugSettingBtn); contextMenu.addItemClickListener(new ContextMenuItemClickListener() { @Override public void contextMenuItemClicked(ContextMenuItemClickEvent event) { if (((ContextMenuItem) event.getSource()).getData() == null) { return; } String category = ((MenuItemData) ((ContextMenuItem) event.getSource()).getData()) .getAction(); String value = ((MenuItemData) ((ContextMenuItem) event.getSource()).getData()).getKey(); if ("status".equals(category)) { if (AppContext.getMessage(BugStatus.Verified).equals(value)) { UI.getCurrent().addWindow(new ApproveInputWindow(BugTableDisplay.this, bug)); } else if (AppContext.getMessage(BugStatus.InProgress).equals(value)) { bug.setStatus(BugStatus.InProgress.name()); BugService bugService = ApplicationContextUtil.getSpringBean(BugService.class); bugService.updateWithSession(bug, AppContext.getUsername()); } else if (AppContext.getMessage(BugStatus.Open).equals(value)) { UI.getCurrent().addWindow(new ReOpenWindow(BugTableDisplay.this, bug)); } else if (AppContext.getMessage(BugStatus.Resolved).equals(value)) { UI.getCurrent().addWindow(new ResolvedInputWindow(BugTableDisplay.this, bug)); } } else if ("severity".equals(category)) { bug.setSeverity(value); BugService bugService = ApplicationContextUtil.getSpringBean(BugService.class); bugService.updateWithSession(bug, AppContext.getUsername()); refresh(); } else if ("priority".equals(category)) { bug.setPriority(value); BugService bugService = ApplicationContextUtil.getSpringBean(BugService.class); bugService.updateWithSession(bug, AppContext.getUsername()); refresh(); } else if ("action".equals(category)) { if ("edit".equals(value)) { EventBusFactory.getInstance() .post(new BugEvent.GotoEdit(BugTableDisplay.this, bug)); } else if ("delete".equals(value)) { 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()) { BugService bugService = ApplicationContextUtil .getSpringBean(BugService.class); bugService.removeWithSession(bug.getId(), AppContext.getUsername(), AppContext.getAccountId()); refresh(); } } }); } } } }); bugSettingBtn.setEnabled(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.BUGS)); bugSettingBtn.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { displayContextMenuItem(contextMenu, bug, event.getClientX(), event.getClientY()); } }); return bugSettingBtn; } }); this.addGeneratedColumn("assignuserFullName", new Table.ColumnGenerator() { private static final long serialVersionUID = 1L; @Override public com.vaadin.ui.Component generateCell(Table source, final Object itemId, Object columnId) { final SimpleBug bug = BugTableDisplay.this.getBeanByIndex(itemId); return new ProjectUserLink(bug.getAssignuser(), bug.getAssignUserAvatarId(), bug.getAssignuserFullName()); } }); this.addGeneratedColumn("loguserFullName", new Table.ColumnGenerator() { private static final long serialVersionUID = 1L; @Override public com.vaadin.ui.Component generateCell(Table source, final Object itemId, Object columnId) { final SimpleBug bug = BugTableDisplay.this.getBeanByIndex(itemId); return new ProjectUserLink(bug.getLogby(), bug.getLoguserAvatarId(), bug.getLoguserFullName()); } }); this.addGeneratedColumn("summary", new Table.ColumnGenerator() { private static final long serialVersionUID = 1L; @Override public com.vaadin.ui.Component generateCell(Table source, final Object itemId, Object columnId) { final SimpleBug bug = BugTableDisplay.this.getBeanByIndex(itemId); String bugname = "[%s-%s] %s"; bugname = String.format(bugname, CurrentProjectVariables.getProject().getShortname(), bug.getBugkey(), bug.getSummary()); LabelLink b = new LabelLink(bugname, ProjectLinkBuilder.generateBugPreviewFullLink(bug.getBugkey(), bug.getProjectShortName())); if (StringUtils.isNotBlank(bug.getPriority())) { b.setIconLink(ProjectResources.getIconResourceLink12ByBugPriority(bug.getPriority())); } b.setDescription(ProjectTooltipGenerator.generateToolTipBug(AppContext.getUserLocale(), bug, AppContext.getSiteUrl(), AppContext.getTimezone())); if (bug.isCompleted()) { b.addStyleName(UIConstants.LINK_COMPLETED); } else if (bug.isOverdue()) { b.addStyleName(UIConstants.LINK_OVERDUE); } return b; } }); this.addGeneratedColumn("severity", new Table.ColumnGenerator() { private static final long serialVersionUID = 1L; @Override public com.vaadin.ui.Component generateCell(Table source, final Object itemId, Object columnId) { final SimpleBug bug = BugTableDisplay.this.getBeanByIndex(itemId); Resource iconPriority = new ExternalResource( ProjectResources.getIconResourceLink12ByBugSeverity(bug.getPriority())); Embedded iconEmbedded = new Embedded(null, iconPriority); Label lbPriority = new Label(AppContext.getMessage(BugSeverity.class, bug.getSeverity())); HorizontalLayout containerField = new HorizontalLayout(); containerField.setSpacing(true); containerField.addComponent(iconEmbedded); containerField.addComponent(lbPriority); containerField.setExpandRatio(lbPriority, 1.0f); return containerField; } }); this.addGeneratedColumn("duedate", new Table.ColumnGenerator() { private static final long serialVersionUID = 1L; @Override public com.vaadin.ui.Component generateCell(Table source, final Object itemId, Object columnId) { final SimpleBug bug = BugTableDisplay.this.getBeanByIndex(itemId); return new Label(AppContext.formatDate(bug.getDuedate())); } }); this.addGeneratedColumn("createdtime", new Table.ColumnGenerator() { private static final long serialVersionUID = 1L; @Override public com.vaadin.ui.Component generateCell(Table source, final Object itemId, Object columnId) { final SimpleBug bug = BugTableDisplay.this.getBeanByIndex(itemId); return new Label(AppContext.formatDateTime(bug.getCreatedtime())); } }); this.addGeneratedColumn("resolution", new Table.ColumnGenerator() { private static final long serialVersionUID = 1L; @Override public Object generateCell(Table source, Object itemId, Object columnId) { final SimpleBug bug = BugTableDisplay.this.getBeanByIndex(itemId); return new Label(AppContext.getMessage(BugResolution.class, bug.getResolution())); } }); this.setWidth("100%"); }
From source file:com.esofthead.mycollab.module.project.view.bug.ComponentReadViewImpl.java
License:Open Source License
@Override protected ComponentContainer createButtonControls() { ProjectPreviewFormControlsGenerator<SimpleComponent> componentPreviewForm = new ProjectPreviewFormControlsGenerator<>( previewForm);/*w w w. j a v a2s . c o m*/ final HorizontalLayout topPanel = componentPreviewForm .createButtonControls(ProjectRolePermissionCollections.COMPONENTS); quickActionStatusBtn = new Button("", new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { if (StatusI18nEnum.Closed.name().equals(beanItem.getStatus())) { beanItem.setStatus(StatusI18nEnum.Open.name()); ComponentReadViewImpl.this.removeLayoutStyleName(UIConstants.LINK_COMPLETED); quickActionStatusBtn.setCaption(AppContext.getMessage(GenericI18Enum.BUTTON_CLOSE)); quickActionStatusBtn.setIcon(FontAwesome.ARCHIVE); } else { beanItem.setStatus(StatusI18nEnum.Closed.name()); ComponentReadViewImpl.this.addLayoutStyleName(UIConstants.LINK_COMPLETED); quickActionStatusBtn.setCaption(AppContext.getMessage(GenericI18Enum.BUTTON_REOPEN)); quickActionStatusBtn.setIcon(FontAwesome.CLIPBOARD); } ComponentService service = ApplicationContextUtil.getSpringBean(ComponentService.class); service.updateSelectiveWithSession(beanItem, AppContext.getUsername()); } }); quickActionStatusBtn.setStyleName(UIConstants.THEME_GREEN_LINK); componentPreviewForm.insertToControlBlock(quickActionStatusBtn); if (!CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.COMPONENTS)) { quickActionStatusBtn.setEnabled(false); } return topPanel; }
From source file:com.esofthead.mycollab.module.project.view.bug.components.BugRowComponent.java
License:Open Source License
private OptionPopupContent createPopupContent() { OptionPopupContent filterBtnLayout = new OptionPopupContent(); Button editButton = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_EDIT), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override/*from www . j a va 2s . c om*/ public void buttonClick(Button.ClickEvent event) { bugSettingPopupBtn.setPopupVisible(false); EventBusFactory.getInstance().post(new BugEvent.GotoEdit(BugRowComponent.this, bug)); } }); editButton.setEnabled(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.BUGS)); editButton.setIcon(FontAwesome.EDIT); filterBtnLayout.addOption(editButton); Button deleteBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_DELETE), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(Button.ClickEvent event) { bugSettingPopupBtn.setPopupVisible(false); 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()) { BugService bugService = AppContextUtil.getSpringBean(BugService.class); bugService.removeWithSession(bug, AppContext.getUsername(), AppContext.getAccountId()); deleteBug(); } } }); } }); deleteBtn.setIcon(FontAwesome.TRASH_O); deleteBtn.setEnabled(CurrentProjectVariables.canAccess(ProjectRolePermissionCollections.TASKS)); filterBtnLayout.addDangerOption(deleteBtn); return filterBtnLayout; }
From source file:com.esofthead.mycollab.module.project.view.bug.components.BugSelectionField.java
License:Open Source License
@Override protected Component initContent() { MHorizontalLayout layout = new MHorizontalLayout(); Button browseBtn = new Button(FontAwesome.ELLIPSIS_H); browseBtn.addStyleName(UIConstants.BUTTON_OPTION); browseBtn.addStyleName(UIConstants.BUTTON_SMALL_PADDING); browseBtn.addClickListener(new Button.ClickListener() { @Override/*from ww w. j ava 2 s . c o m*/ public void buttonClick(Button.ClickEvent event) { UI.getCurrent().addWindow(new BugSelectionWindow(BugSelectionField.this)); } }); layout.with(suggestField, new Label("or browse"), browseBtn); return layout; }
From source file:com.esofthead.mycollab.module.project.view.bug.ComponentSearchPanel.java
License:Open Source License
private HorizontalLayout createSearchTopPanel() { final MHorizontalLayout layout = new MHorizontalLayout().withWidth("100%").withSpacing(true) .withStyleName(UIConstants.HEADER_VIEW).withMargin(new MarginInfo(true, false, true, false)); final Label componenttitle = new ProjectViewHeader(ProjectTypeConstants.BUG_COMPONENT, AppContext.getMessage(ComponentI18nEnum.VIEW_LIST_TITLE)); componenttitle.setStyleName(UIConstants.HEADER_TEXT); layout.with(componenttitle).withAlign(componenttitle, Alignment.MIDDLE_LEFT).expand(componenttitle); final Button createBtn = new Button(AppContext.getMessage(BugI18nEnum.BUTTON_NEW_COMPONENT), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override/*from w w w. j a va2 s . c o m*/ public void buttonClick(final Button.ClickEvent event) { EventBusFactory.getInstance().post(new BugComponentEvent.GotoAdd(this, null)); } }); createBtn.setEnabled(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.COMPONENTS)); createBtn.setStyleName(UIConstants.THEME_GREEN_LINK); createBtn.setIcon(FontAwesome.PLUS); layout.with(createBtn).withAlign(createBtn, Alignment.MIDDLE_RIGHT); return layout; }
From source file:com.esofthead.mycollab.module.project.view.bug.VersionReadViewImpl.java
License:Open Source License
@Override protected ComponentContainer createButtonControls() { ProjectPreviewFormControlsGenerator<Version> versionPreviewForm = new ProjectPreviewFormControlsGenerator<>( previewForm);//from www . j a v a 2 s . co m final HorizontalLayout topPanel = versionPreviewForm .createButtonControls(ProjectRolePermissionCollections.VERSIONS); quickActionStatusBtn = new Button("", new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { if (StatusI18nEnum.Closed.name().equals(beanItem.getStatus())) { beanItem.setStatus(StatusI18nEnum.Open.name()); VersionReadViewImpl.this.removeLayoutStyleName(UIConstants.LINK_COMPLETED); quickActionStatusBtn.setCaption(AppContext.getMessage(GenericI18Enum.BUTTON_CLOSE)); quickActionStatusBtn.setIcon(FontAwesome.ARCHIVE); } else { beanItem.setStatus(StatusI18nEnum.Closed.name()); VersionReadViewImpl.this.addLayoutStyleName(UIConstants.LINK_COMPLETED); quickActionStatusBtn.setCaption(AppContext.getMessage(GenericI18Enum.BUTTON_REOPEN)); quickActionStatusBtn.setIcon(FontAwesome.CLIPBOARD); } VersionService service = ApplicationContextUtil.getSpringBean(VersionService.class); service.updateSelectiveWithSession(beanItem, AppContext.getUsername()); } }); quickActionStatusBtn.setStyleName(UIConstants.THEME_GREEN_LINK); versionPreviewForm.insertToControlBlock(quickActionStatusBtn); if (!CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.VERSIONS)) { quickActionStatusBtn.setEnabled(false); } return topPanel; }
From source file:com.esofthead.mycollab.module.project.view.FollowingTicketViewImpl.java
License:Open Source License
public FollowingTicketViewImpl() { this.setWidth("100%"); final MVerticalLayout headerWrapper = new MVerticalLayout().withSpacing(false).withMargin(false) .withWidth("100%").withStyleName("projectfeed-hdr-wrapper"); final MHorizontalLayout header = new MHorizontalLayout().withMargin(false).withWidth("100%"); final Label layoutHeader = new Label(FontAwesome.EYE.getHtml() + " My Following Tickets", ContentMode.HTML); layoutHeader.addStyleName("h2"); header.with(layoutHeader).withAlign(layoutHeader, Alignment.MIDDLE_LEFT).expand(layoutHeader); headerWrapper.addComponent(header);//from w ww .j a v a2 s. c o m this.addComponent(headerWrapper); MHorizontalLayout controlBtns = new MHorizontalLayout().withSpacing(false) .withMargin(new MarginInfo(true, false, true, false)).withWidth("100%"); final MVerticalLayout contentWrapper = new MVerticalLayout().withSpacing(false).withMargin(false) .withWidth("100%"); contentWrapper.addStyleName("content-wrapper"); contentWrapper.addComponent(controlBtns); this.addComponent(contentWrapper); final Button backBtn = new Button(AppContext.getMessage(FollowerI18nEnum.BUTTON_BACK_TO_WORKBOARD)); backBtn.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { EventBusFactory.getInstance() .post(new ShellEvent.GotoProjectModule(FollowingTicketViewImpl.this, null)); } }); backBtn.addStyleName(UIConstants.THEME_GREEN_LINK); backBtn.setIcon(FontAwesome.ARROW_LEFT); controlBtns.addComponent(backBtn); controlBtns.setExpandRatio(backBtn, 1.0f); Button exportBtn = new Button("Export", new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { exportButtonControl.setPopupVisible(true); } }); exportButtonControl = new SplitButton(exportBtn); exportButtonControl.setWidthUndefined(); exportButtonControl.addStyleName(UIConstants.THEME_GRAY_LINK); exportButtonControl.setIcon(FontAwesome.EXTERNAL_LINK); VerticalLayout popupButtonsControl = new VerticalLayout(); exportButtonControl.setContent(popupButtonsControl); Button exportPdfBtn = new Button("Pdf"); FileDownloader pdfDownloader = new FileDownloader(constructStreamResource(ReportExportType.PDF)); pdfDownloader.extend(exportPdfBtn); exportPdfBtn.setIcon(FontAwesome.FILE_PDF_O); exportPdfBtn.setStyleName("link"); popupButtonsControl.addComponent(exportPdfBtn); Button exportExcelBtn = new Button("Excel"); FileDownloader excelDownloader = new FileDownloader(constructStreamResource(ReportExportType.EXCEL)); excelDownloader.extend(exportExcelBtn); exportExcelBtn.setIcon(FontAwesome.FILE_EXCEL_O); exportExcelBtn.setStyleName("link"); popupButtonsControl.addComponent(exportExcelBtn); controlBtns.addComponent(exportButtonControl); searchPanel = new FollowingTicketSearchPanel(); contentWrapper.addComponent(searchPanel); this.ticketTable = new FollowingTicketTableDisplay(); this.ticketTable.addStyleName("full-border-table"); this.ticketTable.setMargin(new MarginInfo(true, false, false, false)); contentWrapper.addComponent(this.ticketTable); }
From source file:com.esofthead.mycollab.module.project.view.kanban.AddNewColumnWindow.java
License:Open Source License
public AddNewColumnWindow(final IKanbanView kanbanView, final String type, final String fieldGroup) { super(AppContext.getMessage(TaskI18nEnum.ACTION_NEW_COLUMN)); this.setWidth("800px"); this.setModal(true); this.setResizable(false); this.center(); MVerticalLayout layout = new MVerticalLayout().withMargin(new MarginInfo(false, false, true, false)); GridFormLayoutHelper gridFormLayoutHelper = GridFormLayoutHelper.defaultFormLayoutHelper(1, 4); this.setContent(layout); final TextField stageField = new TextField(); final CheckBox defaultProject = new CheckBox(); defaultProject.setEnabled(AppContext.canBeYes(RolePermissionCollections.GLOBAL_PROJECT_SETTINGS)); final ColorPicker colorPicker = new ColorPicker("", new com.vaadin.shared.ui.colorpicker.Color( DEFAULT_COLOR.getRed(), DEFAULT_COLOR.getGreen(), DEFAULT_COLOR.getBlue())); final TextArea description = new TextArea(); gridFormLayoutHelper.addComponent(stageField, AppContext.getMessage(GenericI18Enum.FORM_NAME), 0, 0); gridFormLayoutHelper.addComponent(defaultProject, AppContext.getMessage(TaskI18nEnum.FORM_COLUMN_DEFAULT_FOR_NEW_PROJECT), 0, 1); gridFormLayoutHelper.addComponent(colorPicker, AppContext.getMessage(TaskI18nEnum.FORM_COLUMN_COLOR), 0, 2); gridFormLayoutHelper.addComponent(description, AppContext.getMessage(GenericI18Enum.FORM_DESCRIPTION), 0, 3);/*from www .ja va 2s.c o m*/ Button saveBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_SAVE), new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent clickEvent) { OptionVal optionVal = new OptionVal(); optionVal.setCreatedtime(new GregorianCalendar().getTime()); optionVal.setCreateduser(AppContext.getUsername()); optionVal.setDescription(description.getValue()); com.vaadin.shared.ui.colorpicker.Color color = colorPicker.getColor(); String cssColor = color.getCSS(); if (cssColor.startsWith("#")) { cssColor = cssColor.substring(1); } optionVal.setColor(cssColor); if (defaultProject.getValue()) { optionVal.setIsdefault(true); } else { optionVal.setIsdefault(false); optionVal.setExtraid(CurrentProjectVariables.getProjectId()); } optionVal.setSaccountid(AppContext.getAccountId()); optionVal.setType(type); optionVal.setTypeval(stageField.getValue()); optionVal.setFieldgroup(fieldGroup); OptionValService optionService = AppContextUtil.getSpringBean(OptionValService.class); int optionValId = optionService.saveWithSession(optionVal, AppContext.getUsername()); if (optionVal.getIsdefault()) { optionVal.setId(null); optionVal.setIsdefault(false); optionVal.setRefoption(optionValId); optionVal.setExtraid(CurrentProjectVariables.getProjectId()); optionService.saveWithSession(optionVal, AppContext.getUsername()); } kanbanView.addColumn(optionVal); close(); } }); saveBtn.setIcon(FontAwesome.SAVE); saveBtn.setStyleName(UIConstants.BUTTON_ACTION); Button cancelBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_CANCEL), new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent clickEvent) { close(); } }); cancelBtn.setStyleName(UIConstants.BUTTON_OPTION); MHorizontalLayout controls = new MHorizontalLayout().with(cancelBtn, saveBtn) .withMargin(new MarginInfo(false, true, false, false)); layout.with(gridFormLayoutHelper.getLayout(), controls).withAlign(controls, Alignment.BOTTOM_RIGHT); }
From source file:com.esofthead.mycollab.module.project.view.milestone.MilestoneListViewImpl.java
License:Open Source License
private HorizontalLayout createHeaderRight() { final HorizontalLayout layout = new HorizontalLayout(); this.createBtn = new Button(AppContext.getMessage(MilestoneI18nEnum.BUTTON_NEW_PHASE), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override/*from w w w . ja va 2s. c o m*/ public void buttonClick(final ClickEvent event) { EventBusFactory.getInstance() .post(new MilestoneEvent.GotoAdd(MilestoneListViewImpl.this, null)); } }); this.createBtn.setIcon(FontAwesome.PLUS); this.createBtn.setStyleName(UIConstants.THEME_GREEN_LINK); this.createBtn.setEnabled(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.MILESTONES)); layout.addComponent(this.createBtn); layout.setComponentAlignment(this.createBtn, Alignment.MIDDLE_RIGHT); return layout; }