Search in sources :

Example 1 with ConfirmationEvent

use of org.activiti.explorer.ui.event.ConfirmationEvent in project Activiti by Activiti.

the class DeleteSubTaskClickListener method click.

public void click(ClickEvent event) {
    I18nManager i18nManager = ExplorerApp.get().getI18nManager();
    ViewManager viewManager = ExplorerApp.get().getViewManager();
    final TaskService taskService = ProcessEngines.getDefaultProcessEngine().getTaskService();
    ConfirmationDialogPopupWindow popup = new ConfirmationDialogPopupWindow(i18nManager.getMessage(Messages.TASK_CONFIRM_DELETE_SUBTASK, subTask.getName()));
    popup.addListener(new ConfirmationEventListener() {

        private static final long serialVersionUID = 1L;

        protected void rejected(ConfirmationEvent event) {
        }

        protected void confirmed(ConfirmationEvent event) {
            // delete subtask
            taskService.deleteTask(subTask.getId());
            // Refresh UI
            subTaskComponent.refreshSubTasks();
        }
    });
    viewManager.showPopupWindow(popup);
}
Also used : ConfirmationEventListener(org.activiti.explorer.ui.event.ConfirmationEventListener) ConfirmationEvent(org.activiti.explorer.ui.event.ConfirmationEvent) TaskService(org.activiti.engine.TaskService) ViewManager(org.activiti.explorer.ViewManager) ConfirmationDialogPopupWindow(org.activiti.explorer.ui.custom.ConfirmationDialogPopupWindow) I18nManager(org.activiti.explorer.I18nManager)

Example 2 with ConfirmationEvent

use of org.activiti.explorer.ui.event.ConfirmationEvent in project Activiti by Activiti.

the class ConfirmationDialogPopupWindow method initButtons.

protected void initButtons(I18nManager i18nManager) {
    yesButton = new Button(i18nManager.getMessage(Messages.CONFIRMATION_DIALOG_YES));
    layout.addComponent(yesButton, 0, 1);
    layout.setComponentAlignment(yesButton, Alignment.BOTTOM_RIGHT);
    yesButton.addListener(new ClickListener() {

        private static final long serialVersionUID = 1L;

        public void buttonClick(ClickEvent event) {
            close();
            fireEvent(new ConfirmationEvent(ConfirmationDialogPopupWindow.this, true));
        }
    });
    noButton = new Button(i18nManager.getMessage(Messages.CONFIRMATION_DIALOG_NO));
    layout.addComponent(noButton, 1, 1);
    layout.setComponentAlignment(noButton, Alignment.BOTTOM_LEFT);
    noButton.addListener(new ClickListener() {

        private static final long serialVersionUID = 1L;

        public void buttonClick(ClickEvent event) {
            close();
            fireEvent(new ConfirmationEvent(ConfirmationDialogPopupWindow.this, false));
        }
    });
}
Also used : ConfirmationEvent(org.activiti.explorer.ui.event.ConfirmationEvent) Button(com.vaadin.ui.Button) ClickEvent(com.vaadin.ui.Button.ClickEvent) ClickListener(com.vaadin.ui.Button.ClickListener)

Example 3 with ConfirmationEvent

use of org.activiti.explorer.ui.event.ConfirmationEvent in project Activiti by Activiti.

the class DeleteMembershipListener method click.

public void click(ClickEvent event) {
    I18nManager i18nManager = ExplorerApp.get().getI18nManager();
    ViewManager viewManager = ExplorerApp.get().getViewManager();
    // Add listener to confirmation window. If confirmed, membership is deleted
    ConfirmationDialogPopupWindow confirmationPopup = new ConfirmationDialogPopupWindow(i18nManager.getMessage(Messages.USER_CONFIRM_DELETE_GROUP, userId, groupId));
    confirmationPopup.addListener(new ConfirmationEventListener() {

        protected void rejected(ConfirmationEvent event) {
        }

        protected void confirmed(ConfirmationEvent event) {
            identityService.deleteMembership(userId, groupId);
            membershipChangeListener.notifyMembershipChanged();
        }
    });
    // Show popup
    viewManager.showPopupWindow(confirmationPopup);
}
Also used : ConfirmationEventListener(org.activiti.explorer.ui.event.ConfirmationEventListener) ConfirmationEvent(org.activiti.explorer.ui.event.ConfirmationEvent) ViewManager(org.activiti.explorer.ViewManager) ConfirmationDialogPopupWindow(org.activiti.explorer.ui.custom.ConfirmationDialogPopupWindow) I18nManager(org.activiti.explorer.I18nManager)

Example 4 with ConfirmationEvent

use of org.activiti.explorer.ui.event.ConfirmationEvent in project Activiti by Activiti.

the class DeleteProcessInstanceClickListener method buttonClick.

public void buttonClick(ClickEvent event) {
    I18nManager i18nManager = ExplorerApp.get().getI18nManager();
    ViewManager viewManager = ExplorerApp.get().getViewManager();
    final ConfirmationDialogPopupWindow confirmPopup = new ConfirmationDialogPopupWindow(i18nManager.getMessage(Messages.PROCESS_INSTANCE_DELETE_POPUP_TITLE, processInstanceId), i18nManager.getMessage(Messages.PROCESS_INSTANCE_DELETE_POPUP_DESCRIPTION, processInstanceId));
    confirmPopup.addListener(new ConfirmationEventListener() {

        private static final long serialVersionUID = 1L;

        protected void confirmed(ConfirmationEvent event) {
            RuntimeService runtimeService = ProcessEngines.getDefaultProcessEngine().getRuntimeService();
            runtimeService.deleteProcessInstance(processInstanceId, null);
            processInstancePage.refreshSelectNext();
        }
    });
    viewManager.showPopupWindow(confirmPopup);
}
Also used : ConfirmationEventListener(org.activiti.explorer.ui.event.ConfirmationEventListener) ConfirmationEvent(org.activiti.explorer.ui.event.ConfirmationEvent) RuntimeService(org.activiti.engine.RuntimeService) ViewManager(org.activiti.explorer.ViewManager) ConfirmationDialogPopupWindow(org.activiti.explorer.ui.custom.ConfirmationDialogPopupWindow) I18nManager(org.activiti.explorer.I18nManager)

Example 5 with ConfirmationEvent

use of org.activiti.explorer.ui.event.ConfirmationEvent in project Activiti by Activiti.

the class GroupDetailPanel method initDeleteButton.

protected void initDeleteButton(VerticalLayout actionsLayout) {
    Button deleteButton = new Button(i18nManager.getMessage(Messages.GROUP_DELETE));
    deleteButton.addStyleName(Reindeer.BUTTON_SMALL);
    actionsLayout.addComponent(deleteButton);
    deleteButton.addListener(new ClickListener() {

        public void buttonClick(ClickEvent event) {
            ConfirmationDialogPopupWindow confirmPopup = new ConfirmationDialogPopupWindow(i18nManager.getMessage(Messages.GROUP_CONFIRM_DELETE, group.getId()));
            confirmPopup.addListener(new ConfirmationEventListener() {

                protected void rejected(ConfirmationEvent event) {
                }

                protected void confirmed(ConfirmationEvent event) {
                    // Delete group from database
                    identityService.deleteGroup(group.getId());
                    // Update ui
                    groupPage.refreshSelectNext();
                }
            });
            ExplorerApp.get().getViewManager().showPopupWindow(confirmPopup);
        }
    });
}
Also used : ConfirmationEventListener(org.activiti.explorer.ui.event.ConfirmationEventListener) ConfirmationEvent(org.activiti.explorer.ui.event.ConfirmationEvent) Button(com.vaadin.ui.Button) ClickEvent(com.vaadin.ui.Button.ClickEvent) ConfirmationDialogPopupWindow(org.activiti.explorer.ui.custom.ConfirmationDialogPopupWindow) ClickListener(com.vaadin.ui.Button.ClickListener)

Aggregations

ConfirmationEvent (org.activiti.explorer.ui.event.ConfirmationEvent)7 ConfirmationDialogPopupWindow (org.activiti.explorer.ui.custom.ConfirmationDialogPopupWindow)6 ConfirmationEventListener (org.activiti.explorer.ui.event.ConfirmationEventListener)6 Button (com.vaadin.ui.Button)3 ClickEvent (com.vaadin.ui.Button.ClickEvent)3 ClickListener (com.vaadin.ui.Button.ClickListener)3 I18nManager (org.activiti.explorer.I18nManager)3 ViewManager (org.activiti.explorer.ViewManager)3 RuntimeService (org.activiti.engine.RuntimeService)1 TaskService (org.activiti.engine.TaskService)1 User (org.activiti.engine.identity.User)1