1 19 package org.openide.nodes; 20 21 import javax.swing.JPanel ; 22 23 24 31 public class IndexedNode extends AbstractNode { 32 33 private Index indexImpl; 34 35 38 public IndexedNode() { 39 super(new Index.ArrayChildren()); 40 indexImpl = (Index) getChildren(); 41 } 42 43 48 protected IndexedNode(Children children, Index indexImpl) { 49 super(children); 50 this.indexImpl = indexImpl; 51 } 52 53 58 public boolean hasCustomizer() { 59 return false; 60 } 61 62 65 public java.awt.Component getCustomizer() { 66 java.awt.Container c = new JPanel (); 67 @SuppressWarnings ("deprecation") 68 IndexedCustomizer customizer = new IndexedCustomizer(c, false); 69 customizer.setObject(indexImpl); 70 71 return c; 72 } 73 74 79 public <T extends Node.Cookie> T getCookie(Class <T> clazz) { 80 if (clazz.isInstance(indexImpl)) { 81 return clazz.cast(indexImpl); 83 } 84 85 Children ch = getChildren(); 86 87 if (clazz.isInstance(ch)) { 88 return clazz.cast(ch); 90 } 91 92 return super.getCookie(clazz); 93 } 94 } 95 | Popular Tags |