use of com.vaadin.ui.Button.ClickListener in project Activiti by Activiti.
the class TaskMenuBar method initActions.
protected void initActions() {
Button newCaseButton = new Button();
newCaseButton.setCaption(i18nManager.getMessage(Messages.TASK_NEW));
newCaseButton.setIcon(Images.TASK_16);
addButton(newCaseButton);
newCaseButton.addListener(new ClickListener() {
public void buttonClick(ClickEvent event) {
NewCasePopupWindow newTaskPopupWindow = new NewCasePopupWindow();
viewManager.showPopupWindow(newTaskPopupWindow);
}
});
}
use of com.vaadin.ui.Button.ClickListener in project Activiti by Activiti.
the class SubTaskComponent method initAddButton.
protected void initAddButton() {
addSubTaskButton = new Button();
addSubTaskButton.addStyleName(ExplorerLayout.STYLE_ADD);
addSubTaskPanel.addComponent(addSubTaskButton);
addSubTaskButton.addListener(new ClickListener() {
public void buttonClick(ClickEvent event) {
// Remove button
addSubTaskPanel.removeAllComponents();
// And add textfield
Label createSubTaskLabel = new Label("Create new subtask:");
createSubTaskLabel.addStyleName(Reindeer.LABEL_SMALL);
addSubTaskPanel.addComponent(createSubTaskLabel);
newTaskTextField = new TextField();
newTaskTextField.focus();
addSubTaskPanel.addComponent(newTaskTextField);
}
});
}
use of com.vaadin.ui.Button.ClickListener in project Activiti by Activiti.
the class SubTaskComponent method populateSubTasks.
protected void populateSubTasks(List<HistoricTaskInstance> subTasks) {
if (!subTasks.isEmpty()) {
for (final HistoricTaskInstance subTask : subTasks) {
// icon
Embedded icon = null;
if (subTask.getEndTime() != null) {
icon = new Embedded(null, Images.TASK_FINISHED_22);
} else {
icon = new Embedded(null, Images.TASK_22);
}
icon.setWidth(22, UNITS_PIXELS);
icon.setWidth(22, UNITS_PIXELS);
subTaskLayout.addComponent(icon);
// Link to subtask
Button subTaskLink = new Button(subTask.getName());
subTaskLink.addStyleName(Reindeer.BUTTON_LINK);
subTaskLink.addListener(new ClickListener() {
public void buttonClick(ClickEvent event) {
ExplorerApp.get().getViewManager().showTaskPage(subTask.getId());
}
});
subTaskLayout.addComponent(subTaskLink);
subTaskLayout.setComponentAlignment(subTaskLink, Alignment.MIDDLE_LEFT);
if (subTask.getEndTime() == null) {
// Delete icon only appears when task is not finished yet
Embedded deleteIcon = new Embedded(null, Images.DELETE);
deleteIcon.addStyleName(ExplorerLayout.STYLE_CLICKABLE);
deleteIcon.addListener(new DeleteSubTaskClickListener(subTask, this));
subTaskLayout.addComponent(deleteIcon);
subTaskLayout.setComponentAlignment(deleteIcon, Alignment.MIDDLE_RIGHT);
} else {
// Next line of grid
subTaskLayout.newLine();
}
}
} else {
Label noSubTasksLabel = new Label(i18nManager.getMessage(Messages.TASK_NO_SUBTASKS));
noSubTasksLabel.setSizeUndefined();
noSubTasksLabel.addStyleName(Reindeer.LABEL_SMALL);
subTaskLayout.addComponent(noSubTasksLabel);
}
}
use of com.vaadin.ui.Button.ClickListener in project Activiti by Activiti.
the class ChangeProcessSuspensionStatePopupWindow method addTimeSection.
protected void addTimeSection(boolean suspend) {
Label timeLabel = new Label(suspend ? i18nManager.getMessage(Messages.PROCESS_SUSPEND_POPUP_TIME_DESCRIPTION) : i18nManager.getMessage(Messages.PROCESS_ACTIVATE_POPUP_TIME_DESCRIPTION));
verticalLayout.addComponent(timeLabel);
verticalLayout.addComponent(new Label(" ", Label.CONTENT_XHTML));
nowCheckBox = new CheckBox(i18nManager.getMessage(Messages.PROCESS_SUSPEND_POPUP_TIME_NOW), true);
nowCheckBox.addStyleName(ExplorerLayout.STYLE_PROCESS_DEFINITION_SUSPEND_CHOICE);
nowCheckBox.setImmediate(true);
nowCheckBox.addListener(new ClickListener() {
public void buttonClick(ClickEvent event) {
if (nowCheckBox.booleanValue() == true) {
dateField.setValue(null);
dateCheckBox.setValue(false);
} else {
dateCheckBox.setValue(true);
dateField.setValue(new Date());
}
}
});
verticalLayout.addComponent(nowCheckBox);
HorizontalLayout dateLayout = new HorizontalLayout();
verticalLayout.addComponent(dateLayout);
dateCheckBox = new CheckBox(i18nManager.getMessage(Messages.PROCESS_SUSPEND_POPUP_TIME_DATE));
dateCheckBox.addStyleName(ExplorerLayout.STYLE_PROCESS_DEFINITION_SUSPEND_CHOICE);
dateCheckBox.setImmediate(true);
dateCheckBox.addListener(new ClickListener() {
public void buttonClick(ClickEvent event) {
if (dateCheckBox.booleanValue() == true) {
dateField.setValue(new Date());
nowCheckBox.setValue(false);
} else {
dateField.setValue(null);
nowCheckBox.setValue(true);
}
}
});
dateLayout.addComponent(dateCheckBox);
dateField = new DateField();
dateField.setImmediate(true);
dateField.addListener(new ValueChangeListener() {
public void valueChange(ValueChangeEvent event) {
if (dateField.getValue() != null) {
nowCheckBox.setValue(false);
dateCheckBox.setValue(true);
}
}
});
dateLayout.addComponent(dateField);
}
use of com.vaadin.ui.Button.ClickListener 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();
}
});
}
Aggregations