Search in sources :

Example 21 with Button

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

the class ChangeProcessSuspensionStatePopupWindow method addOkButton.

protected void addOkButton(final boolean suspend) {
    verticalLayout.addComponent(new Label("&nbsp", Label.CONTENT_XHTML));
    verticalLayout.addComponent(new Label("&nbsp", Label.CONTENT_XHTML));
    Button okButton = new Button(i18nManager.getMessage(Messages.BUTTON_OK));
    verticalLayout.addComponent(okButton);
    verticalLayout.setComponentAlignment(okButton, Alignment.BOTTOM_CENTER);
    okButton.addListener(new ClickListener() {

        private static final long serialVersionUID = 1L;

        public void buttonClick(ClickEvent event) {
            RepositoryService repositoryService = ProcessEngines.getDefaultProcessEngine().getRepositoryService();
            boolean includeProcessInstances = (Boolean) includeProcessInstancesCheckBox.getValue();
            if (suspend) {
                repositoryService.suspendProcessDefinitionById(processDefinitionId, includeProcessInstances, (Date) dateField.getValue());
            } else {
                repositoryService.activateProcessDefinitionById(processDefinitionId, includeProcessInstances, (Date) dateField.getValue());
            }
            close();
            // select next item in list on the left
            parentPage.refreshSelectNext();
        }
    });
}
Also used : Button(com.vaadin.ui.Button) ClickEvent(com.vaadin.ui.Button.ClickEvent) Label(com.vaadin.ui.Label) ClickListener(com.vaadin.ui.Button.ClickListener) Date(java.util.Date) RepositoryService(org.activiti.engine.RepositoryService)

Example 22 with Button

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

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

the class ProcessInstanceDetailPanel method addDeleteButton.

protected void addDeleteButton() {
    Button deleteProcessInstanceButton = new Button(i18nManager.getMessage(Messages.PROCESS_INSTANCE_DELETE));
    deleteProcessInstanceButton.setIcon(Images.DELETE);
    deleteProcessInstanceButton.addListener(new DeleteProcessInstanceClickListener(processInstance.getId(), processInstancePage));
    // Clear toolbar and add 'start' button
    processInstancePage.getToolBar().removeAllButtons();
    processInstancePage.getToolBar().addButton(deleteProcessInstanceButton);
}
Also used : Button(com.vaadin.ui.Button)

Example 24 with Button

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

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

the class PropertyTable method addPropertyRow.

protected void addPropertyRow(Object itemId, String propertyName, String propertyType, Boolean required) {
    Object newItemId = null;
    if (itemId == null) {
        // add at the end of list
        newItemId = addItem();
    } else {
        newItemId = addItemAfter(itemId);
    }
    Item newItem = getItem(newItemId);
    // name
    newItem.getItemProperty(ID_PROPERTY_NAME).setValue(propertyName == null ? DEFAULT_PROPERTY_NAME : propertyName);
    // type
    ComboBox typeComboBox = new ComboBox("", Arrays.asList("text", "number", "date"));
    typeComboBox.setNullSelectionAllowed(false);
    if (propertyType == null) {
        typeComboBox.setValue(typeComboBox.getItemIds().iterator().next());
    } else {
        typeComboBox.setValue(propertyType);
    }
    newItem.getItemProperty(ID_PROPERTY_TYPE).setValue(typeComboBox);
    // required
    CheckBox requiredCheckBox = new CheckBox();
    requiredCheckBox.setValue(required == null ? false : required);
    newItem.getItemProperty(ID_PROPERTY_REQUIRED).setValue(requiredCheckBox);
    // actions
    HorizontalLayout actionButtons = new HorizontalLayout();
    Button deleteRowButton = new Button("-");
    deleteRowButton.setData(newItemId);
    deleteRowButton.addListener(new DeletePropertyClickListener(this));
    actionButtons.addComponent(deleteRowButton);
    Button addRowButton = new Button("+");
    addRowButton.setData(newItemId);
    addRowButton.addListener(new AddPropertyClickListener(this));
    actionButtons.addComponent(addRowButton);
    newItem.getItemProperty(ID_PROPERTY_ACTIONS).setValue(actionButtons);
}
Also used : Item(com.vaadin.data.Item) DeletePropertyClickListener(org.activiti.explorer.ui.process.simple.editor.listener.DeletePropertyClickListener) Button(com.vaadin.ui.Button) ComboBox(com.vaadin.ui.ComboBox) CheckBox(com.vaadin.ui.CheckBox) AddPropertyClickListener(org.activiti.explorer.ui.process.simple.editor.listener.AddPropertyClickListener) HorizontalLayout(com.vaadin.ui.HorizontalLayout)

Aggregations

Button (com.vaadin.ui.Button)94 ClickEvent (com.vaadin.ui.Button.ClickEvent)63 ClickListener (com.vaadin.ui.Button.ClickListener)61 HorizontalLayout (com.vaadin.ui.HorizontalLayout)26 Label (com.vaadin.ui.Label)19 VerticalLayout (com.vaadin.ui.VerticalLayout)13 LayoutClickEvent (com.vaadin.event.LayoutEvents.LayoutClickEvent)7 LayoutClickListener (com.vaadin.event.LayoutEvents.LayoutClickListener)7 SubmitEvent (org.activiti.explorer.ui.event.SubmitEvent)7 ClaimTaskClickListener (org.activiti.explorer.ui.task.listener.ClaimTaskClickListener)5 ValueChangeEvent (com.vaadin.data.Property.ValueChangeEvent)4 TextField (com.vaadin.ui.TextField)4 SubmitEventListener (org.activiti.explorer.ui.event.SubmitEventListener)4 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)3 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)3 Item (com.vaadin.data.Item)3 ValueChangeListener (com.vaadin.data.Property.ValueChangeListener)3 ExternalResource (com.vaadin.terminal.ExternalResource)3 ComboBox (com.vaadin.ui.ComboBox)3 FormLayout (com.vaadin.ui.FormLayout)3