Search in sources :

Example 26 with ClickListener

use of com.vaadin.ui.Button.ClickListener 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 27 with ClickListener

use of com.vaadin.ui.Button.ClickListener in project Activiti by Activiti.

the class GroupDetailPanel method initAddMembersButton.

protected void initAddMembersButton(HorizontalLayout membersHeader) {
    Button addButton = new Button();
    addButton.addStyleName(ExplorerLayout.STYLE_ADD);
    membersHeader.addComponent(addButton);
    membersHeader.setComponentAlignment(addButton, Alignment.MIDDLE_RIGHT);
    addButton.addListener(new ClickListener() {

        public void buttonClick(ClickEvent event) {
            final SelectUsersPopupWindow selectUsersPopup = new SelectUsersPopupWindow(i18nManager.getMessage(Messages.GROUP_SELECT_MEMBERS, group.getId()), true, false, getCurrentMembers());
            ExplorerApp.get().getViewManager().showPopupWindow(selectUsersPopup);
            // Listen to submit events (that contain the selected users)
            selectUsersPopup.addListener(new SubmitEventListener() {

                protected void submitted(SubmitEvent event) {
                    Collection<String> userIds = selectUsersPopup.getSelectedUserIds();
                    if (!userIds.isEmpty()) {
                        for (String userId : userIds) {
                            identityService.createMembership(userId, group.getId());
                        }
                        notifyMembershipChanged();
                    }
                }

                protected void cancelled(SubmitEvent event) {
                }
            });
        }
    });
}
Also used : SelectUsersPopupWindow(org.activiti.explorer.ui.custom.SelectUsersPopupWindow) Button(com.vaadin.ui.Button) SubmitEventListener(org.activiti.explorer.ui.event.SubmitEventListener) ClickEvent(com.vaadin.ui.Button.ClickEvent) ClickListener(com.vaadin.ui.Button.ClickListener) SubmitEvent(org.activiti.explorer.ui.event.SubmitEvent)

Example 28 with ClickListener

use of com.vaadin.ui.Button.ClickListener in project Activiti by Activiti.

the class GroupDetailPanel method initActions.

protected void initActions() {
    Button createGroupButton = new Button(i18nManager.getMessage(Messages.GROUP_CREATE));
    createGroupButton.setIcon(Images.GROUP_16);
    createGroupButton.addListener(new ClickListener() {

        public void buttonClick(ClickEvent event) {
            NewGroupPopupWindow popup = new NewGroupPopupWindow();
            ExplorerApp.get().getViewManager().showPopupWindow(popup);
        }
    });
    groupPage.getToolBar().removeAllButtons();
    groupPage.getToolBar().addButton(createGroupButton);
}
Also used : Button(com.vaadin.ui.Button) ClickEvent(com.vaadin.ui.Button.ClickEvent) ClickListener(com.vaadin.ui.Button.ClickListener)

Example 29 with ClickListener

use of com.vaadin.ui.Button.ClickListener in project Activiti by Activiti.

the class GroupDetailPanel method initEditButton.

protected void initEditButton(VerticalLayout actionsLayout) {
    Button editButton = new Button(i18nManager.getMessage(Messages.USER_EDIT));
    editButton.addStyleName(Reindeer.BUTTON_SMALL);
    actionsLayout.addComponent(editButton);
    editButton.addListener(new ClickListener() {

        public void buttonClick(ClickEvent event) {
            editingDetails = true;
            detailLayout.removeAllComponents();
            populateGroupDetails();
        }
    });
}
Also used : Button(com.vaadin.ui.Button) ClickEvent(com.vaadin.ui.Button.ClickEvent) ClickListener(com.vaadin.ui.Button.ClickListener)

Example 30 with ClickListener

use of com.vaadin.ui.Button.ClickListener in project Activiti by Activiti.

the class GroupSelectionPopupWindow method initSelectButton.

protected void initSelectButton() {
    final Button selectButton = new Button(i18nManager.getMessage(Messages.USER_SELECT_GROUPS));
    addComponent(selectButton);
    ((VerticalLayout) getContent()).setComponentAlignment(selectButton, Alignment.BOTTOM_RIGHT);
    selectButton.addListener(new ClickListener() {

        public void buttonClick(ClickEvent event) {
            fireEvent(new SubmitEvent(selectButton, SubmitEvent.SUBMITTED));
            close();
        }
    });
}
Also used : Button(com.vaadin.ui.Button) ClickEvent(com.vaadin.ui.Button.ClickEvent) VerticalLayout(com.vaadin.ui.VerticalLayout) ClickListener(com.vaadin.ui.Button.ClickListener) SubmitEvent(org.activiti.explorer.ui.event.SubmitEvent)

Aggregations

ClickEvent (com.vaadin.ui.Button.ClickEvent)66 ClickListener (com.vaadin.ui.Button.ClickListener)66 Button (com.vaadin.ui.Button)61 HorizontalLayout (com.vaadin.ui.HorizontalLayout)15 Label (com.vaadin.ui.Label)11 SubmitEvent (org.activiti.explorer.ui.event.SubmitEvent)8 LayoutClickEvent (com.vaadin.event.LayoutEvents.LayoutClickEvent)7 LayoutClickListener (com.vaadin.event.LayoutEvents.LayoutClickListener)7 VerticalLayout (com.vaadin.ui.VerticalLayout)6 ValueChangeEvent (com.vaadin.data.Property.ValueChangeEvent)4 ValueChangeListener (com.vaadin.data.Property.ValueChangeListener)4 TextField (com.vaadin.ui.TextField)4 Map (java.util.Map)4 ProcessDefinition (org.activiti.engine.repository.ProcessDefinition)4 ClaimTaskClickListener (org.activiti.explorer.ui.task.listener.ClaimTaskClickListener)4 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)3 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)3 ExternalResource (com.vaadin.terminal.ExternalResource)3 Form (com.vaadin.ui.Form)3 URL (java.net.URL)3