Search in sources :

Example 16 with ClickEvent

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

the class JobDetailPanel method addLinkToProcessDefinition.

protected void addLinkToProcessDefinition(final VerticalLayout verticalLayout, final String labelText, final boolean isSuspendedProcessDefinition) {
    HorizontalLayout layout = new HorizontalLayout();
    verticalLayout.addComponent(layout);
    Label processDefinitionLabel = new Label(labelText);
    processDefinitionLabel.setSizeUndefined();
    layout.addComponent(processDefinitionLabel);
    layout.addComponent(new Label(" ", Label.CONTENT_XHTML));
    Button showProcessDefinitionLink = new Button(job.getProcessDefinitionId());
    showProcessDefinitionLink.addStyleName(Reindeer.BUTTON_LINK);
    showProcessDefinitionLink.addListener(new ClickListener() {

        private static final long serialVersionUID = 1L;

        public void buttonClick(ClickEvent event) {
            if (isSuspendedProcessDefinition) {
                ExplorerApp.get().getViewManager().showSuspendedProcessDefinitionsPage(job.getProcessDefinitionId());
            } else {
                ExplorerApp.get().getViewManager().showActiveProcessDefinitionsPage(job.getProcessDefinitionId());
            }
        }
    });
    layout.addComponent(showProcessDefinitionLink);
}
Also used : Button(com.vaadin.ui.Button) ClickEvent(com.vaadin.ui.Button.ClickEvent) Label(com.vaadin.ui.Label) PrettyTimeLabel(org.activiti.explorer.ui.custom.PrettyTimeLabel) ClickListener(com.vaadin.ui.Button.ClickListener) HorizontalLayout(com.vaadin.ui.HorizontalLayout)

Example 17 with ClickEvent

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

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

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

use of com.vaadin.ui.Button.ClickEvent 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)

Aggregations

ClickEvent (com.vaadin.ui.Button.ClickEvent)68 ClickListener (com.vaadin.ui.Button.ClickListener)66 Button (com.vaadin.ui.Button)63 HorizontalLayout (com.vaadin.ui.HorizontalLayout)17 Label (com.vaadin.ui.Label)13 VerticalLayout (com.vaadin.ui.VerticalLayout)8 SubmitEvent (org.activiti.explorer.ui.event.SubmitEvent)8 LayoutClickEvent (com.vaadin.event.LayoutEvents.LayoutClickEvent)7 LayoutClickListener (com.vaadin.event.LayoutEvents.LayoutClickListener)7 ValueChangeEvent (com.vaadin.data.Property.ValueChangeEvent)5 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