List of usage examples for com.vaadin.ui Button addListener
@Override
public Registration addListener(Component.Listener listener)
From source file:org.activiti.editor.ui.CopyModelPopupWindow.java
License:Apache License
protected void addButtons() { // Cancel/*ww w . j a va 2 s . co m*/ Button cancelButton = new Button(i18nManager.getMessage(Messages.BUTTON_CANCEL)); cancelButton.addStyleName(Reindeer.BUTTON_SMALL); cancelButton.addListener(new ClickListener() { private static final long serialVersionUID = 1L; public void buttonClick(ClickEvent event) { close(); } }); // Create Button createButton = new Button(i18nManager.getMessage(Messages.PROCESS_NEW_POPUP_CREATE_BUTTON)); createButton.addStyleName(Reindeer.BUTTON_SMALL); createButton.addListener(new ClickListener() { private static final long serialVersionUID = 1L; public void buttonClick(ClickEvent event) { if (StringUtils.isEmpty((String) nameTextField.getValue())) { form.setComponentError(new UserError("The name field is required.")); return; } Model newModelData = repositoryService.newModel(); ObjectNode modelObjectNode = new ObjectMapper().createObjectNode(); modelObjectNode.put(MODEL_NAME, (String) nameTextField.getValue()); String description = null; if (StringUtils.isNotEmpty((String) descriptionTextArea.getValue())) { description = (String) descriptionTextArea.getValue(); } else { description = ""; } modelObjectNode.put(MODEL_DESCRIPTION, description); newModelData.setMetaInfo(modelObjectNode.toString()); newModelData.setName((String) nameTextField.getValue()); repositoryService.saveModel(newModelData); repositoryService.addModelEditorSource(newModelData.getId(), repositoryService.getModelEditorSource(modelData.getId())); repositoryService.addModelEditorSourceExtra(newModelData.getId(), repositoryService.getModelEditorSourceExtra(modelData.getId())); close(); ExplorerApp.get().getViewManager().showEditorProcessDefinitionPage(newModelData.getId()); } }); // Alignment HorizontalLayout buttonLayout = new HorizontalLayout(); buttonLayout.setSpacing(true); buttonLayout.addComponent(cancelButton); buttonLayout.addComponent(createButton); addComponent(buttonLayout); windowLayout.setComponentAlignment(buttonLayout, Alignment.BOTTOM_RIGHT); }
From source file:org.activiti.editor.ui.DeleteModelPopupWindow.java
License:Apache License
protected void addButtons() { // Cancel/* www . j a va 2s . co m*/ Button cancelButton = new Button(i18nManager.getMessage(Messages.BUTTON_CANCEL)); cancelButton.addStyleName(Reindeer.BUTTON_SMALL); cancelButton.addListener(new ClickListener() { private static final long serialVersionUID = 1L; public void buttonClick(ClickEvent event) { close(); } }); // Convert Button deleteButton = new Button(i18nManager.getMessage(Messages.PROCESS_DELETE_POPUP_DELETE_BUTTON)); deleteButton.addStyleName(Reindeer.BUTTON_SMALL); deleteButton.addListener(new ClickListener() { private static final long serialVersionUID = 1L; public void buttonClick(ClickEvent event) { repositoryService.deleteModel(modelData.getId()); close(); ExplorerApp.get().getViewManager().showEditorProcessDefinitionPage(); } }); // Alignment HorizontalLayout buttonLayout = new HorizontalLayout(); buttonLayout.setSpacing(true); buttonLayout.addComponent(cancelButton); buttonLayout.addComponent(deleteButton); addComponent(buttonLayout); windowLayout.setComponentAlignment(buttonLayout, Alignment.BOTTOM_RIGHT); }
From source file:org.activiti.editor.ui.EditorProcessDefinitionPage.java
License:Apache License
@Override protected ToolBar createMenuBar() { ProcessMenuBar menuBar = new ProcessMenuBar(); Button newModelButton = new Button(ExplorerApp.get().getI18nManager().getMessage(Messages.PROCESS_NEW)); newModelButton.addListener(new NewModelClickListener()); menuBar.addButton(newModelButton);/* w ww. jav a 2s . c o m*/ Button importModelButton = new Button( ExplorerApp.get().getI18nManager().getMessage(Messages.PROCESS_IMPORT)); importModelButton.addListener(new ImportModelClickListener()); menuBar.addButton(importModelButton); return menuBar; }
From source file:org.activiti.editor.ui.NewModelPopupWindow.java
License:Apache License
protected void addButtons() { // Create/* w w w . ja v a2 s. c om*/ Button createButton = new Button(i18nManager.getMessage(Messages.PROCESS_NEW_POPUP_CREATE_BUTTON)); createButton.setWidth("200px"); createButton.addListener(new ClickListener() { private static final long serialVersionUID = 1L; public void buttonClick(ClickEvent event) { if (StringUtils.isEmpty((String) nameTextField.getValue())) { nameTextField.setComponentError(new UserError("The name field is required.")); return; } if (selectEditorComponent.isModelerPreferred()) { try { ObjectMapper objectMapper = new ObjectMapper(); ObjectNode editorNode = objectMapper.createObjectNode(); editorNode.put("id", "canvas"); editorNode.put("resourceId", "canvas"); ObjectNode stencilSetNode = objectMapper.createObjectNode(); stencilSetNode.put("namespace", "http://b3mn.org/stencilset/bpmn2.0#"); editorNode.put("stencilset", stencilSetNode); Model modelData = repositoryService.newModel(); ObjectNode modelObjectNode = objectMapper.createObjectNode(); modelObjectNode.put(MODEL_NAME, (String) nameTextField.getValue()); modelObjectNode.put(MODEL_REVISION, 1); String description = null; if (StringUtils.isNotEmpty((String) descriptionTextArea.getValue())) { description = (String) descriptionTextArea.getValue(); } else { description = ""; } modelObjectNode.put(MODEL_DESCRIPTION, description); modelData.setMetaInfo(modelObjectNode.toString()); modelData.setName((String) nameTextField.getValue()); repositoryService.saveModel(modelData); repositoryService.addModelEditorSource(modelData.getId(), editorNode.toString().getBytes("utf-8")); close(); ExplorerApp.get().getViewManager().showEditorProcessDefinitionPage(modelData.getId()); URL explorerURL = ExplorerApp.get().getURL(); URL url = new URL(explorerURL.getProtocol(), explorerURL.getHost(), explorerURL.getPort(), explorerURL.getPath().replace("/ui", "") + "modeler.html?modelId=" + modelData.getId()); ExplorerApp.get().getMainWindow().open(new ExternalResource(url)); } catch (Exception e) { notificationManager.showErrorNotification("error", e); } } else { close(); ExplorerApp.get().getViewManager().showSimpleTableProcessEditor( (String) nameTextField.getValue(), (String) descriptionTextArea.getValue()); } } }); // Alignment HorizontalLayout buttonLayout = new HorizontalLayout(); buttonLayout.setSpacing(true); buttonLayout.addComponent(createButton); addComponent(buttonLayout); windowLayout.setComponentAlignment(buttonLayout, Alignment.MIDDLE_CENTER); }
From source file:org.activiti.explorer.ui.alfresco.AlfrescoProcessInstanceTableItem.java
License:Apache License
public AlfrescoProcessInstanceTableItem(final ProcessInstance processInstance) { addItemProperty(PROPERTY_ID, new ObjectProperty<String>(processInstance.getId(), String.class)); if (processInstance.getBusinessKey() != null) { addItemProperty(PROPERTY_BUSINESSKEY, new ObjectProperty<String>(processInstance.getBusinessKey(), String.class)); }/*w w w .j av a 2s . co m*/ Button viewProcessInstanceButton = new Button( ExplorerApp.get().getI18nManager().getMessage(Messages.PROCESS_ACTION_VIEW)); viewProcessInstanceButton.addStyleName(Reindeer.BUTTON_LINK); viewProcessInstanceButton.addListener(new ClickListener() { private static final long serialVersionUID = 1L; public void buttonClick(ClickEvent event) { ExplorerApp.get().getViewManager().showProcessInstancePage(processInstance.getId()); } }); viewProcessInstanceButton.setIcon(Images.MAGNIFIER_16); addItemProperty(PROPERTY_ACTIONS, new ObjectProperty<Component>(viewProcessInstanceButton, Component.class)); }
From source file:org.activiti.explorer.ui.custom.SelectUsersPopupWindow.java
License:Apache License
protected void initSelectMyselfButton(HorizontalLayout searchLayout) { final LoggedInUser loggedInUser = ExplorerApp.get().getLoggedInUser(); if (ignoredUserIds == null || !ignoredUserIds.contains(loggedInUser.getId())) { Button meButton = new Button(i18nManager.getMessage(Messages.PEOPLE_SELECT_MYSELF)); meButton.setIcon(Images.USER_16); searchLayout.addComponent(meButton); searchLayout.setComponentAlignment(meButton, Alignment.MIDDLE_LEFT); if (multiSelect) { meButton.addListener(new ClickListener() { public void buttonClick(ClickEvent event) { selectUser(loggedInUser.getId(), loggedInUser.getFullName()); }/*w w w. j a v a 2s.com*/ }); } else { meButton.addListener(new ClickListener() { public void buttonClick(ClickEvent event) { addMatchingUser(loggedInUser.getId(), loggedInUser.getFullName()); matchingUsersTable.select(loggedInUser.getId()); fireEvent(new SubmitEvent(doneButton, SubmitEvent.SUBMITTED)); close(); } }); } } }
From source file:org.activiti.explorer.ui.custom.UserProfileLink.java
License:Apache License
protected void initUserLink(final String userId) { User user = ProcessEngines.getDefaultProcessEngine().getIdentityService().createUserQuery().userId(userId) .singleResult();/*from w w w. ja v a2 s .co m*/ Button userButton = new Button(user.getFirstName() + " " + user.getLastName()); ClickListener buttonClickListener = new ClickListener() { private static final long serialVersionUID = 1L; public void buttonClick(ClickEvent event) { viewManager.showProfilePopup(userId); } }; userButton.addStyleName(Reindeer.BUTTON_LINK); userButton.addListener(buttonClickListener); addComponent(userButton); setComponentAlignment(userButton, Alignment.MIDDLE_LEFT); }
From source file:org.activiti.explorer.ui.mainlayout.MainMenuBar.java
License:Apache License
protected void initButtons() { // TODO: fixed widths based on i18n strings? Button taskButton = addMenuButton(ViewManager.MAIN_NAVIGATION_TASK, i18nManager.getMessage(Messages.MAIN_MENU_TASKS), Images.MAIN_MENU_TASKS, false, 80); taskButton.addListener(new ShowTasksClickListener()); menuItemButtons.put(ViewManager.MAIN_NAVIGATION_TASK, taskButton); Button processButton = addMenuButton(ViewManager.MAIN_NAVIGATION_PROCESS, i18nManager.getMessage(Messages.MAIN_MENU_PROCESS), Images.MAIN_MENU_PROCESS, false, 80); processButton.addListener(new ShowProcessDefinitionsClickListener()); menuItemButtons.put(ViewManager.MAIN_NAVIGATION_PROCESS, processButton); Button reportingButton = addMenuButton(ViewManager.MAIN_NAVIGATION_REPORT, i18nManager.getMessage(Messages.MAIN_MENU_REPORTS), Images.MAIN_MENU_REPORTS, false, 80); reportingButton.addListener(new ShowReportsClickListener()); menuItemButtons.put(ViewManager.MAIN_NAVIGATION_REPORT, reportingButton); if (ExplorerApp.get().getLoggedInUser().isAdmin()) { Button manageButton = addMenuButton(ViewManager.MAIN_NAVIGATION_MANAGE, i18nManager.getMessage(Messages.MAIN_MENU_MANAGEMENT), Images.MAIN_MENU_MANAGE, false, 90); manageButton.addListener(new ShowManagementClickListener()); menuItemButtons.put(ViewManager.MAIN_NAVIGATION_MANAGE, manageButton); }/*w ww. j a va 2 s . com*/ }
From source file:org.activiti.explorer.ui.MainMenuBar.java
License:Apache License
protected void initButtons() { // TODO: fixed widths based on i18n strings? Button taskButton = addMenuButton(ViewManager.MAIN_NAVIGATION_TASKS, i18nManager.getMessage(Messages.MAIN_MENU_TASKS), Images.MAIN_MENU_TASKS, false, 80); taskButton.addListener(new ShowTasksClickListener()); menuItemButtons.put(ViewManager.MAIN_NAVIGATION_TASKS, taskButton); Button flowsButton = addMenuButton(ViewManager.MAIN_NAVIGATION_FLOWS, i18nManager.getMessage(Messages.MAIN_MENU_FLOWS), Images.MAIN_MENU_FLOWS, false, 80); flowsButton.addListener(new ShowFlowsClickListener()); menuItemButtons.put(ViewManager.MAIN_NAVIGATION_FLOWS, flowsButton); if (ExplorerApp.get().getLoggedInUser().isAdmin()) { Button manageButton = addMenuButton(ViewManager.MAIN_NAVIGATION_MANAGE, i18nManager.getMessage(Messages.MAIN_MENU_MANAGEMENT), Images.MAIN_MENU_MANAGE, false, 90); manageButton.addListener(new ShowManagementClickListener()); menuItemButtons.put(ViewManager.MAIN_NAVIGATION_MANAGE, manageButton); }/* w ww. j av a 2s . com*/ }
From source file:org.activiti.explorer.ui.management.deployment.DeleteDeploymentPopupWindow.java
License:Apache License
protected void addButtons() { // Cancel/*from w w w . ja v a2s. co m*/ Button cancelButton = new Button(i18nManager.getMessage(Messages.BUTTON_CANCEL)); cancelButton.addStyleName(Reindeer.BUTTON_SMALL); cancelButton.addListener(new ClickListener() { public void buttonClick(ClickEvent event) { close(); } }); // Delete Button deleteButton = new Button(i18nManager.getMessage(Messages.DEPLOYMENT_DELETE_POPUP_DELETE_BUTTON)); deleteButton.addStyleName(Reindeer.BUTTON_SMALL); deleteButton.addListener(new ClickListener() { public void buttonClick(ClickEvent event) { // Delete deployment, close popup window and refresh deployment list repositoryService.deleteDeployment(deployment.getId(), true); close(); deploymentPage.refreshSelectNext(); } }); // Alignment HorizontalLayout buttonLayout = new HorizontalLayout(); buttonLayout.setSpacing(true); buttonLayout.addComponent(cancelButton); buttonLayout.addComponent(deleteButton); addComponent(buttonLayout); windowLayout.setComponentAlignment(buttonLayout, Alignment.BOTTOM_RIGHT); }