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

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


      // 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;
        }
View Full Code Here


          // 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);

            socket = (NodeSocket) socket.clone();

            NamedObjectCollectionUtil.createUniqueName(socket, targetNode.getSocketList());

            targetNode.addSocket(socket);
            socket.maintainReferences(ModelObject.RESOLVE_GLOBAL_REFS | ModelObject.RESOLVE_LOCAL_REFS);

            // Add the corresponding socket figure and select it
            // TODO Feature 5: We should take care that an existing socket is not overlayed by the new socket
            SocketFigure socketFigure = nodeFigure.addSocket(socket);
            workspaceView.addToSelection(socketFigure);
View Full Code Here

        Figure figure = fe.nextFigure();
        if (figure instanceof SocketFigure)
        {
          // 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

        // Print a newline to separate the node from the last one
        w.println();
      }
      start = false;

      NodeSocket entrySocket = null;
      NodeSocket exitSocket = null;

      if (socket.isEntrySocket())
      {
        // Entry socket specified, determine the default exit socket
        entrySocket = socket;
        exitSocket = node.getDefaultExitSocket();
      }
      else
      {
        // Exit socket specified, no entry socket (e. g. for initial node)
        exitSocket = socket;
      }

      String comment = node.getDisplayText();
      if (comment != null)
      {
        w.printComment(comment, JavaTemplateWriter.COMMENT_SHORT);
      }

      if (node instanceof DecisionNode)
      {
        // Decision node: if-then-else statement
        DecisionNode decisionNode = (DecisionNode) node;

        // Determine the outgoing sockets of the decision node
        // and advance to the entry socket of the next nodes.
        NodeSocket yesSocket = getNamedSocket(node, CoreConstants.SOCKET_YES);
        yesSocket = ((ControlLink) yesSocket.getControlLinks().next()).getTargetSocket();
        NodeSocket noSocket = getNamedSocket(node, CoreConstants.SOCKET_NO);
        noSocket = ((ControlLink) noSocket.getControlLinks().next()).getTargetSocket();

        Node joinNode = skipDecisionNodeBranches(decisionNode);

        printDecisionNodeCondition(decisionNode, entrySocket);
        printDecisionNodeThen(decisionNode, yesSocket, joinNode);
View Full Code Here

    throws CodeGeneratorException
  {
    // Determine the outgoing sockets of the decision node
    // and advance to the entry socket of the next nodes.

    NodeSocket yesSocket = getNamedSocket(decisionNode, CoreConstants.SOCKET_YES);
    yesSocket = ((ControlLink) yesSocket.getControlLinks().next()).getTargetSocket();

    NodeSocket noSocket = getNamedSocket(decisionNode, CoreConstants.SOCKET_NO);
    noSocket = ((ControlLink) noSocket.getControlLinks().next()).getTargetSocket();

    return findJoiningNode(decisionNode, yesSocket, noSocket);
  }
View Full Code Here

  protected NodeSocket getNamedSocket(Node node, String name)
    throws CodeGeneratorException
  {
    for (Iterator itSockets = node.getSockets(); itSockets.hasNext();)
    {
      NodeSocket socket = (NodeSocket) itSockets.next();

      if (socket.getName().equals(name))
      {
        if (! socket.hasControlLinks())
        {
          errMsg("Error: Socket '" + name + "' of node '" + node.getQualifier() + "' not connected.");
          throw new CodeGeneratorException();
        }
        return socket;
View Full Code Here

    qualifier.setItemType(ItemTypes.PROCESS);
    ProcessItem process = (ProcessItem) modelMgr.getItemByQualifier(qualifier, true);
 
    Node startNode = process.getNodeByName("Start");
    assertTrue(startNode instanceof InitialNode);
    NodeSocket socket = (NodeSocket) startNode.getDefaultEntrySocket();
   
    List socketDescriptorList = ModelInspectorUtil.determinePossibleExits(socket, WaitStateNode.class, false);
    assertEquals(4, socketDescriptorList.size());

    Node waitStateNode = process.getNodeByName("WaitState");
View Full Code Here

        }
        else
        {
          // We may do this if the socket of the selected figure does not have a control link
          // attached or if the node of the socket supports multiple exit links
          NodeSocket socket = selectedSocketFigure.getNodeSocket();

          if (!socket.hasControlLinks() || socket.getNode().isMultiExitLinkNode())
          {
            // An exit socket with no Links has been selected
            sourceSocketFigure = selectedSocketFigure;
            targetSocketFigure = newNodeFigure.getConnectableSocket(true);
          }
View Full Code Here

      {
        Object o = selection.get(iSelected);
        if (o instanceof SocketFigure)
        {
          // Socket selected; add itsmodel qualifier
          NodeSocket socket = ((SocketFigure) o).getNodeSocket();
          qualifiers.add(socket.getQualifier());
        }
        else if (o instanceof NodeFigure)
        {
          // Node selected; add the Qualifiers of all of its sockets
          Node node = ((NodeFigure) o).getNode();
          for (Iterator itSockets = node.getSockets(); itSockets.hasNext();)
          {
            NodeSocket socket = (NodeSocket) itSockets.next();
            qualifiers.add(socket.getQualifier());
          }
        }
        else if (o instanceof FlowConnection)
        {
          // Control link selected; add the Qualifiers of its start end end sockets
View Full Code Here

        if (ie.isDataFlavorSupported(ClientFlavors.INITIAL_NODE))
          node = (SingleSocketNode) ie.getSafeTransferData(ClientFlavors.INITIAL_NODE);
        else
          node = (SingleSocketNode) ie.getSafeTransferData(ClientFlavors.FINAL_NODE);

        final NodeSocket socket = node.getSocket();

        setupSocketContextMenu(ie, socket);
      }

      // Sockets: -> set/clear Breakpoints, run to here
      if (ie.isDataFlavorSupported(ClientFlavors.NODE_SOCKET))
      {
        final NodeSocket socket = (NodeSocket) ie.getSafeTransferData(ClientFlavors.NODE_SOCKET);

        setupSocketContextMenu(ie, socket);
      }

      return EVENT_HANDLED;
View Full Code Here

TOP

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

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.