use of com.vaadin.data.Property.ValueChangeEvent in project Activiti by Activiti.
the class TabbedSelectionWindow method initSelectionTable.
protected void initSelectionTable() {
selectionTable = new Table();
selectionTable.setSizeUndefined();
selectionTable.setColumnHeaderMode(Table.COLUMN_HEADER_MODE_HIDDEN);
selectionTable.setSelectable(true);
selectionTable.setImmediate(true);
selectionTable.setNullSelectionAllowed(false);
selectionTable.setWidth(150, UNITS_PIXELS);
selectionTable.setHeight(100, UNITS_PERCENTAGE);
selectionTable.setCellStyleGenerator(new CellStyleGenerator() {
private static final long serialVersionUID = 1L;
public String getStyle(Object itemId, Object propertyId) {
if ("name".equals(propertyId)) {
return ExplorerLayout.STYLE_RELATED_CONTENT_CREATE_LIST_LAST_COLUMN;
}
return null;
}
});
selectionTable.addStyleName(ExplorerLayout.STYLE_RELATED_CONTENT_CREATE_LIST);
selectionTable.addContainerProperty("type", Embedded.class, null);
selectionTable.setColumnWidth("type", 22);
selectionTable.addContainerProperty("name", String.class, null);
// Listener to switch to the selected component
selectionTable.addListener(new ValueChangeListener() {
private static final long serialVersionUID = 1L;
public void valueChange(ValueChangeEvent event) {
String name = (String) event.getProperty().getValue();
if (name != null) {
currentSelection = name;
currentComponent = components.get(name);
selectedComponentLayout.removeComponent(selectedComponentLayout.getComponent(0, 0));
if (currentComponent != null) {
currentComponent.setSizeFull();
selectedComponentLayout.addComponent(currentComponent, 0, 0);
okButton.setEnabled(true);
} else {
okButton.setEnabled(false);
}
}
}
});
windowLayout.addComponent(selectionTable);
}
use of com.vaadin.data.Property.ValueChangeEvent in project Activiti by Activiti.
the class AdminCompletedInstancesPanel method initInstancesTable.
protected void initInstancesTable() {
instancesTable = new Table();
instancesTable.setWidth(100, UNITS_PERCENTAGE);
instancesTable.setHeight(250, UNITS_PIXELS);
instancesTable.setEditable(false);
instancesTable.setImmediate(true);
instancesTable.setSelectable(true);
instancesTable.setSortDisabled(false);
instancesTable.addContainerProperty("id", String.class, null, i18nManager.getMessage(Messages.PROCESS_INSTANCE_ID), null, Table.ALIGN_LEFT);
instancesTable.addContainerProperty("business key", String.class, null, i18nManager.getMessage(Messages.PROCESS_INSTANCE_BUSINESSKEY), null, Table.ALIGN_LEFT);
instancesTable.addContainerProperty("start user id", String.class, null, i18nManager.getMessage(Messages.ADMIN_STARTED_BY), null, Table.ALIGN_LEFT);
instancesTable.addContainerProperty("start activity id", String.class, null, i18nManager.getMessage(Messages.ADMIN_START_ACTIVITY), null, Table.ALIGN_LEFT);
instancesTable.addContainerProperty("start time", String.class, null, i18nManager.getMessage(Messages.PROCESS_INSTANCE_STARTED), null, Table.ALIGN_LEFT);
instancesTable.addContainerProperty("end time", String.class, null, i18nManager.getMessage(Messages.TASK_COMPLETE_TIME), null, Table.ALIGN_LEFT);
instancesTable.addContainerProperty("duration", String.class, null, i18nManager.getMessage(Messages.TASK_DURATION), null, Table.ALIGN_LEFT);
instancesTable.addListener(new Property.ValueChangeListener() {
private static final long serialVersionUID = 1L;
public void valueChange(ValueChangeEvent event) {
// the value of the property is the itemId of the table entry
Item item = instancesTable.getItem(event.getProperty().getValue());
if (item != null) {
String instanceId = (String) item.getItemProperty("id").getValue();
HistoricProcessInstance processInstance = null;
for (HistoricProcessInstance instance : selectedManagementDefinition.runningInstances) {
if (instance.getId().equals(instanceId)) {
processInstance = instance;
break;
}
}
if (processInstance != null)
addProcessImage(selectedManagementDefinition.processDefinition, processInstance);
addTasks(processInstance);
addVariables(processInstance);
}
}
});
instancesLayout.addComponent(instancesTable);
}
use of com.vaadin.data.Property.ValueChangeEvent in project Activiti by Activiti.
the class AdminRunningInstancesPanel method initDefinitionsTable.
protected void initDefinitionsTable() {
if (instanceList == null || instanceList.isEmpty()) {
noMembersTable = new Label(i18nManager.getMessage(Messages.ADMIN_RUNNING_NONE_FOUND));
definitionsLayout.addComponent(noMembersTable);
} else {
runningDefinitions = new HashMap<String, ManagementProcessDefinition>();
for (HistoricProcessInstance instance : instanceList) {
String processDefinitionId = instance.getProcessDefinitionId();
ManagementProcessDefinition managementDefinition = null;
if (runningDefinitions.containsKey(processDefinitionId)) {
managementDefinition = runningDefinitions.get(processDefinitionId);
} else {
ProcessDefinition definition = repositoryService.createProcessDefinitionQuery().processDefinitionId(processDefinitionId).singleResult();
if (definition == null) {
// this process has a missing definition - skip
continue;
}
managementDefinition = new ManagementProcessDefinition();
managementDefinition.processDefinition = definition;
managementDefinition.runningInstances = new ArrayList<HistoricProcessInstance>();
runningDefinitions.put(definition.getId(), managementDefinition);
}
managementDefinition.runningInstances.add(instance);
}
definitionsTable = new Table();
definitionsTable.setWidth(100, UNITS_PERCENTAGE);
definitionsTable.setHeight(250, UNITS_PIXELS);
definitionsTable.setEditable(false);
definitionsTable.setImmediate(true);
definitionsTable.setSelectable(true);
definitionsTable.setSortDisabled(false);
definitionsTable.addContainerProperty("id", String.class, null, i18nManager.getMessage(Messages.PROCESS_INSTANCE_ID), null, Table.ALIGN_LEFT);
definitionsTable.addContainerProperty("name", String.class, null, i18nManager.getMessage(Messages.PROCESS_INSTANCE_NAME), null, Table.ALIGN_LEFT);
definitionsTable.addContainerProperty("nr of instances", String.class, null, i18nManager.getMessage(Messages.ADMIN_NR_INSTANCES), null, Table.ALIGN_LEFT);
for (ManagementProcessDefinition managementDefinition : runningDefinitions.values()) {
definitionsTable.addItem(new String[] { managementDefinition.processDefinition.getId(), managementDefinition.processDefinition.getName(), String.valueOf(managementDefinition.runningInstances.size()) }, managementDefinition.processDefinition.getId());
}
definitionsTable.addListener(new Property.ValueChangeListener() {
private static final long serialVersionUID = 1L;
public void valueChange(ValueChangeEvent event) {
// the value of the property is the itemId of the table entry
Item item = definitionsTable.getItem(event.getProperty().getValue());
if (item != null) {
String definitionId = (String) item.getItemProperty("id").getValue();
selectedManagementDefinition = runningDefinitions.get(definitionId);
refreshInstancesTable();
}
}
});
definitionsLayout.addComponent(definitionsTable);
}
}
use of com.vaadin.data.Property.ValueChangeEvent in project Activiti by Activiti.
the class AdminRunningInstancesPanel method initInstancesTable.
protected void initInstancesTable() {
instancesTable = new Table();
instancesTable.setWidth(100, UNITS_PERCENTAGE);
instancesTable.setHeight(250, UNITS_PIXELS);
instancesTable.setEditable(false);
instancesTable.setImmediate(true);
instancesTable.setSelectable(true);
instancesTable.setSortDisabled(false);
instancesTable.addContainerProperty("id", String.class, null, i18nManager.getMessage(Messages.PROCESS_INSTANCE_ID), null, Table.ALIGN_LEFT);
instancesTable.addContainerProperty("business key", String.class, null, i18nManager.getMessage(Messages.PROCESS_INSTANCE_BUSINESSKEY), null, Table.ALIGN_LEFT);
instancesTable.addContainerProperty("start user id", String.class, null, i18nManager.getMessage(Messages.ADMIN_STARTED_BY), null, Table.ALIGN_LEFT);
instancesTable.addContainerProperty("start activity id", String.class, null, i18nManager.getMessage(Messages.ADMIN_START_ACTIVITY), null, Table.ALIGN_LEFT);
instancesTable.addContainerProperty("start time", String.class, null, i18nManager.getMessage(Messages.PROCESS_INSTANCE_STARTED), null, Table.ALIGN_LEFT);
instancesTable.addListener(new Property.ValueChangeListener() {
private static final long serialVersionUID = 1L;
public void valueChange(ValueChangeEvent event) {
// the value of the property is the itemId of the table entry
Item item = instancesTable.getItem(event.getProperty().getValue());
if (item != null) {
String instanceId = (String) item.getItemProperty("id").getValue();
HistoricProcessInstance processInstance = null;
for (HistoricProcessInstance instance : selectedManagementDefinition.runningInstances) {
if (instance.getId().equals(instanceId)) {
processInstance = instance;
break;
}
}
if (processInstance != null)
addProcessImage(selectedManagementDefinition.processDefinition, processInstance);
addTasks(processInstance);
addVariables(processInstance);
}
}
});
instancesLayout.addComponent(instancesTable);
}
use of com.vaadin.data.Property.ValueChangeEvent 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();
}
Aggregations