Package org.openbp.core.model.item.process

Examples of org.openbp.core.model.item.process.ActivityNodeImpl


      // 2. Clone the object
      // 3. Add the cloned object to the dummy process
      // 4. Generate reference names from the actual object references (e. g. for actions, sub processes, data types etc.)

      // Node that contains the selected sockets
      ActivityNodeImpl socketHolder = null;

      // List of source nodes that have been copied
      ArrayList copiedSourceNodes = new ArrayList();

      // Socket that contains the selected parameters
      NodeSocket paramHolder = null;

      for (FigureEnumeration fe = workspaceView.selectionElements(); fe.hasMoreElements();)
      {
        Figure next = fe.nextFigure();

        if (next instanceof NodeFigure)
        {
          NodeFigure nodeFigure = (NodeFigure) next;
          nodeFigure.encodeGeometry();

          Node node = nodeFigure.getNode();

          // Remember that we have copied this one
          copiedSourceNodes.add(node);

          // Clone the node and add it to the process
          node = (Node) node.clone();
          process.addNode(node);

          copyFlavor = ClientFlavors.PROCESS_ITEM;
        }

        else if (next instanceof TextElementFigure)
        {
          TextElementFigure textElementFigure = (TextElementFigure) next;
          textElementFigure.encodeGeometry();

          TextElement textElement = textElementFigure.getTextElement();

          // Clone the element and add it to the process
          textElement = (TextElement) textElement.clone();
          process.addTextElement(textElement);

          copyFlavor = ClientFlavors.PROCESS_ITEM;
        }

        else if (next instanceof SocketFigure)
        {
          SocketFigure socketFigure = (SocketFigure) next;
          socketFigure.encodeGeometry();

          NodeSocket socket = socketFigure.getNodeSocket();

          if (socketHolder == null)
          {
            socketHolder = new ActivityNodeImpl();
            socketHolder.setName("NodeDummy");
            process.addNode(socketHolder);
          }

          // Clone the socketand add it to the dummy node
          socket = (NodeSocket) socket.clone();
          socketHolder.addSocket(socket);

          copyFlavor = ClientFlavors.NODE_SOCKETS;
        }

        else if (next instanceof ParamFigure)
        {
          ParamFigure paramFigure = (ParamFigure) next;

          NodeParam param = paramFigure.getNodeParam();

          if (paramHolder == null)
          {
            if (socketHolder == null)
            {
              socketHolder = new ActivityNodeImpl();
              socketHolder.setName("NodeDummy");
              process.addNode(socketHolder);
            }

            paramHolder = new NodeSocketImpl();
            paramHolder.setName("SocketDummy");
            socketHolder.addSocket(paramHolder);
          }

          // Clone the socket and add it to the dummy node
          param = (NodeParam) param.clone();
          paramHolder.addParam(param, - 1);
View Full Code Here


          // Get the node figure to add the sockets to
          MultiSocketNodeFigure nodeFigure = (MultiSocketNodeFigure) selection;
          MultiSocketNode targetNode = (MultiSocketNode) nodeFigure.getNode();

          // Get the source node that contains the sockets
          ActivityNodeImpl node = (ActivityNodeImpl) source.getNodeByName("NodeDummy");

          workspaceView.clearSelection();

          // Add all sockets to the selected node
          List sockets = node.getSocketList();
          int n = sockets.size();
          for (int i = 0; i < n; ++i)
          {
            NodeSocket socket = (NodeSocket) sockets.get(i);
View Full Code Here

          // Get the node figure to add the sockets to
          SocketFigure socketFigure = (SocketFigure) figure;
          NodeSocket targetSocket = socketFigure.getNodeSocket();

          // Get the source node that contains the params
          ActivityNodeImpl node = (ActivityNodeImpl) source.getNodeByName("NodeDummy");

          workspaceView.clearSelection();

          // Add all params of the only socket of the source node to the selected node
          NodeSocket socket = (NodeSocket) node.getSocketList().get(0);
          List params = socket.getParamList();
          int n = params.size();
          for (int i = 0; i < n; ++i)
          {
            NodeParam param = (NodeParam) params.get(i);
View Full Code Here

   *
   * @return The new {@link ActivityNode}
   */
  public Node toNode(ProcessItem process, int syncFlags)
  {
    ActivityNode result = new ActivityNodeImpl();

    result.setProcess(process);
    result.copyFromItem(this, syncFlags);

    return result;
  }
View Full Code Here

   *
   * @return The new node
   */
  public ActivityNodeImpl createStandardActivityNode()
  {
    ActivityNodeImpl node = new ActivityNodeImpl();
    configureStandardNode(node);
    return node;
  }
View Full Code Here

TOP

Related Classes of org.openbp.core.model.item.process.ActivityNodeImpl

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.