1 26 27 package org.objectweb.util.browser.core.dnd; 28 29 import org.objectweb.util.browser.api.DropAction; 30 import org.objectweb.util.browser.api.Entry; 31 import org.objectweb.util.browser.core.api.AssociatedDropAction; 32 import org.objectweb.util.browser.core.api.BrowserProperty; 33 import org.objectweb.util.browser.core.api.DropActionFactory; 34 import org.objectweb.util.browser.core.common.AssociatedElementImpl; 35 36 43 public class AssociatedDropActionImpl 44 extends AssociatedElementImpl 45 implements AssociatedDropAction { 46 47 53 59 63 public AssociatedDropActionImpl(BrowserProperty loader) { 64 super(); 65 context_ = new DropActionPropertyContainer(loader); 66 } 67 68 74 80 83 public DropAction getDropAction(Object node, int dropAction) { 84 return getDropAction(node,false, dropAction); 85 } 86 87 90 public DropAction getDropAction(Object node, boolean disabledJavaLangObject, int dropAction) { 91 if (context_ != null) { 92 Entry entry = context_.getRecursiveProperty(node); 93 if (entry != null && !(entry.getName().toString().equals("java.lang.Object") && disabledJavaLangObject)) { 94 DropActionFactory dropActionFactory = (DropActionFactory) entry.getValue(); 95 return dropActionFactory.newDropAction(node, dropAction); 96 } 97 } 98 return null; 99 } 100 101 104 public String getDropLabel(Object node, int dropAction) { 105 return getDropLabel(node,false, dropAction); 106 } 107 108 111 public String getDropLabel(Object node, boolean disabledJavaLangObject, int dropAction) { 112 if (context_ != null) { 113 Entry entry = context_.getRecursiveProperty(node); 114 if (entry != null && !(entry.getName().toString().equals("java.lang.Object") && disabledJavaLangObject)) { 115 DropActionFactory dropActionFactory = (DropActionFactory) entry.getValue(); 116 return dropActionFactory.getLabel(dropAction); 117 } 118 } 119 return null; 120 } 121 } | Popular Tags |