Esempio n. 1
0
 /**
  * Fills a SubtreeFrame with info about the subtree. Used to display info when user right clicks
  * on an existing subtree.
  */
 public void buildSubtreeFrame(SubtreeFrame sFrame) {
   // Clear visited flag on all vertices in the tree
   // and determine the layer number of the root node
   int highestLayer = 100;
   Enumeration edges = m_edgeList.elements();
   while (edges.hasMoreElements()) {
     TreeEdge edge = (TreeEdge) edges.nextElement();
     edge.getDestVertex().setVisited(false);
     edge.getSourceVertex().setVisited(false);
     if (edge.getSourceVertex().getLayer() < highestLayer) {
       highestLayer = edge.getSourceVertex().getLayer();
     }
   }
   // Create list of premises and conclusion and assign
   // to text areas in the dialog
   Vector premiseList = new Vector();
   String conclusion = "";
   String criticalQuestions = "";
   edges = m_edgeList.elements();
   while (edges.hasMoreElements()) {
     TreeEdge edge = (TreeEdge) edges.nextElement();
     TreeVertex source = edge.getSourceVertex();
     TreeVertex dest = edge.getDestVertex();
     if (!source.getVisited()) {
       if (source.getLayer() == highestLayer) {
         conclusion += (String) source.getLabel();
       } else {
         premiseList.add((String) source.getLabel());
       }
       source.setVisited(true);
     }
     if (!dest.getVisited()) {
       premiseList.add((String) dest.getLabel());
       dest.setVisited(true);
     }
   }
   sFrame.setPremisesText(premiseList);
   sFrame.setConclusionText(conclusion);
   sFrame.loadArgTypeCombo();
   // Assign the correct argument type to the combo box
   for (int index = 0; index < sFrame.selectArgumentCombo.getItemCount(); index++) {
     if (m_argumentType.getName().equals(sFrame.selectArgumentCombo.getItemAt(index))) {
       sFrame.selectArgumentCombo.setSelectedIndex(index);
       sFrame.selectArgumentCombo.setEditable(false);
       break;
     }
   }
   // Construct list of critical questions
   //    Enumeration quesList = m_argumentType.getCriticalQuestions().elements();
   //    while (quesList.hasMoreElements()) {
   //      criticalQuestions += (String)quesList.nextElement() +
   //          "\r\n _____________________________ \r\n";
   //   }
   sFrame.updateTextBoxes();
 }
Esempio n. 2
0
  /**
   * Build a shape for the entire subtree by joining together the shapes for each of its edges.
   * Vertices included since needed for FullTextPanel.
   */
  public Shape constructInternalShape(DiagramBase diagram, boolean includeVertices) {
    GeneralPath shape = new GeneralPath();
    Enumeration edges = m_edgeList.elements();
    while (edges.hasMoreElements()) {
      TreeEdge edge = (TreeEdge) edges.nextElement();
      Shape edgeShape = edge.getSchemeShape(diagram);
      PathIterator path = edgeShape.getPathIterator(null);
      shape.append(path, false);

      if (includeVertices) {
        Shape vertexShape;
        if (!edge.getSourceVertex().isVirtual()) {
          vertexShape = edge.getSourceVertex().getShape(diagram);
          path = vertexShape.getPathIterator(null);
          shape.append(path, false);
        }
        if (!edge.getDestVertex().isVirtual()) {
          vertexShape = edge.getDestVertex().getShape(diagram);
          path = vertexShape.getPathIterator(null);
          shape.append(path, false);
        }
      }
    }
    BasicStroke stroke =
        new BasicStroke(
            diagram.getSubtreeLineWidth() - DiagramBase.EDGE_OUTLINE_WIDTH + 1,
            BasicStroke.CAP_ROUND,
            BasicStroke.JOIN_MITER);
    internalShapeTable.put(diagram, stroke.createStrokedShape(shape));
    return (Shape) internalShapeTable.get(diagram);
  }
Esempio n. 3
0
 public String getInfo() {
   String info = "Edges: ";
   Enumeration edges = m_edgeList.elements();
   while (edges.hasMoreElements()) {
     TreeEdge edge = (TreeEdge) edges.nextElement();
     info += edge.getSourceVertex().getLabel() + " => " + edge.getDestVertex().getLabel() + "; ";
   }
   return info;
 }
Esempio n. 4
0
 /** Build a shape for the entire subtree by joining together the shapes for each of its edges. */
 public Shape constructShape(DiagramBase diagram) {
   GeneralPath shape = new GeneralPath();
   Enumeration edges = m_edgeList.elements();
   while (edges.hasMoreElements()) {
     TreeEdge edge = (TreeEdge) edges.nextElement();
     if (!edge.visible) {
       continue;
     }
     Shape edgeShape = edge.getSchemeShape(diagram);
     PathIterator path = edgeShape.getPathIterator(null);
     shape.append(path, false);
   }
   BasicStroke stroke =
       new BasicStroke(
           diagram.getSubtreeLineWidth(), BasicStroke.CAP_ROUND, BasicStroke.JOIN_MITER);
   shapeTable.put(diagram, stroke.createStrokedShape(shape));
   return (Shape) shapeTable.get(diagram);
 }
Esempio n. 5
0
 /** Build a shape for the entire subtree by joining together the shapes for each of its edges. */
 public Shape constructFullTextShape(DiagramBase diagram) {
   GeneralPath shape = new GeneralPath();
   Enumeration edges = m_edgeList.elements();
   while (edges.hasMoreElements()) {
     TreeEdge edge = (TreeEdge) edges.nextElement();
     if (!edge.visible) {
       continue;
     }
     Shape edgeShape = edge.getSchemeShape(diagram);
     PathIterator path = edgeShape.getPathIterator(null);
     shape.append(path, false);
     TreeVertex vertex = edge.getSourceVertex();
     if (!vertex.isVirtual()) {
       shape.append(vertex.getShape(diagram).getPathIterator(null), false);
     }
     vertex = edge.getDestVertex();
     if (!vertex.isVirtual()) {
       shape.append(vertex.getShape(diagram).getPathIterator(null), false);
     }
   }
   BasicStroke stroke = new BasicStroke(20, BasicStroke.CAP_ROUND, BasicStroke.JOIN_MITER);
   shapeTable.put(diagram, stroke.createStrokedShape(shape));
   return (Shape) shapeTable.get(diagram);
 }