Search in sources :

Example 6 with ValueChangeListener

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();
}
Also used : ReplaySimulationRun(org.activiti.crystalball.simulator.ReplaySimulationRun) ClickEvent(com.vaadin.ui.Button.ClickEvent) SimpleEventCalendar(org.activiti.crystalball.simulator.SimpleEventCalendar) NoExecutionVariableScope(org.activiti.engine.impl.el.NoExecutionVariableScope) SimulationEventComparator(org.activiti.crystalball.simulator.SimulationEventComparator) ProcessDefinition(org.activiti.engine.repository.ProcessDefinition) EventLogTransformer(org.activiti.crystalball.simulator.delegate.event.impl.EventLogTransformer) HorizontalLayout(com.vaadin.ui.HorizontalLayout) ValueChangeEvent(com.vaadin.data.Property.ValueChangeEvent) ValueChangeListener(com.vaadin.data.Property.ValueChangeListener) Button(com.vaadin.ui.Button) NativeSelect(com.vaadin.ui.NativeSelect) ArrayList(java.util.ArrayList) List(java.util.List) ClickListener(com.vaadin.ui.Button.ClickListener)

Example 7 with ValueChangeListener

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;
}
Also used : ValueChangeEvent(com.vaadin.data.Property.ValueChangeEvent) ValueChangeListener(com.vaadin.data.Property.ValueChangeListener) ListSelect(com.vaadin.ui.ListSelect)

Example 8 with ValueChangeListener

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));
            }
        }
    };
}
Also used : Item(com.vaadin.data.Item) ValueChangeEvent(com.vaadin.data.Property.ValueChangeEvent) ValueChangeListener(com.vaadin.data.Property.ValueChangeListener) UriFragment(org.activiti.explorer.navigation.UriFragment)

Example 9 with ValueChangeListener

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);
}
Also used : ValueChangeEvent(com.vaadin.data.Property.ValueChangeEvent) ValueChangeListener(com.vaadin.data.Property.ValueChangeListener) Button(com.vaadin.ui.Button) ImportModelClickListener(org.activiti.explorer.ui.process.listener.ImportModelClickListener) Label(com.vaadin.ui.Label) Select(com.vaadin.ui.Select) EditModelClickListener(org.activiti.explorer.ui.process.listener.EditModelClickListener) NewModelClickListener(org.activiti.explorer.ui.process.listener.NewModelClickListener)

Example 10 with ValueChangeListener

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);
}
Also used : Item(com.vaadin.data.Item) ValueChangeEvent(com.vaadin.data.Property.ValueChangeEvent) Table(com.vaadin.ui.Table) ValueChangeListener(com.vaadin.data.Property.ValueChangeListener) Resource(com.vaadin.terminal.Resource) CellStyleGenerator(com.vaadin.ui.Table.CellStyleGenerator) Embedded(com.vaadin.ui.Embedded)

Aggregations

ValueChangeEvent (com.vaadin.data.Property.ValueChangeEvent)10 ValueChangeListener (com.vaadin.data.Property.ValueChangeListener)10 ClickEvent (com.vaadin.ui.Button.ClickEvent)4 ClickListener (com.vaadin.ui.Button.ClickListener)4 Button (com.vaadin.ui.Button)3 CheckBox (com.vaadin.ui.CheckBox)3 Item (com.vaadin.data.Item)2 HorizontalLayout (com.vaadin.ui.HorizontalLayout)2 Label (com.vaadin.ui.Label)2 Table (com.vaadin.ui.Table)2 CellStyleGenerator (com.vaadin.ui.Table.CellStyleGenerator)2 Resource (com.vaadin.terminal.Resource)1 DateField (com.vaadin.ui.DateField)1 Embedded (com.vaadin.ui.Embedded)1 Form (com.vaadin.ui.Form)1 ListSelect (com.vaadin.ui.ListSelect)1 NativeSelect (com.vaadin.ui.NativeSelect)1 PasswordField (com.vaadin.ui.PasswordField)1 Select (com.vaadin.ui.Select)1 TextField (com.vaadin.ui.TextField)1