Package net.java.textilej.parser

Examples of net.java.textilej.parser.IdGenerator


    root.clear();
    if (textile == null || textile.length() == 0) {
      return root;
    }
 
    IdGenerator idGenerator = new IdGenerator();
   
    OutlineItem current = root;
   
    Matcher matcher = ITEM_PATTERN.matcher(textile);
    while (matcher.find()) {
      int offset = matcher.start();
      int length = matcher.end()-offset;
      String kind = matcher.group(1);
      String levelString = matcher.group(2);
      String label = matcher.group(3);
      String tooltip = label;
      String fullLabelText = label;
      if (label == null) {
        label = "";
      } else {
        if (labelMaxLength > 0 && label.length() > labelMaxLength) {
          label = label.substring(0,labelMaxLength)+"...";
        }
      }
      int level = Integer.parseInt(levelString);
      if (level <= 0) {
        level = 1;
      }
      while (level <= current.getLevel()) {
        current = current.getParent();
      }
      current = createOutlineItem(current,idGenerator.newId(kind,fullLabelText), offset, length, label);
      current.setTooltip(tooltip);
      current.setKind(kind);
    }
   
    return root;
View Full Code Here

TOP

Related Classes of net.java.textilej.parser.IdGenerator

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.