Skip to content

Commit df28751

Browse files
hansonrhansonr
authored andcommitted
Adds JSUtil.getJ2SAlias(Component c, String name) and .isOverridden()
1 parent d5bddb5 commit df28751

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

sources/net.sf.j2s.java.core/src/swingjs/JSUtil.java

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package swingjs;
22

3+
import java.awt.Component;
34
import java.awt.JSComponent;
45
import java.awt.Toolkit;
56
import java.io.BufferedInputStream;
@@ -572,5 +573,29 @@ public static BufferedReader getJSONReader(Object is) {
572573
return JSON.getJSONReader((InputStream) is);
573574
}
574575

576+
/**
577+
* Retrieve the JavaScript method or field aliasing this component's method or field
578+
* @param c the component
579+
* @param name the method's fully qualified name, such as paint$java_awt_Graphics
580+
* @return the JavaScript function backing this method name
581+
*/
582+
public static Object getJ2SAlias(Component c, String name) {
583+
return (/** @j2sNative c[name] || */null);
584+
}
585+
586+
/**
587+
*
588+
* @param f the JavaScript function aliasing the Java method
589+
* @param cl
590+
* @return
591+
*/
592+
public static boolean isOverridden(Object f, Class<?> cl) {
593+
return (/** @j2sNative f && f.exClazz != cl.$clazz$ || */false);
594+
}
595+
596+
public static boolean isOverridden(Component c, String name, Class<?> cl) {
597+
return isOverridden(getJ2SAlias(c, name), cl);
598+
}
599+
575600
}
576601

0 commit comments

Comments
 (0)