Search in sources :

Example 41 with ClickEvent

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

the class ChangePasswordPopupWindow method initChangePasswordButton.

protected void initChangePasswordButton() {
    errorLabel = new Label("&nbsp", Label.CONTENT_XHTML);
    errorLabel.addStyleName(Reindeer.LABEL_SMALL);
    errorLabel.addStyleName(ExplorerLayout.STYLE_LABEL_RED);
    layout.addComponent(errorLabel);
    Button changePasswordButton = new Button(i18nManager.getMessage(Messages.PASSWORD_CHANGE));
    layout.addComponent(changePasswordButton);
    layout.setComponentAlignment(changePasswordButton, Alignment.MIDDLE_CENTER);
    changePasswordButton.addListener(new ClickListener() {

        public void buttonClick(ClickEvent event) {
            handlePasswordChange();
        }
    });
}
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 42 with ClickEvent

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

the class ProfilePanel method initEditProfileButton.

protected Button initEditProfileButton() {
    Button editProfileButton = new Button(i18nManager.getMessage(Messages.PROFILE_EDIT));
    editProfileButton.setIcon(Images.EDIT);
    editProfileButton.addListener(new ClickListener() {

        public void buttonClick(ClickEvent event) {
            editable = true;
            initUi();
        }
    });
    return editProfileButton;
}
Also used : Button(com.vaadin.ui.Button) ClickEvent(com.vaadin.ui.Button.ClickEvent) ClickListener(com.vaadin.ui.Button.ClickListener)

Example 43 with ClickEvent

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

the class ProfilePanel method initSaveProfileButton.

protected Button initSaveProfileButton() {
    Button saveProfileButton = new Button(i18nManager.getMessage(Messages.PROFILE_SAVE));
    saveProfileButton.setIcon(Images.SAVE);
    saveProfileButton.addListener(new ClickListener() {

        public void buttonClick(ClickEvent event) {
            user.setFirstName((String) firstNameField.getValue());
            user.setLastName((String) lastNameField.getValue());
            user.setEmail((String) emailField.getValue());
            identityService.saveUser(user);
            identityService.setUserInfo(user.getId(), Constants.USER_INFO_JOB_TITLE, jobTitleField.getValue().toString());
            if (birthDateField.getValue() != null && !"".equals(birthDateField.getValue().toString())) {
                identityService.setUserInfo(user.getId(), Constants.USER_INFO_BIRTH_DATE, new SimpleDateFormat(Constants.DEFAULT_DATE_FORMAT).format(birthDateField.getValue()));
            }
            identityService.setUserInfo(user.getId(), Constants.USER_INFO_LOCATION, locationField.getValue().toString());
            identityService.setUserInfo(user.getId(), Constants.USER_INFO_PHONE, phoneField.getValue().toString());
            identityService.setUserInfo(user.getId(), Constants.USER_INFO_TWITTER, twitterField.getValue().toString());
            identityService.setUserInfo(user.getId(), Constants.USER_INFO_SKYPE, skypeField.getValue().toString());
            // UI
            editable = false;
            loadProfileData();
            initUi();
        }
    });
    return saveProfileButton;
}
Also used : Button(com.vaadin.ui.Button) ClickEvent(com.vaadin.ui.Button.ClickEvent) SimpleDateFormat(java.text.SimpleDateFormat) ClickListener(com.vaadin.ui.Button.ClickListener)

Example 44 with ClickEvent

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

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

Aggregations

ClickEvent (com.vaadin.ui.Button.ClickEvent)68 ClickListener (com.vaadin.ui.Button.ClickListener)66 Button (com.vaadin.ui.Button)63 HorizontalLayout (com.vaadin.ui.HorizontalLayout)17 Label (com.vaadin.ui.Label)13 VerticalLayout (com.vaadin.ui.VerticalLayout)8 SubmitEvent (org.activiti.explorer.ui.event.SubmitEvent)8 LayoutClickEvent (com.vaadin.event.LayoutEvents.LayoutClickEvent)7 LayoutClickListener (com.vaadin.event.LayoutEvents.LayoutClickListener)7 ValueChangeEvent (com.vaadin.data.Property.ValueChangeEvent)5 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