Package org.openbp.cockpit.modeler.figures.process

Examples of org.openbp.cockpit.modeler.figures.process.SocketFigure$HiddenSocketInfo


          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");
View Full Code Here


          // Pressing the CTRL key while connecting two sockets will invoke the data link autoconnector.
          if (connectionFigure instanceof FlowConnection && !InputState.isCtrlDown())
          {
            FlowConnection flowConnectionFigure = (FlowConnection) connectionFigure;
            SocketFigure sourceSocketFigure = ((TagConnector) flowConnectionFigure.getStartConnector()).getSocketFigure();
            SocketFigure targetSocketFigure = ((TagConnector) flowConnectionFigure.getEndConnector()).getSocketFigure();
            AutoConnector autoConnector = new AutoConnector((Modeler) getEditor(), sourceSocketFigure, targetSocketFigure);
            autoConnector.autoConnectDataLinks();
          }
        }
      }
View Full Code Here

          for (FigureEnumeration fe = nodeFigure.figures(); fe.hasMoreElements();)
          {
            Figure f = fe.nextFigure();
            if (f instanceof SocketFigure)
            {
              SocketFigure socketFigure = (SocketFigure) f;

              boolean affected = false;

              if (socketFigure == startConnector.owner())
              {
                // This is the start socket of the new connection; always visible
                affected = true;
              }

              if (socketFigure == connectionFigure.startFigure() || socketFigure == connectionFigure.endFigure())
              {
                // This is the end socket of the new connection; always visible
                affected = true;
              }

              if (canLinkFigures(startSocketFigure, socketFigure))
              {
                // We can link to this socket, so it's affected.
                affected = true;
              }

              if (affected)
              {
                // Notify possibly affected sockets of the DnD operation
                String eventType = on ? VisualElementEvent.SET_DND_PARTICIPANT : VisualElementEvent.UNSET_DND_PARTICIPANT;
                socketFigure.handleEvent(new VisualElementEvent(eventType, getEditor()));
              }
            }
          }
        }
      }
View Full Code Here

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

          return true;
        }
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);

            param = (NodeParam) param.clone();

            NamedObjectCollectionUtil.createUniqueName(param, targetSocket.getParamList());

            targetSocket.addParam(param, - 1);
            param.maintainReferences(ModelObject.RESOLVE_GLOBAL_REFS | ModelObject.RESOLVE_LOCAL_REFS);

            // Add the corresponding param figure and select it
            ParamFigure paramFigure = socketFigure.addParam(param, - 1);
            workspaceView.addToSelection(paramFigure);

            ViewModeMgr.getInstance().setDataLinkVisible(true);
          }
View Full Code Here

   *
   * @param newFigure The newly added {@link NodeFigure} or {@link SocketFigure}
   */
  private void determineSocketFiguresFromSelection(Figure newFigure)
  {
    SocketFigure newSocketFigure = null;
    if (newFigure instanceof NodeFigure)
    {
      newNodeFigure = (NodeFigure) newFigure;
    }
    else if (newFigure instanceof SocketFigure)
    {
      newSocketFigure = (SocketFigure) newFigure;
    }

    // Only one element selected?
    if (workspaceView.selectionCount() != 1)
    {
      // No or multiple elements selected, can't autoconnect
      return;
    }
    selectedFigure = (Figure) workspaceView.selection().get(0);

    if (newNodeFigure != null)
    {
      // Selected is a node
      if (selectedFigure instanceof NodeFigure)
      {
        NodeFigure selectedNodeFigure = (NodeFigure) selectedFigure;
        if (newNodeFigure instanceof InitialNodeFigure)
        {
          // We inserted an initial node, link the exit socket of the new node
          // with an entry socket of the selected node (reverse way)
          sourceSocketFigure = selectedNodeFigure.getConnectableSocket(true);
          targetSocketFigure = newNodeFigure.getConnectableSocket(false);
        }
        else
        {
          // For any other nodes, link the regular way
          sourceSocketFigure = newNodeFigure.getConnectableSocket(true);
          targetSocketFigure = selectedNodeFigure.getConnectableSocket(false);
        }
      }
      else if (selectedFigure instanceof SocketFigure)
      {
        SocketFigure selectedSocketFigure = (SocketFigure) selectedFigure;
        if (selectedSocketFigure.isEntrySocket())
        {
          // An entry socket is selected
          targetSocketFigure = selectedSocketFigure;
          sourceSocketFigure = newNodeFigure.getConnectableSocket(false);
        }
        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);
          }
        }
      }
    }
    else if (newSocketFigure != null)
    {
      // Selected is a node
      if (selectedFigure instanceof NodeFigure)
      {
        NodeFigure selectedNodeFigure = (NodeFigure) selectedFigure;
        if (newSocketFigure.isEntrySocket())
        {
          // We inserted an initial node, link the exit socket of the new node
          // with an entry socket of the selected node (reverse way)
          sourceSocketFigure = selectedNodeFigure.getConnectableSocket(false);
          targetSocketFigure = newSocketFigure;
        }
        else
        {
          // For any other nodes, link the regular way
          sourceSocketFigure = newSocketFigure;
          targetSocketFigure = selectedNodeFigure.getConnectableSocket(true);
        }
      }
      else if (selectedFigure instanceof SocketFigure)
      {
        SocketFigure selectedSocketFigure = (SocketFigure) selectedFigure;
        if (selectedSocketFigure.isEntrySocket())
        {
          // An entry socket has been selected
          sourceSocketFigure = selectedSocketFigure;
          targetSocketFigure = newSocketFigure;
        }
View Full Code Here

    targetSocket = targetSocketFigure.getNodeSocket();

    if (sourceSocket.isEntrySocket())
    {
      // Swap direction
      SocketFigure tmp = sourceSocketFigure;
      sourceSocketFigure = targetSocketFigure;
      targetSocketFigure = tmp;

      sourceSocket = sourceSocketFigure.getNodeSocket();
      targetSocket = targetSocketFigure.getNodeSocket();
View Full Code Here

        if (flavor [i].equals(ModelerFlavors.PARAM_FIGURE))
        {
          final ParamFigure paramFigure = (ParamFigure) ie.getSafeTransferData(flavor [i]);
          final NodeParam nodeParam = paramFigure.getNodeParam();
          SocketFigure socketFigure = (SocketFigure) paramFigure.getParent();

          // Add the 'Parameter visibility' sub menu for all parameters of the socket if appropriate
          ParamVisibilityHelper.addParamMenu(ie, modeler, socketFigure);

          // 'Parameter Value Wizard' popup
          final NodeFigure nodeFigure = (NodeFigure) socketFigure.getParent();
          if (ParamValueWizard.isParameterValueWizardApplyable(modeler, nodeFigure, nodeParam.getSocket().getName()))
          {
            JaspiraAction wizardGroup = new JaspiraAction("popupwizard", null, null, null, null, 2, JaspiraAction.TYPE_GROUP);

            wizardGroup.addMenuChild(new JaspiraAction(modeler, "modeler.edit.paramvaluewizard")
            {
              public void actionPerformed(ActionEvent e)
              {
                // Display parameter value wizard if appropriate
                ParamValueWizard.displayParameterValueWizard(modeler, nodeFigure, nodeParam.getSocket().getName(), nodeParam.getName());
              }
            });

            ie.add(wizardGroup);
          }

          // 'Create identical process variable' popup
          String paramName = nodeParam.getName();
          if (nodeParam.getProcess().getProcessVariableByName(paramName) == null)
          {
            JaspiraAction wizardGroup = new JaspiraAction("processvargroup", null, null, null, null, 2, JaspiraAction.TYPE_GROUP);

            wizardGroup.addMenuChild(new JaspiraAction(modeler, "modeler.edit.createprocessvarfromparam")
            {
              public void actionPerformed(ActionEvent e)
              {
                // Forward to the process variables plugin
                modeler.fireEvent("variables.createprocessvarfromparam", nodeParam);
              }
            });

            ie.add(wizardGroup);
          }
        }

        if (flavor [i].equals(ModelerFlavors.SOCKET_FIGURE))
        {
          final SocketFigure socketFigure = (SocketFigure) ie.getSafeTransferData(flavor [i]);
          final NodeSocket socket = socketFigure.getNodeSocket();

          // Add the 'Parameter visibility' sub menu if appropriate
          ParamVisibilityHelper.addParamMenu(ie, modeler, socketFigure);

          // 'Parameter Value Wizard' popup
          final NodeFigure nodeFigure = (NodeFigure) socketFigure.getParent();
          if (ParamValueWizard.isParameterValueWizardApplyable(modeler, nodeFigure, socket.getName()))
          {
            JaspiraAction wizardGroup = new JaspiraAction("popupwizard", null, null, null, null, 2, JaspiraAction.TYPE_GROUP);

            wizardGroup.addMenuChild(new JaspiraAction(modeler, "modeler.edit.paramvaluewizard")
View Full Code Here

        // We have to include it if the socket or some connecting figure is selected.

        // We are decorating if the socket or its node is selected or a drop target.
        boolean decorate = false;

        SocketFigure socketFigure = null;

        if (owner instanceof SocketFigure)
        {
          socketFigure = (SocketFigure) owner;
          if ((socketFigure.getVisualStatus() & VisualElement.VISUAL_DND_PARTICIPANT) != 0)
          {
            decorate = true;
          }
          else
          {
            // No drop target, try selection of the socket or its node
            decorate = isSocketRelativeSelected(socketFigure);
            if (!decorate)
            {
              // Not selected, check if control link pointing to that node is selected
              if (socketFigure != null)
              {
                List connections = socketFigure.getFlowConnections();
                if (connections != null)
                {
                  int n = connections.size();
                  for (int i = 0; i < n; ++i)
                  {
View Full Code Here

      }
      else
      {
        if (owner instanceof SocketFigure)
        {
          SocketFigure socketFigure = (SocketFigure) owner;
          qualifier = socketFigure.getNodeSocket().getQualifier();
        }
      }

      return super.qualifies(qualifier);
    }
View Full Code Here

TOP

Related Classes of org.openbp.cockpit.modeler.figures.process.SocketFigure$HiddenSocketInfo

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.