use of com.vaadin.ui.Button.ClickListener in project Activiti by Activiti.
the class NewModelPopupWindow method addButtons.
protected void addButtons() {
// Create
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);
}
use of com.vaadin.ui.Button.ClickListener in project Activiti by Activiti.
the class SelectEditorComponent method createModelerEditorChoice.
protected void createModelerEditorChoice() {
modelerLayout = new HorizontalLayout();
modelerLayout.setWidth("300px");
modelerLayout.addStyleName(ExplorerLayout.STYLE_CLICKABLE);
addComponent(modelerLayout);
modelerButton = new Button();
modelerButton.setIcon(Images.PROCESS_EDITOR_BPMN);
modelerButton.setStyleName(Reindeer.BUTTON_LINK);
modelerLayout.addComponent(modelerButton);
modelerLayout.setComponentAlignment(modelerButton, Alignment.MIDDLE_LEFT);
VerticalLayout modelerTextLayout = new VerticalLayout();
modelerLayout.addComponent(modelerTextLayout);
modelerLayout.setExpandRatio(modelerTextLayout, 1.0f);
modelerLabel = new Label(i18nManager.getMessage(Messages.PROCESS_EDITOR_MODELER));
modelerLabel.addStyleName(ExplorerLayout.STYLE_CLICKABLE);
modelerTextLayout.addComponent(modelerLabel);
modelerDescriptionLabel = new Label(i18nManager.getMessage(Messages.PROCESS_EDITOR_MODELER_DESCRIPTION));
modelerDescriptionLabel.addStyleName(Reindeer.LABEL_SMALL);
modelerDescriptionLabel.addStyleName(ExplorerLayout.STYLE_CLICKABLE);
modelerTextLayout.addComponent(modelerDescriptionLabel);
modelerLayout.addListener(new LayoutClickListener() {
public void layoutClick(LayoutClickEvent event) {
preferModeler();
}
});
modelerButton.addListener(new ClickListener() {
public void buttonClick(ClickEvent event) {
preferModeler();
}
});
}
use of com.vaadin.ui.Button.ClickListener in project Activiti by Activiti.
the class FormPropertiesForm method initListeners.
protected void initListeners() {
submitFormButton.addListener(new ClickListener() {
private static final long serialVersionUID = -6091586145870618870L;
public void buttonClick(ClickEvent event) {
// Extract the submitted values from the form. Throws exception when validation fails.
try {
Map<String, String> formProperties = formPropertiesComponent.getFormPropertyValues();
fireEvent(new FormPropertiesEvent(FormPropertiesForm.this, FormPropertiesEvent.TYPE_SUBMIT, formProperties));
submitFormButton.setComponentError(null);
} catch (InvalidValueException ive) {
// Error is presented to user by the form component
}
}
});
cancelFormButton.addListener(new ClickListener() {
private static final long serialVersionUID = -8980500491522472381L;
public void buttonClick(ClickEvent event) {
fireEvent(new FormPropertiesEvent(FormPropertiesForm.this, FormPropertiesEvent.TYPE_CANCEL));
submitFormButton.setComponentError(null);
}
});
}
use of com.vaadin.ui.Button.ClickListener in project Activiti by Activiti.
the class ToolbarEntry method initLabelComponent.
protected void initLabelComponent() {
titleButton = new Button(title);
titleButton.addStyleName(Reindeer.BUTTON_LINK);
layout.addComponent(titleButton);
layout.setComponentAlignment(titleButton, Alignment.MIDDLE_LEFT);
titleButton.addListener(new ClickListener() {
private static final long serialVersionUID = 1L;
public void buttonClick(ClickEvent event) {
if (command != null) {
command.toolBarItemSelected();
}
}
});
}
use of com.vaadin.ui.Button.ClickListener in project Activiti by Activiti.
the class SelectUsersPopupWindow method initSelectMyselfButton.
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());
}
});
} 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();
}
});
}
}
}
Aggregations