Search in sources :

Example 26 with Button

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

the class ProcessDefinitionDetailPanel method initActions.

protected void initActions(AbstractPage parentPage) {
    ProcessDefinitionPage processDefinitionPage = (ProcessDefinitionPage) parentPage;
    startProcessInstanceButton = new Button(i18nManager.getMessage(Messages.PROCESS_START));
    startProcessInstanceButton.addListener(new StartProcessInstanceClickListener(processDefinition, processDefinitionPage));
    editProcessDefinitionButton = new Button(i18nManager.getMessage(Messages.PROCESS_CONVERT));
    editProcessDefinitionButton.addListener(new ConvertProcessDefinitionToModelClickListener(processDefinition));
    if (((ProcessDefinitionEntity) processDefinition).isGraphicalNotationDefined() == false) {
        editProcessDefinitionButton.setEnabled(false);
    }
    // Clear toolbar and add 'start' button
    processDefinitionPage.getToolBar().removeAllButtons();
    processDefinitionPage.getToolBar().addButton(startProcessInstanceButton);
    processDefinitionPage.getToolBar().addButton(editProcessDefinitionButton);
}
Also used : StartProcessInstanceClickListener(org.activiti.explorer.ui.process.listener.StartProcessInstanceClickListener) Button(com.vaadin.ui.Button) ConvertProcessDefinitionToModelClickListener(org.activiti.explorer.ui.process.listener.ConvertProcessDefinitionToModelClickListener)

Example 27 with Button

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

the class DescriptionComponent method initLayoutClickListener.

protected void initLayoutClickListener() {
    addListener(new LayoutClickListener() {

        public void layoutClick(LayoutClickEvent event) {
            if (event.getClickedComponent() != null && event.getClickedComponent().equals(descriptionLabel)) {
                // textarea
                final TextArea descriptionTextArea = new TextArea();
                descriptionTextArea.setWidth(100, UNITS_PERCENTAGE);
                descriptionTextArea.setValue(task.getDescription());
                editLayout.addComponent(descriptionTextArea);
                // ok button
                Button okButton = new Button(i18nManager.getMessage(Messages.BUTTON_OK));
                editLayout.addComponent(okButton);
                editLayout.setComponentAlignment(okButton, Alignment.BOTTOM_RIGHT);
                // replace
                replaceComponent(descriptionLabel, editLayout);
                // When OK is clicked -> update task data + ui
                okButton.addListener(new ClickListener() {

                    public void buttonClick(ClickEvent event) {
                        // Update data
                        task.setDescription(descriptionTextArea.getValue().toString());
                        taskService.saveTask(task);
                        // Update UI
                        descriptionLabel.setValue(task.getDescription());
                        replaceComponent(editLayout, descriptionLabel);
                    }
                });
            }
        }
    });
}
Also used : LayoutClickEvent(com.vaadin.event.LayoutEvents.LayoutClickEvent) TextArea(com.vaadin.ui.TextArea) Button(com.vaadin.ui.Button) ClickEvent(com.vaadin.ui.Button.ClickEvent) LayoutClickEvent(com.vaadin.event.LayoutEvents.LayoutClickEvent) ClickListener(com.vaadin.ui.Button.ClickListener) LayoutClickListener(com.vaadin.event.LayoutEvents.LayoutClickListener) LayoutClickListener(com.vaadin.event.LayoutEvents.LayoutClickListener)

Example 28 with Button

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

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

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

Aggregations

Button (com.vaadin.ui.Button)94 ClickEvent (com.vaadin.ui.Button.ClickEvent)63 ClickListener (com.vaadin.ui.Button.ClickListener)61 HorizontalLayout (com.vaadin.ui.HorizontalLayout)26 Label (com.vaadin.ui.Label)19 VerticalLayout (com.vaadin.ui.VerticalLayout)13 LayoutClickEvent (com.vaadin.event.LayoutEvents.LayoutClickEvent)7 LayoutClickListener (com.vaadin.event.LayoutEvents.LayoutClickListener)7 SubmitEvent (org.activiti.explorer.ui.event.SubmitEvent)7 ClaimTaskClickListener (org.activiti.explorer.ui.task.listener.ClaimTaskClickListener)5 ValueChangeEvent (com.vaadin.data.Property.ValueChangeEvent)4 TextField (com.vaadin.ui.TextField)4 SubmitEventListener (org.activiti.explorer.ui.event.SubmitEventListener)4 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)3 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)3 Item (com.vaadin.data.Item)3 ValueChangeListener (com.vaadin.data.Property.ValueChangeListener)3 ExternalResource (com.vaadin.terminal.ExternalResource)3 ComboBox (com.vaadin.ui.ComboBox)3 FormLayout (com.vaadin.ui.FormLayout)3