コード例 #1
0
  /**
   * <code>addSlotNavNode</code>
   *
   * @param slot - <code>PwSlot</code> -
   * @return - <code>SlotNavNode</code> -
   */
  protected final SlotNavNode addSlotNavNode(final PwSlot slot) {
    boolean isDraggable = true;
    PwTimeline timeline = partialPlan.getTimeline(slot.getTimelineId());

    //     System.err.println( "addSlotNavNode id = " + slot.getId());
    //     System.err.println( "entityNavNodeMap ");
    //     List keyList = new ArrayList( entityNavNodeMap.keySet());
    //     Iterator keyItr = keyList.iterator();
    //     while (keyItr.hasNext()) {
    //       Integer key = (Integer) keyItr.next();
    //       System.err.println( "  key " + key + " " + entityNavNodeMap.get( key).getClass());
    //     }

    SlotNavNode slotNavNode = (SlotNavNode) entityNavNodeMap.get(slot.getId());
    if (slotNavNode == null) {
      slotNavNode =
          new SlotNavNode(
              slot,
              new Point(
                  ViewConstants.TIMELINE_VIEW_X_INIT * 2, ViewConstants.TIMELINE_VIEW_Y_INIT * 2),
              getTimelineColor(timeline.getId()),
              isDraggable,
              this);
      entityNavNodeMap.put(slot.getId(), slotNavNode);
      jGoDocument.addObjectAtTail(slotNavNode);
    }
    return slotNavNode;
  } // end addSlotNavNode
コード例 #2
0
 public final String toString() {
   StringBuffer buf = new StringBuffer("key=");
   buf.append(id.toString()).append("; ");
   if (type == DbConstants.D_OBJECT) {
     if (partialPlan.getResource(entityId) != null) {
       buf.append("Resource ");
     } else if (partialPlan.getTimeline(entityId) != null) {
       buf.append("Timeline ");
     } else if (partialPlan.getObject(entityId) != null) {
       buf.append("Object ");
     }
   } else if (type == DbConstants.D_TOKEN) {
     buf.append("Token ");
   } else if (type == DbConstants.D_VARIABLE) {
     buf.append("Variable ");
   }
   buf.append("key=").append(entityId.toString());
   return buf.toString();
 }
コード例 #3
0
 /**
  * <code>renderEntityPathNodes</code>
  *
  * @param findEntityPath - <code>FindEntityPath</code> -
  * @return - <code>List</code> -
  */
 public List renderEntityPathNodes(final FindEntityPath findEntityPath) {
   boolean isLayoutNeeded = false;
   List nodeList = new ArrayList();
   Iterator entityItr = findEntityPath.getEntityKeyList().iterator();
   PwEntity entity = null;
   boolean isFirstNode = true;
   while (entityItr.hasNext()) {
     Integer entityKey = (Integer) entityItr.next();
     // System.err.println( "key " + entityKey);
     if ((entity = partialPlan.getToken(entityKey)) != null) {
       TokenNavNode tokenNode = null;
       if (isFirstNode) {
         isFirstNode = false;
         tokenNode = (TokenNavNode) renderInitialNode(entity);
         if (didRenderInitialNodeChange) {
           isLayoutNeeded = true;
         }
       } else {
         PwToken token = (PwToken) entity;
         tokenNode = addTokenNavNode(token);
         if (!tokenNode.areNeighborsShown()) {
           if (tokenNode.addTokenObjects(tokenNode)) {
             isLayoutNeeded = true;
           }
           tokenNode.setAreNeighborsShown(true);
         }
       }
       nodeList.add(tokenNode);
     } else if ((entity = partialPlan.getVariable(entityKey)) != null) {
       VariableNavNode variableNode = null;
       if (isFirstNode) {
         isFirstNode = false;
         variableNode = (VariableNavNode) renderInitialNode(entity);
         if (didRenderInitialNodeChange) {
           isLayoutNeeded = true;
         }
       } else {
         PwVariable variable = (PwVariable) entity;
         variableNode = addVariableNavNode(variable);
         if (!variableNode.areNeighborsShown()) {
           if (variableNode.addVariableObjects(variableNode)) {
             isLayoutNeeded = true;
           }
           variableNode.setAreNeighborsShown(true);
         }
       }
       nodeList.add(variableNode);
     } else if ((entity = partialPlan.getConstraint(entityKey)) != null) {
       ConstraintNavNode constraintNode = null;
       if (isFirstNode) {
         isFirstNode = false;
         constraintNode = (ConstraintNavNode) renderInitialNode(entity);
         if (didRenderInitialNodeChange) {
           isLayoutNeeded = true;
         }
       } else {
         PwConstraint constraint = (PwConstraint) entity;
         constraintNode = addConstraintNavNode(constraint);
         if (!constraintNode.areNeighborsShown()) {
           if (constraintNode.addConstraintObjects(constraintNode)) {
             isLayoutNeeded = true;
           }
           constraintNode.setAreNeighborsShown(true);
         }
       }
       nodeList.add(constraintNode);
     } else if ((entity = partialPlan.getRuleInstance(entityKey)) != null) {
       RuleInstanceNavNode ruleInstanceNode = null;
       if (isFirstNode) {
         isFirstNode = false;
         ruleInstanceNode = (RuleInstanceNavNode) renderInitialNode(entity);
         if (didRenderInitialNodeChange) {
           isLayoutNeeded = true;
         }
       } else {
         PwRuleInstance ruleInstance = (PwRuleInstance) entity;
         ruleInstanceNode = addRuleInstanceNavNode(ruleInstance);
         if (!ruleInstanceNode.areNeighborsShown()) {
           if (ruleInstanceNode.addRuleInstanceObjects(ruleInstanceNode)) {
             isLayoutNeeded = true;
           }
           ruleInstanceNode.setAreNeighborsShown(true);
         }
       }
       nodeList.add(ruleInstanceNode);
     } else if ((entity = partialPlan.getSlot(entityKey)) != null) {
       SlotNavNode slotNode = null;
       if (isFirstNode) {
         isFirstNode = false;
         slotNode = (SlotNavNode) renderInitialNode(entity);
         if (didRenderInitialNodeChange) {
           isLayoutNeeded = true;
         }
       } else {
         PwSlot slot = (PwSlot) entity;
         slotNode = addSlotNavNode(slot);
         if (!slotNode.areNeighborsShown()) {
           if (slotNode.addSlotObjects(slotNode)) {
             isLayoutNeeded = true;
           }
           slotNode.setAreNeighborsShown(true);
         }
       }
       nodeList.add(slotNode);
     } else if ((entity = partialPlan.getTimeline(entityKey)) != null) {
       TimelineNavNode timelineNode = null;
       if (isFirstNode) {
         isFirstNode = false;
         timelineNode = (TimelineNavNode) renderInitialNode(entity);
         if (didRenderInitialNodeChange) {
           isLayoutNeeded = true;
         }
       } else {
         PwTimeline timeline = (PwTimeline) entity;
         timelineNode = addTimelineNavNode(timeline);
         if (!timelineNode.areNeighborsShown()) {
           if (timelineNode.addTimelineObjects(timelineNode)) {
             isLayoutNeeded = true;
           }
           timelineNode.setAreNeighborsShown(true);
         }
       }
       nodeList.add(timelineNode);
     } else if ((entity = partialPlan.getResource(entityKey)) != null) {
       ResourceNavNode resourceNode = null;
       if (isFirstNode) {
         isFirstNode = false;
         resourceNode = (ResourceNavNode) renderInitialNode(entity);
         if (didRenderInitialNodeChange) {
           isLayoutNeeded = true;
         }
       } else {
         PwResource resource = (PwResource) entity;
         resourceNode = addResourceNavNode(resource);
         if (!resourceNode.areNeighborsShown()) {
           if (resourceNode.addResourceObjects(resourceNode)) {
             isLayoutNeeded = true;
           }
           resourceNode.setAreNeighborsShown(true);
         }
       }
       nodeList.add(resourceNode);
     } else if ((entity = partialPlan.getObject(entityKey)) != null) {
       // PwObject must be last
       ModelClassNavNode objectNode = null;
       if (isFirstNode) {
         isFirstNode = false;
         objectNode = (ModelClassNavNode) renderInitialNode(entity);
         if (didRenderInitialNodeChange) {
           isLayoutNeeded = true;
         }
       } else {
         PwObject object = (PwObject) entity;
         objectNode = addModelClassNavNode(object);
         if (!objectNode.areNeighborsShown()) {
           if (objectNode.addObjects(objectNode)) {
             isLayoutNeeded = true;
           }
           objectNode.setAreNeighborsShown(true);
         }
       }
       nodeList.add(objectNode);
     } else {
       System.err.println(
           "NavigatorView.renderEntityPathNodes: entityKey " + entityKey + " not handled");
     }
   }
   if (isLayoutNeeded) {
     // System.err.println( "NavigatorView.renderEntityPathNodes: setLayoutNeeded");
     setLayoutNeeded();
   }
   setFocusNode(null);
   highlightPathNodesList = nodeList;
   redraw();
   return nodeList;
 } // end renderEntityPathNodes