Exemplo n.º 1
0
  /**
   * <code>VariableNode</code> - constructor
   *
   * @param variable - <code>PwVariable</code> -
   * @param tokenNode - <code>TokenNode</code> -
   * @param variableLocation - <code>Point</code> -
   * @param backgroundColor - <code>Color</code> -
   * @param isFreeToken - <code>boolean</code> -
   * @param isDraggable - <code>boolean</code> -
   * @param partialPlanView - <code>PartialPlanView</code> -
   */
  public VariableNode(
      final PwVariable variable,
      final VariableContainerNode parentNode,
      final Point variableLocation,
      final Color backgroundColor,
      final boolean isDraggable,
      final PartialPlanView partialPlanView) {
    super(ViewConstants.PINCHED_RECTANGLE);
    this.variable = variable;
    this.partialPlanView = partialPlanView;
    containerNodeList = new ArrayList();
    containerNodeList.add(parentNode);
    constraintNodeList = new ArrayList();
    variableContainerLinkList = new ArrayList();
    this.backgroundColor = backgroundColor;

    inLayout = false;
    hasZeroConstraints = true;
    if (variable.getConstraintList().size() > 0) {
      hasZeroConstraints = false;
    }
    hasBeenVisited = false;

    isDebug = false;
    // isDebug = true;
    StringBuffer labelBuf = new StringBuffer(variable.getDomain().toString());
    labelBuf.append("\nkey=").append(variable.getId().toString());
    nodeLabel = labelBuf.toString();
    // System.err.println( "VariableNode: " + nodeLabel);

    configure(variableLocation, backgroundColor, isDraggable);
  } // end constructor
Exemplo n.º 2
0
 /**
  * <code>getToolTipText</code>
  *
  * @return - <code>String</code> -
  */
 public String getToolTipText() {
   if (variable == null) {
     return null;
   }
   String operation = null;
   if (areNeighborsShown()) {
     operation = "close";
   } else {
     operation = "open";
   }
   StringBuffer tip = new StringBuffer("<html> ");
   boolean isVariableWithConstraints =
       (!hasZeroConstraints) && (partialPlanView instanceof ConstraintNetworkView);
   NodeGenerics.getVariableNodeToolTipText(variable, partialPlanView, tip);
   if (isDebug) {
     tip.append(" linkCnt ").append(String.valueOf(constraintLinkCount));
   }
   if (partialPlanView.getZoomFactor() > 1) {
     tip.append("<br>key=");
     tip.append(variable.getId().toString());
   }
   if (isVariableWithConstraints) {
     tip.append("<br> Mouse-L: ").append(operation);
   }
   return tip.append("</html>").toString();
 } // end getToolTipText
Exemplo n.º 3
0
 /**
  * <code>getToolTipText</code> - when over 1/8 scale overview variable node implements
  * OverviewToolTip
  *
  * @param isOverview - <code>boolean</code> -
  * @return - <code>String</code> -
  */
 public String getToolTipText(boolean isOverview) {
   StringBuffer tip = new StringBuffer("<html> ");
   NodeGenerics.getVariableNodeToolTipText(variable, partialPlanView, tip);
   tip.append("<br>key=");
   tip.append(variable.getId().toString());
   tip.append("</html>");
   return tip.toString();
 } // end getToolTipText
Exemplo n.º 4
0
 /**
  * <code>addVariableNavNode</code>
  *
  * @param variable - <code>PwVariable</code> -
  * @return - <code>VariableNavNode</code> -
  */
 protected final VariableNavNode addVariableNavNode(final PwVariable variable) {
   // ConstraintNetwork.VariableNode
   boolean isDraggable = true;
   VariableNavNode variableNavNode = (VariableNavNode) entityNavNodeMap.get(variable.getId());
   if (variableNavNode == null) {
     variableNavNode =
         new VariableNavNode(
             variable,
             new Point(
                 ViewConstants.TIMELINE_VIEW_X_INIT * 2, ViewConstants.TIMELINE_VIEW_Y_INIT * 2),
             NavNodeGenerics.getVariableColor(variable, this),
             isDraggable,
             this);
     entityNavNodeMap.put(variable.getId(), variableNavNode);
     jGoDocument.addObjectAtTail(variableNavNode);
   }
   return variableNavNode;
 } // end renderVariableNode
Exemplo n.º 5
0
 /**
  * <code>resetNode</code> - when closed by token close traversal
  *
  * @param isDebug - <code>boolean</code> -
  */
 public void resetNode(boolean isDebug) {
   setAreNeighborsShown(false);
   if (isDebug && (constraintLinkCount != 0)) {
     System.err.println(
         "reset variable node: "
             + variable.getId()
             + "; constraintLinkCount != 0: "
             + constraintLinkCount);
   }
   constraintLinkCount = 0;
   if (isDebug && (containerLinkCount != 0)) {
     System.err.println(
         "reset variable node: "
             + variable.getId()
             + "; containerLinkCount != 0: "
             + containerLinkCount);
   }
   containerLinkCount = 0;
 } // end resetNode
Exemplo n.º 6
0
 public boolean equals(VariableNode v) {
   return variable.getId().equals(v.getVariable().getId());
 }
Exemplo n.º 7
0
 /**
  * <code>toString</code>
  *
  * @return - <code>String</code> -
  */
 public String toString() {
   return variable.getId().toString();
 }