Search in sources :

Example 41 with ClickListener

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

the class AccountSelectionPopup method initAlfrescoComponent.

protected void initAlfrescoComponent() {
    alfrescoForm = new Form();
    alfrescoForm.setDescription(i18nManager.getMessage(Messages.ALFRESCO_DESCRIPTION));
    final TextField alfrescoServer = new TextField(i18nManager.getMessage(Messages.ALFRESCO_SERVER));
    alfrescoForm.getLayout().addComponent(alfrescoServer);
    final TextField alfrescoUserName = new TextField(i18nManager.getMessage(Messages.ALFRESCO_USERNAME));
    alfrescoForm.getLayout().addComponent(alfrescoUserName);
    final PasswordField alfrescoPassword = new PasswordField(i18nManager.getMessage(Messages.ALFRESCO_PASSWORD));
    alfrescoForm.getLayout().addComponent(alfrescoPassword);
    // Matching listener
    alfrescoClickListener = new ClickListener() {

        public void buttonClick(ClickEvent event) {
            Map<String, Object> accountDetails = createAccountDetails("alfresco", alfrescoUserName.getValue().toString(), alfrescoPassword.getValue().toString(), "server", alfrescoServer.getValue().toString());
            fireEvent(new SubmitEvent(AccountSelectionPopup.this, SubmitEvent.SUBMITTED, accountDetails));
        }
    };
}
Also used : Form(com.vaadin.ui.Form) ClickEvent(com.vaadin.ui.Button.ClickEvent) TextField(com.vaadin.ui.TextField) PasswordField(com.vaadin.ui.PasswordField) HashMap(java.util.HashMap) Map(java.util.Map) ClickListener(com.vaadin.ui.Button.ClickListener) SubmitEvent(org.activiti.explorer.ui.event.SubmitEvent)

Example 42 with ClickListener

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

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

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

use of com.vaadin.ui.Button.ClickListener 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("&nbsp;", 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)69 ClickListener (com.vaadin.ui.Button.ClickListener)69 Button (com.vaadin.ui.Button)64 HorizontalLayout (com.vaadin.ui.HorizontalLayout)15 Label (com.vaadin.ui.Label)12 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)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