1 26 27 package org.objectweb.util.browser.core.icon; 28 29 import org.objectweb.util.browser.core.api.AssociatedIcon; 30 import org.objectweb.util.browser.core.api.BrowserProperty; 31 import org.objectweb.util.browser.core.common.AssociatedElementImpl; 32 import org.objectweb.util.browser.api.Entry; 33 import org.objectweb.util.browser.api.IconProvider; 34 import javax.swing.Icon ; 35 36 42 public class AssociatedIconImpl 43 extends AssociatedElementImpl 44 implements AssociatedIcon 45 { 46 47 51 public AssociatedIconImpl(BrowserProperty loader) { 52 super(); 53 context_ = new IconPropertyContainer(loader); 54 } 55 56 63 public Icon getIcon(Object node) { 64 return getIcon(node, false); 65 } 66 67 74 public Icon getIcon(Object node, boolean disabledJavaLangObject) { 75 if (context_ != null) { 76 Entry entry = context_.getRecursiveProperty(node); 77 if (entry != null && !(entry.getName().toString().equals("java.lang.Object") && disabledJavaLangObject)) { 78 IconProvider iconFactory = (IconProvider) entry.getValue(); 79 return iconFactory.newIcon(node); 80 } 81 } 82 return null; 83 } 84 } 85 | Popular Tags |