Search in sources :

Example 16 with ClickListener

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

the class ActiveProcessDefinitionDetailPanel method initActions.

protected void initActions(final AbstractPage parentPage) {
    ActiveProcessDefinitionPage processDefinitionPage = (ActiveProcessDefinitionPage) parentPage;
    Button suspendButton = new Button(i18nManager.getMessage(Messages.PROCESS_SUSPEND));
    suspendButton.addListener(new ClickListener() {

        private static final long serialVersionUID = 1L;

        public void buttonClick(ClickEvent event) {
            ChangeProcessSuspensionStatePopupWindow popupWindow = new ChangeProcessSuspensionStatePopupWindow(processDefinition.getId(), parentPage, true);
            ExplorerApp.get().getViewManager().showPopupWindow(popupWindow);
        }
    });
    // Check if button must be disabled
    boolean suspendJobPending = false;
    List<Job> jobs = ProcessEngines.getDefaultProcessEngine().getManagementService().createJobQuery().processDefinitionId(processDefinition.getId()).list();
    for (Job job : jobs) {
        // TODO: this is a hack. Needs to be cleaner in engine!
        if (((JobEntity) job).getJobHandlerType().equals(TimerSuspendProcessDefinitionHandler.TYPE)) {
            suspendJobPending = true;
            break;
        }
    }
    suspendButton.setEnabled(!suspendJobPending);
    // Clear toolbar and add 'start' button
    processDefinitionPage.getToolBar().removeAllButtons();
    processDefinitionPage.getToolBar().addButton(suspendButton);
}
Also used : Button(com.vaadin.ui.Button) ClickEvent(com.vaadin.ui.Button.ClickEvent) Job(org.activiti.engine.runtime.Job) ClickListener(com.vaadin.ui.Button.ClickListener)

Example 17 with ClickListener

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

the class ReportDetailPanel method initActions.

protected void initActions() {
    final Button saveButton = new Button(i18nManager.getMessage(Messages.BUTTON_SAVE));
    saveButton.addListener(new ClickListener() {

        private static final long serialVersionUID = 1L;

        public void buttonClick(ClickEvent event) {
            SaveReportPopupWindow saveReportPopupWindow = new SaveReportPopupWindow();
            saveReportPopupWindow.setProcessDefinitionId(processDefinition.getId());
            saveReportPopupWindow.setOriginalFormProperties(savedFormProperties);
            saveReportPopupWindow.setComponentToDisableOnClose(saveButton);
            ExplorerApp.get().getViewManager().showPopupWindow(saveReportPopupWindow);
        }
    });
    // Clear toolbar and add 'start' button
    parentPage.getToolBar().removeAllButtons();
    parentPage.getToolBar().addButton(saveButton);
}
Also used : Button(com.vaadin.ui.Button) ClickEvent(com.vaadin.ui.Button.ClickEvent) ClickListener(com.vaadin.ui.Button.ClickListener)

Example 18 with ClickListener

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

the class HistoricTaskDetailPanel method populateSubTasks.

protected void populateSubTasks(List<HistoricTaskInstance> subTasks) {
    for (final HistoricTaskInstance subTask : subTasks) {
        // icon
        Embedded icon = new Embedded(null, Images.TASK_22);
        icon.setWidth(22, UNITS_PIXELS);
        icon.setWidth(22, UNITS_PIXELS);
        subTaskGrid.addComponent(icon);
        // Link to subtask
        Button subTaskLink = new Button(subTask.getName());
        subTaskLink.addStyleName(Reindeer.BUTTON_LINK);
        subTaskLink.addListener(new ClickListener() {

            public void buttonClick(ClickEvent event) {
                ExplorerApp.get().getViewManager().showTaskPage(subTask.getId());
            }
        });
        subTaskGrid.addComponent(subTaskLink);
        subTaskGrid.setComponentAlignment(subTaskLink, Alignment.MIDDLE_LEFT);
    }
}
Also used : HistoricTaskInstance(org.activiti.engine.history.HistoricTaskInstance) Button(com.vaadin.ui.Button) ClickEvent(com.vaadin.ui.Button.ClickEvent) Embedded(com.vaadin.ui.Embedded) ClickListener(com.vaadin.ui.Button.ClickListener)

Example 19 with ClickListener

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

the class HistoricTaskDetailPanel method initParentTaskLink.

protected void initParentTaskLink() {
    if (historicTask.getParentTaskId() != null) {
        final HistoricTaskInstance parentTask = historyService.createHistoricTaskInstanceQuery().taskId(historicTask.getParentTaskId()).singleResult();
        Button showParentTaskButton = new Button(i18nManager.getMessage(Messages.TASK_SUBTASK_OF_PARENT_TASK, parentTask.getName()));
        showParentTaskButton.addStyleName(Reindeer.BUTTON_LINK);
        showParentTaskButton.addListener(new ClickListener() {

            public void buttonClick(ClickEvent event) {
                viewManager.showTaskPage(parentTask.getId());
            }
        });
        centralLayout.addComponent(showParentTaskButton);
    }
}
Also used : HistoricTaskInstance(org.activiti.engine.history.HistoricTaskInstance) Button(com.vaadin.ui.Button) ClickEvent(com.vaadin.ui.Button.ClickEvent) ClickListener(com.vaadin.ui.Button.ClickListener)

Example 20 with ClickListener

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

the class SelectEditorComponent method createTableDrivenEditorChoice.

protected void createTableDrivenEditorChoice() {
    tableEditorLayout = new HorizontalLayout();
    tableEditorLayout.setWidth("300px");
    tableEditorLayout.addStyleName(ExplorerLayout.STYLE_CLICKABLE);
    addComponent(tableEditorLayout);
    tableEditorButton = new Button();
    tableEditorButton.setIcon(Images.PROCESS_EDITOR_TABLE);
    tableEditorButton.setStyleName(Reindeer.BUTTON_LINK);
    tableEditorLayout.addComponent(tableEditorButton);
    tableEditorLayout.setComponentAlignment(tableEditorButton, Alignment.MIDDLE_LEFT);
    VerticalLayout tableEditorTextLayout = new VerticalLayout();
    tableEditorLayout.addComponent(tableEditorTextLayout);
    tableEditorLayout.setExpandRatio(tableEditorTextLayout, 1.0f);
    tableEditorLabel = new Label(i18nManager.getMessage(Messages.PROCESS_EDITOR_TABLE));
    tableEditorLabel.addStyleName(ExplorerLayout.STYLE_CLICKABLE);
    tableEditorTextLayout.addComponent(tableEditorLabel);
    tableEditorDescriptionLabel = new Label(i18nManager.getMessage(Messages.PROCESS_EDITOR_TABLE_DESCRIPTION));
    tableEditorDescriptionLabel.addStyleName(Reindeer.LABEL_SMALL);
    tableEditorDescriptionLabel.addStyleName(ExplorerLayout.STYLE_CLICKABLE);
    tableEditorTextLayout.addComponent(tableEditorDescriptionLabel);
    tableEditorLayout.addListener(new LayoutClickListener() {

        public void layoutClick(LayoutClickEvent event) {
            preferTableDrivenEditor();
        }
    });
    tableEditorButton.addListener(new ClickListener() {

        public void buttonClick(ClickEvent event) {
            preferTableDrivenEditor();
        }
    });
}
Also used : LayoutClickEvent(com.vaadin.event.LayoutEvents.LayoutClickEvent) Button(com.vaadin.ui.Button) ClickEvent(com.vaadin.ui.Button.ClickEvent) LayoutClickEvent(com.vaadin.event.LayoutEvents.LayoutClickEvent) Label(com.vaadin.ui.Label) VerticalLayout(com.vaadin.ui.VerticalLayout) ClickListener(com.vaadin.ui.Button.ClickListener) LayoutClickListener(com.vaadin.event.LayoutEvents.LayoutClickListener) HorizontalLayout(com.vaadin.ui.HorizontalLayout) LayoutClickListener(com.vaadin.event.LayoutEvents.LayoutClickListener)

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