use of com.vaadin.ui.Button.ClickListener 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.ClickListener 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.ClickListener 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.ClickListener 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));
}
};
}
use of com.vaadin.ui.Button.ClickListener in project Activiti by Activiti.
the class JobDetailPanel method addLinkToProcessDefinition.
protected void addLinkToProcessDefinition(final VerticalLayout verticalLayout, final String labelText, final boolean isSuspendedProcessDefinition) {
HorizontalLayout layout = new HorizontalLayout();
verticalLayout.addComponent(layout);
Label processDefinitionLabel = new Label(labelText);
processDefinitionLabel.setSizeUndefined();
layout.addComponent(processDefinitionLabel);
layout.addComponent(new Label(" ", Label.CONTENT_XHTML));
Button showProcessDefinitionLink = new Button(job.getProcessDefinitionId());
showProcessDefinitionLink.addStyleName(Reindeer.BUTTON_LINK);
showProcessDefinitionLink.addListener(new ClickListener() {
private static final long serialVersionUID = 1L;
public void buttonClick(ClickEvent event) {
if (isSuspendedProcessDefinition) {
ExplorerApp.get().getViewManager().showSuspendedProcessDefinitionsPage(job.getProcessDefinitionId());
} else {
ExplorerApp.get().getViewManager().showActiveProcessDefinitionsPage(job.getProcessDefinitionId());
}
}
});
layout.addComponent(showProcessDefinitionLink);
}
Aggregations