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.deployment.DeploymentDetailPanel.java
License:Apache License
protected void addActions() { // Delete button Button deleteButton = new Button(i18nManager.getMessage(Messages.DEPLOYMENT_DELETE)); deleteButton.setIcon(Images.DELETE); deleteButton.addListener(new ClickListener() { public void buttonClick(ClickEvent event) { viewManager.showPopupWindow(new DeleteDeploymentPopupWindow(deployment, parent)); }/* w w w . j a va2 s . co m*/ }); parent.getToolBar().removeAllButtons(); parent.getToolBar().addButton(deleteButton); }
From source file:org.activiti.explorer.ui.management.deployment.DeploymentDetailPanel.java
License:Apache License
protected void addProcessDefinitionLinks() { List<ProcessDefinition> processDefinitions = repositoryService.createProcessDefinitionQuery() .deploymentId(deployment.getId()).orderByProcessDefinitionName().asc().list(); if (!processDefinitions.isEmpty()) { // Header Label processDefinitionHeader = new Label( i18nManager.getMessage(Messages.DEPLOYMENT_HEADER_DEFINITIONS)); processDefinitionHeader.addStyleName(ExplorerLayout.STYLE_H3); processDefinitionHeader.addStyleName(ExplorerLayout.STYLE_DETAIL_BLOCK); processDefinitionHeader.setWidth(100, UNITS_PERCENTAGE); addDetailComponent(processDefinitionHeader); // processes VerticalLayout processDefinitionLinksLayout = new VerticalLayout(); processDefinitionLinksLayout.setSpacing(true); processDefinitionLinksLayout.setMargin(true, false, true, false); addDetailComponent(processDefinitionLinksLayout); for (final ProcessDefinition processDefinition : processDefinitions) { Button processDefinitionButton = new Button(getProcessDisplayName(processDefinition)); processDefinitionButton.addListener(new ClickListener() { public void buttonClick(ClickEvent event) { viewManager.showDeployedProcessDefinitionPage(processDefinition.getId()); }/*from w w w . ja v a 2s . co m*/ }); processDefinitionButton.addStyleName(Reindeer.BUTTON_LINK); processDefinitionLinksLayout.addComponent(processDefinitionButton); } } }
From source file:org.activiti.explorer.ui.management.identity.GroupDetailPanel.java
License:Apache License
protected void initActions() { Button createGroupButton = new Button(i18nManager.getMessage(Messages.GROUP_CREATE)); createGroupButton.setIcon(Images.GROUP_16); createGroupButton.addListener(new ClickListener() { public void buttonClick(ClickEvent event) { NewGroupPopupWindow popup = new NewGroupPopupWindow(); ExplorerApp.get().getViewManager().showPopupWindow(popup); }/* w w w .j a v a2 s. co m*/ }); groupPage.getToolBar().removeAllButtons(); groupPage.getToolBar().addButton(createGroupButton); }
From source file:org.activiti.explorer.ui.management.identity.GroupDetailPanel.java
License:Apache License
protected void initEditButton(VerticalLayout actionsLayout) { Button editButton = new Button(i18nManager.getMessage(Messages.USER_EDIT)); editButton.addStyleName(Reindeer.BUTTON_SMALL); actionsLayout.addComponent(editButton); editButton.addListener(new ClickListener() { public void buttonClick(ClickEvent event) { editingDetails = true;// w ww . j a v a2 s . c om detailLayout.removeAllComponents(); populateGroupDetails(); } }); }
From source file:org.activiti.explorer.ui.management.identity.GroupDetailPanel.java
License:Apache License
protected void initSaveButton(VerticalLayout actionsLayout) { Button saveButton = new Button(i18nManager.getMessage(Messages.USER_SAVE)); saveButton.addStyleName(Reindeer.BUTTON_SMALL); actionsLayout.addComponent(saveButton); saveButton.addListener(new ClickListener() { public void buttonClick(ClickEvent event) { String originalName = group.getName(); // Update data if (nameTextField.getValue() != null) { group.setName(nameTextField.getValue().toString()); group.setType(typeCombobox.getValue().toString()); }/*www .j a v a2 s.co m*/ identityService.saveGroup(group); // Update UI editingDetails = false; detailLayout.removeAllComponents(); populateGroupDetails(); // Refresh task list (only if name was changed) if ((originalName != null && !originalName.equals(group.getName())) || (originalName == null && group.getName() != null)) { groupPage.notifyGroupChanged(group.getId()); } } }); }
From source file:org.activiti.explorer.ui.management.identity.GroupDetailPanel.java
License:Apache License
protected void initDeleteButton(VerticalLayout actionsLayout) { Button deleteButton = new Button(i18nManager.getMessage(Messages.GROUP_DELETE)); deleteButton.addStyleName(Reindeer.BUTTON_SMALL); actionsLayout.addComponent(deleteButton); deleteButton.addListener(new ClickListener() { public void buttonClick(ClickEvent event) { ConfirmationDialogPopupWindow confirmPopup = new ConfirmationDialogPopupWindow( i18nManager.getMessage(Messages.GROUP_CONFIRM_DELETE, group.getId())); confirmPopup.addListener(new ConfirmationEventListener() { protected void rejected(ConfirmationEvent event) { }//from www. j a v a 2 s .co m protected void confirmed(ConfirmationEvent event) { // Delete group from database identityService.deleteGroup(group.getId()); // Update ui groupPage.refreshSelectNext(); } }); ExplorerApp.get().getViewManager().showPopupWindow(confirmPopup); } }); }
From source file:org.activiti.explorer.ui.management.identity.GroupDetailPanel.java
License:Apache License
protected void initAddMembersButton(HorizontalLayout membersHeader) { Button addButton = new Button(); addButton.addStyleName(ExplorerLayout.STYLE_ADD); membersHeader.addComponent(addButton); membersHeader.setComponentAlignment(addButton, Alignment.MIDDLE_RIGHT); addButton.addListener(new ClickListener() { public void buttonClick(ClickEvent event) { final SelectUsersPopupWindow selectUsersPopup = new SelectUsersPopupWindow( i18nManager.getMessage(Messages.GROUP_SELECT_MEMBERS, group.getId()), true, false, getCurrentMembers()); ExplorerApp.get().getViewManager().showPopupWindow(selectUsersPopup); // Listen to submit events (that contain the selected users) selectUsersPopup.addListener(new SubmitEventListener() { protected void submitted(SubmitEvent event) { Collection<String> userIds = selectUsersPopup.getSelectedUserIds(); if (!userIds.isEmpty()) { for (String userId : userIds) { identityService.createMembership(userId, group.getId()); }//from w w w. j a v a 2 s.com notifyMembershipChanged(); } } protected void cancelled(SubmitEvent event) { } }); } }); }
From source file:org.activiti.explorer.ui.management.identity.GroupSelectionPopupWindow.java
License:Apache License
protected void initSelectButton() { final Button selectButton = new Button(i18nManager.getMessage(Messages.USER_SELECT_GROUPS)); addComponent(selectButton);//from ww w .j av a 2 s.c om ((VerticalLayout) getContent()).setComponentAlignment(selectButton, Alignment.BOTTOM_RIGHT); selectButton.addListener(new ClickListener() { public void buttonClick(ClickEvent event) { fireEvent(new SubmitEvent(selectButton, SubmitEvent.SUBMITTED)); close(); } }); }
From source file:org.activiti.explorer.ui.management.identity.NewGroupPopupWindow.java
License:Apache License
protected void initCreateButton() { HorizontalLayout buttonLayout = new HorizontalLayout(); buttonLayout.setWidth(100, UNITS_PERCENTAGE); form.getFooter().setWidth(100, UNITS_PERCENTAGE); form.getFooter().addComponent(buttonLayout); Button createButton = new Button(i18nManager.getMessage(Messages.GROUP_CREATE)); buttonLayout.addComponent(createButton); buttonLayout.setComponentAlignment(createButton, Alignment.BOTTOM_RIGHT); createButton.addListener(new ClickListener() { public void buttonClick(ClickEvent event) { handleFormSubmit();//from w ww . j av a2 s . c om } }); }
From source file:org.activiti.explorer.ui.management.identity.NewUserPopupWindow.java
License:Apache License
protected void initCreateButton() { HorizontalLayout buttonLayout = new HorizontalLayout(); buttonLayout.setWidth(100, UNITS_PERCENTAGE); form.getFooter().setWidth(100, UNITS_PERCENTAGE); form.getFooter().addComponent(buttonLayout); Button createButton = new Button(i18nManager.getMessage(Messages.USER_CREATE)); buttonLayout.addComponent(createButton); buttonLayout.setComponentAlignment(createButton, Alignment.BOTTOM_RIGHT); createButton.addListener(new ClickListener() { public void buttonClick(ClickEvent event) { handleFormSubmit();/*from w ww.jav a 2s .co m*/ } }); }