1 package org.jahia.content; 2 3 import java.util.ArrayList ; 4 import java.util.Arrays ; 5 import java.util.Comparator ; 6 7 import org.jahia.exceptions.JahiaException; 8 9 18 19 public class ContentTreeList extends ContentTree { 20 21 private static org.apache.log4j.Logger logger = 22 org.apache.log4j.Logger.getLogger(ContentTreeList.class); 23 24 private ArrayList list; 25 26 31 public ContentTreeList(ContentObject rootContentObject) { 32 super(rootContentObject); 33 this.list = new ArrayList (); 34 } 35 36 42 public void iterate(ContentTreeVisitorInterface visitor) 43 throws JahiaException { 44 this.list = new ArrayList (); 45 super.iterate(visitor); 46 } 47 48 53 public ArrayList getList(){ 54 return this.list; 55 } 56 57 public void sort(Comparator comparator){ 58 Object [] array = this.list.toArray(); 59 Arrays.sort(array,comparator); 60 this.list = new ArrayList (Arrays.asList(array)); 61 } 62 } | Popular Tags |