Search in sources :

Example 71 with Button

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

the class FormPopupWindow method initUi.

protected void initUi() {
    VerticalLayout layout = new VerticalLayout();
    layout.setSpacing(true);
    addComponent(layout);
    // Description
    layout.addComponent(new Label(DESCRIPTION));
    // Property table
    propertyTable = new PropertyTable();
    layout.addComponent(propertyTable);
    fillFormFields();
    // Buttons
    HorizontalLayout buttons = new HorizontalLayout();
    buttons.setSpacing(true);
    // Save button
    Button saveButton = new Button(ExplorerApp.get().getI18nManager().getMessage(Messages.BUTTON_SAVE));
    buttons.addComponent(saveButton);
    saveButton.addListener(new Button.ClickListener() {

        private static final long serialVersionUID = -2906886872414089331L;

        public void buttonClick(ClickEvent event) {
            FormDefinition form = createForm();
            formModel.addForm(taskItemId, form);
            close();
        }
    });
    // Delete button
    Button deleteButton = new Button(ExplorerApp.get().getI18nManager().getMessage(Messages.BUTTON_DELETE));
    buttons.addComponent(deleteButton);
    deleteButton.addListener(new Button.ClickListener() {

        private static final long serialVersionUID = 5267967369680365653L;

        public void buttonClick(ClickEvent event) {
            formModel.removeForm(taskItemId);
            close();
        }
    });
    layout.addComponent(new Label(""));
    layout.addComponent(buttons);
}
Also used : PropertyTable(org.activiti.explorer.ui.process.simple.editor.table.PropertyTable) Button(com.vaadin.ui.Button) ClickEvent(com.vaadin.ui.Button.ClickEvent) Label(com.vaadin.ui.Label) VerticalLayout(com.vaadin.ui.VerticalLayout) FormDefinition(org.activiti.workflow.simple.definition.form.FormDefinition) HorizontalLayout(com.vaadin.ui.HorizontalLayout)

Example 72 with Button

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

the class SaveReportPopupWindow method createSaveButton.

protected void createSaveButton(final I18nManager i18nManager, final VerticalLayout layout) {
    layout.addComponent(new Label("&nbsp", Label.CONTENT_XHTML));
    Button saveButton = new Button(i18nManager.getMessage(Messages.BUTTON_SAVE));
    layout.addComponent(saveButton);
    layout.setComponentAlignment(saveButton, Alignment.MIDDLE_CENTER);
    saveButton.addListener(new ClickListener() {

        private static final long serialVersionUID = 1L;

        public void buttonClick(ClickEvent event) {
            String reportName = null;
            // Validate
            String error = null;
            if (nameField.getValue() == null || ((String) nameField.getValue()).length() == 0) {
                error = i18nManager.getMessage(Messages.REPORTING_SAVE_POPUP_NAME_EMPTY);
            } else {
                reportName = ExplorerApp.get().getLoggedInUser().getId() + "_" + nameField.getValue();
                if (reportName.length() > 255) {
                    error = i18nManager.getMessage(Messages.REPORTING_SAVE_POPUP_NAME_TOO_LONG);
                } else {
                    boolean nameUsed = ProcessEngines.getDefaultProcessEngine().getHistoryService().createHistoricProcessInstanceQuery().processInstanceBusinessKey(reportName).count() != 0;
                    if (nameUsed) {
                        error = i18nManager.getMessage(Messages.REPORTING_SAVE_POPUP_NAME_EXISTS);
                    }
                }
            }
            if (error != null) {
                setHeight(185, UNITS_PIXELS);
                layout.addComponent(new Label(" ", Label.CONTENT_XHTML));
                Label errorLabel = new Label(error);
                errorLabel.addStyleName(ExplorerLayout.STYLE_ERROR);
                layout.addComponent(errorLabel);
            } else {
                // Re-run reports to store the data for good now (the previous process instance was deleted)
                if (originalFormProperties != null) {
                    startProcessInstanceWithFormProperties(reportName);
                } else {
                    startProcessInstance(reportName);
                }
                // Remove the popup
                if (componentToDisableOnClose != null) {
                    componentToDisableOnClose.setEnabled(false);
                }
                close();
            }
        }
    });
}
Also used : Button(com.vaadin.ui.Button) ClickEvent(com.vaadin.ui.Button.ClickEvent) Label(com.vaadin.ui.Label) ClickListener(com.vaadin.ui.Button.ClickListener)

Example 73 with Button

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

the class NewCasePopupWindow method initCreateTaskButton.

protected void initCreateTaskButton() {
    HorizontalLayout buttonLayout = new HorizontalLayout();
    buttonLayout.setWidth(100, UNITS_PERCENTAGE);
    form.getFooter().setWidth(100, UNITS_PERCENTAGE);
    form.getFooter().addComponent(buttonLayout);
    Button createButton = new Button(i18nManager.getMessage(Messages.BUTTON_CREATE));
    buttonLayout.addComponent(createButton);
    buttonLayout.setComponentAlignment(createButton, Alignment.BOTTOM_RIGHT);
    createButton.addListener(new ClickListener() {

        public void buttonClick(ClickEvent event) {
            handleFormSubmit();
        }
    });
}
Also used : Button(com.vaadin.ui.Button) ClickEvent(com.vaadin.ui.Button.ClickEvent) ClickListener(com.vaadin.ui.Button.ClickListener) HorizontalLayout(com.vaadin.ui.HorizontalLayout)

Example 74 with Button

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

the class TaskEventsPanel method addInputField.

protected void addInputField() {
    HorizontalLayout layout = new HorizontalLayout();
    layout.setSpacing(true);
    layout.setWidth(100, UNITS_PERCENTAGE);
    addComponent(layout);
    // Hack: actionHandlers can only be attached to panels or windows
    Panel textFieldPanel = new Panel();
    textFieldPanel.addStyleName(Reindeer.PANEL_LIGHT);
    textFieldPanel.setContent(new VerticalLayout());
    textFieldPanel.setWidth(100, UNITS_PERCENTAGE);
    layout.addComponent(textFieldPanel);
    layout.setExpandRatio(textFieldPanel, 1.0f);
    commentInputField = new TextField();
    commentInputField.setWidth(100, UNITS_PERCENTAGE);
    textFieldPanel.addComponent(commentInputField);
    // Hack to catch keyboard 'enter'
    textFieldPanel.addActionHandler(new Handler() {

        public void handleAction(Action action, Object sender, Object target) {
            addNewComment(commentInputField.getValue().toString());
        }

        public Action[] getActions(Object target, Object sender) {
            return new Action[] { new ShortcutAction("enter", ShortcutAction.KeyCode.ENTER, null) };
        }
    });
    addCommentButton = new Button(i18nManager.getMessage(Messages.TASK_ADD_COMMENT));
    layout.addComponent(addCommentButton);
    layout.setComponentAlignment(addCommentButton, Alignment.MIDDLE_LEFT);
    addCommentButton.addListener(new ClickListener() {

        public void buttonClick(ClickEvent event) {
            addNewComment(commentInputField.getValue().toString());
        }
    });
}
Also used : Panel(com.vaadin.ui.Panel) ShortcutAction(com.vaadin.event.ShortcutAction) Action(com.vaadin.event.Action) Button(com.vaadin.ui.Button) ClickEvent(com.vaadin.ui.Button.ClickEvent) VerticalLayout(com.vaadin.ui.VerticalLayout) TextField(com.vaadin.ui.TextField) Handler(com.vaadin.event.Action.Handler) ShortcutAction(com.vaadin.event.ShortcutAction) ClickListener(com.vaadin.ui.Button.ClickListener) HorizontalLayout(com.vaadin.ui.HorizontalLayout)

Example 75 with Button

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

the class JobDetailPanel method addActions.

protected void addActions() {
    Button deleteButton = new Button(i18nManager.getMessage(Messages.JOB_DELETE));
    deleteButton.setIcon(Images.DELETE);
    deleteButton.addListener(new ClickListener() {

        private static final long serialVersionUID = 1L;

        public void buttonClick(ClickEvent event) {
            managementService.deleteJob(job.getId());
            notificationManager.showInformationNotification(Messages.JOB_DELETED);
            jobPage.refreshSelectNext();
        }
    });
    Button executeButton = new Button(i18nManager.getMessage(Messages.JOB_EXECUTE));
    executeButton.setIcon(Images.EXECUTE);
    executeButton.addListener(new ClickListener() {

        private static final long serialVersionUID = 1L;

        public void buttonClick(ClickEvent event) {
            try {
                managementService.executeJob(job.getId());
                jobPage.refreshSelectNext();
            } catch (ActivitiException ae) {
                String errorMessage = ae.getMessage() + (ae.getCause() != null ? " (" + ae.getCause().getClass().getName() + ")" : "");
                notificationManager.showErrorNotification(Messages.JOB_ERROR, errorMessage);
                // Refresh the current job
                jobPage.refreshCurrentJobDetails();
            }
        }
    });
    jobPage.getToolBar().removeAllButtons();
    jobPage.getToolBar().addButton(executeButton);
    jobPage.getToolBar().addButton(deleteButton);
}
Also used : ActivitiException(org.activiti.engine.ActivitiException) Button(com.vaadin.ui.Button) ClickEvent(com.vaadin.ui.Button.ClickEvent) ClickListener(com.vaadin.ui.Button.ClickListener)

Aggregations

Button (com.vaadin.ui.Button)114 ClickEvent (com.vaadin.ui.Button.ClickEvent)72 ClickListener (com.vaadin.ui.Button.ClickListener)64 HorizontalLayout (com.vaadin.ui.HorizontalLayout)33 VerticalLayout (com.vaadin.ui.VerticalLayout)25 Label (com.vaadin.ui.Label)21 Chart (com.vaadin.addon.charts.Chart)8 ListSeries (com.vaadin.addon.charts.model.ListSeries)8 TextField (com.vaadin.ui.TextField)8 SubmitEvent (org.activiti.explorer.ui.event.SubmitEvent)7 Configuration (com.vaadin.addon.charts.model.Configuration)6 LayoutClickEvent (com.vaadin.event.LayoutEvents.LayoutClickEvent)6 LayoutClickListener (com.vaadin.event.LayoutEvents.LayoutClickListener)6 ClaimTaskClickListener (org.activiti.explorer.ui.task.listener.ClaimTaskClickListener)5 ComboBox (com.vaadin.ui.ComboBox)4 FormLayout (com.vaadin.ui.FormLayout)4 Window (com.vaadin.ui.Window)4 SimpleDateFormat (java.text.SimpleDateFormat)4 SubmitEventListener (org.activiti.explorer.ui.event.SubmitEventListener)4 VertexRef (org.opennms.features.topology.api.topo.VertexRef)4