Search in sources :

Example 11 with ClickListener

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

the class SuspendedProcessDefinitionDetailPanel method initActions.

protected void initActions(final AbstractPage parentPage) {
    SuspendedProcessDefinitionPage processDefinitionPage = (SuspendedProcessDefinitionPage) parentPage;
    Button activateButton = new Button(i18nManager.getMessage(Messages.PROCESS_ACTIVATE));
    activateButton.addListener(new ClickListener() {

        private static final long serialVersionUID = 1L;

        public void buttonClick(ClickEvent event) {
            ChangeProcessSuspensionStatePopupWindow popupWindow = new ChangeProcessSuspensionStatePopupWindow(processDefinition.getId(), parentPage, false);
            ExplorerApp.get().getViewManager().showPopupWindow(popupWindow);
        }
    });
    // Check if already activation job pending
    boolean activateJobPending = false;
    List<Job> jobs = ProcessEngines.getDefaultProcessEngine().getManagementService().createJobQuery().processDefinitionId(processDefinition.getId()).list();
    for (Job job : jobs) {
        // TODO: this is a hack. Needs to be cleaner in engine!
        if (((JobEntity) job).getJobHandlerType().equals(TimerActivateProcessDefinitionHandler.TYPE)) {
            activateJobPending = true;
            break;
        }
    }
    activateButton.setEnabled(!activateJobPending);
    // Clear toolbar and add 'start' button
    processDefinitionPage.getToolBar().removeAllButtons();
    processDefinitionPage.getToolBar().addButton(activateButton);
}
Also used : Button(com.vaadin.ui.Button) ClickEvent(com.vaadin.ui.Button.ClickEvent) Job(org.activiti.engine.runtime.Job) ClickListener(com.vaadin.ui.Button.ClickListener)

Example 12 with ClickListener

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

the class SimpleTableEditor method initButtons.

protected void initButtons(GridLayout layout) {
    final Button saveButton = new Button(ExplorerApp.get().getI18nManager().getMessage(Messages.PROCESS_EDITOR_SAVE));
    saveButton.setEnabled(nameField.getValue() != null && !"".equals((String) nameField.getValue()));
    toolBar.addButton(saveButton);
    saveButton.addListener(new ClickListener() {

        private static final long serialVersionUID = 1L;

        public void buttonClick(ClickEvent event) {
            save();
        }
    });
    // Dependending on namefield value, save button is enabled
    nameField.addListener(new ValueChangeListener() {

        private static final long serialVersionUID = 1L;

        public void valueChange(ValueChangeEvent event) {
            if (nameField.getValue() != null && !"".equals((String) nameField.getValue())) {
                saveButton.setEnabled(true);
            } else {
                saveButton.setEnabled(false);
            }
        }
    });
}
Also used : ValueChangeEvent(com.vaadin.data.Property.ValueChangeEvent) ValueChangeListener(com.vaadin.data.Property.ValueChangeListener) Button(com.vaadin.ui.Button) ClickEvent(com.vaadin.ui.Button.ClickEvent) ClickListener(com.vaadin.ui.Button.ClickListener)

Example 13 with ClickListener

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

the class DescriptionComponent method initLayoutClickListener.

protected void initLayoutClickListener() {
    addListener(new LayoutClickListener() {

        public void layoutClick(LayoutClickEvent event) {
            if (event.getClickedComponent() != null && event.getClickedComponent().equals(descriptionLabel)) {
                // textarea
                final TextArea descriptionTextArea = new TextArea();
                descriptionTextArea.setWidth(100, UNITS_PERCENTAGE);
                descriptionTextArea.setValue(task.getDescription());
                editLayout.addComponent(descriptionTextArea);
                // ok button
                Button okButton = new Button(i18nManager.getMessage(Messages.BUTTON_OK));
                editLayout.addComponent(okButton);
                editLayout.setComponentAlignment(okButton, Alignment.BOTTOM_RIGHT);
                // replace
                replaceComponent(descriptionLabel, editLayout);
                // When OK is clicked -> update task data + ui
                okButton.addListener(new ClickListener() {

                    public void buttonClick(ClickEvent event) {
                        // Update data
                        task.setDescription(descriptionTextArea.getValue().toString());
                        taskService.saveTask(task);
                        // Update UI
                        descriptionLabel.setValue(task.getDescription());
                        replaceComponent(editLayout, descriptionLabel);
                    }
                });
            }
        }
    });
}
Also used : LayoutClickEvent(com.vaadin.event.LayoutEvents.LayoutClickEvent) TextArea(com.vaadin.ui.TextArea) Button(com.vaadin.ui.Button) ClickEvent(com.vaadin.ui.Button.ClickEvent) LayoutClickEvent(com.vaadin.event.LayoutEvents.LayoutClickEvent) ClickListener(com.vaadin.ui.Button.ClickListener) LayoutClickListener(com.vaadin.event.LayoutEvents.LayoutClickListener) LayoutClickListener(com.vaadin.event.LayoutEvents.LayoutClickListener)

Example 14 with ClickListener

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

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

the class JobDetailPanel method addLinkToProcessDefinition.

protected void addLinkToProcessDefinition(final VerticalLayout verticalLayout, final String labelText, final boolean isSuspendedProcessDefinition) {
    HorizontalLayout layout = new HorizontalLayout();
    verticalLayout.addComponent(layout);
    Label processDefinitionLabel = new Label(labelText);
    processDefinitionLabel.setSizeUndefined();
    layout.addComponent(processDefinitionLabel);
    layout.addComponent(new Label("&nbsp;", Label.CONTENT_XHTML));
    Button showProcessDefinitionLink = new Button(job.getProcessDefinitionId());
    showProcessDefinitionLink.addStyleName(Reindeer.BUTTON_LINK);
    showProcessDefinitionLink.addListener(new ClickListener() {

        private static final long serialVersionUID = 1L;

        public void buttonClick(ClickEvent event) {
            if (isSuspendedProcessDefinition) {
                ExplorerApp.get().getViewManager().showSuspendedProcessDefinitionsPage(job.getProcessDefinitionId());
            } else {
                ExplorerApp.get().getViewManager().showActiveProcessDefinitionsPage(job.getProcessDefinitionId());
            }
        }
    });
    layout.addComponent(showProcessDefinitionLink);
}
Also used : Button(com.vaadin.ui.Button) ClickEvent(com.vaadin.ui.Button.ClickEvent) Label(com.vaadin.ui.Label) PrettyTimeLabel(org.activiti.explorer.ui.custom.PrettyTimeLabel) ClickListener(com.vaadin.ui.Button.ClickListener) HorizontalLayout(com.vaadin.ui.HorizontalLayout)

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