use of com.vaadin.data.Property.ValueChangeListener 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.data.Property.ValueChangeListener in project opennms by OpenNMS.
the class SimpleViewContribution method getView.
@SuppressWarnings("serial")
@Override
public Component getView(final WidgetContext widgetContext) {
ListSelect listSelect = new ListSelect("Select a city", cities);
listSelect.setHeight("100%");
listSelect.setWidth("100%");
listSelect.setImmediate(true);
listSelect.addValueChangeListener(new ValueChangeListener() {
@Override
public void valueChange(ValueChangeEvent event) {
Notification.show("" + event.getProperty());
}
});
return listSelect;
}
use of com.vaadin.data.Property.ValueChangeListener in project Activiti by Activiti.
the class TaskPage method getListSelectionListener.
protected ValueChangeListener getListSelectionListener() {
return 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 = taskTable.getItem(event.getProperty().getValue());
if (item != null) {
String id = (String) item.getItemProperty("id").getValue();
setDetailComponent(createDetailComponent(id));
UriFragment taskFragment = getUriFragment(id);
ExplorerApp.get().setCurrentUriFragment(taskFragment);
} else {
// Nothing is selected
setDetailComponent(null);
taskEventPanel.setTaskId(null);
ExplorerApp.get().setCurrentUriFragment(getUriFragment(null));
}
}
};
}
use of com.vaadin.data.Property.ValueChangeListener in project Activiti by Activiti.
the class EditorProcessDefinitionDetailPanel method initActions.
protected void initActions() {
newModelButton = new Button(i18nManager.getMessage(Messages.PROCESS_NEW));
newModelButton.addListener(new NewModelClickListener());
importModelButton = new Button(i18nManager.getMessage(Messages.PROCESS_IMPORT));
importModelButton.addListener(new ImportModelClickListener());
editModelButton = new Button(i18nManager.getMessage(Messages.PROCESS_EDIT));
editModelButton.addListener(new EditModelClickListener(modelData));
actionLabel = new Label(i18nManager.getMessage(Messages.MODEL_ACTION));
actionLabel.setSizeUndefined();
actionSelect = new Select();
actionSelect.addItem(i18nManager.getMessage(Messages.PROCESS_COPY));
actionSelect.addItem(i18nManager.getMessage(Messages.PROCESS_DELETE));
actionSelect.addItem(i18nManager.getMessage(Messages.PROCESS_DEPLOY));
actionSelect.addItem(i18nManager.getMessage(Messages.PROCESS_EXPORT));
actionSelect.setWidth("100px");
actionSelect.setFilteringMode(Filtering.FILTERINGMODE_OFF);
actionSelect.setImmediate(true);
actionSelect.addListener(new ValueChangeListener() {
private static final long serialVersionUID = 1L;
@Override
public void valueChange(ValueChangeEvent event) {
if (i18nManager.getMessage(Messages.PROCESS_COPY).equals(event.getProperty().getValue())) {
ExplorerApp.get().getViewManager().showPopupWindow(new CopyModelPopupWindow(modelData));
} else if (i18nManager.getMessage(Messages.PROCESS_DELETE).equals(event.getProperty().getValue())) {
ExplorerApp.get().getViewManager().showPopupWindow(new DeleteModelPopupWindow(modelData));
} else if (i18nManager.getMessage(Messages.PROCESS_DEPLOY).equals(event.getProperty().getValue())) {
deployModel();
} else if (i18nManager.getMessage(Messages.PROCESS_EXPORT).equals(event.getProperty().getValue())) {
exportModel();
}
}
});
// Clear toolbar and add 'start' button
processDefinitionPage.getToolBar().removeAllButtons();
processDefinitionPage.getToolBar().removeAllAdditionalComponents();
processDefinitionPage.getToolBar().addButton(newModelButton);
processDefinitionPage.getToolBar().addButton(importModelButton);
processDefinitionPage.getToolBar().addButton(editModelButton);
processDefinitionPage.getToolBar().addAdditionalComponent(actionLabel);
processDefinitionPage.getToolBar().setComponentAlignment(actionLabel, Alignment.MIDDLE_LEFT);
processDefinitionPage.getToolBar().addAdditionalComponent(actionSelect);
processDefinitionPage.getToolBar().setComponentAlignment(actionSelect, Alignment.MIDDLE_RIGHT);
}
use of com.vaadin.data.Property.ValueChangeListener in project Activiti by Activiti.
the class CreateAttachmentPopupWindow method initTable.
protected void initTable() {
attachmentTypes = new Table();
attachmentTypes.setSizeUndefined();
attachmentTypes.setColumnHeaderMode(Table.COLUMN_HEADER_MODE_HIDDEN);
attachmentTypes.setSelectable(true);
attachmentTypes.setImmediate(true);
attachmentTypes.setNullSelectionAllowed(false);
attachmentTypes.setWidth(200, UNITS_PIXELS);
attachmentTypes.setHeight(100, UNITS_PERCENTAGE);
attachmentTypes.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;
}
});
attachmentTypes.addStyleName(ExplorerLayout.STYLE_RELATED_CONTENT_CREATE_LIST);
attachmentTypes.addContainerProperty("type", Embedded.class, null);
attachmentTypes.setColumnWidth("type", 16);
attachmentTypes.addContainerProperty("name", String.class, null);
// Add all possible attachment types
for (AttachmentEditor editor : attachmentRendererManager.getAttachmentEditors()) {
String name = editor.getTitle(i18nManager);
Embedded image = null;
Resource resource = editor.getImage();
if (resource != null) {
image = new Embedded(null, resource);
}
Item item = attachmentTypes.addItem(editor.getName());
item.getItemProperty("type").setValue(image);
item.getItemProperty("name").setValue(name);
}
// Add listener to show editor component
attachmentTypes.addListener(new ValueChangeListener() {
private static final long serialVersionUID = 1L;
public void valueChange(ValueChangeEvent event) {
String type = (String) event.getProperty().getValue();
selectType(type);
}
});
layout.addComponent(attachmentTypes);
}
Aggregations