1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
|
public void showBookmarkTree(){
topBook =new DefaultMutableTreeNode("Bookmarks");
ArrayList annots=(ArrayList)bookmark_xml.selectNodes("//bookmark");
Iterator ite= annots.iterator();
ArrayList artRealNames=new ArrayList();
HashMap annotPage=new HashMap();
HashMap annotTitle= new HashMap();
while(ite.hasNext()){
Element ann= (Element)ite.next();
String name= ann.attributeValue("artikel");
String page = ann.attributeValue("page_log");
String title = ann.getText();
artRealNames.add(title);
annotPage.put(title, page);
annotTitle.put(title, name);
}
Collections.sort(artRealNames);
ArrayList createTree=new ArrayList();
ite= artRealNames.iterator();
DefaultMutableTreeNode artName = null;
DefaultMutableTreeNode titel = null;
String artnameOld="";
while(ite.hasNext()){
String titre=(String)ite.next();
String page=(String)annotPage.get(titre);
System.out.println("11111");
titre=titre+" ("+annotTitle.get(titre)+")";
titel= new DefaultMutableTreeNode(new TreeNode(titre,page));
topBook.add(titel);
}
bookmarkNavtree = new JTree(topBook);
ActionMap actionMap = bookmarkNavtree.getActionMap();
removeAction("copy", actionMap);
removeAction("cut", actionMap);
removeAction("paste", actionMap);
} |
Partager