Make res.skinpath work.

This commit is contained in:
hns 2003-06-25 11:56:11 +00:00
parent 9e5ab59493
commit 7f213bf43a
4 changed files with 43 additions and 6 deletions

View file

@ -93,7 +93,11 @@ public class GlobalObject extends ScriptableObject {
if (skin instanceof Skin) {
s = (Skin) skin;
} else {
s = core.app.getSkin(null, skin.toString(), null);
// retrieve res.skinpath, an array of objects that tell us where to look for skins
// (strings for directory names and INodes for internal, db-stored skinsets)
Object[] skinpath = reval.res.getSkinpath();
RhinoCore.unwrapSkinpath(skinpath);
s = core.app.getSkin(null, skin.toString(), skinpath);
}
Map p = null;
@ -139,7 +143,11 @@ public class GlobalObject extends ScriptableObject {
if (skin instanceof Skin) {
s = (Skin) skin;
} else {
s = core.app.getSkin(null, skin.toString(), null);
// retrieve res.skinpath, an array of objects that tell us where to look for skins
// (strings for directory names and INodes for internal, db-stored skinsets)
Object[] skinpath = reval.res.getSkinpath();
RhinoCore.unwrapSkinpath(skinpath);
s = core.app.getSkin(null, skin.toString(), skinpath);
}
Map p = null;

View file

@ -181,7 +181,11 @@ public class HopObject extends ScriptableObject {
if (skin instanceof Skin) {
s = (Skin) skin;
} else {
s = core.app.getSkin(node, skin.toString(), null);
// retrieve res.skinpath, an array of objects that tell us where to look for skins
// (strings for directory names and INodes for internal, db-stored skinsets)
Object[] skinpath = reval.res.getSkinpath();
RhinoCore.unwrapSkinpath(skinpath);
s = core.app.getSkin(node, skin.toString(), skinpath);
}
Map p = null;
@ -228,7 +232,11 @@ public class HopObject extends ScriptableObject {
if (skin instanceof Skin) {
s = (Skin) skin;
} else {
s = core.app.getSkin(node, skin.toString(), null);
// retrieve res.skinpath, an array of objects that tell us where to look for skins
// (strings for directory names and INodes for internal, db-stored skinsets)
Object[] skinpath = reval.res.getSkinpath();
RhinoCore.unwrapSkinpath(skinpath);
s = core.app.getSkin(node, skin.toString(), skinpath);
}
Map p = null;

View file

@ -80,7 +80,11 @@ public class JavaObject extends NativeJavaObject {
if (skin instanceof Skin) {
s = (Skin) skin;
} else {
s = core.app.getSkin(javaObject, skin.toString(), null);
// retrieve res.skinpath, an array of objects that tell us where to look for skins
// (strings for directory names and INodes for internal, db-stored skinsets)
Object[] skinpath = reval.res.getSkinpath();
RhinoCore.unwrapSkinpath(skinpath);
s = core.app.getSkin(javaObject, skin.toString(), skinpath);
}
Map p = null;
@ -121,7 +125,11 @@ public class JavaObject extends NativeJavaObject {
if (skin instanceof Skin) {
s = (Skin) skin;
} else {
s = core.app.getSkin(javaObject, skin.toString(), null);
// retrieve res.skinpath, an array of objects that tell us where to look for skins
// (strings for directory names and INodes for internal, db-stored skinsets)
Object[] skinpath = reval.res.getSkinpath();
RhinoCore.unwrapSkinpath(skinpath);
s = core.app.getSkin(javaObject, skin.toString(), skinpath);
}
Map p = null;

View file

@ -674,6 +674,19 @@ public final class RhinoCore {
}
}
protected static Object[] unwrapSkinpath(Object[] skinpath) {
if (skinpath != null) {
for (int i=0; i<skinpath.length; i++) {
if (skinpath[i] instanceof HopObject) {
skinpath[i] = ((HopObject) skinpath[i]).getNode();
} else if (skinpath[i] instanceof NativeJavaObject) {
skinpath[i] = ((NativeJavaObject) skinpath[i]).unwrap();
}
}
}
return skinpath;
}
private synchronized void updateEvaluator(Prototype prototype, Reader reader,
String sourceName, int firstline) {
// context = Context.enter(context);