private int findResourceYLoc(final PwResource resourceToFind) {
   int yLoc = 0;
   Iterator resourceTransSetItr = resourceTransactionSetList.iterator();
   while (resourceTransSetItr.hasNext()) {
     ResourceTransactionSet resourceTransSet = (ResourceTransactionSet) resourceTransSetItr.next();
     if (resourceToFind.getId().equals(resourceTransSet.getResource().getId())) {
       return resourceTransSet.getTransactionSetYOrigin();
     }
   }
   return yLoc;
 } // end findResourceYLoc
 /**
  * <code>findAndSelectResource</code>
  *
  * @param resourceToFind - <code>PwResource</code> -
  * @param xLoc - <code>int</code> -
  */
 public final void findAndSelectResource(final PwResource resourceToFind, final int xLoc) {
   boolean isResourceFound = false;
   Iterator resourceSetListItr = resourceTransactionSetList.iterator();
   while (resourceSetListItr.hasNext()) {
     ResourceTransactionSet resourceTransactionSet =
         (ResourceTransactionSet) resourceSetListItr.next();
     //       System.err.println( "resourceToFind id = " + resourceToFind.getId() +
     //                           " resource id = " +
     // resourceTransactionSet.getResource().getId());
     if (resourceTransactionSet.getResource().getId().equals(resourceToFind.getId())) {
       System.err.println(
           "ResourceTransactionView found resource: "
               + resourceToFind.getName()
               + " (key="
               + resourceToFind.getId().toString()
               + ")");
       isResourceFound = true;
       this.getJGoLevelScaleViewSelection().clearSelection();
       this.getJGoExtentViewSelection().clearSelection();
       this.getJGoExtentViewHScrollBar()
           .setValue(Math.max(0, (int) (xLoc - (this.getJGoExtentViewSize().getWidth() / 2))));
       this.getJGoExtentViewVScrollBar()
           .setValue(
               Math.max(
                   0,
                   (int)
                       (findResourceYLoc(resourceToFind)
                           - (this.getJGoExtentViewSize().getHeight() / 2))));
       Iterator nameNodeItr = resourceNameNodeList.iterator();
       while (nameNodeItr.hasNext()) {
         ResourceNameNode nameNode = (ResourceNameNode) nameNodeItr.next();
         if (nameNode.getResource().getId().equals(resourceToFind.getId())) {
           this.getJGoLevelScaleViewSelection().extendSelection(nameNode);
           break;
         }
       }
     }
   }
   if (!isResourceFound) {
     // Content Spec filtering may cause this to happen
     String message =
         "Resource '"
             + resourceToFind.getName()
             + "' (key="
             + resourceToFind.getId().toString()
             + ") not found.";
     JOptionPane.showMessageDialog(
         PlanWorks.getPlanWorks(),
         message,
         "Resource Not Found in ResourceTransactionView",
         JOptionPane.ERROR_MESSAGE);
     System.err.println(message);
   }
 } // end findAndSelectResource
 /**
  * <code>findNearestResource</code>
  *
  * @param dCoords - <code>Point</code> -
  * @return - <code>PwResource</code> -
  */
 protected final PwResource findNearestResource(final Point dCoords) {
   int docY = (int) dCoords.getY();
   PwResource resourceCandidate = null;
   Iterator reourceTransSetItr = resourceTransactionSetList.iterator();
   while (reourceTransSetItr.hasNext()) {
     ResourceTransactionSet resourceTransSet = (ResourceTransactionSet) reourceTransSetItr.next();
     if (docY >= resourceTransSet.getTransactionSetYOrigin()) {
       resourceCandidate = resourceTransSet.getResource();
     } else {
       break;
     }
   }
   return resourceCandidate;
 } // end findNearestResource
 /**
  * <code>computeMaxResourceLabelWidth</code>
  *
  * @return - <code>int</code> -
  */
 protected final int computeMaxResourceLabelWidth() {
   boolean isNamesOnly = true;
   int maxWidth = ViewConstants.JGO_SCROLL_BAR_WIDTH * 2;
   // resourceList will come from partialPlan
   List resourceList = partialPlan.getResourceList(); // createDummyData( isNamesOnly);
   Iterator resourceItr = resourceList.iterator();
   while (resourceItr.hasNext()) {
     PwResource resource = (PwResource) resourceItr.next();
     int width = ResourceTransactionSet.getNodeLabelWidth(resource.getName(), this);
     if (width > maxWidth) {
       maxWidth = width;
     }
   }
   return maxWidth;
 } // end computeMaxResourceLabelWidth
 /**
  * <code>findAndSelectResourceTransaction</code>
  *
  * @param resourceTransToFind - <code>PwResourceTransaction</code> -
  */
 public final void findAndSelectResourceTransaction(
     final PwResourceTransaction resourceTransToFind) {
   boolean isResourceTransFound = false;
   if ((resourceTransToFind.getParentId() != null)
       && (!resourceTransToFind.getParentId().equals(DbConstants.NO_ID))) {
     PwResource resourceToFind =
         (PwResource) partialPlan.getObject(resourceTransToFind.getParentId());
     //       System.err.println( "findAndSelectResourceTransaction resourceToFind " +
     //                           resourceToFind);
     Iterator resourceSetListItr = resourceTransactionSetList.iterator();
     foundIt:
     while (resourceSetListItr.hasNext()) {
       ResourceTransactionSet resourceTransactionSet =
           (ResourceTransactionSet) resourceSetListItr.next();
       if (resourceTransactionSet.getResource().getId().equals(resourceToFind.getId())) {
         Iterator transNodeItr = resourceTransactionSet.getTransactionNodeList().iterator();
         while (transNodeItr.hasNext()) {
           ResourceTransactionNode transNode = (ResourceTransactionNode) transNodeItr.next();
           if (transNode.getTransaction().getId().equals(resourceTransToFind.getId())) {
             System.err.println(
                 "ResourceTransactionView found resourceTransaction: "
                     + resourceTransToFind.getName()
                     + " (key="
                     + resourceTransToFind.getId().toString()
                     + ")");
             isResourceTransFound = true;
             this.getJGoLevelScaleViewSelection().clearSelection();
             this.getJGoExtentViewSelection().clearSelection();
             this.getJGoExtentViewHScrollBar()
                 .setValue(
                     Math.max(
                         0,
                         (int)
                             (transNode.getLocation().getX()
                                 - (this.getJGoExtentViewSize().getWidth() / 2))));
             this.getJGoExtentViewVScrollBar()
                 .setValue(
                     Math.max(
                         0,
                         (int)
                             (transNode.getLocation().getY()
                                 - (this.getJGoExtentViewSize().getHeight() / 2))));
             this.getJGoExtentViewSelection().extendSelection(transNode);
             break foundIt;
           }
         }
       }
     }
     if (!isResourceTransFound) {
       // Content Spec filtering may cause this to happen
       String message =
           "Resource Transaction'"
               + resourceTransToFind.getName()
               + "' (key="
               + resourceTransToFind.getId().toString()
               + ") not found.";
       JOptionPane.showMessageDialog(
           PlanWorks.getPlanWorks(),
           message,
           "Resource TransactionNot Found in ResourceTransactionView",
           JOptionPane.ERROR_MESSAGE);
       System.err.println(message);
     }
   }
 } // end findAndSelectResourceTransaction