Package org.olat.core.util.traversal

Examples of org.olat.core.util.traversal.GenericTraversalNode


  public void renderValue(StringOutput sb, int row, Renderer renderer) {
    StringOutput sbuf = new StringOutput();
    super.renderValue(sbuf, row, renderer);
    String val = sbuf.toString();
    Object m = messages.get(getTable().getSortedRow(row));
    GenericTraversalNode gtn = getTreeWalker().getGenericTraversalNode(m);
    // + "..."+gtn.getDepth()+", vnr:"+gtn.getVisitNumber();
    sb.append("<div style=\"white-space: nowrap;"); // do not wrap titles, looks unsexy
    int indent = gtn.getDepth(); // starts with 1
    if (indent > MAXINDENTS) indent = MAXINDENTS;
    if (toIndent) {
      sb.append("padding-left: ");
      sb.append(Formatter.roundToString(((float)indent-1)/2, 2));
      sb.append("em;");
View Full Code Here


    // we take the treewalker which we built previously and use the visitednr
    // attribute to specify sort order
    Object a = messages.get(rowa);
    Object b = messages.get(rowb); // both are messages; to be compared
    TreeWalker treeWalker = getTreeWalker();
    GenericTraversalNode gtna = treeWalker.getGenericTraversalNode(a);
    GenericTraversalNode gtnb = treeWalker.getGenericTraversalNode(b);
    int sortedposa = gtna.getVisitNumber(); // the visitednumber was determined
                                            // by the sorting algorithm,
                                            // therefore it is the sorted
                                            // position
    int sortedposb = gtnb.getVisitNumber();
    int diff = sortedposa - sortedposb;
    int res = (diff == 0 ? 0 : (diff > 0 ? 1 : -1));
    return res;
  }
View Full Code Here

      /**
       * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
       */
      public int compare(Object a, Object b) {
        boolean asc = true; //ascending;
        GenericTraversalNode ga = (GenericTraversalNode) a;
        GenericTraversalNode gb = (GenericTraversalNode) b;
        Message ma = (Message) ga.getItem();
        Message mb = (Message) gb.getItem();
        Date da = ma.getCreationDate();
        Date db = mb.getCreationDate();
        // TODO:fj: avoid allocation of lots of new Date objects
        // timestamp and date did not compare? recheck.
        // See also http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5103041 for the java 1.4/1.5 code bug
View Full Code Here

TOP

Related Classes of org.olat.core.util.traversal.GenericTraversalNode

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.