Search in sources :

Example 1 with I18nManager

use of org.activiti.explorer.I18nManager 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 I18nManager

use of org.activiti.explorer.I18nManager in project Activiti by Activiti.

the class PrettyTimeLabel method init.

protected void init() {
    final I18nManager i18nManager = ExplorerApp.get().getI18nManager();
    if (date != null) {
        DateFormat dateFormat = null;
        if (showTime) {
            dateFormat = new SimpleDateFormat(Constants.DEFAULT_TIME_FORMAT);
        } else {
            dateFormat = new SimpleDateFormat(Constants.DEFAULT_DATE_FORMAT);
        }
        if (labelTemplate != null) {
            super.setValue(MessageFormat.format(labelTemplate, new HumanTime(i18nManager).format(date)));
        } else {
            super.setValue(new HumanTime(i18nManager).format(date));
        }
        setDescription(dateFormat.format(date));
    } else {
        super.setValue(noDateCaption);
        setDescription(noDateCaption);
    }
}
Also used : HumanTime(org.activiti.explorer.util.time.HumanTime) SimpleDateFormat(java.text.SimpleDateFormat) DateFormat(java.text.DateFormat) SimpleDateFormat(java.text.SimpleDateFormat) I18nManager(org.activiti.explorer.I18nManager)

Example 3 with I18nManager

use of org.activiti.explorer.I18nManager 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 I18nManager

use of org.activiti.explorer.I18nManager in project Activiti by Activiti.

the class MonthFormPropertyRenderer method getPropertyField.

public Field getPropertyField(FormProperty formProperty) {
    ComboBox comboBox = new MonthCombobox(getPropertyLabel(formProperty));
    comboBox.setRequired(formProperty.isRequired());
    comboBox.setRequiredError(getMessage(Messages.FORM_FIELD_REQUIRED, getPropertyLabel(formProperty)));
    comboBox.setEnabled(formProperty.isWritable());
    // Fill combobox
    I18nManager i18nManager = ExplorerApp.get().getI18nManager();
    for (int i = 0; i < 12; i++) {
        comboBox.addItem(i);
        comboBox.setItemCaption(i, i18nManager.getMessage(Messages.MONTH_PREFIX + i));
    }
    // Select first
    comboBox.setNullSelectionAllowed(false);
    Calendar cal = Calendar.getInstance();
    comboBox.select(cal.get(Calendar.MONTH));
    return comboBox;
}
Also used : ComboBox(com.vaadin.ui.ComboBox) Calendar(java.util.Calendar) I18nManager(org.activiti.explorer.I18nManager)

Example 5 with I18nManager

use of org.activiti.explorer.I18nManager 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)

Aggregations

I18nManager (org.activiti.explorer.I18nManager)5 ViewManager (org.activiti.explorer.ViewManager)3 ConfirmationDialogPopupWindow (org.activiti.explorer.ui.custom.ConfirmationDialogPopupWindow)3 ConfirmationEvent (org.activiti.explorer.ui.event.ConfirmationEvent)3 ConfirmationEventListener (org.activiti.explorer.ui.event.ConfirmationEventListener)3 ComboBox (com.vaadin.ui.ComboBox)1 DateFormat (java.text.DateFormat)1 SimpleDateFormat (java.text.SimpleDateFormat)1 Calendar (java.util.Calendar)1 RuntimeService (org.activiti.engine.RuntimeService)1 TaskService (org.activiti.engine.TaskService)1 HumanTime (org.activiti.explorer.util.time.HumanTime)1