use of com.vaadin.ui.Button.ClickEvent in project Activiti by Activiti.
the class ChangeProcessSuspensionStatePopupWindow method addOkButton.
protected void addOkButton(final boolean suspend) {
verticalLayout.addComponent(new Label(" ", Label.CONTENT_XHTML));
verticalLayout.addComponent(new Label(" ", Label.CONTENT_XHTML));
Button okButton = new Button(i18nManager.getMessage(Messages.BUTTON_OK));
verticalLayout.addComponent(okButton);
verticalLayout.setComponentAlignment(okButton, Alignment.BOTTOM_CENTER);
okButton.addListener(new ClickListener() {
private static final long serialVersionUID = 1L;
public void buttonClick(ClickEvent event) {
RepositoryService repositoryService = ProcessEngines.getDefaultProcessEngine().getRepositoryService();
boolean includeProcessInstances = (Boolean) includeProcessInstancesCheckBox.getValue();
if (suspend) {
repositoryService.suspendProcessDefinitionById(processDefinitionId, includeProcessInstances, (Date) dateField.getValue());
} else {
repositoryService.activateProcessDefinitionById(processDefinitionId, includeProcessInstances, (Date) dateField.getValue());
}
close();
// select next item in list on the left
parentPage.refreshSelectNext();
}
});
}
use of com.vaadin.ui.Button.ClickEvent in project Activiti by Activiti.
the class SuspendedProcessDefinitionDetailPanel method initActions.
protected void initActions(final AbstractPage parentPage) {
SuspendedProcessDefinitionPage processDefinitionPage = (SuspendedProcessDefinitionPage) parentPage;
Button activateButton = new Button(i18nManager.getMessage(Messages.PROCESS_ACTIVATE));
activateButton.addListener(new ClickListener() {
private static final long serialVersionUID = 1L;
public void buttonClick(ClickEvent event) {
ChangeProcessSuspensionStatePopupWindow popupWindow = new ChangeProcessSuspensionStatePopupWindow(processDefinition.getId(), parentPage, false);
ExplorerApp.get().getViewManager().showPopupWindow(popupWindow);
}
});
// Check if already activation job pending
boolean activateJobPending = false;
List<Job> jobs = ProcessEngines.getDefaultProcessEngine().getManagementService().createJobQuery().processDefinitionId(processDefinition.getId()).list();
for (Job job : jobs) {
// TODO: this is a hack. Needs to be cleaner in engine!
if (((JobEntity) job).getJobHandlerType().equals(TimerActivateProcessDefinitionHandler.TYPE)) {
activateJobPending = true;
break;
}
}
activateButton.setEnabled(!activateJobPending);
// Clear toolbar and add 'start' button
processDefinitionPage.getToolBar().removeAllButtons();
processDefinitionPage.getToolBar().addButton(activateButton);
}
use of com.vaadin.ui.Button.ClickEvent in project Activiti by Activiti.
the class SimpleTableEditor method initButtons.
protected void initButtons(GridLayout layout) {
final Button saveButton = new Button(ExplorerApp.get().getI18nManager().getMessage(Messages.PROCESS_EDITOR_SAVE));
saveButton.setEnabled(nameField.getValue() != null && !"".equals((String) nameField.getValue()));
toolBar.addButton(saveButton);
saveButton.addListener(new ClickListener() {
private static final long serialVersionUID = 1L;
public void buttonClick(ClickEvent event) {
save();
}
});
// Dependending on namefield value, save button is enabled
nameField.addListener(new ValueChangeListener() {
private static final long serialVersionUID = 1L;
public void valueChange(ValueChangeEvent event) {
if (nameField.getValue() != null && !"".equals((String) nameField.getValue())) {
saveButton.setEnabled(true);
} else {
saveButton.setEnabled(false);
}
}
});
}
use of com.vaadin.ui.Button.ClickEvent in project Activiti by Activiti.
the class DescriptionComponent method initLayoutClickListener.
protected void initLayoutClickListener() {
addListener(new LayoutClickListener() {
public void layoutClick(LayoutClickEvent event) {
if (event.getClickedComponent() != null && event.getClickedComponent().equals(descriptionLabel)) {
// textarea
final TextArea descriptionTextArea = new TextArea();
descriptionTextArea.setWidth(100, UNITS_PERCENTAGE);
descriptionTextArea.setValue(task.getDescription());
editLayout.addComponent(descriptionTextArea);
// ok button
Button okButton = new Button(i18nManager.getMessage(Messages.BUTTON_OK));
editLayout.addComponent(okButton);
editLayout.setComponentAlignment(okButton, Alignment.BOTTOM_RIGHT);
// replace
replaceComponent(descriptionLabel, editLayout);
// When OK is clicked -> update task data + ui
okButton.addListener(new ClickListener() {
public void buttonClick(ClickEvent event) {
// Update data
task.setDescription(descriptionTextArea.getValue().toString());
taskService.saveTask(task);
// Update UI
descriptionLabel.setValue(task.getDescription());
replaceComponent(editLayout, descriptionLabel);
}
});
}
}
});
}
use of com.vaadin.ui.Button.ClickEvent in project Activiti by Activiti.
the class AccountSelectionPopup method initImapComponent.
protected void initImapComponent() {
imapForm = new Form();
imapForm.setDescription(i18nManager.getMessage(Messages.IMAP_DESCRIPTION));
final TextField imapServer = new TextField(i18nManager.getMessage(Messages.IMAP_SERVER));
imapForm.getLayout().addComponent(imapServer);
final TextField imapPort = new TextField(i18nManager.getMessage(Messages.IMAP_PORT));
imapPort.setWidth(30, UNITS_PIXELS);
// Default imap port (non-ssl)
imapPort.setValue(143);
imapForm.getLayout().addComponent(imapPort);
final CheckBox useSSL = new CheckBox(i18nManager.getMessage(Messages.IMAP_SSL));
useSSL.setValue(false);
useSSL.setImmediate(true);
imapForm.getLayout().addComponent(useSSL);
useSSL.addListener(new ValueChangeListener() {
public void valueChange(ValueChangeEvent event) {
imapPort.setValue(((Boolean) useSSL.getValue()) ? 993 : 143);
}
});
final TextField imapUserName = new TextField(i18nManager.getMessage(Messages.IMAP_USERNAME));
imapForm.getLayout().addComponent(imapUserName);
final PasswordField imapPassword = new PasswordField(i18nManager.getMessage(Messages.IMAP_PASSWORD));
imapForm.getLayout().addComponent(imapPassword);
// Matching listener
imapClickListener = new ClickListener() {
public void buttonClick(ClickEvent event) {
Map<String, Object> accountDetails = createAccountDetails("imap", imapUserName.getValue().toString(), imapPassword.getValue().toString(), "server", imapServer.getValue().toString(), "port", imapPort.getValue().toString(), "ssl", imapPort.getValue().toString());
fireEvent(new SubmitEvent(AccountSelectionPopup.this, SubmitEvent.SUBMITTED, accountDetails));
}
};
}
Aggregations