use of com.vaadin.ui.Button.ClickListener in project Activiti by Activiti.
the class EventOverviewPanel method initProcessInstances.
protected void initProcessInstances() {
HorizontalLayout instancesHeader = new HorizontalLayout();
instancesHeader.setSpacing(false);
instancesHeader.setMargin(false);
instancesHeader.setWidth(100, UNITS_PERCENTAGE);
instancesHeader.addStyleName(ExplorerLayout.STYLE_DETAIL_BLOCK);
addDetailComponent(instancesHeader);
initProcessInstanceTitle(instancesHeader);
HorizontalLayout selectLayout = new HorizontalLayout();
selectLayout.setSpacing(true);
selectLayout.setMargin(true);
selectLayout.setWidth(50, UNITS_PERCENTAGE);
addDetailComponent(selectLayout);
definitionSelect = new NativeSelect(i18nManager.getMessage(Messages.DEPLOYMENT_HEADER_DEFINITIONS));
definitionSelect.setImmediate(true);
for (ProcessDefinition definition : definitionList) {
definitionSelect.addItem(definition.getId());
definitionSelect.setItemCaption(definition.getId(), definition.getName());
}
definitionSelect.addListener(new ValueChangeListener() {
private static final long serialVersionUID = 1L;
@Override
public void valueChange(ValueChangeEvent event) {
if (definitionSelect.getValue() != null) {
String selectedDefinitionId = (String) definitionSelect.getValue();
ExplorerApp.get().setCrystalBallCurrentDefinitionId(selectedDefinitionId);
refreshInstances(selectedDefinitionId);
}
}
});
selectLayout.addComponent(definitionSelect);
replayButton = new Button(i18nManager.getMessage(Messages.CRYSTALBALL_BUTTON_REPLAY));
replayButton.setEnabled(false);
replayButton.addListener(new ClickListener() {
private static final long serialVersionUID = 1L;
@Override
public void buttonClick(ClickEvent event) {
if (instanceTable.getValue() != null) {
String processInstanceId = (String) instanceTable.getValue();
ExplorerApp.get().setCrystalBallCurrentInstanceId(processInstanceId);
List<EventLogEntry> eventLogEntries = managementService.getEventLogEntriesByProcessInstanceId(processInstanceId);
if (eventLogEntries == null || eventLogEntries.isEmpty())
return;
EventLogTransformer transformer = new EventLogTransformer(getTransformers());
simulationEvents = transformer.transform(eventLogEntries);
ExplorerApp.get().setCrystalBallSimulationEvents(simulationEvents);
SimpleEventCalendar eventCalendar = new SimpleEventCalendar(ProcessEngines.getDefaultProcessEngine().getProcessEngineConfiguration().getClock(), new SimulationEventComparator());
eventCalendar.addEvents(simulationEvents);
// replay process instance run
simulationDebugger = new ReplaySimulationRun(ProcessEngines.getDefaultProcessEngine(), eventCalendar, getReplayHandlers(processInstanceId));
ExplorerApp.get().setCrystalBallSimulationDebugger(simulationDebugger);
simulationDebugger.init(new NoExecutionVariableScope());
simulationDebugger.step();
// replay process was started
List<HistoricProcessInstance> replayProcessInstanceList = historyService.createHistoricProcessInstanceQuery().processInstanceBusinessKey(SIMULATION_BUSINESS_KEY).orderByProcessInstanceStartTime().desc().list();
if (replayProcessInstanceList != null && !replayProcessInstanceList.isEmpty()) {
replayHistoricInstance = replayProcessInstanceList.get(0);
}
refreshEvents();
}
}
});
selectLayout.addComponent(replayButton);
selectLayout.setComponentAlignment(replayButton, Alignment.MIDDLE_LEFT);
instanceLayout = new HorizontalLayout();
instanceLayout.setWidth(100, UNITS_PERCENTAGE);
addDetailComponent(instanceLayout);
initInstancesTable();
}
use of com.vaadin.ui.Button.ClickListener in project Activiti by Activiti.
the class GroupDetailPanel method initAddMembersButton.
protected void initAddMembersButton(HorizontalLayout membersHeader) {
Button addButton = new Button();
addButton.addStyleName(ExplorerLayout.STYLE_ADD);
membersHeader.addComponent(addButton);
membersHeader.setComponentAlignment(addButton, Alignment.MIDDLE_RIGHT);
addButton.addListener(new ClickListener() {
public void buttonClick(ClickEvent event) {
final SelectUsersPopupWindow selectUsersPopup = new SelectUsersPopupWindow(i18nManager.getMessage(Messages.GROUP_SELECT_MEMBERS, group.getId()), true, false, getCurrentMembers());
ExplorerApp.get().getViewManager().showPopupWindow(selectUsersPopup);
// Listen to submit events (that contain the selected users)
selectUsersPopup.addListener(new SubmitEventListener() {
protected void submitted(SubmitEvent event) {
Collection<String> userIds = selectUsersPopup.getSelectedUserIds();
if (!userIds.isEmpty()) {
for (String userId : userIds) {
identityService.createMembership(userId, group.getId());
}
notifyMembershipChanged();
}
}
protected void cancelled(SubmitEvent event) {
}
});
}
});
}
use of com.vaadin.ui.Button.ClickListener in project Activiti by Activiti.
the class GroupDetailPanel method initActions.
protected void initActions() {
Button createGroupButton = new Button(i18nManager.getMessage(Messages.GROUP_CREATE));
createGroupButton.setIcon(Images.GROUP_16);
createGroupButton.addListener(new ClickListener() {
public void buttonClick(ClickEvent event) {
NewGroupPopupWindow popup = new NewGroupPopupWindow();
ExplorerApp.get().getViewManager().showPopupWindow(popup);
}
});
groupPage.getToolBar().removeAllButtons();
groupPage.getToolBar().addButton(createGroupButton);
}
use of com.vaadin.ui.Button.ClickListener in project Activiti by Activiti.
the class GroupDetailPanel method initEditButton.
protected void initEditButton(VerticalLayout actionsLayout) {
Button editButton = new Button(i18nManager.getMessage(Messages.USER_EDIT));
editButton.addStyleName(Reindeer.BUTTON_SMALL);
actionsLayout.addComponent(editButton);
editButton.addListener(new ClickListener() {
public void buttonClick(ClickEvent event) {
editingDetails = true;
detailLayout.removeAllComponents();
populateGroupDetails();
}
});
}
use of com.vaadin.ui.Button.ClickListener in project Activiti by Activiti.
the class GroupSelectionPopupWindow method initSelectButton.
protected void initSelectButton() {
final Button selectButton = new Button(i18nManager.getMessage(Messages.USER_SELECT_GROUPS));
addComponent(selectButton);
((VerticalLayout) getContent()).setComponentAlignment(selectButton, Alignment.BOTTOM_RIGHT);
selectButton.addListener(new ClickListener() {
public void buttonClick(ClickEvent event) {
fireEvent(new SubmitEvent(selectButton, SubmitEvent.SUBMITTED));
close();
}
});
}
Aggregations