Package org.apache.uima.taeconfigurator.model

Examples of org.apache.uima.taeconfigurator.model.FlowNodes


        return;

      CapabilityLanguageFlow clf = null;
      FixedFlow ff = null;

      String[] nodes = new FlowNodes(modelFlow).getFlow();

      if (flowTypeGUI.equals(CAPABILITY_LANGUAGE_FLOW)) {
        setFlowControllerDeclaration(null);
        getAnalysisEngineMetaData().setFlowConstraints(clf = new CapabilityLanguageFlow_impl());
        clf.setCapabilityLanguageFlow(nodes);
      } else if (flowTypeGUI.equals(FIXED_FLOW)) {
        setFlowControllerDeclaration(null);
        getAnalysisEngineMetaData().setFlowConstraints(ff = new FixedFlow_impl());
        ff.setFixedFlow(nodes);
      } else if (flowTypeGUI.equals(USER_DEFINED_FLOW)) {
        // use case: user set user-defined-flow from some other state.
        // user will have to fill in the import (CDE only supports that format)
        // flow nodes kept, put under "Fixed Flow" arbitrarily
        FlowControllerDeclaration newFcd = new FlowControllerDeclaration_impl();
        setFlowControllerDeclaration(newFcd);
        refreshFcd(newFcd);
        getAnalysisEngineMetaData().setFlowConstraints(ff = new FixedFlow_impl());
        ff.setFixedFlow(nodes);
      }
      enable();
      setFileDirty();
    }

    else if (event.widget == upButton) {
      String[] nodes = new FlowNodes(getModelFlow()).getFlow();
      // update both model and gui: swap nodes
      int selection = flowList.getSelectionIndex();
      if (selection == 0)
        return; // can't move up 0
      String temp = nodes[selection - 1];
      nodes[selection - 1] = nodes[selection];
      nodes[selection] = temp;
      finishFlowAction();
      flowList.setSelection(selection - 1);
      enable(); // after setting selection
    } else if (event.widget == downButton) {
      String[] nodes = new FlowNodes(getModelFlow()).getFlow();
      // update both model and gui: swap nodes
      int selection = flowList.getSelectionIndex();
      if (selection == flowList.getItemCount() - 1)
        return; // can't move down at end of list
      String temp = nodes[selection + 1];
View Full Code Here


  }

  public void handleRemove() {
    // get node to remove
    int removedItemIndex = flowList.getSelectionIndex();
    String[] nodes = new FlowNodes(getModelFlow()).getFlow();
    int origItemCount = nodes.length;
    // remove node from array by copying additional items above down 1
    for (int i = removedItemIndex + 1; i < origItemCount; i++) {
      nodes[i - 1] = nodes[i];
    }
    // copy array in a smaller one
    String newNodes[] = new String[origItemCount - 1];
    if (newNodes.length > 0) {
      System.arraycopy(nodes, 0, newNodes, 0, newNodes.length);
    }

    new FlowNodes(getModelFlow()).setFlow(newNodes);

    finishFlowAction(); // does also enable() and refresh()
    flowList.setSelection(removedItemIndex - 1);
    enable(); // after setting selection
  }
View Full Code Here

      // set up Fix Flow style of contraints
      //   This can happen if the style is user-defined flow
      flowConstraints = UIMAFramework.getResourceSpecifierFactory().createFixedFlow();
      getAnalysisEngineMetaData().setFlowConstraints(flowConstraints);
    }
    FlowNodes flowNodes = new FlowNodes(flowConstraints);
    String[] nodes = flowNodes.getFlow();

    if (nodes == null) {
      nodes = new String[] { node };
      flowNodes.setFlow(nodes);
    } else {
      // create a new String array and copy old Strings
      String newNodes[] = new String[nodes.length + 1];
      System.arraycopy(nodes, 0, newNodes, 0, nodes.length);
      newNodes[newNodes.length - 1] = node;
      flowNodes.setFlow(newNodes);
    }
    finishFlowAction(); // setFileDirty, enable() and setFocus()
  }
View Full Code Here

   *
   * @param node
   * @return whether the node is in the list or not
   */
  public boolean containsNode(String node) {
    String[] nodes = new FlowNodes(getModelFlow()).getFlow();
    if (null == nodes)
      return false;

    for (int i = 0; i < nodes.length; i++) {
      if (node.equals(nodes[i]))
View Full Code Here

TOP

Related Classes of org.apache.uima.taeconfigurator.model.FlowNodes

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.