1 26 27 package org.objectweb.util.browser.core.panel; 28 29 30 import java.util.List ; 31 import java.util.Iterator ; 32 33 import org.objectweb.util.browser.api.Entry; 34 import org.objectweb.util.browser.core.api.BrowserProperty; 35 import org.objectweb.util.browser.core.api.PanelFactory; 36 import org.objectweb.util.browser.core.api.Role; 37 import org.objectweb.util.browser.core.common.ClassesInheritance; 38 import org.objectweb.util.browser.core.common.DefaultPropertyContainer; 39 import org.objectweb.util.browser.core.common.ExtendedBoolean; 40 41 49 public class PanelPropertyContainer extends DefaultPropertyContainer { 50 51 57 61 public PanelPropertyContainer(BrowserProperty loader) { 62 super(loader); 63 } 64 65 71 76 protected Entry getElement(String className, Role role, ExtendedBoolean nodeFound) { 77 return loader_.getPanel(className, role, nodeFound); 78 } 79 80 87 protected void addEntry(String id, PanelFactory object) { 88 super.addEntry(id, object); 89 } 90 91 97 106 public void addEntry(String id, Object object) { 107 if (object != null) { 108 addEntry(id, (PanelFactory) object); 109 } 110 } 111 112 121 public Entry getRecursiveProperty(Object object) { 122 String cKey = getKey(object.getClass()); 123 if (cache_.containsKey(cKey)) { 125 return getLocalEntry((String ) cache_.get(cKey)); 126 } 127 ClassesInheritance ci = new ClassesInheritance(object.getClass()); 128 List list = ci.getInheritClasses(); 129 Iterator it = list.iterator(); 130 Entry returnedEntry = null; 131 PanelFactory panelFactory = null; 132 boolean isFirst = true; 133 while (it.hasNext()) { 134 String key = getKey((Class ) it.next());; 135 Entry entry = getLocalEntry(key); 136 if (entry == null) { 137 entry = tryToLoad(key); 138 } 139 if (entry != null) { 140 if(isFirst){ 141 cache_.put(cKey, key); 142 returnedEntry = entry; 143 panelFactory = (PanelFactory)entry.getValue(); 144 isFirst = false; 145 } else { 146 panelFactory.addInheritPanelFactory((PanelFactory)entry.getValue()); 147 } 148 PanelFactory currentPanelFactory = (PanelFactory)entry.getValue(); 149 if(!currentPanelFactory.inheritTypePanel()) break; 150 } 151 } 152 return returnedEntry; 153 } 154 155 } 156 | Popular Tags |