Package org.jbpm.formapi.shared.api

Examples of org.jbpm.formapi.shared.api.FBScript


        dataSnapshot.put("item", getItem());
        bus.fireEvent(new UndoableEvent(dataSnapshot, new UndoableHandler() {
            @Override
            @SuppressWarnings("unchecked")
            public void undoAction(UndoableEvent event) {
                FBScript script = (FBScript) event.getData("oldScript");
                String eventName = (String) event.getData("eventName");
                Map<String, FBScript> eventActions = (Map<String, FBScript>) event.getData("eventActions");
                FBFormItem item = (FBFormItem) event.getData("item");
                eventActions.put(eventName, script);
                item.setEventActions(eventActions);
            }
            @Override
            public void onEvent(UndoableEvent event) { }
            @Override
            @SuppressWarnings("unchecked")
            public void doAction(UndoableEvent event) {
                FBScript script = (FBScript) event.getData("newScript");
                String eventName = (String) event.getData("eventName");
                Map<String, FBScript> eventActions = (Map<String, FBScript>) event.getData("eventActions");
                FBFormItem item = (FBFormItem) event.getData("item");
                eventActions.put(eventName, script);
                item.setEventActions(eventActions);
View Full Code Here


        dataSnapshot.put("eventName", eventName);
        dataSnapshot.put("item", getItem());
        bus.fireEvent(new UndoableEvent(dataSnapshot, new UndoableHandler() {
            @Override @SuppressWarnings("unchecked")
            public void undoAction(UndoableEvent event) {
                FBScript script = (FBScript) event.getData("oldScript");
                String eventName = (String) event.getData("eventName");
                FBFormItem item = (FBFormItem) event.getData("item");
                Map<String, FBScript> eventActions = (Map<String, FBScript>) event.getData("eventActions");
                eventActions.put(eventName, script);
                item.setEventActions(eventActions);
            }
            @Override
            public void onEvent(UndoableEvent event) { }
            @Override @SuppressWarnings("unchecked")
            public void doAction(UndoableEvent event) {
                FBScript script = (FBScript) event.getData("newScript");
                String eventName = (String) event.getData("eventName");
                FBFormItem item = (FBFormItem) event.getData("item");
                Map<String, FBScript> eventActions = (Map<String, FBScript>) event.getData("eventActions");
                eventActions.put(eventName, script);
                item.setEventActions(eventActions);
View Full Code Here

        add(mainPanel);
    }

    private void startScriptPanel() {
        String initialEventName = eventSelectionCombo.getValue(0);
        FBScript initialScript = eventActions.get(initialEventName);
        populateScriptHelperView(initialScript);
    }
View Full Code Here

        Button confirmButton = new Button(i18n.ConfirmButton(), new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
                int selectedIndex = eventSelectionCombo.getSelectedIndex();
                String evtName = eventSelectionCombo.getValue(selectedIndex);
                FBScript fbScript = eventActions.get(evtName);
                if (fbScript == null) {
                    fbScript = new FBScript();
                    eventActions.put(evtName, fbScript);
                }
                List<FBScriptHelper> helpers = fbScript.getHelpers();
                effect.confirmEventAction(evtName, toScript(helpers));
                hide();
            }
        });
        return confirmButton;
View Full Code Here

        Button saveContinueButton = new Button(i18n.SaveChangesButton(), new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
                int selectedIndex = eventSelectionCombo.getSelectedIndex();
                String evtName = eventSelectionCombo.getValue(selectedIndex);
                FBScript fbScript = eventActions.get(evtName);
                if (fbScript == null) {
                    fbScript = new FBScript();
                    eventActions.put(evtName, fbScript);
                }
                List<FBScriptHelper> helpers = fbScript.getHelpers();
                effect.storeEventAction(evtName, toScript(helpers));
            }
        });
        return saveContinueButton;
    }
View Full Code Here

        });
        return saveContinueButton;
    }
   
    private FBScript toScript(List<FBScriptHelper> helpers) {
        FBScript script = new FBScript();
        if (helpers != null && !helpers.isEmpty()) {
            StringBuilder sb = new StringBuilder();
            for (FBScriptHelper helper : helpers) {
                sb.append(helper.asScriptContent());
            }
            script.setContent(sb.toString());
            script.setHelpers(helpers);
        }
        script.setType("text/javascript");
        return script;
    }
View Full Code Here

                String helperName = helperSelectionCombo.getValue(helperSelectionCombo.getSelectedIndex());
                String eventName = eventSelectionCombo.getValue(eventSelectionCombo.getSelectedIndex());
                String helperClassName = helpersAvailable.get(helperName);
                try {
                    FBScriptHelper helper = (FBScriptHelper) ReflectionHelper.newInstance(helperClassName);
                    FBScript fbScript = eventActions.get(eventName);
                    if (fbScript == null) {
                        fbScript = new FBScript();
                        eventActions.put(eventName, fbScript);
                    }
                    List<FBScriptHelper> helpers = getHelpersForEvent(fbScript);
                    helpers.add(helper);
                    ScriptHelperListPanel editors = new ScriptHelperListPanel();
                    for (FBScriptHelper helper2 : helpers) {
                        editors.addScriptHelper(helper2, newScriptOrderHandler(fbScript));
                    }
                    mainPanel.remove(1);
                    mainPanel.insert(editors, 1);
                } catch (Exception e) {
                    bus.fireEvent(new NotificationEvent(Level.ERROR, "Problem starting script helper " + helperClassName, e));
                }
            }
        });
        for (Map.Entry<String, FBScript> entry : this.eventActions.entrySet()) {
            FBScript script = entry.getValue();
            List<FBScriptHelper> helpers = script == null ? new ArrayList<FBScriptHelper>() : script.getHelpers();
            String key = entry.getKey();
            FBScript fbScript = this.eventActions.get(key);
            if (fbScript == null) {
                fbScript = new FBScript();
                eventActions.put(key, fbScript);
            }
            fbScript.setHelpers(helpers);
        }
    }
View Full Code Here

        eventSelectionCombo.addChangeHandler(new ChangeHandler() {
            @Override
            public void onChange(ChangeEvent event) {
                int selectedIndex = eventSelectionCombo.getSelectedIndex();
                String eventName = eventSelectionCombo.getValue(selectedIndex);
                FBScript script = eventActions.get(eventName);
                if (script == null) {
                    script = new FBScript();
                    eventActions.put(eventName, script);
                }
                populateScriptHelperView(script);
            }
        });
View Full Code Here

    private Map<String, String> i18n = new HashMap<String, String>();
    private String format;
   
    public CompleteButtonRepresentation() {
        super("completeButton");
        this.onClickScript = new FBScript();
        this.onClickScript.setType("text/javascript");
        this.onClickScript.setContent("document.forms[0].submit();");
    }
View Full Code Here

    public String getOnEventParams(FormItemRepresentation item) {
        Map<String, FBScript> actions = item.getEventActions();
        StringBuilder builder = new StringBuilder();
        for (Map.Entry<String, FBScript> entry : actions.entrySet()) {
            String attrName = entry.getKey();
            FBScript script = entry.getValue();
            if (script != null) {
                String attrContent = script.getContent().replaceAll("\n", " ");
                builder.append(getParam(attrName, attrContent)).append(' ');
            }
        }
        return builder.toString();
    }
View Full Code Here

TOP

Related Classes of org.jbpm.formapi.shared.api.FBScript

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.