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

Examples of org.openbp.cockpit.modeler.figures.process.NodeFigure


      }
      else
      {
        if (next instanceof SocketFigure)
        {
          NodeFigure nodeFigure = (NodeFigure) ((SocketFigure) next).getParent();
          Node node = nodeFigure.getNode();
          if (node instanceof SingleSocketNode)
          {
            // We may not delete the only socket of a node
            return false;
          }
View Full Code Here


      {
        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
View Full Code Here

      target.addNode(node);

      // Rebuild the references after adding the object to the target
      node.maintainReferences(ModelObject.SYNC_GLOBAL_REFNAMES);

      NodeFigure nodeFigure = drawing.createNodeFigure(node);
      if (nodeFigure == null)
      {
        target.removeNode(node);
        continue;
      }
View Full Code Here

      // If control connectors are hidden, make sure we display the connectors we can connect to
      if (!ViewModeMgr.getInstance().isControlAnchorVisible())
      {
        for (Iterator it = ((ProcessDrawing) getDrawing()).getNodeFigures(); it.hasNext();)
        {
          NodeFigure nodeFigure = (NodeFigure) it.next();

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

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

          // 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")
            {
              public void actionPerformed(ActionEvent e)
              {
                // Display parameter value wizard if appropriate
                ParamValueWizard.displayParameterValueWizard(modeler, nodeFigure, socket.getName(), null);
              }
            });

            ie.add(wizardGroup);
          }

          /* Currently unused, rathr leads to confusion
          JaspiraAction socketToNodeGroup = new JaspiraAction("popupsockettonode", null, null, null, null, 2, JaspiraAction.TYPE_GROUP);

          // 'Create initial node' popup
          socketToNodeGroup.addMenuChild(new JaspiraAction(modeler, "modeler.edit.createentryfromsocket")
          {
            public void actionPerformed(ActionEvent e)
            {
              modeler.startUndo("Create Initial Node");

              if (drawing.getProcess().getNodeByName(socket.getName()) != null)
              {
                // A node with this name already exists; issue a warning.
                // The createFinalNodeFromSocket method will ensure that the new node
                // has a unique name.
                String msg = modeler.getPluginResourceCollection().getRequiredString("messages.nodealreadyexists");
                JMsgBox.show(null, msg, JMsgBox.ICON_INFO);
              }

              // Create a node from the socket and add it to the process
              NodeFigure nodeFigure = ModelerUtil.createInitialNodeFromSocket(socketFigure);

              modeler.endUndo();
            }
          });

          if (socket.isExitSocket())
          {
            // 'Create final node' popup
            socketToNodeGroup.addMenuChild(new JaspiraAction(modeler, "modeler.edit.createexitfromsocket")
            {
              public void actionPerformed(ActionEvent e)
              {
                modeler.startUndo("Create Final Node");

                if (drawing.getProcess().getNodeByName(socket.getName()) != null)
                {
                  // A node with this name already exists; issue a warning.
                  // The createFinalNodeFromSocket method will ensure that the new node
                  // has a unique name.
                  String msg = modeler.getPluginResourceCollection().getRequiredString("messages.nodealreadyexists");
                  JMsgBox.show(null, msg, JMsgBox.ICON_INFO);
                }

                // Create a node from the socket and add it to the process
                NodeFigure nodeFigure = ModelerUtil.createFinalNodeFromSocket(socketFigure);

                modeler.endUndo();
              }
            });
          }

          ie.add(socketToNodeGroup);
           */
        }

        if (flavor [i].equals(ModelerFlavors.NODE_FIGURE))
        {
          final NodeFigure nodeFigure = (NodeFigure) ie.getSafeTransferData(flavor [i]);

          group.addMenuChild(new JaspiraAction(modeler, "modeler.edit.mirrororientation")
          {
            public void actionPerformed(ActionEvent e)
            {
              modeler.startUndo("Flip Orientation");

              nodeFigure.flipOrientation();
              workspaceView.checkDamage();

              modeler.endUndo();
            }
          });

          group.addMenuChild(new JaspiraAction(modeler, "modeler.edit.rotateorientationcw")
          {
            public void actionPerformed(ActionEvent e)
            {
              modeler.startUndo("Rotate Orientation");

              nodeFigure.changeOrientation(NodeFigure.ROTATE_CW);
              workspaceView.checkDamage();

              modeler.endUndo();
            }
          });

          group.addMenuChild(new JaspiraAction(modeler, "modeler.edit.rotateorientationccw")
          {
            public void actionPerformed(ActionEvent e)
            {
              modeler.startUndo("Rotate Orientation");

              nodeFigure.changeOrientation(NodeFigure.ROTATE_CCW);
              workspaceView.checkDamage();

              modeler.endUndo();
            }
          });
View Full Code Here

    final Figure addedFigure = (Figure) je.getObject();

    if (addedFigure instanceof NodeFigure)
    {
      // Try the autoconnector
      NodeFigure newNode = (NodeFigure) addedFigure;

      // Display parameter value wizard if desired
      if (OptionMgr.getInstance().getBooleanOption("editor.paramvaluewizard", true))
      {
        ParamValueWizard.displayParameterValueWizard(modeler, newNode, null, null);
View Full Code Here

      int minX = 20;
      int minY = 100;
      int maxX = 20;
      int maxY = 500;

      NodeFigure nf = null;
      if (getAffectedObject() instanceof NodeFigure)
      {
        nf = (NodeFigure) getAffectedObject();
        XFigure presentationFigure = (XFigure) nf.getPresentationFigure();
        XFigureDescriptor fd = presentationFigure.getDescriptor();
        minX = fd.getMinSizeX();
        minY = fd.getMinSizeY();
        maxX = fd.getMaxSizeX();
        maxY = fd.getMaxSizeY();
      }

      int newX = origX * (100 + x - anchorX) / 100;
      int newY = origY * (100 + y - anchorY) / 100;
      newX = Math.min(newX, maxX);
      newY = Math.min(newY, maxY);
      newX = Math.max(newX, minX);
      newY = Math.max(newY, minY);

      if (nf != null)
      {
        if (maintainRatio)
        {
          // Maintain aspect ratio for triangle figures
          newY = newX;
        }
        else if (heightOnly)
        {
          // When resizing circle figures, only change the figure height
          // since it determines the radius of the circle
          newY = origY * (100 + x - anchorX) / 100;
          newY = Math.min(newY, maxY);
          newY = Math.max(newY, minY);

          newX = origX;
        }

        nf.setSize(newX, newY);
      }
      else
      {
        Rectangle db = getAffectedFigure().displayBox();
        db.grow((newX - db.width) / 2, (newY - db.height) / 2);
View Full Code Here

    // Add the node to the process
    patternSocket.getProcess().addNode(node);

    // Create a node figure for the new node
    NodeFigure nodeFigure = drawing.createNodeFigure(node);

    // Position the new node
    positionNode(nodeFigure, patternSocketFigure, offset);

    // Add the node to the drawing
View Full Code Here

    // Decode the swim lane geometry
    decodeProcessGeometry(process.getGeometry());

    for (Iterator it = process.getNodes(); it.hasNext();)
    {
      NodeFigure p = createNodeFigure((Node) it.next());
      if (p != null)
        add(p);
    }

    for (Iterator it = process.getControlLinks(); it.hasNext();)
View Full Code Here

TOP

Related Classes of org.openbp.cockpit.modeler.figures.process.NodeFigure

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.