Search in sources :

Example 96 with Button

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

the class NewModelPopupWindow method addButtons.

protected void addButtons() {
    // Create
    Button createButton = new Button(i18nManager.getMessage(Messages.PROCESS_NEW_POPUP_CREATE_BUTTON));
    createButton.setWidth("200px");
    createButton.addListener(new ClickListener() {

        private static final long serialVersionUID = 1L;

        public void buttonClick(ClickEvent event) {
            if (StringUtils.isEmpty((String) nameTextField.getValue())) {
                nameTextField.setComponentError(new UserError("The name field is required."));
                return;
            }
            if (selectEditorComponent.isModelerPreferred()) {
                try {
                    ObjectMapper objectMapper = new ObjectMapper();
                    ObjectNode editorNode = objectMapper.createObjectNode();
                    editorNode.put("id", "canvas");
                    editorNode.put("resourceId", "canvas");
                    ObjectNode stencilSetNode = objectMapper.createObjectNode();
                    stencilSetNode.put("namespace", "http://b3mn.org/stencilset/bpmn2.0#");
                    editorNode.put("stencilset", stencilSetNode);
                    Model modelData = repositoryService.newModel();
                    ObjectNode modelObjectNode = objectMapper.createObjectNode();
                    modelObjectNode.put(MODEL_NAME, (String) nameTextField.getValue());
                    modelObjectNode.put(MODEL_REVISION, 1);
                    String description = null;
                    if (StringUtils.isNotEmpty((String) descriptionTextArea.getValue())) {
                        description = (String) descriptionTextArea.getValue();
                    } else {
                        description = "";
                    }
                    modelObjectNode.put(MODEL_DESCRIPTION, description);
                    modelData.setMetaInfo(modelObjectNode.toString());
                    modelData.setName((String) nameTextField.getValue());
                    repositoryService.saveModel(modelData);
                    repositoryService.addModelEditorSource(modelData.getId(), editorNode.toString().getBytes("utf-8"));
                    close();
                    ExplorerApp.get().getViewManager().showEditorProcessDefinitionPage(modelData.getId());
                    URL explorerURL = ExplorerApp.get().getURL();
                    URL url = new URL(explorerURL.getProtocol(), explorerURL.getHost(), explorerURL.getPort(), explorerURL.getPath().replace("/ui", "") + "modeler.html?modelId=" + modelData.getId());
                    ExplorerApp.get().getMainWindow().open(new ExternalResource(url));
                } catch (Exception e) {
                    notificationManager.showErrorNotification("error", e);
                }
            } else {
                close();
                ExplorerApp.get().getViewManager().showSimpleTableProcessEditor((String) nameTextField.getValue(), (String) descriptionTextArea.getValue());
            }
        }
    });
    // Alignment
    HorizontalLayout buttonLayout = new HorizontalLayout();
    buttonLayout.setSpacing(true);
    buttonLayout.addComponent(createButton);
    addComponent(buttonLayout);
    windowLayout.setComponentAlignment(buttonLayout, Alignment.MIDDLE_CENTER);
}
Also used : UserError(com.vaadin.terminal.UserError) ObjectNode(com.fasterxml.jackson.databind.node.ObjectNode) ClickEvent(com.vaadin.ui.Button.ClickEvent) ExternalResource(com.vaadin.terminal.ExternalResource) URL(java.net.URL) HorizontalLayout(com.vaadin.ui.HorizontalLayout) Button(com.vaadin.ui.Button) Model(org.activiti.engine.repository.Model) ClickListener(com.vaadin.ui.Button.ClickListener) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper)

Example 97 with Button

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

the class SelectEditorComponent method createModelerEditorChoice.

protected void createModelerEditorChoice() {
    modelerLayout = new HorizontalLayout();
    modelerLayout.setWidth("300px");
    modelerLayout.addStyleName(ExplorerLayout.STYLE_CLICKABLE);
    addComponent(modelerLayout);
    modelerButton = new Button();
    modelerButton.setIcon(Images.PROCESS_EDITOR_BPMN);
    modelerButton.setStyleName(Reindeer.BUTTON_LINK);
    modelerLayout.addComponent(modelerButton);
    modelerLayout.setComponentAlignment(modelerButton, Alignment.MIDDLE_LEFT);
    VerticalLayout modelerTextLayout = new VerticalLayout();
    modelerLayout.addComponent(modelerTextLayout);
    modelerLayout.setExpandRatio(modelerTextLayout, 1.0f);
    modelerLabel = new Label(i18nManager.getMessage(Messages.PROCESS_EDITOR_MODELER));
    modelerLabel.addStyleName(ExplorerLayout.STYLE_CLICKABLE);
    modelerTextLayout.addComponent(modelerLabel);
    modelerDescriptionLabel = new Label(i18nManager.getMessage(Messages.PROCESS_EDITOR_MODELER_DESCRIPTION));
    modelerDescriptionLabel.addStyleName(Reindeer.LABEL_SMALL);
    modelerDescriptionLabel.addStyleName(ExplorerLayout.STYLE_CLICKABLE);
    modelerTextLayout.addComponent(modelerDescriptionLabel);
    modelerLayout.addListener(new LayoutClickListener() {

        public void layoutClick(LayoutClickEvent event) {
            preferModeler();
        }
    });
    modelerButton.addListener(new ClickListener() {

        public void buttonClick(ClickEvent event) {
            preferModeler();
        }
    });
}
Also used : LayoutClickEvent(com.vaadin.event.LayoutEvents.LayoutClickEvent) Button(com.vaadin.ui.Button) ClickEvent(com.vaadin.ui.Button.ClickEvent) LayoutClickEvent(com.vaadin.event.LayoutEvents.LayoutClickEvent) Label(com.vaadin.ui.Label) VerticalLayout(com.vaadin.ui.VerticalLayout) ClickListener(com.vaadin.ui.Button.ClickListener) LayoutClickListener(com.vaadin.event.LayoutEvents.LayoutClickListener) HorizontalLayout(com.vaadin.ui.HorizontalLayout) LayoutClickListener(com.vaadin.event.LayoutEvents.LayoutClickListener)

Example 98 with Button

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

the class ToolbarEntry method initLabelComponent.

protected void initLabelComponent() {
    titleButton = new Button(title);
    titleButton.addStyleName(Reindeer.BUTTON_LINK);
    layout.addComponent(titleButton);
    layout.setComponentAlignment(titleButton, Alignment.MIDDLE_LEFT);
    titleButton.addListener(new ClickListener() {

        private static final long serialVersionUID = 1L;

        public void buttonClick(ClickEvent event) {
            if (command != null) {
                command.toolBarItemSelected();
            }
        }
    });
}
Also used : Button(com.vaadin.ui.Button) ClickEvent(com.vaadin.ui.Button.ClickEvent) ClickListener(com.vaadin.ui.Button.ClickListener)

Example 99 with Button

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

the class ToolbarEntry method initCountComponent.

protected void initCountComponent() {
    countButton = new Button(count + "");
    countButton.addStyleName(Reindeer.BUTTON_LINK);
    countButton.addStyleName(ExplorerLayout.STYLE_TOOLBAR_COUNT);
    // Initially hidden
    countButton.setVisible(false);
    layout.addComponent(countButton);
    layout.setComponentAlignment(countButton, Alignment.MIDDLE_LEFT);
}
Also used : Button(com.vaadin.ui.Button)

Example 100 with Button

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

the class SelectUsersPopupWindow method initSelectMyselfButton.

protected void initSelectMyselfButton(HorizontalLayout searchLayout) {
    final LoggedInUser loggedInUser = ExplorerApp.get().getLoggedInUser();
    if (ignoredUserIds == null || !ignoredUserIds.contains(loggedInUser.getId())) {
        Button meButton = new Button(i18nManager.getMessage(Messages.PEOPLE_SELECT_MYSELF));
        meButton.setIcon(Images.USER_16);
        searchLayout.addComponent(meButton);
        searchLayout.setComponentAlignment(meButton, Alignment.MIDDLE_LEFT);
        if (multiSelect) {
            meButton.addListener(new ClickListener() {

                public void buttonClick(ClickEvent event) {
                    selectUser(loggedInUser.getId(), loggedInUser.getFullName());
                }
            });
        } else {
            meButton.addListener(new ClickListener() {

                public void buttonClick(ClickEvent event) {
                    addMatchingUser(loggedInUser.getId(), loggedInUser.getFullName());
                    matchingUsersTable.select(loggedInUser.getId());
                    fireEvent(new SubmitEvent(doneButton, SubmitEvent.SUBMITTED));
                    close();
                }
            });
        }
    }
}
Also used : Button(com.vaadin.ui.Button) ClickEvent(com.vaadin.ui.Button.ClickEvent) LoggedInUser(org.activiti.explorer.identity.LoggedInUser) ClickListener(com.vaadin.ui.Button.ClickListener) SubmitEvent(org.activiti.explorer.ui.event.SubmitEvent)

Aggregations

Button (com.vaadin.ui.Button)114 ClickEvent (com.vaadin.ui.Button.ClickEvent)72 ClickListener (com.vaadin.ui.Button.ClickListener)64 HorizontalLayout (com.vaadin.ui.HorizontalLayout)33 VerticalLayout (com.vaadin.ui.VerticalLayout)25 Label (com.vaadin.ui.Label)21 Chart (com.vaadin.addon.charts.Chart)8 ListSeries (com.vaadin.addon.charts.model.ListSeries)8 TextField (com.vaadin.ui.TextField)8 SubmitEvent (org.activiti.explorer.ui.event.SubmitEvent)7 Configuration (com.vaadin.addon.charts.model.Configuration)6 LayoutClickEvent (com.vaadin.event.LayoutEvents.LayoutClickEvent)6 LayoutClickListener (com.vaadin.event.LayoutEvents.LayoutClickListener)6 ClaimTaskClickListener (org.activiti.explorer.ui.task.listener.ClaimTaskClickListener)5 ComboBox (com.vaadin.ui.ComboBox)4 FormLayout (com.vaadin.ui.FormLayout)4 Window (com.vaadin.ui.Window)4 SimpleDateFormat (java.text.SimpleDateFormat)4 SubmitEventListener (org.activiti.explorer.ui.event.SubmitEventListener)4 VertexRef (org.opennms.features.topology.api.topo.VertexRef)4