Search in sources :

Example 6 with ClickListener

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

the class TaskMenuBar method initActions.

protected void initActions() {
    Button newCaseButton = new Button();
    newCaseButton.setCaption(i18nManager.getMessage(Messages.TASK_NEW));
    newCaseButton.setIcon(Images.TASK_16);
    addButton(newCaseButton);
    newCaseButton.addListener(new ClickListener() {

        public void buttonClick(ClickEvent event) {
            NewCasePopupWindow newTaskPopupWindow = new NewCasePopupWindow();
            viewManager.showPopupWindow(newTaskPopupWindow);
        }
    });
}
Also used : Button(com.vaadin.ui.Button) ClickEvent(com.vaadin.ui.Button.ClickEvent) ClickListener(com.vaadin.ui.Button.ClickListener)

Example 7 with ClickListener

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

the class SubTaskComponent method initAddButton.

protected void initAddButton() {
    addSubTaskButton = new Button();
    addSubTaskButton.addStyleName(ExplorerLayout.STYLE_ADD);
    addSubTaskPanel.addComponent(addSubTaskButton);
    addSubTaskButton.addListener(new ClickListener() {

        public void buttonClick(ClickEvent event) {
            // Remove button
            addSubTaskPanel.removeAllComponents();
            // And add textfield
            Label createSubTaskLabel = new Label("Create new subtask:");
            createSubTaskLabel.addStyleName(Reindeer.LABEL_SMALL);
            addSubTaskPanel.addComponent(createSubTaskLabel);
            newTaskTextField = new TextField();
            newTaskTextField.focus();
            addSubTaskPanel.addComponent(newTaskTextField);
        }
    });
}
Also used : Button(com.vaadin.ui.Button) ClickEvent(com.vaadin.ui.Button.ClickEvent) Label(com.vaadin.ui.Label) TextField(com.vaadin.ui.TextField) ClickListener(com.vaadin.ui.Button.ClickListener) DeleteSubTaskClickListener(org.activiti.explorer.ui.task.listener.DeleteSubTaskClickListener)

Example 8 with ClickListener

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

the class SubTaskComponent method populateSubTasks.

protected void populateSubTasks(List<HistoricTaskInstance> subTasks) {
    if (!subTasks.isEmpty()) {
        for (final HistoricTaskInstance subTask : subTasks) {
            // icon
            Embedded icon = null;
            if (subTask.getEndTime() != null) {
                icon = new Embedded(null, Images.TASK_FINISHED_22);
            } else {
                icon = new Embedded(null, Images.TASK_22);
            }
            icon.setWidth(22, UNITS_PIXELS);
            icon.setWidth(22, UNITS_PIXELS);
            subTaskLayout.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());
                }
            });
            subTaskLayout.addComponent(subTaskLink);
            subTaskLayout.setComponentAlignment(subTaskLink, Alignment.MIDDLE_LEFT);
            if (subTask.getEndTime() == null) {
                // Delete icon only appears when task is not finished yet
                Embedded deleteIcon = new Embedded(null, Images.DELETE);
                deleteIcon.addStyleName(ExplorerLayout.STYLE_CLICKABLE);
                deleteIcon.addListener(new DeleteSubTaskClickListener(subTask, this));
                subTaskLayout.addComponent(deleteIcon);
                subTaskLayout.setComponentAlignment(deleteIcon, Alignment.MIDDLE_RIGHT);
            } else {
                // Next line of grid
                subTaskLayout.newLine();
            }
        }
    } else {
        Label noSubTasksLabel = new Label(i18nManager.getMessage(Messages.TASK_NO_SUBTASKS));
        noSubTasksLabel.setSizeUndefined();
        noSubTasksLabel.addStyleName(Reindeer.LABEL_SMALL);
        subTaskLayout.addComponent(noSubTasksLabel);
    }
}
Also used : HistoricTaskInstance(org.activiti.engine.history.HistoricTaskInstance) Button(com.vaadin.ui.Button) ClickEvent(com.vaadin.ui.Button.ClickEvent) Label(com.vaadin.ui.Label) DeleteSubTaskClickListener(org.activiti.explorer.ui.task.listener.DeleteSubTaskClickListener) Embedded(com.vaadin.ui.Embedded) ClickListener(com.vaadin.ui.Button.ClickListener) DeleteSubTaskClickListener(org.activiti.explorer.ui.task.listener.DeleteSubTaskClickListener)

Example 9 with ClickListener

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

the class ChangeProcessSuspensionStatePopupWindow method addTimeSection.

protected void addTimeSection(boolean suspend) {
    Label timeLabel = new Label(suspend ? i18nManager.getMessage(Messages.PROCESS_SUSPEND_POPUP_TIME_DESCRIPTION) : i18nManager.getMessage(Messages.PROCESS_ACTIVATE_POPUP_TIME_DESCRIPTION));
    verticalLayout.addComponent(timeLabel);
    verticalLayout.addComponent(new Label("&nbsp", Label.CONTENT_XHTML));
    nowCheckBox = new CheckBox(i18nManager.getMessage(Messages.PROCESS_SUSPEND_POPUP_TIME_NOW), true);
    nowCheckBox.addStyleName(ExplorerLayout.STYLE_PROCESS_DEFINITION_SUSPEND_CHOICE);
    nowCheckBox.setImmediate(true);
    nowCheckBox.addListener(new ClickListener() {

        public void buttonClick(ClickEvent event) {
            if (nowCheckBox.booleanValue() == true) {
                dateField.setValue(null);
                dateCheckBox.setValue(false);
            } else {
                dateCheckBox.setValue(true);
                dateField.setValue(new Date());
            }
        }
    });
    verticalLayout.addComponent(nowCheckBox);
    HorizontalLayout dateLayout = new HorizontalLayout();
    verticalLayout.addComponent(dateLayout);
    dateCheckBox = new CheckBox(i18nManager.getMessage(Messages.PROCESS_SUSPEND_POPUP_TIME_DATE));
    dateCheckBox.addStyleName(ExplorerLayout.STYLE_PROCESS_DEFINITION_SUSPEND_CHOICE);
    dateCheckBox.setImmediate(true);
    dateCheckBox.addListener(new ClickListener() {

        public void buttonClick(ClickEvent event) {
            if (dateCheckBox.booleanValue() == true) {
                dateField.setValue(new Date());
                nowCheckBox.setValue(false);
            } else {
                dateField.setValue(null);
                nowCheckBox.setValue(true);
            }
        }
    });
    dateLayout.addComponent(dateCheckBox);
    dateField = new DateField();
    dateField.setImmediate(true);
    dateField.addListener(new ValueChangeListener() {

        public void valueChange(ValueChangeEvent event) {
            if (dateField.getValue() != null) {
                nowCheckBox.setValue(false);
                dateCheckBox.setValue(true);
            }
        }
    });
    dateLayout.addComponent(dateField);
}
Also used : ValueChangeEvent(com.vaadin.data.Property.ValueChangeEvent) ValueChangeListener(com.vaadin.data.Property.ValueChangeListener) CheckBox(com.vaadin.ui.CheckBox) ClickEvent(com.vaadin.ui.Button.ClickEvent) Label(com.vaadin.ui.Label) DateField(com.vaadin.ui.DateField) ClickListener(com.vaadin.ui.Button.ClickListener) Date(java.util.Date) HorizontalLayout(com.vaadin.ui.HorizontalLayout)

Example 10 with ClickListener

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

the class ChangeProcessSuspensionStatePopupWindow method addOkButton.

protected void addOkButton(final boolean suspend) {
    verticalLayout.addComponent(new Label("&nbsp", Label.CONTENT_XHTML));
    verticalLayout.addComponent(new Label("&nbsp", Label.CONTENT_XHTML));
    Button okButton = new Button(i18nManager.getMessage(Messages.BUTTON_OK));
    verticalLayout.addComponent(okButton);
    verticalLayout.setComponentAlignment(okButton, Alignment.BOTTOM_CENTER);
    okButton.addListener(new ClickListener() {

        private static final long serialVersionUID = 1L;

        public void buttonClick(ClickEvent event) {
            RepositoryService repositoryService = ProcessEngines.getDefaultProcessEngine().getRepositoryService();
            boolean includeProcessInstances = (Boolean) includeProcessInstancesCheckBox.getValue();
            if (suspend) {
                repositoryService.suspendProcessDefinitionById(processDefinitionId, includeProcessInstances, (Date) dateField.getValue());
            } else {
                repositoryService.activateProcessDefinitionById(processDefinitionId, includeProcessInstances, (Date) dateField.getValue());
            }
            close();
            // select next item in list on the left
            parentPage.refreshSelectNext();
        }
    });
}
Also used : Button(com.vaadin.ui.Button) ClickEvent(com.vaadin.ui.Button.ClickEvent) Label(com.vaadin.ui.Label) ClickListener(com.vaadin.ui.Button.ClickListener) Date(java.util.Date) RepositoryService(org.activiti.engine.RepositoryService)

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