Package org.openbp.cockpit.modeler.drawing

Examples of org.openbp.cockpit.modeler.drawing.ProcessDrawing$ZComparator


    // Repair any references of the clone
    source.maintainReferences(ModelObject.RESOLVE_GLOBAL_REFS | ModelObject.RESOLVE_LOCAL_REFS);

    // We will copy to our target process
    ProcessDrawing drawing = (ProcessDrawing) workspaceView.drawing();
    ProcessItem target = drawing.getProcess();

    // Make sure the references names of the target are up to date
    target.maintainReferences(ModelObject.SYNC_LOCAL_REFNAMES | ModelObject.SYNC_GLOBAL_REFNAMES);

    // We need to make the names in the source process unique with respect to our target process
    NamedObjectCollectionUtil.createUniqueNames(source.getNodeList(), target.getNodeList());
    NamedObjectCollectionUtil.createUniqueNames(source.getTextElementList(), target.getTextElementList());
    NamedObjectCollectionUtil.createUniqueNames(source.getDataLinkList(), target.getDataLinkList());
    NamedObjectCollectionUtil.createUniqueNames(source.getControlLinkList(), target.getControlLinkList());

    // Update the reference names according to the changed object names
    source.maintainReferences(ModelObject.SYNC_LOCAL_REFNAMES);

    Figure firstFigure = null;

    // Add the nodes to the target process
    for (Iterator it = source.getNodes(); it.hasNext();)
    {
      Node node = (Node) it.next();

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

      if (firstFigure == null)
        firstFigure = nodeFigure;

      workspaceView.add(nodeFigure);
      workspaceView.addToSelection(nodeFigure);

      // Position the new node within the process drawing so that it doesn't hide an existing figure
      ModelerUtil.preventOverlap(drawing, nodeFigure);
    }

    // Add the text elements to the target process
    for (Iterator it = source.getTextElements(); it.hasNext();)
    {
      TextElement textElement = (TextElement) it.next();

      target.addTextElement(textElement);

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

      TextElementFigure textElementFigure = drawing.createTextElementFigure(textElement);
      if (textElementFigure == null)
      {
        target.removeTextElement(textElement);
        continue;
      }

      if (firstFigure == null)
        firstFigure = textElementFigure;

      workspaceView.add(textElementFigure);
      workspaceView.addToSelection(textElementFigure);

      // Position the new element within the process drawing so that it doesn't hide an existing figure
      ModelerUtil.preventOverlap(drawing, textElementFigure);
    }

    // Add the control links
    for (Iterator it = source.getControlLinks(); it.hasNext();)
    {
      ControlLink link = (ControlLink) it.next();

      target.addControlLink(link);

      // Determine the reference names after adding the object to the target
      link.maintainReferences(ModelObject.SYNC_LOCAL_REFNAMES);

      FlowConnection flowConnection = drawing.createFlowConnection(link);
      if (flowConnection == null)
      {
        target.removeControlLink(link);
        continue;
      }

      workspaceView.add(flowConnection);
      workspaceView.addToSelection(flowConnection);
    }

    // Add the data links
    for (Iterator it = source.getDataLinks(); it.hasNext();)
    {
      DataLink link = (DataLink) it.next();

      target.addDataLink(link);

      // Determine the reference names after adding the object to the target
      link.maintainReferences(ModelObject.SYNC_LOCAL_REFNAMES);

      ParamConnection paramConnection = drawing.createParamConnection(link);
      if (paramConnection == null)
      {
        target.removeDataLink(link);
        continue;
      }
View Full Code Here


          WorkspaceDrawingView view = currentModeler.getDrawingView();

          // We must clear the selection because all drawing objects will be cleared.
          view.clearSelection();

          ProcessDrawing drawing = (ProcessDrawing) view.drawing();

          // Save any geometry changes
          drawing.encodeGeometry();

          currentModeler.startUndo("Change Presentation Skin");

          // Completely reinitialize the drawing by re-setting the process
          ProcessItem process = drawing.getProcess();
          process.setSkinName(skin.getName());
          drawing.setProcess(process);

          currentModeler.endUndo();

          view.redraw();
View Full Code Here

    // Make sure that the parent-child links and control and data links are valid
    clonedProcess.maintainReferences(ModelObject.RESOLVE_LOCAL_REFS);

    processQualifier = clonedProcess.getQualifier();

    drawing = new ProcessDrawing(clonedProcess, this);
    drawing.setReadOnly(readonly);

    initializeModeler();

    if (process != null)
View Full Code Here

   * @return The new node figure
   */
  private static NodeFigure createNodeFromSocket(SingleSocketNode node, SocketFigure patternSocketFigure, int offset)
  {
    // Create a node figure for the new node
    ProcessDrawing drawing = patternSocketFigure.getDrawing();

    NodeSocket patternSocket = patternSocketFigure.getNodeSocket();

    // Copy name and parameters from the given socket to the node
    copySocketPropertiesToNode(node, patternSocket);

    // 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
    drawing.add(nodeFigure);

    // Create the corresponding figure, add it to the process and return it
    return nodeFigure;
  }
View Full Code Here

   *
   * @param referencePath Reference path to assign
   */
  public void assignPlaceholderReference(String referencePath)
  {
    ProcessDrawing drawing = getDrawing();

    drawing.getEditor().startUndo("Create placeholder reference");

    // Assign the object reference to the placeholder
    PlaceholderNode placeholderNode = (PlaceholderNode) node;
    placeholderNode.setReferencePath(referencePath);

    // Make the skin reflect the change
    updateFigure();

    // Redisplay the placeholder properties
    drawing.getView().updateSelection();

    drawing.getEditor().endUndo();

    drawing.getView().redraw();
  }
View Full Code Here

  // TODO Feature 6 Method currently not used, should be private then, is protected to prevent compiler warning
  protected void substitutePlaceholderNode(Node newNode, boolean newNodeFlag)
  {
    // TODO Feature 6: Placeholder substitution: Implement
    ProcessDrawing drawing = getDrawing();
    ProcessItem process = drawing.getProcess();

    // Save any geometry changes
    drawing.encodeGeometry();

    drawing.getEditor().startUndo("Replace placeholder");

    // Add the new node to the process
    process.addNode(node);
    node.maintainReferences(ModelObject.SYNC_GLOBAL_REFNAMES | ModelObject.SYNC_LOCAL_REFNAMES);

    // Try to connect the control and data links from/to the placeholder to the new node

    // If the orientation of the new node figure and the drawing don't match,
    // rotate the figure
    PlaceholderNode plNode = (PlaceholderNode) getNode();

    // Try to connect

    // Iterate all sockets of the placeholder
    for (Iterator itSockets = plNode.getSockets(); itSockets.hasNext();)
    {
      // TODO Feature 6 NodeSocket plSocket = (NodeSocket) itSockets.next();
    }

    // Reinitialize the drawing
    drawing.setProcess(process);

    drawing.getEditor().endUndo();

    drawing.getView().redraw();
  }
View Full Code Here

  {
    clipboardSupport = new ClipboardSupport(workspaceView, getPluginResourceCollection(), true);

    // Get the node's dummy process
    ProcessItem process = node.getProcess();
    drawing = new ProcessDrawing(process, this);

    // In the component editor, we always display parameters and flow connectors
    drawing.setDisplayAll(true);

    figure = (MultiSocketNodeFigure) drawing.figureAt(0);
View Full Code Here

    // We don't need no oversize for a one-node workspace (to prevent unnessecary scrolling)
    workspaceView.setSizeOffset(0);

    // This is just temporary; will be reinitialized when calling setNode
    drawing = new ProcessDrawing(new ProcessItemImpl(), this);
    workspaceView.setDrawing(drawing);

    toolSupport = new ModelerToolSupport(this);
    StandardToolSupportSetup.setupToolSupport(toolSupport, false);
View Full Code Here

  private boolean isDisplayedInNodeItemEditor(VisualElement ve)
  {
    if (ve != null)
    {
      ProcessDrawing drawing = ve.getDrawing();
      if (drawing != null)
      {
        if (drawing.getEditor() instanceof NodeItemEditorPlugin)
          return true;
      }
    }
    return false;
  }
View Full Code Here

    // Add the link to the process
    process.addDataLink(dataLink);

    // Now create a connection figure and add it to the drawing
    ProcessDrawing drawing = modeler.getDrawing();
    ParamConnection connection = drawing.createParamConnection(dataLink);
    drawing.add(connection);

    // Layout the connection
    connection.layoutAndAdjustConnection();

    connectedDataLink = true;
View Full Code Here

TOP

Related Classes of org.openbp.cockpit.modeler.drawing.ProcessDrawing$ZComparator

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.