1 26 27 package org.objectweb.util.browser.core.popup; 28 29 import org.objectweb.util.browser.api.Entry; 30 import org.objectweb.util.browser.api.MenuItemTreeView; 31 import org.objectweb.util.browser.core.common.AssociatedElementImpl; 32 import org.objectweb.util.browser.core.common.DynamicTree; 33 import org.objectweb.util.browser.core.api.AssociatedMenu; 34 import org.objectweb.util.browser.core.api.BrowserProperty; 35 import org.objectweb.util.browser.core.api.MenuFactory; 36 37 43 public class AssociatedMenuImpl 44 extends AssociatedElementImpl 45 implements AssociatedMenu { 46 47 48 protected DynamicTree tree_ = null; 49 50 53 public AssociatedMenuImpl(BrowserProperty loader, DynamicTree tree) { 54 super(); 55 context_ = new MenuPropertyContainer(loader); 56 tree_ = tree; 57 } 58 59 66 public AdvancedJPopupMenu getMenu(Object node, MenuItemTreeView treeView) { 67 return getMenu(node, false, treeView); 68 } 69 70 77 public AdvancedJPopupMenu getMenu(Object node, boolean disabledJavaLangObject, MenuItemTreeView treeView) { 78 if (context_ != null) { 79 Entry entry = context_.getRecursiveProperty(node); 80 if (entry != null && !(entry.getName().toString().equals("java.lang.Object") && disabledJavaLangObject)) { 81 MenuFactory menuFactory = (MenuFactory) entry.getValue(); 82 return menuFactory.newMenu(node, tree_, treeView); 83 } 84 } 85 return null; 86 } 87 88 94 public AdvancedJPopupMenu getParentMenu(Object parent) { 95 if (context_ != null) { 96 Entry parentFactoryEntry = context_.getRecursiveProperty(parent); 97 if (parentFactoryEntry != null) { 98 MenuFactory parentFactory = (MenuFactory) parentFactoryEntry.getValue(); 99 return parentFactory.newParentMenu(tree_); 100 } 101 } 102 return null; 103 } 104 } 105 | Popular Tags |