@Override
  public Map<String, String> getEditorParameters(
      final Path path, final String editorID, String hostInfo, PlaceRequest place) {
    List<String> activeNodesList = new ArrayList<String>();
    String activeNodesParam = place.getParameter("activeNodes", null);

    String readOnly = place.getParameter("readOnly", "false");
    String encodedProcessSource = place.getParameter("encodedProcessSource", "");

    if (activeNodesParam != null) {
      activeNodesList = Arrays.asList(activeNodesParam.split(","));
    }

    List<String> completedNodesList = new ArrayList<String>();
    String completedNodesParam = place.getParameter("completedNodes", null);

    if (completedNodesParam != null) {
      completedNodesList = Arrays.asList(completedNodesParam.split(","));
    }

    JSONArray activeNodesArray = new JSONArray(activeNodesList);
    String encodedActiveNodesParam;
    try {
      encodedActiveNodesParam =
          Base64.encodeBase64URLSafeString(activeNodesArray.toString().getBytes("UTF-8"));
    } catch (UnsupportedEncodingException e) {
      encodedActiveNodesParam = "";
    }

    JSONArray completedNodesArray = new JSONArray(completedNodesList);
    String encodedCompletedNodesParam;
    try {
      encodedCompletedNodesParam =
          Base64.encodeBase64URLSafeString(completedNodesArray.toString().getBytes("UTF-8"));
    } catch (UnsupportedEncodingException e) {
      encodedCompletedNodesParam = "";
    }

    Map<String, String> editorParamsMap = new HashMap<String, String>();
    editorParamsMap.put("hostinfo", hostInfo);
    editorParamsMap.put("uuid", path.toURI());
    editorParamsMap.put("profile", "jbpm");
    editorParamsMap.put("pp", "");
    editorParamsMap.put("editorid", editorID);
    editorParamsMap.put("readonly", readOnly);
    editorParamsMap.put("activenodes", encodedActiveNodesParam);
    editorParamsMap.put("completednodes", encodedCompletedNodesParam);
    editorParamsMap.put("processsource", encodedProcessSource);

    return editorParamsMap;
    //        String editorURL = hostInfo + "/editor/?uuid=" + path.toURI() +
    // "&profile=jbpm&pp=&editorid=" + editorID + "&readonly=" + readOnly +
    //                "&activenodes=" + encodedActiveNodesParam + "&completednodes=" +
    // encodedCompletedNodesParam;
    //        return getEditorResponse( editorURL, encodedProcessSource );
  }
  @OnStartup
  public void onStartup(final ObservablePath path, final PlaceRequest place) {
    init(path, place, resourceType, true, false, SAVE, COPY, RENAME, DELETE);

    // This is only used to define the "name" used by @WorkbenchPartTitle which is called by
    // Uberfire after @OnStartup
    // but before the async call in "loadContent()" has returned. When the *real* plugin is loaded
    // this is overwritten
    final String name = place.getParameter("name", "");
    plugin = new Plugin(name, PluginType.PERSPECTIVE_LAYOUT, path);
    this.layoutEditorPlugin.init(name, lookupPerspectiveDragComponents());
    this.perspectiveEditorView.setupLayoutEditor(layoutEditorPlugin.asWidget());
  }
 @OnOpen
 public void onOpen() {
   this.currentProcessDefinition = place.getParameter("processName", "");
   view.setCurrentFilter(currentProcessDefinition);
   refreshActiveProcessList();
 }
Ejemplo n.º 4
0
  @OnStartup
  public void onStartup(final ObservablePath path, final PlaceRequest place) {
    this.path = path;
    this.place = place;
    this.isReadOnly = place.getParameter("readOnly", null) == null ? false : true;
    this.version = place.getParameter("version", null);

    this.path.onRename(
        new Command() {
          @Override
          public void execute() {
            changeTitleNotification.fire(new ChangeTitleWidgetEvent(place, getTitle(), null));
          }
        });
    this.path.onConcurrentUpdate(
        new ParameterizedCommand<ObservablePath.OnConcurrentUpdateEvent>() {
          @Override
          public void execute(final ObservablePath.OnConcurrentUpdateEvent eventInfo) {
            concurrentUpdateSessionInfo = eventInfo;
          }
        });

    this.path.onConcurrentRename(
        new ParameterizedCommand<ObservablePath.OnConcurrentRenameEvent>() {
          @Override
          public void execute(final ObservablePath.OnConcurrentRenameEvent info) {
            newConcurrentRename(
                    info.getSource(),
                    info.getTarget(),
                    info.getIdentity(),
                    new Command() {
                      @Override
                      public void execute() {
                        disableMenus();
                      }
                    },
                    new Command() {
                      @Override
                      public void execute() {
                        reload();
                      }
                    })
                .show();
          }
        });

    this.path.onConcurrentDelete(
        new ParameterizedCommand<ObservablePath.OnConcurrentDelete>() {
          @Override
          public void execute(final ObservablePath.OnConcurrentDelete info) {
            newConcurrentDelete(
                    info.getPath(),
                    info.getIdentity(),
                    new Command() {
                      @Override
                      public void execute() {
                        disableMenus();
                      }
                    },
                    new Command() {
                      @Override
                      public void execute() {
                        placeManager.closePlace(place);
                      }
                    })
                .show();
          }
        });

    makeMenuBar();

    view.showBusyIndicator(CommonConstants.INSTANCE.Loading());

    multiPage.addWidget(view, DSLTextEditorConstants.INSTANCE.DSL());

    multiPage.addPage(
        new Page(metadataWidget, CommonConstants.INSTANCE.MetadataTabTitle()) {
          @Override
          public void onFocus() {
            metadataWidget.showBusyIndicator(CommonConstants.INSTANCE.Loading());
            metadataService
                .call(
                    new MetadataSuccessCallback(metadataWidget, isReadOnly),
                    new HasBusyIndicatorDefaultErrorCallback(metadataWidget))
                .getMetadata(path);
          }

          @Override
          public void onLostFocus() {
            // Nothing to do
          }
        });

    loadContent();
  }