Search in sources :

Example 1 with Table

use of com.vaadin.ui.Table in project Activiti by Activiti.

the class ActiveProcessDefinitionPage method createList.

protected Table createList() {
    processDefinitionTable = new Table();
    processDefinitionListQuery = new ActiveProcessDefinitionListQuery();
    processDefinitionListContainer = new LazyLoadingContainer(processDefinitionListQuery);
    processDefinitionTable.setContainerDataSource(processDefinitionListContainer);
    // Column headers
    processDefinitionTable.addContainerProperty("name", String.class, null);
    processDefinitionTable.setColumnHeaderMode(Table.COLUMN_HEADER_MODE_HIDDEN);
    // Listener to change right panel when clicked on a user
    processDefinitionTable.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 = processDefinitionTable.getItem(event.getProperty().getValue());
            if (item != null) {
                String processDefinitionId = (String) item.getItemProperty("id").getValue();
                setDetailComponent(new ActiveProcessDefinitionDetailPanel(processDefinitionId, ActiveProcessDefinitionPage.this));
                // Update URL
                ExplorerApp.get().setCurrentUriFragment(new UriFragment(ActiveProcessDefinitionNavigator.ACTIVE_PROC_DEF_URI_PART, processDefinitionId));
            } else {
                // Nothing selected
                setDetailComponent(null);
                ExplorerApp.get().setCurrentUriFragment(new UriFragment(ActiveProcessDefinitionNavigator.ACTIVE_PROC_DEF_URI_PART));
            }
        }
    });
    return processDefinitionTable;
}
Also used : Item(com.vaadin.data.Item) ValueChangeEvent(com.vaadin.data.Property.ValueChangeEvent) Table(com.vaadin.ui.Table) LazyLoadingContainer(org.activiti.explorer.data.LazyLoadingContainer) Property(com.vaadin.data.Property) UriFragment(org.activiti.explorer.navigation.UriFragment)

Example 2 with Table

use of com.vaadin.ui.Table in project Activiti by Activiti.

the class ProcessInstanceDetailPanel method addVariables.

protected void addVariables() {
    Label header = new Label(i18nManager.getMessage(Messages.PROCESS_INSTANCE_HEADER_VARIABLES));
    header.addStyleName(ExplorerLayout.STYLE_H3);
    header.addStyleName(ExplorerLayout.STYLE_DETAIL_BLOCK);
    header.addStyleName(ExplorerLayout.STYLE_NO_LINE);
    panelLayout.addComponent(header);
    panelLayout.addComponent(new Label(" ", Label.CONTENT_XHTML));
    // variable sorting is done in-memory (which is ok, since normally there aren't that many vars)
    Map<String, Object> variables = new TreeMap<String, Object>(runtimeService.getVariables(processInstance.getId()));
    if (!variables.isEmpty()) {
        Table variablesTable = new Table();
        variablesTable.setWidth(60, UNITS_PERCENTAGE);
        variablesTable.addStyleName(ExplorerLayout.STYLE_PROCESS_INSTANCE_TASK_LIST);
        variablesTable.addContainerProperty("name", String.class, null, i18nManager.getMessage(Messages.PROCESS_INSTANCE_VARIABLE_NAME), null, Table.ALIGN_LEFT);
        variablesTable.addContainerProperty("value", String.class, null, i18nManager.getMessage(Messages.PROCESS_INSTANCE_VARIABLE_VALUE), null, Table.ALIGN_LEFT);
        for (String variable : variables.keySet()) {
            Item variableItem = variablesTable.addItem(variable);
            variableItem.getItemProperty("name").setValue(variable);
            // Get string value to show
            String theValue = variableRendererManager.getStringRepresentation(variables.get(variable));
            variableItem.getItemProperty("value").setValue(theValue);
        }
        variablesTable.setPageLength(variables.size());
        panelLayout.addComponent(variablesTable);
    } else {
        Label noVariablesLabel = new Label(i18nManager.getMessage(Messages.PROCESS_INSTANCE_NO_VARIABLES));
        panelLayout.addComponent(noVariablesLabel);
    }
}
Also used : Item(com.vaadin.data.Item) Table(com.vaadin.ui.Table) Label(com.vaadin.ui.Label) PrettyTimeLabel(org.activiti.explorer.ui.custom.PrettyTimeLabel) TreeMap(java.util.TreeMap)

Example 3 with Table

use of com.vaadin.ui.Table in project Activiti by Activiti.

the class ProcessInstanceDetailPanel method addTasks.

protected void addTasks() {
    Label header = new Label(i18nManager.getMessage(Messages.PROCESS_INSTANCE_HEADER_TASKS));
    header.addStyleName(ExplorerLayout.STYLE_H3);
    header.addStyleName(ExplorerLayout.STYLE_DETAIL_BLOCK);
    header.addStyleName(ExplorerLayout.STYLE_NO_LINE);
    panelLayout.addComponent(header);
    panelLayout.addComponent(new Label("&nbsp;", Label.CONTENT_XHTML));
    Table taskTable = new Table();
    taskTable.addStyleName(ExplorerLayout.STYLE_PROCESS_INSTANCE_TASK_LIST);
    taskTable.setWidth(100, UNITS_PERCENTAGE);
    // Fetch all tasks
    List<HistoricTaskInstance> tasks = historyService.createHistoricTaskInstanceQuery().processInstanceId(processInstance.getId()).orderByHistoricTaskInstanceEndTime().desc().orderByHistoricTaskInstanceStartTime().desc().list();
    if (!tasks.isEmpty()) {
        // Finished icon
        taskTable.addContainerProperty("finished", Component.class, null, "", null, Table.ALIGN_CENTER);
        taskTable.setColumnWidth("finished", 22);
        taskTable.addContainerProperty("name", String.class, null, i18nManager.getMessage(Messages.TASK_NAME), null, Table.ALIGN_LEFT);
        taskTable.addContainerProperty("priority", Integer.class, null, i18nManager.getMessage(Messages.TASK_PRIORITY), null, Table.ALIGN_LEFT);
        taskTable.addContainerProperty("assignee", Component.class, null, i18nManager.getMessage(Messages.TASK_ASSIGNEE), null, Table.ALIGN_LEFT);
        taskTable.addContainerProperty("dueDate", Component.class, null, i18nManager.getMessage(Messages.TASK_DUEDATE), null, Table.ALIGN_LEFT);
        taskTable.addContainerProperty("startDate", Component.class, null, i18nManager.getMessage(Messages.TASK_CREATE_TIME), null, Table.ALIGN_LEFT);
        taskTable.addContainerProperty("endDate", Component.class, null, i18nManager.getMessage(Messages.TASK_COMPLETE_TIME), null, Table.ALIGN_LEFT);
        panelLayout.addComponent(taskTable);
        panelLayout.setExpandRatio(taskTable, 1.0f);
        for (HistoricTaskInstance task : tasks) {
            addTaskItem(task, taskTable);
        }
        taskTable.setPageLength(taskTable.size());
    } else {
        // No tasks
        Label noTaskLabel = new Label(i18nManager.getMessage(Messages.PROCESS_INSTANCE_NO_TASKS));
        panelLayout.addComponent(noTaskLabel);
    }
}
Also used : Table(com.vaadin.ui.Table) HistoricTaskInstance(org.activiti.engine.history.HistoricTaskInstance) Label(com.vaadin.ui.Label) PrettyTimeLabel(org.activiti.explorer.ui.custom.PrettyTimeLabel)

Example 4 with Table

use of com.vaadin.ui.Table in project Activiti by Activiti.

the class ProcessDefinitionPage 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();
    LazyLoadingQuery lazyLoadingQuery = new ProcessDefinitionListQuery(repositoryService, definitionFilter);
    this.processDefinitionContainer = new LazyLoadingContainer(lazyLoadingQuery, 30);
    processDefinitionTable.setContainerDataSource(processDefinitionContainer);
    // Listener to change right panel when clicked on a task
    processDefinitionTable.addListener(new Property.ValueChangeListener() {

        private static final long serialVersionUID = 1L;

        public void valueChange(ValueChangeEvent event) {
            Item item = processDefinitionTable.getItem(event.getProperty().getValue());
            String processDefinitionId = (String) item.getItemProperty("id").getValue();
            showProcessDefinitionDetail(processDefinitionId);
        }
    });
    // 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);
    return processDefinitionTable;
}
Also used : Item(com.vaadin.data.Item) ValueChangeEvent(com.vaadin.data.Property.ValueChangeEvent) Table(com.vaadin.ui.Table) ThemeImageColumnGenerator(org.activiti.explorer.ui.util.ThemeImageColumnGenerator) LazyLoadingContainer(org.activiti.explorer.data.LazyLoadingContainer) Property(com.vaadin.data.Property) LazyLoadingQuery(org.activiti.explorer.data.LazyLoadingQuery)

Example 5 with Table

use of com.vaadin.ui.Table in project Activiti by Activiti.

the class ProcessInstancePage method createList.

@Override
protected Table createList() {
    final Table processInstanceTable = new Table();
    processInstanceTable.addStyleName(ExplorerLayout.STYLE_PROCESS_INSTANCE_LIST);
    // Listener to change right panel when clicked on a process instance
    processInstanceTable.addListener(new Property.ValueChangeListener() {

        private static final long serialVersionUID = 8811553575319455854L;

        public void valueChange(ValueChangeEvent event) {
            // the value of the property is the itemId of the table entry
            Item item = processInstanceTable.getItem(event.getProperty().getValue());
            if (item != null) {
                String processInstanceId = (String) item.getItemProperty("id").getValue();
                setDetailComponent(new ProcessInstanceDetailPanel(processInstanceId, ProcessInstancePage.this));
                UriFragment taskFragment = getUriFragment(processInstanceId);
                ExplorerApp.get().setCurrentUriFragment(taskFragment);
            } else {
                // Nothing is selected
                setDetailComponent(null);
                UriFragment taskFragment = getUriFragment(null);
                ExplorerApp.get().setCurrentUriFragment(taskFragment);
            }
        }
    });
    this.lazyLoadingQuery = createLazyLoadingQuery();
    this.processInstanceListContainer = new LazyLoadingContainer(lazyLoadingQuery, 30);
    processInstanceTable.setContainerDataSource(processInstanceListContainer);
    // Create column header
    processInstanceTable.addGeneratedColumn("icon", new ThemeImageColumnGenerator(Images.PROCESS_22));
    processInstanceTable.setColumnWidth("icon", 22);
    processInstanceTable.addContainerProperty("name", String.class, null);
    processInstanceTable.setColumnHeaderMode(Table.COLUMN_HEADER_MODE_HIDDEN);
    return processInstanceTable;
}
Also used : Item(com.vaadin.data.Item) ValueChangeEvent(com.vaadin.data.Property.ValueChangeEvent) ProcessInstanceDetailPanel(org.activiti.explorer.ui.management.processinstance.ProcessInstanceDetailPanel) Table(com.vaadin.ui.Table) ThemeImageColumnGenerator(org.activiti.explorer.ui.util.ThemeImageColumnGenerator) Property(com.vaadin.data.Property) LazyLoadingContainer(org.activiti.explorer.data.LazyLoadingContainer) UriFragment(org.activiti.explorer.navigation.UriFragment)

Aggregations

Table (com.vaadin.ui.Table)63 Item (com.vaadin.data.Item)25 Property (com.vaadin.data.Property)22 ValueChangeEvent (com.vaadin.data.Property.ValueChangeEvent)21 Label (com.vaadin.ui.Label)18 LazyLoadingContainer (org.activiti.explorer.data.LazyLoadingContainer)17 ThemeImageColumnGenerator (org.activiti.explorer.ui.util.ThemeImageColumnGenerator)13 UriFragment (org.activiti.explorer.navigation.UriFragment)12 PrettyTimeLabel (org.activiti.explorer.ui.custom.PrettyTimeLabel)8 Test (org.junit.Test)8 LazyLoadingQuery (org.activiti.explorer.data.LazyLoadingQuery)6 VerticalLayout (com.vaadin.ui.VerticalLayout)4 HistoricProcessInstance (org.activiti.engine.history.HistoricProcessInstance)4 ValueChangeListener (com.vaadin.data.Property.ValueChangeListener)3 IndexedContainer (com.vaadin.data.util.IndexedContainer)3 ArrayList (java.util.ArrayList)3 HistoricFormProperty (org.activiti.engine.history.HistoricFormProperty)3 HistoricTaskInstance (org.activiti.engine.history.HistoricTaskInstance)3 Annotation (annis.model.Annotation)2 Button (com.vaadin.ui.Button)2