use of com.vaadin.ui.Button in project Activiti by Activiti.
the class FormPopupWindow method initUi.
protected void initUi() {
VerticalLayout layout = new VerticalLayout();
layout.setSpacing(true);
addComponent(layout);
// Description
layout.addComponent(new Label(DESCRIPTION));
// Property table
propertyTable = new PropertyTable();
layout.addComponent(propertyTable);
fillFormFields();
// Buttons
HorizontalLayout buttons = new HorizontalLayout();
buttons.setSpacing(true);
// Save button
Button saveButton = new Button(ExplorerApp.get().getI18nManager().getMessage(Messages.BUTTON_SAVE));
buttons.addComponent(saveButton);
saveButton.addListener(new Button.ClickListener() {
private static final long serialVersionUID = -2906886872414089331L;
public void buttonClick(ClickEvent event) {
FormDefinition form = createForm();
formModel.addForm(taskItemId, form);
close();
}
});
// Delete button
Button deleteButton = new Button(ExplorerApp.get().getI18nManager().getMessage(Messages.BUTTON_DELETE));
buttons.addComponent(deleteButton);
deleteButton.addListener(new Button.ClickListener() {
private static final long serialVersionUID = 5267967369680365653L;
public void buttonClick(ClickEvent event) {
formModel.removeForm(taskItemId);
close();
}
});
layout.addComponent(new Label(""));
layout.addComponent(buttons);
}
use of com.vaadin.ui.Button in project Activiti by Activiti.
the class SaveReportPopupWindow method createSaveButton.
protected void createSaveButton(final I18nManager i18nManager, final VerticalLayout layout) {
layout.addComponent(new Label(" ", Label.CONTENT_XHTML));
Button saveButton = new Button(i18nManager.getMessage(Messages.BUTTON_SAVE));
layout.addComponent(saveButton);
layout.setComponentAlignment(saveButton, Alignment.MIDDLE_CENTER);
saveButton.addListener(new ClickListener() {
private static final long serialVersionUID = 1L;
public void buttonClick(ClickEvent event) {
String reportName = null;
// Validate
String error = null;
if (nameField.getValue() == null || ((String) nameField.getValue()).length() == 0) {
error = i18nManager.getMessage(Messages.REPORTING_SAVE_POPUP_NAME_EMPTY);
} else {
reportName = ExplorerApp.get().getLoggedInUser().getId() + "_" + nameField.getValue();
if (reportName.length() > 255) {
error = i18nManager.getMessage(Messages.REPORTING_SAVE_POPUP_NAME_TOO_LONG);
} else {
boolean nameUsed = ProcessEngines.getDefaultProcessEngine().getHistoryService().createHistoricProcessInstanceQuery().processInstanceBusinessKey(reportName).count() != 0;
if (nameUsed) {
error = i18nManager.getMessage(Messages.REPORTING_SAVE_POPUP_NAME_EXISTS);
}
}
}
if (error != null) {
setHeight(185, UNITS_PIXELS);
layout.addComponent(new Label(" ", Label.CONTENT_XHTML));
Label errorLabel = new Label(error);
errorLabel.addStyleName(ExplorerLayout.STYLE_ERROR);
layout.addComponent(errorLabel);
} else {
// Re-run reports to store the data for good now (the previous process instance was deleted)
if (originalFormProperties != null) {
startProcessInstanceWithFormProperties(reportName);
} else {
startProcessInstance(reportName);
}
// Remove the popup
if (componentToDisableOnClose != null) {
componentToDisableOnClose.setEnabled(false);
}
close();
}
}
});
}
use of com.vaadin.ui.Button in project Activiti by Activiti.
the class NewCasePopupWindow method initCreateTaskButton.
protected void initCreateTaskButton() {
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.BUTTON_CREATE));
buttonLayout.addComponent(createButton);
buttonLayout.setComponentAlignment(createButton, Alignment.BOTTOM_RIGHT);
createButton.addListener(new ClickListener() {
public void buttonClick(ClickEvent event) {
handleFormSubmit();
}
});
}
use of com.vaadin.ui.Button in project Activiti by Activiti.
the class TaskEventsPanel method addInputField.
protected void addInputField() {
HorizontalLayout layout = new HorizontalLayout();
layout.setSpacing(true);
layout.setWidth(100, UNITS_PERCENTAGE);
addComponent(layout);
// Hack: actionHandlers can only be attached to panels or windows
Panel textFieldPanel = new Panel();
textFieldPanel.addStyleName(Reindeer.PANEL_LIGHT);
textFieldPanel.setContent(new VerticalLayout());
textFieldPanel.setWidth(100, UNITS_PERCENTAGE);
layout.addComponent(textFieldPanel);
layout.setExpandRatio(textFieldPanel, 1.0f);
commentInputField = new TextField();
commentInputField.setWidth(100, UNITS_PERCENTAGE);
textFieldPanel.addComponent(commentInputField);
// Hack to catch keyboard 'enter'
textFieldPanel.addActionHandler(new Handler() {
public void handleAction(Action action, Object sender, Object target) {
addNewComment(commentInputField.getValue().toString());
}
public Action[] getActions(Object target, Object sender) {
return new Action[] { new ShortcutAction("enter", ShortcutAction.KeyCode.ENTER, null) };
}
});
addCommentButton = new Button(i18nManager.getMessage(Messages.TASK_ADD_COMMENT));
layout.addComponent(addCommentButton);
layout.setComponentAlignment(addCommentButton, Alignment.MIDDLE_LEFT);
addCommentButton.addListener(new ClickListener() {
public void buttonClick(ClickEvent event) {
addNewComment(commentInputField.getValue().toString());
}
});
}
use of com.vaadin.ui.Button in project Activiti by Activiti.
the class JobDetailPanel method addActions.
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();
}
});
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);
}
Aggregations