/** * <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
/** * <code>addResourceNavNode</code> * * @param resource - <code>PwResource</code> - * @return - <code>ResourceNavNode</code> - */ protected final ResourceNavNode addResourceNavNode(final PwResource resource) { boolean isDraggable = true; ResourceNavNode resourceNavNode = (ResourceNavNode) entityNavNodeMap.get(resource.getId()); if (resourceNavNode == null) { resourceNavNode = new ResourceNavNode( resource, new Point( ViewConstants.TIMELINE_VIEW_X_INIT * 2, ViewConstants.TIMELINE_VIEW_Y_INIT * 2), getTimelineColor(resource.getId()), isDraggable, this); entityNavNodeMap.put(resource.getId(), resourceNavNode); jGoDocument.addObjectAtTail(resourceNavNode); } return resourceNavNode; } // end addResourceNavNode
/** * <code>addTimelineNavNode</code> * * @param timeline - <code>PwTimeline</code> - * @return - <code>TimelineNavNode</code> - */ protected final TimelineNavNode addTimelineNavNode(final PwTimeline timeline) { boolean isDraggable = true; TimelineNavNode timelineNavNode = (TimelineNavNode) entityNavNodeMap.get(timeline.getId()); if (timelineNavNode == null) { timelineNavNode = new TimelineNavNode( timeline, new Point( ViewConstants.TIMELINE_VIEW_X_INIT * 2, ViewConstants.TIMELINE_VIEW_Y_INIT * 2), getTimelineColor(timeline.getId()), isDraggable, this); entityNavNodeMap.put(timeline.getId(), timelineNavNode); jGoDocument.addObjectAtTail(timelineNavNode); } return timelineNavNode; } // end addTimelineNavNode
/** * <code>addModelClassNavNode</code> * * @param object - <code>PwObject</code> - * @return - <code>ModelClassNavNode</code> - */ protected final ModelClassNavNode addModelClassNavNode(final PwObject object) { boolean isDraggable = true; ModelClassNavNode objectNavNode = (ModelClassNavNode) entityNavNodeMap.get(object.getId()); if (objectNavNode == null) { objectNavNode = new ModelClassNavNode( object, new Point( ViewConstants.TIMELINE_VIEW_X_INIT * 2, ViewConstants.TIMELINE_VIEW_Y_INIT * 2), getTimelineColor(object.getId()), isDraggable, this); entityNavNodeMap.put(object.getId(), objectNavNode); jGoDocument.addObjectAtTail(objectNavNode); } return objectNavNode; } // end addModelClassNavNode
/** * <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
/** * <code>addRuleInstanceNavNode</code> * * @param ruleInstance - <code>PwRuleInstance</code> - * @return - <code>RuleInstanceNavNode</code> - */ protected final RuleInstanceNavNode addRuleInstanceNavNode(final PwRuleInstance ruleInstance) { boolean isDraggable = true; RuleInstanceNavNode ruleInstanceNavNode = (RuleInstanceNavNode) entityNavNodeMap.get(ruleInstance.getId()); if (ruleInstanceNavNode == null) { ruleInstanceNavNode = new RuleInstanceNavNode( ruleInstance, new Point( ViewConstants.TIMELINE_VIEW_X_INIT * 2, ViewConstants.TIMELINE_VIEW_Y_INIT * 2), ViewConstants.RULE_INSTANCE_BG_COLOR, isDraggable, this); entityNavNodeMap.put(ruleInstance.getId(), ruleInstanceNavNode); jGoDocument.addObjectAtTail(ruleInstanceNavNode); } return ruleInstanceNavNode; } // end addRuleInstanceNavNode
/** * <code>addTokenNavNode</code> * * @param token - <code>PwToken</code> - * @return - <code>TokenNavNode</code> - */ protected final TokenNavNode addTokenNavNode(final PwToken token) { // TokenNetwork.TokenNode TemporalExtent.TemporalNode // System.err.println( "addTokenNavNode id " + token.getId() + " " + token.getClass()); boolean isDraggable = true; TokenNavNode tokenNavNode = (TokenNavNode) entityNavNodeMap.get(token.getId()); if (tokenNavNode == null) { tokenNavNode = new TokenNavNode( token, new Point( ViewConstants.TIMELINE_VIEW_X_INIT * 2, ViewConstants.TIMELINE_VIEW_Y_INIT * 2), NavNodeGenerics.getTokenColor(token, this), isDraggable, this); entityNavNodeMap.put(token.getId(), tokenNavNode); jGoDocument.addObjectAtTail(tokenNavNode); } return tokenNavNode; } // end addTokenNavNode
/** * <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
private void renderStepContent(String query) { getDocument().deleteContents(); Color bgColor = ViewConstants.VIEW_BACKGROUND_COLOR; int x = 0, y = 5; Iterator transItr = transactionList.iterator(); int i = 1; // System.err.println( "renderStepContent: transactionList " + transactionList); while (transItr.hasNext()) { x = 0; PwTransaction transaction = (PwTransaction) transItr.next(); StepField stepNumField = new StepField( transaction.getStepNumber().toString(), new Point(x, y), JGoText.ALIGN_RIGHT, bgColor, viewableObject, vizView); jGoDocument.addObjectAtTail(stepNumField); stepNumField.setSize( (int) headerJGoView.getStepNumNode().getSize().getWidth(), (int) stepNumField.getSize().getHeight()); x += headerJGoView.getStepNumNode().getSize().getWidth(); keyField = new StepField( transaction.getId().toString(), new Point(x, y), JGoText.ALIGN_CENTER, bgColor, viewableObject); jGoDocument.addObjectAtTail(keyField); keyField.setSize( (int) headerJGoView.getKeyNode().getSize().getWidth(), (int) keyField.getSize().getHeight()); x += headerJGoView.getKeyNode().getSize().getWidth(); StepField typeField = new StepField( transaction.getType(), new Point(x, y), JGoText.ALIGN_CENTER, bgColor, viewableObject); jGoDocument.addObjectAtTail(typeField); typeField.setSize( (int) headerJGoView.getTypeNode().getSize().getWidth(), (int) typeField.getSize().getHeight()); x += headerJGoView.getTypeNode().getSize().getWidth(); if ((query.indexOf(" With ") >= 0) || ((query.indexOf(" With ") == -1) && key.equals(""))) { StepField objectKeyField = new StepField( transaction.getObjectId().toString(), new Point(x, y), JGoText.ALIGN_CENTER, bgColor, viewableObject); jGoDocument.addObjectAtTail(objectKeyField); objectKeyField.setSize( (int) headerJGoView.getObjectKeyNode().getSize().getWidth(), (int) objectKeyField.getSize().getHeight()); x += headerJGoView.getObjectKeyNode().getSize().getWidth(); } String objectName = NodeGenerics.trimName( transaction.getInfo()[0], headerJGoView.getObjectNameNode(), vizView); StepField objectNameField = new StepField(objectName, new Point(x, y), JGoText.ALIGN_CENTER, bgColor, viewableObject); jGoDocument.addObjectAtTail(objectNameField); objectNameField.setSize( (int) headerJGoView.getObjectNameNode().getSize().getWidth(), (int) objectNameField.getSize().getHeight()); x += headerJGoView.getObjectNameNode().getSize().getWidth(); String predicateName = NodeGenerics.trimName( transaction.getInfo()[1], headerJGoView.getPredicateNode(), vizView); StepField predicateField = new StepField( predicateName, new Point(x, y), JGoText.ALIGN_CENTER, bgColor, viewableObject); jGoDocument.addObjectAtTail(predicateField); predicateField.setSize( (int) headerJGoView.getPredicateNode().getSize().getWidth(), (int) predicateField.getSize().getHeight()); x += headerJGoView.getPredicateNode().getSize().getWidth(); String parameterName = NodeGenerics.trimName( transaction.getInfo()[2], headerJGoView.getParameterNode(), vizView); StepField parameterField = new StepField( parameterName, new Point(x, y), JGoText.ALIGN_CENTER, bgColor, viewableObject); jGoDocument.addObjectAtTail(parameterField); parameterField.setSize( (int) headerJGoView.getParameterNode().getSize().getWidth(), (int) parameterField.getSize().getHeight()); x += headerJGoView.getParameterNode().getSize().getWidth(); y += stepNumField.getSize().getHeight(); i++; } } // end renderSteps