Examples of TagConnector


Examples of org.openbp.cockpit.modeler.figures.tag.TagConnector

  /**
   * Checks if the direction is locked.
   */
  public boolean isOrientationLocked()
  {
    TagConnector startConnector = (TagConnector) getStartConnector();
    TagConnector endConnector = (TagConnector) getEndConnector();

    return startConnector.isOrientationLocked() || endConnector.isOrientationLocked();
  }
View Full Code Here

Examples of org.openbp.cockpit.modeler.figures.tag.TagConnector

  /**
   * Toggles the orientation lock.
   */
  public void toggleOrientationLock()
  {
    TagConnector startConnector = (TagConnector) getStartConnector();
    TagConnector endConnector = (TagConnector) getEndConnector();

    boolean startLocked = startConnector.isOrientationLocked();
    boolean endLocked = endConnector.isOrientationLocked();

    if (startLocked && endLocked)
    {
      // Unlock the orientation of the associated connectors
      if (startLocked)
      {
        startConnector.setLockedOrientation(Orientation.UNDETERMINED);
      }
      if (endLocked)
      {
        endConnector.setLockedOrientation(Orientation.UNDETERMINED);
      }
    }
    else
    {
      // Lock the orientation of the associated connectors
      if (!startLocked)
      {
        startConnector.toggleOrientationLock();
      }
      if (!endLocked)
      {
        endConnector.toggleOrientationLock();
      }
    }
  }
View Full Code Here

Examples of org.openbp.cockpit.modeler.figures.tag.TagConnector

  /**
   * Flips (toggles) the locked orientation of the associated parameter figures.
   */
  public void flipOrientation()
  {
    TagConnector startConnector = (TagConnector) getStartConnector();
    TagConnector endConnector = (TagConnector) getEndConnector();

    // First, lock the orientation of the associated figures
    if (!startConnector.isOrientationLocked())
    {
      startConnector.toggleOrientationLock();
    }
    if (!endConnector.isOrientationLocked())
    {
      endConnector.toggleOrientationLock();
    }

    Orientation startOrientation = startConnector.getLockedOrientation();
    Orientation endOrientation = endConnector.getLockedOrientation();

    // Order of orientations to toggle:
    // ^ ^
    // v ^
    // ^ v
    // v v

    if ((startOrientation == Orientation.TOP || startOrientation == Orientation.LEFT) && (endOrientation == Orientation.TOP || endOrientation == Orientation.LEFT))
    {
      startConnector.flipOrientation();
    }
    else if ((startOrientation == Orientation.BOTTOM || startOrientation == Orientation.RIGHT) && (endOrientation == Orientation.TOP || endOrientation == Orientation.LEFT))
    {
      startConnector.flipOrientation();
      endConnector.flipOrientation();
    }
    else if ((startOrientation == Orientation.TOP || startOrientation == Orientation.LEFT) && (endOrientation == Orientation.BOTTOM || endOrientation == Orientation.RIGHT))
    {
      startConnector.flipOrientation();
    }
    else if ((startOrientation == Orientation.BOTTOM || startOrientation == Orientation.RIGHT) && (endOrientation == Orientation.BOTTOM || endOrientation == Orientation.RIGHT))
    {
      startConnector.flipOrientation();
      endConnector.flipOrientation();
    }
  }
View Full Code Here

Examples of org.openbp.cockpit.modeler.figures.tag.TagConnector

    }
  }

  public void layoutAndAdjustConnection()
  {
    TagConnector startConnector = (TagConnector) getStartConnector();
    TagConnector endConnector = (TagConnector) getEndConnector();

    Orientation startOrientation = startConnector.getOrientation();
    Orientation endOrientation = endConnector.getOrientation();

    SocketFigure startSocketFigure = (SocketFigure) ((ParamFigure) startFigure()).getParent();
    SocketFigure endSocketFigure = (SocketFigure) ((ParamFigure) endFigure()).getParent();
    Figure startNodeFigure = startSocketFigure.getParent();
    Figure endNodeFigure = endSocketFigure.getParent();

    Point startCenter = startSocketFigure.center();
    Point endCenter = endSocketFigure.center();
    Orientation startSocketOrientation = CircleConstants.determineOrientation(startSocketFigure.getAngle(), startNodeFigure.displayBox());
    Orientation endSocketOrientation = CircleConstants.determineOrientation(endSocketFigure.getAngle(), endNodeFigure.displayBox());
    boolean startSocketIsVertical = startSocketOrientation == Orientation.TOP || startSocketOrientation == Orientation.BOTTOM;
    boolean endSocketIsVertical = endSocketOrientation == Orientation.TOP || endSocketOrientation == Orientation.BOTTOM;
    boolean socketsInSync = startSocketIsVertical == endSocketIsVertical;

    // TODO Fix 4: Param autoconnector orientation doesn't work optimal, test...
    if (socketsInSync)
    {
      endOrientation = startOrientation;
    }
    else
    {
      if (startSocketOrientation == Orientation.LEFT || startSocketOrientation == Orientation.RIGHT)
      {
        if (startCenter.y <= endCenter.y)
          startOrientation = Orientation.BOTTOM;
        else
          startOrientation = Orientation.TOP;
      }

      if (startSocketOrientation == Orientation.TOP || startSocketOrientation == Orientation.BOTTOM)
      {
        if (startCenter.x <= endCenter.x)
          startOrientation = Orientation.RIGHT;
        else
          startOrientation = Orientation.LEFT;
      }

      if (endSocketOrientation == Orientation.LEFT || endSocketOrientation == Orientation.RIGHT)
      {
        if (startCenter.y <= endCenter.y)
          endOrientation = Orientation.TOP;
        else
          endOrientation = Orientation.BOTTOM;
      }

      if (endSocketOrientation == Orientation.TOP || endSocketOrientation == Orientation.BOTTOM)
      {
        if (startCenter.x <= endCenter.x)
          endOrientation = Orientation.LEFT;
        else
          endOrientation = Orientation.RIGHT;
      }

      /*
      if (verticalRelationship)
      {
        // Vertical line, connectors can be LEFT and RIGHT for param connections
        if (startCenter.x < endCenter.x)
        {
          startOrientation = Orientation.RIGHT;
          endOrientation = Orientation.LEFT;
        }
        else
        {
          startOrientation = Orientation.LEFT;
          endOrientation = Orientation.RIGHT;
        }
      }
      else
      {
        // Horizontal line, connectors can be TOP and BOTTOM for param connections
        if (startCenter.y < endCenter.y)
        {
          startOrientation = Orientation.BOTTOM;
          endOrientation = Orientation.TOP;
        }
        else
        {
          startOrientation = Orientation.TOP;
          endOrientation = Orientation.BOTTOM;
        }
        startConnector.setLockedOrientation(startOrientation);
        endConnector.setLockedOrientation(endOrientation);
      }
       */
    }

    startConnector.setLockedOrientation(startOrientation);
    endConnector.setLockedOrientation(endOrientation);

    // Perform a simple connection layout
    layoutConnection();
  }
View Full Code Here

Examples of org.openbp.cockpit.modeler.figures.tag.TagConnector

  protected String encode()
  {
    String result = super.encode();

    TagConnector startConnector = (TagConnector) getStartConnector();
    TagConnector endConnector = (TagConnector) getEndConnector();
    if ((startConnector != null && startConnector.getLockedOrientation() != Orientation.UNDETERMINED) && (endConnector != null && endConnector.getLockedOrientation() != Orientation.UNDETERMINED))
    {
      result = result + "|orientation:" + startConnector.getLockedOrientation() + ":" + endConnector.getLockedOrientation();
    }

    return result;
  }
View Full Code Here

Examples of org.openbp.cockpit.modeler.figures.tag.TagConnector

    }
  }

  public Connector connectorAt(int x, int y)
  {
    return new TagConnector(this);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.