Search in sources :

Example 16 with Property

use of com.vaadin.data.Property in project Activiti by Activiti.

the class UserPage method createList.

protected Table createList() {
    userTable = new Table();
    userListQuery = new UserListQuery();
    userListContainer = new LazyLoadingContainer(userListQuery, 30);
    userTable.setContainerDataSource(userListContainer);
    // Column headers
    userTable.addGeneratedColumn("icon", new ThemeImageColumnGenerator(Images.USER_22));
    userTable.setColumnWidth("icon", 22);
    userTable.addContainerProperty("name", String.class, null);
    userTable.setColumnHeaderMode(Table.COLUMN_HEADER_MODE_HIDDEN);
    // Listener to change right panel when clicked on a user
    userTable.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 = userTable.getItem(event.getProperty().getValue());
            if (item != null) {
                String userId = (String) item.getItemProperty("id").getValue();
                setDetailComponent(new UserDetailPanel(UserPage.this, userId));
                // Update URL
                ExplorerApp.get().setCurrentUriFragment(new UriFragment(UserNavigator.USER_URI_PART, userId));
            } else {
                // Nothing is selected
                setDetailComponent(null);
                ExplorerApp.get().setCurrentUriFragment(new UriFragment(UserNavigator.USER_URI_PART));
            }
        }
    });
    return userTable;
}
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) UriFragment(org.activiti.explorer.navigation.UriFragment)

Example 17 with Property

use of com.vaadin.data.Property in project Activiti by Activiti.

the class DeploymentPage method createList.

@Override
protected Table createList() {
    final Table deploymentTable = new Table();
    LazyLoadingQuery deploymentListQuery = new DeploymentListQuery(deploymentFilter);
    deploymentListContainer = new LazyLoadingContainer(deploymentListQuery, 30);
    deploymentTable.setContainerDataSource(deploymentListContainer);
    // Listener to change right panel when clicked on a deployment
    deploymentTable.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 = deploymentTable.getItem(event.getProperty().getValue());
            if (item != null) {
                String deploymentId = (String) item.getItemProperty("id").getValue();
                setDetailComponent(new DeploymentDetailPanel(deploymentId, DeploymentPage.this));
                // Update URL
                ExplorerApp.get().setCurrentUriFragment(new UriFragment(DeploymentNavigator.DEPLOYMENT_URI_PART, deploymentId));
            } else {
                // Nothing is selected
                setDetailComponent(null);
                ExplorerApp.get().setCurrentUriFragment(new UriFragment(DeploymentNavigator.DEPLOYMENT_URI_PART));
            }
        }
    });
    // Create column headers
    deploymentTable.addGeneratedColumn("icon", new ThemeImageColumnGenerator(Images.DEPLOYMENT_22));
    deploymentTable.setColumnWidth("icon", 22);
    deploymentTable.addContainerProperty("name", String.class, null);
    deploymentTable.setColumnHeaderMode(Table.COLUMN_HEADER_MODE_HIDDEN);
    return deploymentTable;
}
Also used : Table(com.vaadin.ui.Table) LazyLoadingContainer(org.activiti.explorer.data.LazyLoadingContainer) UriFragment(org.activiti.explorer.navigation.UriFragment) Item(com.vaadin.data.Item) ValueChangeEvent(com.vaadin.data.Property.ValueChangeEvent) ThemeImageColumnGenerator(org.activiti.explorer.ui.util.ThemeImageColumnGenerator) Property(com.vaadin.data.Property) LazyLoadingQuery(org.activiti.explorer.data.LazyLoadingQuery)

Example 18 with Property

use of com.vaadin.data.Property in project Activiti by Activiti.

the class AdministrationPage method createList.

protected Table createList() {
    managementTable = new Table();
    managementTable.setEditable(false);
    managementTable.setImmediate(true);
    managementTable.setSelectable(true);
    managementTable.setNullSelectionAllowed(false);
    managementTable.setSortDisabled(true);
    managementTable.setSizeFull();
    // Column headers
    managementTable.addContainerProperty("name", String.class, null);
    managementTable.setColumnHeaderMode(Table.COLUMN_HEADER_MODE_HIDDEN);
    managementTable.addItem(new String[] { i18nManager.getMessage(Messages.ADMIN_MENU_RUNNING) }, 0);
    managementTable.addItem(new String[] { i18nManager.getMessage(Messages.ADMIN_MENU_COMPLETED) }, 1);
    managementTable.addItem(new String[] { i18nManager.getMessage(Messages.ADMIN_MENU_DATABASE) }, 2);
    // Listener to change right panel when clicked on a user
    managementTable.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 = managementTable.getItem(event.getProperty().getValue());
            if (item != null) {
                if ("0".equals(event.getProperty().getValue().toString())) {
                    setDetailComponent(new AdminRunningInstancesPanel());
                } else if ("1".equals(event.getProperty().getValue().toString())) {
                    setDetailComponent(new AdminCompletedInstancesPanel());
                } else if ("2".equals(event.getProperty().getValue().toString())) {
                    setDetailComponent(new AdminDatabaseSettingsPanel());
                }
                // Update URL
                ExplorerApp.get().setCurrentUriFragment(new UriFragment(AdministrationNavigator.MANAGEMENT_URI_PART, event.getProperty().getValue().toString()));
            } else {
                // Nothing is selected
                setDetailComponent(null);
                ExplorerApp.get().setCurrentUriFragment(new UriFragment(AdministrationNavigator.MANAGEMENT_URI_PART, managementId));
            }
        }
    });
    return managementTable;
}
Also used : Item(com.vaadin.data.Item) ValueChangeEvent(com.vaadin.data.Property.ValueChangeEvent) Table(com.vaadin.ui.Table) Property(com.vaadin.data.Property) UriFragment(org.activiti.explorer.navigation.UriFragment)

Example 19 with Property

use of com.vaadin.data.Property in project Activiti by Activiti.

the class SuspendedProcessDefinitionPage method createList.

protected Table createList() {
    processDefinitionTable = new Table();
    processDefinitionListQuery = new SuspendedProcessDefinitionListQuery();
    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 SuspendedProcessDefinitionDetailPanel(processDefinitionId, SuspendedProcessDefinitionPage.this));
                // Update URL
                ExplorerApp.get().setCurrentUriFragment(new UriFragment(SuspendedProcessDefinitionNavigator.SUSPENDED_PROC_DEF_URI_PART, processDefinitionId));
            } else {
                // Nothing selected
                setDetailComponent(null);
                ExplorerApp.get().setCurrentUriFragment(new UriFragment(SuspendedProcessDefinitionNavigator.SUSPENDED_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 20 with Property

use of com.vaadin.data.Property 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);
    }
}
Also used : Table(com.vaadin.ui.Table) HistoricProcessInstance(org.activiti.engine.history.HistoricProcessInstance) Label(com.vaadin.ui.Label) PrettyTimeLabel(org.activiti.explorer.ui.custom.PrettyTimeLabel) ProcessDefinition(org.activiti.engine.repository.ProcessDefinition) Item(com.vaadin.data.Item) ValueChangeEvent(com.vaadin.data.Property.ValueChangeEvent) HistoricFormProperty(org.activiti.engine.history.HistoricFormProperty) Property(com.vaadin.data.Property)

Aggregations

Property (com.vaadin.data.Property)26 Item (com.vaadin.data.Item)18 ValueChangeEvent (com.vaadin.data.Property.ValueChangeEvent)16 Table (com.vaadin.ui.Table)15 UriFragment (org.activiti.explorer.navigation.UriFragment)11 LazyLoadingContainer (org.activiti.explorer.data.LazyLoadingContainer)10 ThemeImageColumnGenerator (org.activiti.explorer.ui.util.ThemeImageColumnGenerator)8 HistoricProcessInstance (org.activiti.engine.history.HistoricProcessInstance)4 WeakItemChangeListener (com.haulmont.cuba.gui.data.impl.WeakItemChangeListener)3 Label (com.vaadin.ui.Label)3 LazyLoadingQuery (org.activiti.explorer.data.LazyLoadingQuery)3 MetaClass (com.haulmont.chile.core.model.MetaClass)2 WeakItemPropertyChangeListener (com.haulmont.cuba.gui.data.impl.WeakItemPropertyChangeListener)2 ErrorMessage (com.vaadin.server.ErrorMessage)2 Collection (java.util.Collection)2 HistoricFormProperty (org.activiti.engine.history.HistoricFormProperty)2 ProcessDefinition (org.activiti.engine.repository.ProcessDefinition)2 PrettyTimeLabel (org.activiti.explorer.ui.custom.PrettyTimeLabel)2 ClickableLabel (au.com.vaadinutils.fields.ClickableLabel)1 Enumeration (com.haulmont.chile.core.datatypes.Enumeration)1