use of com.vaadin.data.Property.ValueChangeEvent in project Activiti by Activiti.
the class AdminCompletedInstancesPanel method initDefinitionsTable.
protected void initDefinitionsTable() {
if (instanceList == null || instanceList.isEmpty()) {
noMembersTable = new Label(i18nManager.getMessage(Messages.ADMIN_COMPLETED_NONE_FOUND));
definitionsLayout.addComponent(noMembersTable);
} else {
completedDefinitions = new HashMap<String, ManagementProcessDefinition>();
for (HistoricProcessInstance instance : instanceList) {
String processDefinitionId = instance.getProcessDefinitionId();
ManagementProcessDefinition managementDefinition = null;
if (completedDefinitions.containsKey(processDefinitionId)) {
managementDefinition = completedDefinitions.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>();
completedDefinitions.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 : completedDefinitions.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 = completedDefinitions.get(definitionId);
refreshInstancesTable();
}
}
});
definitionsLayout.addComponent(definitionsTable);
}
}
use of com.vaadin.data.Property.ValueChangeEvent 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.ValueChangeEvent 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.ValueChangeEvent 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);
}
use of com.vaadin.data.Property.ValueChangeEvent in project Activiti by Activiti.
the class EditorProcessDefinitionPage method createList.
@Override
protected Table createList() {
final Table processDefinitionTable = new Table();
processDefinitionTable.addStyleName(ExplorerLayout.STYLE_PROCESS_DEFINITION_LIST);
// Set non-editable, selectable and full-size
processDefinitionTable.setEditable(false);
processDefinitionTable.setImmediate(true);
processDefinitionTable.setSelectable(true);
processDefinitionTable.setNullSelectionAllowed(false);
processDefinitionTable.setSortDisabled(true);
processDefinitionTable.setSizeFull();
// Listener to change right panel when clicked on a model
processDefinitionTable.addListener(new Property.ValueChangeListener() {
private static final long serialVersionUID = 1L;
public void valueChange(ValueChangeEvent event) {
showProcessDefinitionDetail((String) event.getProperty().getValue());
}
});
// Create columns
processDefinitionTable.addGeneratedColumn("icon", new ThemeImageColumnGenerator(Images.PROCESS_22));
processDefinitionTable.setColumnWidth("icon", 22);
processDefinitionTable.addContainerProperty("name", String.class, null);
processDefinitionTable.setColumnHeaderMode(Table.COLUMN_HEADER_MODE_HIDDEN);
List<Model> modelList = repositoryService.createModelQuery().list();
for (Model modelData : modelList) {
Item item = processDefinitionTable.addItem(modelData.getId());
item.getItemProperty("name").setValue(modelData.getName());
}
return processDefinitionTable;
}
Aggregations