Package misc

Examples of misc.ResultTreeNode


  /**
   * highlightText highlights text with the matches informations stored in the resultTree
   * @param matches
   */
  private void highlightText(ResultTreeNode matches) {
    ResultTreeNode node;
    highlighter.removeAllHighlights();
    for (Enumeration e = matches.depthFirstEnumeration(); e.hasMoreElements() ;) {     
      try {
        node = (ResultTreeNode)e.nextElement();
        highlighter.addHighlight(node.getIndexStart(), node.getIndexEnd(), highlightPainter);
      }
      catch (Exception evt) { evt.printStackTrace(); }
    }
  }
View Full Code Here


  /**
   * This method creates the displayable tree from matched groups
  **/
  private ResultTreeNode getResultTree(String pattern, String text) {
   
    resultTree = new ResultTreeNode(Application.messages.getString("TITLE_RESULT"), "", 0, 0);
    resultTree.setToolTipText("<html>"+Application.messages.getString("TOOLTIP_RESULTS_ROOT")+"</html>");
    Pattern p = Pattern.compile(pattern);
    Matcher m = p.matcher(text);
   
    // Creation of the tree from the matched results
View Full Code Here

   * This method recursively adds leaves to the group's leaf
  **/ @SuppressWarnings("unchecked")
  private ResultTreeNode getResultTree(Matcher m, int groupIndex) {
    // Create the leaf for the current group and add it to the used groups vector
    usedGroups.add(groupIndex);
    ResultTreeNode treeNode = new ResultTreeNode(m.group(groupIndex), "", m.start(groupIndex), m.end(groupIndex));
 
    // Seek for children
    for (int i = groupIndex+1; i < m.groupCount(); i++) {
     
      // if the group #i is contained by the current group and has never been added in the tree, add it !
      if (m.start(i) >= m.start(groupIndex) && m.end(i) <= m.end(groupIndex) && !usedGroups.contains(i)) {
        ResultTreeNode child = getResultTree(m, i);
        treeNode.add(child);
      }
    }
    return treeNode;
  }
View Full Code Here

   *  
   * @return javax.swing.JTree 
   */
  private JTree getJResultTree() {
    if (jResultTree == null) {
      jResultTree = new JTree((ResultTreeNode)new ResultTreeNode("Results", "", 0, 0));
      jResultTree.setCellRenderer(renderer);
    }
    return jResultTree;
  }
View Full Code Here

TOP

Related Classes of misc.ResultTreeNode

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.