use of com.vaadin.ui.Button.ClickListener in project opennms by OpenNMS.
the class NodeSelectionLinkGenerator method generateCell.
@Override
public Object generateCell(final Table source, final Object itemId, Object columnId) {
final Property<Integer> nodeIdProperty = source.getContainerProperty(itemId, m_nodeIdProperty);
Object cellValue = m_generator.generateCell(source, itemId, columnId);
if (cellValue == null) {
return null;
} else {
if (nodeIdProperty.getValue() == null) {
return cellValue;
} else {
Button button = new Button(cellValue.toString());
button.setStyleName(BaseTheme.BUTTON_LINK);
button.setDescription(nodeIdProperty.getValue().toString());
button.addClickListener(new ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
Integer nodeId = nodeIdProperty.getValue();
String nodeLabel = (String) source.getContainerProperty(itemId, m_nodeLabelProperty).getValue();
VertexRef vertexRef = new DefaultVertexRef("nodes", String.valueOf(nodeId), nodeLabel);
fireVertexUpdatedEvent(vertexRef);
}
});
return button;
}
}
}
use of com.vaadin.ui.Button.ClickListener in project Activiti by Activiti.
the class TaskInvolvedPeopleComponent method initAddPeopleButton.
protected void initAddPeopleButton(HorizontalLayout headerLayout) {
addPeopleButton = new Button();
addPeopleButton.addStyleName(ExplorerLayout.STYLE_ADD);
headerLayout.addComponent(addPeopleButton);
addPeopleButton.addListener(new ClickListener() {
public void buttonClick(ClickEvent event) {
final SelectUsersPopupWindow involvePeoplePopupWindow = new SelectUsersPopupWindow(i18nManager.getMessage(Messages.PEOPLE_INVOLVE_POPUP_CAPTION), true);
involvePeoplePopupWindow.addListener(new SubmitEventListener() {
protected void submitted(SubmitEvent event) {
Collection<String> selectedUserIds = involvePeoplePopupWindow.getSelectedUserIds();
for (String userId : selectedUserIds) {
String role = involvePeoplePopupWindow.getSelectedUserRole(userId);
taskService.addUserIdentityLink(task.getId(), userId, role);
}
taskDetailPanel.notifyPeopleInvolvedChanged();
}
protected void cancelled(SubmitEvent event) {
}
});
viewManager.showPopupWindow(involvePeoplePopupWindow);
}
});
}
use of com.vaadin.ui.Button.ClickListener in project Activiti by Activiti.
the class ConvertProcessDefinitionPopupWindow method addButtons.
protected void addButtons() {
// Cancel
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 convertButton = new Button(i18nManager.getMessage(Messages.PROCESS_CONVERT_POPUP_CONVERT_BUTTON));
convertButton.addStyleName(Reindeer.BUTTON_SMALL);
convertButton.addListener(new ClickListener() {
private static final long serialVersionUID = 1L;
public void buttonClick(ClickEvent event) {
try {
InputStream bpmnStream = repositoryService.getResourceAsStream(processDefinition.getDeploymentId(), processDefinition.getResourceName());
XMLInputFactory xif = XmlUtil.createSafeXmlInputFactory();
InputStreamReader in = new InputStreamReader(bpmnStream, "UTF-8");
XMLStreamReader xtr = xif.createXMLStreamReader(in);
BpmnModel bpmnModel = new BpmnXMLConverter().convertToBpmnModel(xtr);
if (bpmnModel.getMainProcess() == null || bpmnModel.getMainProcess().getId() == null) {
notificationManager.showErrorNotification(Messages.MODEL_IMPORT_FAILED, i18nManager.getMessage(Messages.MODEL_IMPORT_INVALID_BPMN_EXPLANATION));
} else {
if (bpmnModel.getLocationMap().isEmpty()) {
notificationManager.showErrorNotification(Messages.MODEL_IMPORT_INVALID_BPMNDI, i18nManager.getMessage(Messages.MODEL_IMPORT_INVALID_BPMNDI_EXPLANATION));
} else {
BpmnJsonConverter converter = new BpmnJsonConverter();
ObjectNode modelNode = converter.convertToJson(bpmnModel);
Model modelData = repositoryService.newModel();
ObjectNode modelObjectNode = new ObjectMapper().createObjectNode();
modelObjectNode.put(MODEL_NAME, processDefinition.getName());
modelObjectNode.put(MODEL_REVISION, 1);
modelObjectNode.put(MODEL_DESCRIPTION, processDefinition.getDescription());
modelData.setMetaInfo(modelObjectNode.toString());
modelData.setName(processDefinition.getName());
repositoryService.saveModel(modelData);
repositoryService.addModelEditorSource(modelData.getId(), modelNode.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);
}
}
});
// Alignment
HorizontalLayout buttonLayout = new HorizontalLayout();
buttonLayout.setSpacing(true);
buttonLayout.addComponent(cancelButton);
buttonLayout.addComponent(convertButton);
addComponent(buttonLayout);
windowLayout.setComponentAlignment(buttonLayout, Alignment.BOTTOM_RIGHT);
}
use of com.vaadin.ui.Button.ClickListener in project Activiti by Activiti.
the class EditorProcessDefinitionDetailPanel method deploySimpleTableEditorModel.
protected void deploySimpleTableEditorModel(final byte[] model) {
final DeployModelPopupWindow deployModelPopupWindow = new DeployModelPopupWindow(modelData);
deployModelPopupWindow.getDeployButton().addListener(new ClickListener() {
private static final long serialVersionUID = 1L;
public void buttonClick(ClickEvent event) {
// Convert to simple workflow definition
WorkflowDefinition workflowDefinition = ExplorerApp.get().getSimpleWorkflowJsonConverter().readWorkflowDefinition(model);
// Update model name
modelData.setName(deployModelPopupWindow.getProcessName());
workflowDefinition.setName(deployModelPopupWindow.getProcessName());
WorkflowDefinitionConversion conversion = ExplorerApp.get().getWorkflowDefinitionConversionFactory().createWorkflowDefinitionConversion(workflowDefinition);
conversion.convert();
// Deploy to database
byte[] bpmnBytes = null;
try {
bpmnBytes = conversion.getBpmn20Xml().getBytes("utf-8");
String processName = modelData.getName() + ".bpmn20.xml";
Deployment deployment = repositoryService.createDeployment().name(modelData.getName()).addString(processName, new String(bpmnBytes)).deploy();
// Generate reports
if (deployModelPopupWindow.isGenerateReports()) {
ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().deploymentId(deployment.getId()).singleResult();
ReportingUtil.generateTaskDurationReport(processDefinition.getId());
}
// Close popup and show new deployment
deployModelPopupWindow.closePopupWindow();
ExplorerApp.get().getViewManager().showDeploymentPage(deployment.getId());
} catch (UnsupportedEncodingException e) {
ExplorerApp.get().getNotificationManager().showErrorNotification(Messages.PROCESS_TOXML_FAILED, e);
deployModelPopupWindow.closePopupWindow();
}
}
});
deployModelPopupWindow.showPopupWindow();
}
use of com.vaadin.ui.Button.ClickListener in project Activiti by Activiti.
the class CreateAttachmentPopupWindow method initActions.
protected void initActions() {
okButton = new Button(i18nManager.getMessage(Messages.RELATED_CONTENT_CREATE));
detailLayout.addComponent(okButton, 0, 1);
okButton.setEnabled(false);
okButton.addListener(new ClickListener() {
private static final long serialVersionUID = 1L;
public void buttonClick(ClickEvent event) {
saveAttachment();
}
});
detailLayout.setComponentAlignment(okButton, Alignment.BOTTOM_RIGHT);
}
Aggregations