Package org.jbpm.formbuilder.client.bus

Examples of org.jbpm.formbuilder.client.bus.UndoableHandler


    protected void createStyles() {
        final Map<String, Object> dataSnapshot = new HashMap<String, Object>();
        dataSnapshot.put("selectedX", getParent().getAbsoluteLeft());
        dataSnapshot.put("selectedY", getParent().getAbsoluteTop());
        dataSnapshot.put("item", getItem());
        bus.fireEvent(new UndoableEvent(dataSnapshot, new UndoableHandler() {
            @Override
            public void undoAction(UndoableEvent event) {
                TabbedLayoutFormItem item = (TabbedLayoutFormItem) event.getData("item");
                Integer selectedX = (Integer) event.getData("selectedX");
                Integer selectedY = (Integer) event.getData("selectedY");
View Full Code Here


        I18NFormItem item = (I18NFormItem) getItem();
        Map<String, Object> dataSnapshot = new HashMap<String, Object>();
        dataSnapshot.put("item", item);
        dataSnapshot.put("oldFormat", item.getFormat());
        dataSnapshot.put("newFormat", I18NFormItem.Format.valueOf(savedFormat));
        bus.fireEvent(new UndoableEvent(dataSnapshot, new UndoableHandler() {
            @Override
            public void undoAction(UndoableEvent event) {
                I18NFormItem item = (I18NFormItem) event.getData("item");
                I18NFormItem.Format format = (I18NFormItem.Format) event.getData("oldFormat");
                item.setFormat(format);
View Full Code Here

        Map<String, Object> dataSnapshot = new HashMap<String, Object>();
        dataSnapshot.put("formItem", formItem);
        dataSnapshot.put("menuItem", menuItem);
        dataSnapshot.put("x", x);
        dataSnapshot.put("y", y);
        this.bus.fireEvent(new UndoableEvent(dataSnapshot, new UndoableHandler() {
            @Override
            public void onEvent(UndoableEvent event) {  }
            @Override
            public void undoAction(UndoableEvent event) {
                FBFormItem formItem = (FBFormItem) event.getData("formItem");
View Full Code Here

        dataSnapshot.put("movable", movable);
        dataSnapshot.put("oldMovableX", movable.getAbsoluteLeft());
        dataSnapshot.put("oldMovableY", movable.getAbsoluteTop());
        dataSnapshot.put("x", x);
        dataSnapshot.put("y", y);
        this.bus.fireEvent(new UndoableEvent(dataSnapshot, new UndoableHandler() {
            @Override
            public void onEvent(UndoableEvent event) {  }
            @Override
            public void undoAction(UndoableEvent event) {
                FBFormItem formItem = (FBFormItem) event.getData("formItem");
View Full Code Here

        Map<String, Object> dataSnapshot = new HashMap<String, Object>();
        HasSourceReference item = (HasSourceReference) getItem();
        dataSnapshot.put("item", item);
        dataSnapshot.put("oldSrcUrl", item.getSourceReference());
        dataSnapshot.put("newSrcUrl", getSrcUrl());
        bus.fireEvent(new UndoableEvent(dataSnapshot, new UndoableHandler() {
            @Override
            public void onEvent(UndoableEvent event) { }
            @Override
            public void undoAction(UndoableEvent event) {
                HasSourceReference item = (HasSourceReference) event.getData("item");
View Full Code Here

    private final I18NConstants i18n = FormBuilderGlobals.getInstance().getI18n();
    private final EventBus bus = CommonGlobals.getInstance().getEventBus();
   
    public FormExporter() {
        bus.addHandler(UndoableEvent.TYPE, new UndoableHandler() {
            @Override
            public void onEvent(UndoableEvent event) {
                bus.fireEvent(new GetFormRepresentationEvent(EXPORT_TYPE));
            }
            @Override
View Full Code Here

   
    /**
     * Registers itself to listen every {@link UndoableEvent}
     */
    private UndoRedoManager() {
        bus.addHandler(UndoableEvent.TYPE, new UndoableHandler() {
            @Override
            public void onEvent(UndoableEvent event) {
                syncAdd(event);
            }
            @Override
View Full Code Here

                dataSnapshot.put("newAction", event.getAction());
                dataSnapshot.put("newProcessId", event.getProcessId());
                dataSnapshot.put("newTaskId", event.getTaskId());
                dataSnapshot.put("newMethod", event.getMethod());
                dataSnapshot.put("newEnctype", event.getEnctype());
                bus.fireEvent(new UndoableEvent(dataSnapshot, new UndoableHandler() {
                    @Override
                    public void onEvent(UndoableEvent event) {  }
                    @Override
                    public void undoAction(UndoableEvent event) {
                        String name = (String) event.getData("oldName");
                        String action = (String) event.getData("oldAction");
                        String taskId = (String) event.getData("oldTaskId");
                        String processId = (String) event.getData("oldProcessId");
                        String method = (String) event.getData("oldMethod");
                        String enctype = (String) event.getData("oldEnctype");
                        populateFormData(action, processId, taskId, name, method, enctype);
                    }
                    @Override
                    public void doAction(UndoableEvent event) {
                        String name = (String) event.getData("newName");
                        String action = (String) event.getData("newAction");
                        String taskId = (String) event.getData("newTaskId");
                        String processId = (String) event.getData("newProcessId");
                        String method = (String) event.getData("newMethod");
                        String enctype = (String) event.getData("newEnctype");
                        populateFormData(action, processId, taskId, name, method, enctype);
                    }
                }));
            }
        });
        this.bus.addHandler(TaskSelectedEvent.TYPE, new TaskSelectedHandler() {
            @Override
            public void onSelectedTask(TaskSelectedEvent event) {
                Map<String, Object> dataSnapshot = new HashMap<String, Object>();
                dataSnapshot.put("oldTaskID", layoutView.getFormDisplay().getTaskId());
                dataSnapshot.put("oldProcessID", layoutView.getFormDisplay().getProcessId());
                dataSnapshot.put("oldTaskInputs", layoutView.getFormDisplay().getInputs());
                dataSnapshot.put("oldTaskOutputs", layoutView.getFormDisplay().getOutputs());
                if (event.getSelectedTask() != null) {
                    dataSnapshot.put("newTaskID", event.getSelectedTask().getTaskId());
                    Map<String, InputData> inputs = new HashMap<String, InputData>();
                    Map<String, OutputData> outputs = new HashMap<String, OutputData>();
                    if (event.getSelectedTask().getInputs() != null) {
                        for (TaskPropertyRef input : event.getSelectedTask().getInputs()) {
                            InputData in = new InputData();
                            in.setName(input.getName());
                            in.setValue(input.getSourceExpresion());
                            inputs.put(input.getName(), in);
                        }
                    }
                    if (event.getSelectedTask().getOutputs() != null) {
                        for (TaskPropertyRef output : event.getSelectedTask().getOutputs()) {
                            OutputData out = new OutputData();
                            out.setName(output.getName());
                            out.setValue(output.getSourceExpresion());
                            outputs.put(output.getName(), out);
                        }
                    }
                    dataSnapshot.put("newTaskInputs", inputs);
                    dataSnapshot.put("newTaskOutputs", outputs);
                }
                dataSnapshot.put("newTaskID", event.getSelectedTask() == null ? null : event.getSelectedTask().getTaskId());
                dataSnapshot.put("newProcessID", event.getSelectedTask() == null ? null : event.getSelectedTask().getProcessId());
                dataSnapshot.put("newTaskInputs", event.getSelectedTask() == null ? null : event.getSelectedTask().getInputs());
                dataSnapshot.put("newTaskOutputs", event.getSelectedTask() == null ? null : event.getSelectedTask().getOutputs());
                bus.fireEvent(new UndoableEvent(dataSnapshot, new UndoableHandler() {
                    @Override
                    public void onEvent(UndoableEvent event) { }
                    @Override
                    @SuppressWarnings("unchecked")
                    public void doAction(UndoableEvent event) {
                        String value = (String) event.getData("newTaskID");
                        String procId = (String) event.getData("newProcessID");
                        List<TaskPropertyRef> inputs = (List<TaskPropertyRef>) event.getData("newTaskInputs");
                        List<TaskPropertyRef> outputs = (List<TaskPropertyRef>) event.getData("newTaskOutputs");
                        layoutView.getFormDisplay().setTaskId(value);
                        layoutView.getFormDisplay().setProcessId(procId);
                        layoutView.getFormDisplay().setInputs(toInputs(inputs));
                        layoutView.getFormDisplay().setOutputs(toOutputs(outputs));
                    }
                    @Override
                    @SuppressWarnings("unchecked")
                    public void undoAction(UndoableEvent event) {
                        String value = (String) event.getData("oldTaskID");
                        String procId = (String) event.getData("oldProcessID");
                        List<TaskPropertyRef> inputs = (List<TaskPropertyRef>) event.getData("oldTaskInputs");
                        List<TaskPropertyRef> outputs = (List<TaskPropertyRef>) event.getData("oldTaskOutputs");
                        layoutView.getFormDisplay().setTaskId(value);
                        layoutView.getFormDisplay().setProcessId(procId);
                        layoutView.getFormDisplay().setInputs(toInputs(inputs));
                        layoutView.getFormDisplay().setOutputs(toOutputs(outputs));
                    }
                }));
            }
        });
       
        bus.addHandler(FormSavedEvent.TYPE, new FormSavedHandler() {
            @Override
            public void onEvent(FormSavedEvent event) {
                layoutView.getFormDisplay().setSaved(true);
            }
        });
       
        bus.addHandler(UpdateFormViewEvent.TYPE, new UpdateFormViewHandler() {
            @Override
            public void onEvent(UpdateFormViewEvent event) {
                Map<String, Object> dataSnapshot = new HashMap<String, Object>();
                dataSnapshot.put("newForm", event.getFormRepresentation());
                dataSnapshot.put("oldForm", layoutView.getFormDisplay().createRepresentation());
                bus.fireEvent(new UndoableEvent(dataSnapshot, new UndoableHandler() {
                    @Override
                    public void undoAction(UndoableEvent event) {
                        FormRepresentation oldForm = (FormRepresentation) event.getData("oldForm");
                        try {
                            layoutView.getFormDisplay().populate(oldForm);
View Full Code Here

    public void execute() {
        Map<String, Object> dataSnapshot = new HashMap<String, Object>();
        dataSnapshot.put("selectedItem", getSelectedItem());
        dataSnapshot.put("oldItemParent", getSelectedItem() == null ? null : getSelectedItem().getParent());
        dataSnapshot.put("oldMemory", AbstractCopyPasteCommand.getMemory());
        fireUndoableEvent(dataSnapshot, new UndoableHandler() {
            @Override
            public void doAction(UndoableEvent event) {
                FBFormItem item = (FBFormItem) event.getData("selectedItem");
                if (item == null) {
                    AbstractCopyPasteCommand.setMemory(null);
View Full Code Here

                  public void execute() {
                      Map<String, Object> dataSnapshot = new HashMap<String, Object>();
                      dataSnapshot.put("menuItem", CustomMenuItem.this);
                      dataSnapshot.put("groupName", groupName);
                      final EventBus bus = CommonGlobals.getInstance().getEventBus();
                      bus.fireEvent(new UndoableEvent(dataSnapshot, new UndoableHandler() {
                          @Override
                          public void onEvent(UndoableEvent event) { }
                          @Override
                          public void undoAction(UndoableEvent event) {
                              FBMenuItem item = (FBMenuItem) event.getData("menuItem");
View Full Code Here

TOP

Related Classes of org.jbpm.formbuilder.client.bus.UndoableHandler

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.