List of usage examples for com.vaadin.ui Button addListener
@Override
public Registration addListener(Component.Listener listener)
From source file:org.activiti.explorer.ui.management.identity.UserDetailPanel.java
License:Apache License
protected void initActions() { Button createUserButton = new Button(i18nManager.getMessage(Messages.USER_CREATE)); createUserButton.setIcon(Images.USER_16); createUserButton.addListener(new ClickListener() { private static final long serialVersionUID = 1L; public void buttonClick(ClickEvent event) { NewUserPopupWindow newUserPopupWindow = new NewUserPopupWindow(); ExplorerApp.get().getViewManager().showPopupWindow(newUserPopupWindow); }/* w w w . j av a 2 s . c o m*/ }); userPage.getToolBar().removeAllButtons(); userPage.getToolBar().addButton(createUserButton); }
From source file:org.activiti.explorer.ui.management.identity.UserDetailPanel.java
License:Apache License
protected void initEditButton(VerticalLayout actionLayout) { Button editButton = new Button(i18nManager.getMessage(Messages.USER_EDIT)); editButton.addStyleName(Reindeer.BUTTON_SMALL); actionLayout.addComponent(editButton); editButton.addListener(new ClickListener() { public void buttonClick(ClickEvent event) { editingDetails = true;/*w ww . ja va2 s .c o m*/ userDetailsLayout.removeAllComponents(); populateUserDetails(); // the layout will be populated differently since the 'editingDetails' boolean is set } }); }
From source file:org.activiti.explorer.ui.management.identity.UserDetailPanel.java
License:Apache License
protected void initSaveButton(VerticalLayout actionLayout) { Button saveButton = new Button(i18nManager.getMessage(Messages.USER_SAVE)); saveButton.addStyleName(Reindeer.BUTTON_SMALL); actionLayout.addComponent(saveButton); saveButton.addListener(new ClickListener() { public void buttonClick(ClickEvent event) { String originalFirstName = user.getFirstName(); String originalLastName = user.getLastName(); // Change data user.setFirstName(firstNameField.getValue().toString()); user.setLastName(lastNameField.getValue().toString()); user.setEmail(emailField.getValue().toString()); if (passwordField.getValue() != null && !"".equals(passwordField.getValue().toString())) { user.setPassword(passwordField.getValue().toString()); }/*w ww . j av a 2s . c o m*/ identityService.saveUser(user); // Refresh detail panel editingDetails = false; userDetailsLayout.removeAllComponents(); populateUserDetails(); // Refresh task list (only if name was changed) if (nameChanged(originalFirstName, originalLastName)) { userPage.notifyUserChanged(user.getId()); } } }); }
From source file:org.activiti.explorer.ui.management.identity.UserDetailPanel.java
License:Apache License
protected void initDeleteButton(VerticalLayout actionLayout) { Button deleteButton = new Button(i18nManager.getMessage(Messages.USER_DELETE)); deleteButton.addStyleName(Reindeer.BUTTON_SMALL); actionLayout.addComponent(deleteButton); deleteButton.addListener(new ClickListener() { public void buttonClick(ClickEvent event) { ConfirmationDialogPopupWindow confirmPopup = new ConfirmationDialogPopupWindow( i18nManager.getMessage(Messages.USER_CONFIRM_DELETE, user.getId())); confirmPopup.addListener(new ConfirmationEventListener() { protected void rejected(ConfirmationEvent event) { }//from w w w .j a va2 s . c o m protected void confirmed(ConfirmationEvent event) { // Delete user from database identityService.deleteUser(user.getId()); // Update ui userPage.refreshSelectNext(); } }); ExplorerApp.get().getViewManager().showPopupWindow(confirmPopup); } }); }
From source file:org.activiti.explorer.ui.management.identity.UserDetailPanel.java
License:Apache License
protected void initAddGroupsButton(HorizontalLayout groupHeader) { Button addRelatedContentButton = new Button(); addRelatedContentButton.addStyleName(ExplorerLayout.STYLE_ADD); groupHeader.addComponent(addRelatedContentButton); groupHeader.setComponentAlignment(addRelatedContentButton, Alignment.MIDDLE_RIGHT); addRelatedContentButton.addListener(new ClickListener() { private static final long serialVersionUID = 1L; public void buttonClick(ClickEvent event) { final GroupSelectionPopupWindow selectionPopup = new GroupSelectionPopupWindow(identityService, user.getId());/*www. ja v a 2 s . co m*/ selectionPopup.addListener(new SubmitEventListener() { private static final long serialVersionUID = 1L; protected void submitted(SubmitEvent event) { Set<String> selectedGroups = selectionPopup.getSelectedGroupIds(); if (!selectedGroups.isEmpty()) { for (String groupId : selectedGroups) { identityService.createMembership(user.getId(), groupId); } notifyMembershipChanged(); } } protected void cancelled(SubmitEvent event) { } }); ExplorerApp.get().getViewManager().showPopupWindow(selectionPopup); } }); }
From source file:org.activiti.explorer.ui.management.job.JobDetailPanel.java
License:Apache License
protected void addActions() { Button deleteButton = new Button(i18nManager.getMessage(Messages.JOB_DELETE)); deleteButton.setIcon(Images.DELETE); deleteButton.addListener(new ClickListener() { private static final long serialVersionUID = 1L; public void buttonClick(ClickEvent event) { managementService.deleteJob(job.getId()); notificationManager.showInformationNotification(Messages.JOB_DELETED); jobPage.refreshSelectNext(); }//from ww w .j a v a 2 s . c om }); Button executeButton = new Button(i18nManager.getMessage(Messages.JOB_EXECUTE)); executeButton.setIcon(Images.EXECUTE); executeButton.addListener(new ClickListener() { private static final long serialVersionUID = 1L; public void buttonClick(ClickEvent event) { try { managementService.executeJob(job.getId()); jobPage.refreshSelectNext(); } catch (ActivitiException ae) { String errorMessage = ae.getMessage() + (ae.getCause() != null ? " (" + ae.getCause().getClass().getName() + ")" : ""); notificationManager.showErrorNotification(Messages.JOB_ERROR, errorMessage); // Refresh the current job jobPage.refreshCurrentJobDetails(); } } }); jobPage.getToolBar().removeAllButtons(); jobPage.getToolBar().addButton(executeButton); jobPage.getToolBar().addButton(deleteButton); }
From source file:org.activiti.explorer.ui.management.job.JobDetailPanel.java
License:Apache License
protected void addLinkToProcessDefinition(final VerticalLayout verticalLayout, final String labelText, final boolean isSuspendedProcessDefinition) { HorizontalLayout layout = new HorizontalLayout(); verticalLayout.addComponent(layout); Label processDefinitionLabel = new Label(labelText); processDefinitionLabel.setSizeUndefined(); layout.addComponent(processDefinitionLabel); layout.addComponent(new Label(" ", Label.CONTENT_XHTML)); Button showProcessDefinitionLink = new Button(job.getProcessDefinitionId()); showProcessDefinitionLink.addStyleName(Reindeer.BUTTON_LINK); showProcessDefinitionLink.addListener(new ClickListener() { private static final long serialVersionUID = 1L; public void buttonClick(ClickEvent event) { if (isSuspendedProcessDefinition) { ExplorerApp.get().getViewManager() .showSuspendedProcessDefinitionsPage(job.getProcessDefinitionId()); } else { ExplorerApp.get().getViewManager() .showActiveProcessDefinitionsPage(job.getProcessDefinitionId()); }/*w w w . j a va 2 s .co m*/ } }); layout.addComponent(showProcessDefinitionLink); }
From source file:org.activiti.explorer.ui.management.process.ProcessInstanceDetailPanel.java
License:Apache License
protected void addDeleteButton() { Button deleteProcessInstanceButton = new Button(i18nManager.getMessage(Messages.PROCESS_INSTANCE_DELETE)); deleteProcessInstanceButton.setIcon(Images.DELETE); deleteProcessInstanceButton .addListener(new DeleteProcessInstanceClickListener(processInstance.getId(), processInstancePage)); // Clear toolbar and add 'start' button processInstancePage.getToolBar().removeAllButtons(); processInstancePage.getToolBar().addButton(deleteProcessInstanceButton); }
From source file:org.activiti.explorer.ui.management.processdefinition.ActiveProcessDefinitionDetailPanel.java
License:Apache License
protected void initActions(final AbstractPage parentPage) { ActiveProcessDefinitionPage processDefinitionPage = (ActiveProcessDefinitionPage) parentPage; Button suspendButton = new Button(i18nManager.getMessage(Messages.PROCESS_SUSPEND)); suspendButton.addListener(new ClickListener() { private static final long serialVersionUID = 1L; public void buttonClick(ClickEvent event) { ChangeProcessSuspensionStatePopupWindow popupWindow = new ChangeProcessSuspensionStatePopupWindow( processDefinition.getId(), parentPage, true); ExplorerApp.get().getViewManager().showPopupWindow(popupWindow); }/*www .jav a 2s .c o m*/ }); // Check if button must be disabled boolean suspendJobPending = false; List<Job> jobs = ProcessEngines.getDefaultProcessEngine().getManagementService().createJobQuery() .processDefinitionId(processDefinition.getId()).list(); for (Job job : jobs) { // TODO: this is a hack. Needs to be cleaner in engine! if (((JobEntity) job).getJobHandlerType().equals(TimerSuspendProcessDefinitionHandler.TYPE)) { suspendJobPending = true; break; } } suspendButton.setEnabled(!suspendJobPending); // Clear toolbar and add 'start' button processDefinitionPage.getToolBar().removeAllButtons(); processDefinitionPage.getToolBar().addButton(suspendButton); }
From source file:org.activiti.explorer.ui.management.processdefinition.ChangeProcessSuspensionStatePopupWindow.java
License:Apache License
protected void addOkButton(final boolean suspend) { verticalLayout.addComponent(new Label(" ", Label.CONTENT_XHTML)); verticalLayout.addComponent(new Label(" ", Label.CONTENT_XHTML)); Button okButton = new Button(i18nManager.getMessage(Messages.BUTTON_OK)); verticalLayout.addComponent(okButton); verticalLayout.setComponentAlignment(okButton, Alignment.BOTTOM_CENTER); okButton.addListener(new ClickListener() { private static final long serialVersionUID = 1L; public void buttonClick(ClickEvent event) { RepositoryService repositoryService = ProcessEngines.getDefaultProcessEngine() .getRepositoryService(); boolean includeProcessInstances = (Boolean) includeProcessInstancesCheckBox.getValue(); if (suspend) { repositoryService.suspendProcessDefinitionById(processDefinitionId, includeProcessInstances, (Date) dateField.getValue()); } else { repositoryService.activateProcessDefinitionById(processDefinitionId, includeProcessInstances, (Date) dateField.getValue()); }//from w w w. j a va 2 s .c om close(); parentPage.refreshSelectNext(); // select next item in list on the left } }); }