Search in sources :

Example 1 with SubmitEvent

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

the class AccountSelectionPopup method initImapComponent.

protected void initImapComponent() {
    imapForm = new Form();
    imapForm.setDescription(i18nManager.getMessage(Messages.IMAP_DESCRIPTION));
    final TextField imapServer = new TextField(i18nManager.getMessage(Messages.IMAP_SERVER));
    imapForm.getLayout().addComponent(imapServer);
    final TextField imapPort = new TextField(i18nManager.getMessage(Messages.IMAP_PORT));
    imapPort.setWidth(30, UNITS_PIXELS);
    // Default imap port (non-ssl)
    imapPort.setValue(143);
    imapForm.getLayout().addComponent(imapPort);
    final CheckBox useSSL = new CheckBox(i18nManager.getMessage(Messages.IMAP_SSL));
    useSSL.setValue(false);
    useSSL.setImmediate(true);
    imapForm.getLayout().addComponent(useSSL);
    useSSL.addListener(new ValueChangeListener() {

        public void valueChange(ValueChangeEvent event) {
            imapPort.setValue(((Boolean) useSSL.getValue()) ? 993 : 143);
        }
    });
    final TextField imapUserName = new TextField(i18nManager.getMessage(Messages.IMAP_USERNAME));
    imapForm.getLayout().addComponent(imapUserName);
    final PasswordField imapPassword = new PasswordField(i18nManager.getMessage(Messages.IMAP_PASSWORD));
    imapForm.getLayout().addComponent(imapPassword);
    // Matching listener
    imapClickListener = new ClickListener() {

        public void buttonClick(ClickEvent event) {
            Map<String, Object> accountDetails = createAccountDetails("imap", imapUserName.getValue().toString(), imapPassword.getValue().toString(), "server", imapServer.getValue().toString(), "port", imapPort.getValue().toString(), "ssl", imapPort.getValue().toString());
            fireEvent(new SubmitEvent(AccountSelectionPopup.this, SubmitEvent.SUBMITTED, accountDetails));
        }
    };
}
Also used : ValueChangeEvent(com.vaadin.data.Property.ValueChangeEvent) ValueChangeListener(com.vaadin.data.Property.ValueChangeListener) Form(com.vaadin.ui.Form) CheckBox(com.vaadin.ui.CheckBox) 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 2 with SubmitEvent

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

the class GroupDetailPanel method initAddMembersButton.

protected void initAddMembersButton(HorizontalLayout membersHeader) {
    Button addButton = new Button();
    addButton.addStyleName(ExplorerLayout.STYLE_ADD);
    membersHeader.addComponent(addButton);
    membersHeader.setComponentAlignment(addButton, Alignment.MIDDLE_RIGHT);
    addButton.addListener(new ClickListener() {

        public void buttonClick(ClickEvent event) {
            final SelectUsersPopupWindow selectUsersPopup = new SelectUsersPopupWindow(i18nManager.getMessage(Messages.GROUP_SELECT_MEMBERS, group.getId()), true, false, getCurrentMembers());
            ExplorerApp.get().getViewManager().showPopupWindow(selectUsersPopup);
            // Listen to submit events (that contain the selected users)
            selectUsersPopup.addListener(new SubmitEventListener() {

                protected void submitted(SubmitEvent event) {
                    Collection<String> userIds = selectUsersPopup.getSelectedUserIds();
                    if (!userIds.isEmpty()) {
                        for (String userId : userIds) {
                            identityService.createMembership(userId, group.getId());
                        }
                        notifyMembershipChanged();
                    }
                }

                protected void cancelled(SubmitEvent event) {
                }
            });
        }
    });
}
Also used : SelectUsersPopupWindow(org.activiti.explorer.ui.custom.SelectUsersPopupWindow) Button(com.vaadin.ui.Button) SubmitEventListener(org.activiti.explorer.ui.event.SubmitEventListener) ClickEvent(com.vaadin.ui.Button.ClickEvent) ClickListener(com.vaadin.ui.Button.ClickListener) SubmitEvent(org.activiti.explorer.ui.event.SubmitEvent)

Example 3 with SubmitEvent

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

the class GroupSelectionPopupWindow method initSelectButton.

protected void initSelectButton() {
    final Button selectButton = new Button(i18nManager.getMessage(Messages.USER_SELECT_GROUPS));
    addComponent(selectButton);
    ((VerticalLayout) getContent()).setComponentAlignment(selectButton, Alignment.BOTTOM_RIGHT);
    selectButton.addListener(new ClickListener() {

        public void buttonClick(ClickEvent event) {
            fireEvent(new SubmitEvent(selectButton, SubmitEvent.SUBMITTED));
            close();
        }
    });
}
Also used : Button(com.vaadin.ui.Button) ClickEvent(com.vaadin.ui.Button.ClickEvent) VerticalLayout(com.vaadin.ui.VerticalLayout) ClickListener(com.vaadin.ui.Button.ClickListener) SubmitEvent(org.activiti.explorer.ui.event.SubmitEvent)

Example 4 with SubmitEvent

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

the class UserDetailPanel method initAddGroupsButton.

protected void initAddGroupsButton(HorizontalLayout groupHeader) {
    Button addRelatedContentButton = new Button();
    addRelatedContentButton.addStyleName(ExplorerLayout.STYLE_ADD);
    groupHeader.addComponent(addRelatedContentButton);
    groupHeader.setComponentAlignment(addRelatedContentButton, Alignment.MIDDLE_RIGHT);
    addRelatedContentButton.addListener(new ClickListener() {

        private static final long serialVersionUID = 1L;

        public void buttonClick(ClickEvent event) {
            final GroupSelectionPopupWindow selectionPopup = new GroupSelectionPopupWindow(identityService, user.getId());
            selectionPopup.addListener(new SubmitEventListener() {

                private static final long serialVersionUID = 1L;

                protected void submitted(SubmitEvent event) {
                    Set<String> selectedGroups = selectionPopup.getSelectedGroupIds();
                    if (!selectedGroups.isEmpty()) {
                        for (String groupId : selectedGroups) {
                            identityService.createMembership(user.getId(), groupId);
                        }
                        notifyMembershipChanged();
                    }
                }

                protected void cancelled(SubmitEvent event) {
                }
            });
            ExplorerApp.get().getViewManager().showPopupWindow(selectionPopup);
        }
    });
}
Also used : Button(com.vaadin.ui.Button) SubmitEventListener(org.activiti.explorer.ui.event.SubmitEventListener) ClickEvent(com.vaadin.ui.Button.ClickEvent) ClickListener(com.vaadin.ui.Button.ClickListener) SubmitEvent(org.activiti.explorer.ui.event.SubmitEvent)

Example 5 with SubmitEvent

use of org.activiti.explorer.ui.event.SubmitEvent 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)

Aggregations

SubmitEvent (org.activiti.explorer.ui.event.SubmitEvent)12 ClickEvent (com.vaadin.ui.Button.ClickEvent)8 ClickListener (com.vaadin.ui.Button.ClickListener)8 Button (com.vaadin.ui.Button)7 SubmitEventListener (org.activiti.explorer.ui.event.SubmitEventListener)6 SelectUsersPopupWindow (org.activiti.explorer.ui.custom.SelectUsersPopupWindow)4 Form (com.vaadin.ui.Form)2 PasswordField (com.vaadin.ui.PasswordField)2 TextField (com.vaadin.ui.TextField)2 HashMap (java.util.HashMap)2 Map (java.util.Map)2 ValueChangeEvent (com.vaadin.data.Property.ValueChangeEvent)1 ValueChangeListener (com.vaadin.data.Property.ValueChangeListener)1 InvalidValueException (com.vaadin.data.Validator.InvalidValueException)1 CheckBox (com.vaadin.ui.CheckBox)1 HorizontalLayout (com.vaadin.ui.HorizontalLayout)1 Label (com.vaadin.ui.Label)1 VerticalLayout (com.vaadin.ui.VerticalLayout)1 Attachment (org.activiti.engine.task.Attachment)1 LoggedInUser (org.activiti.explorer.identity.LoggedInUser)1