Ejemplo n.º 1
0
  /**
   * <code>ConstraintNode</code> - constructor
   *
   * @param constraint - <code>PwConstraint</code> -
   * @param variableNode - <code>VariableNode</code> -
   * @param constraintLocation - <code>Point</code> -
   * @param backgroundColor - <code>Color</code> -
   * @param isFreeToken - <code>boolean</code> -
   * @param isDraggable - <code>boolean</code> -
   * @param partialPlanView - <code>PartialPlanView</code> -
   */
  public ConstraintNode(
      PwConstraint constraint,
      VariableNode variableNode,
      Point constraintLocation,
      Color backgroundColor,
      boolean isFreeToken,
      boolean isDraggable,
      PartialPlanView partialPlanView) {
    super();
    this.constraint = constraint;
    this.variableNode = variableNode;
    this.isFreeToken = isFreeToken;
    this.partialPlanView = partialPlanView;
    variableNodeList = new ArrayList();
    variableNodeList.add(variableNode);
    constraintVariableLinkList = new ArrayList();
    constraintVariableLinkMap = new HashMap();

    inLayout = false;
    isUnaryConstraint = true;
    if (constraint.getVariablesList().size() > 1) {
      isUnaryConstraint = false;
    }
    isDebug = false;
    // isDebug = true;
    StringBuffer labelBuf = new StringBuffer(constraint.getName());
    labelBuf.append("\nkey=").append(constraint.getId().toString());
    nodeLabel = labelBuf.toString();
    // System.err.println( "ConstraintNode: " + nodeLabel);

    hasBeenVisited = false;
    resetNode(false);

    configure(constraintLocation, backgroundColor, isDraggable);
  } // end constructor
Ejemplo n.º 2
0
 /**
  * <code>getToolTipText</code> - when over 1/8 scale overview constraint node
  *
  * @param isOverview - <code>boolean</code> -
  * @return - <code>String</code> -
  */
 public String getToolTipText(boolean isOverview) {
   StringBuffer tip = new StringBuffer("<html> ");
   tip.append(constraint.getName());
   tip.append("<br>key=");
   tip.append(constraint.getId().toString());
   tip.append("</html>");
   return tip.toString();
 } // end getToolTipText
Ejemplo n.º 3
0
 /**
  * <code>getToolTipText</code>
  *
  * @return - <code>String</code> -
  */
 public String getToolTipText() {
   String operation = null;
   if (areNeighborsShown) {
     operation = "close";
   } else {
     operation = "open";
   }
   if ((!isUnaryConstraint) && (partialPlanView instanceof ConstraintNetworkView)) {
     StringBuffer tip = new StringBuffer("<html> ");
     tip.append(constraint.getType());
     if (isDebug) {
       tip.append(" linkCnt ").append(String.valueOf(variableLinkCount));
     }
     tip.append("<br> Mouse-L: ").append(operation);
     return tip.append(" nearest token variables</html>").toString();
   } else {
     return constraint.getType();
   }
 } // end getToolTipText
Ejemplo n.º 4
0
 /**
  * <code>resetNode</code> - when closed by token close traversal
  *
  * @param isDebug - <code>boolean</code> -
  */
 public void resetNode(boolean isDebug) {
   areNeighborsShown = false;
   if (isDebug && (variableLinkCount != 0)) {
     System.err.println(
         "reset constraint node: "
             + constraint.getId()
             + "; variableLinkCount != 0: "
             + variableLinkCount);
   }
   variableLinkCount = 0;
 } // end resetNode
Ejemplo n.º 5
0
 /**
  * <code>addConstraintNavNode</code>
  *
  * @param constraint - <code>PwConstraint</code> -
  * @return - <code>ConstraintNavNode</code> -
  */
 protected final ConstraintNavNode addConstraintNavNode(final PwConstraint constraint) {
   // ConstraintNetwork.ConstraintNode
   boolean isDraggable = true;
   PwVariable variable = (PwVariable) constraint.getVariablesList().get(0);
   ConstraintNavNode constraintNavNode =
       (ConstraintNavNode) entityNavNodeMap.get(constraint.getId());
   if (constraintNavNode == null) {
     constraintNavNode =
         new ConstraintNavNode(
             constraint,
             new Point(
                 ViewConstants.TIMELINE_VIEW_X_INIT * 2, ViewConstants.TIMELINE_VIEW_Y_INIT * 2),
             NavNodeGenerics.getVariableColor(variable, this),
             isDraggable,
             this);
     entityNavNodeMap.put(constraint.getId(), constraintNavNode);
     jGoDocument.addObjectAtTail(constraintNavNode);
   }
   return constraintNavNode;
 } // end renderConstraintNode
Ejemplo n.º 6
0
 /**
  * <code>toString</code>
  *
  * @return - <code>String</code> -
  */
 public String toString() {
   return constraint.getId().toString();
 }