Ditched getTranslatedSkinpath() and setTranslatedSkinpath in RequestTrans.

getSkinpath() and setSkinpath now directly deal with Object arrays.
This commit is contained in:
hns 2002-07-19 11:35:21 +00:00
parent 02d64e6d1e
commit a106e43fd0
3 changed files with 11 additions and 35 deletions

View file

@ -117,11 +117,11 @@ public class ResponseBean implements Serializable {
} }
public void setskinpath (Object[] arr) { public void setskinpath (Object[] arr) {
res.setTranslatedSkinpath (arr); res.setSkinpath (arr);
} }
public Object[] getskinpath () { public Object[] getskinpath () {
return res.getTranslatedSkinpath (); return res.getSkinpath ();
} }
public int getstatus () { public int getstatus () {

View file

@ -61,10 +61,8 @@ public final class ResponseTrans implements Externalizable {
// these are used to implement the _as_string variants for Hop templates. // these are used to implement the _as_string variants for Hop templates.
private transient Stack buffers; private transient Stack buffers;
// the path used to resolve skin names // the path used to tell where to look for skins
private transient Object skinpath = null; private transient Object[] skinpath = null;
// the processed skinpath as array of Nodes or directory names
private transient Object[] translatedSkinpath = null;
// hashmap for skin caching // hashmap for skin caching
private transient HashMap skincache; private transient HashMap skincache;
@ -329,24 +327,17 @@ public final class ResponseTrans implements Externalizable {
return contentType; return contentType;
} }
public void setSkinpath (Object obj) { public void setSkinpath (Object[] arr) {
skinpath = obj; this.skinpath = arr;
translatedSkinpath = null;
skincache = null; skincache = null;
} }
public Object getSkinpath () { public Object[] getSkinpath () {
if (skinpath == null)
skinpath = new Object[0];
return skinpath; return skinpath;
} }
public void setTranslatedSkinpath (Object[] arr) {
this.translatedSkinpath = arr;
}
public Object[] getTranslatedSkinpath () {
return translatedSkinpath;
}
public Skin getCachedSkin (String id) { public Skin getCachedSkin (String id) {
if (skincache == null) if (skincache == null)
return null; return null;

View file

@ -476,25 +476,10 @@ public final class HopExtension {
skin = (Skin) obj; skin = (Skin) obj;
} }
// if res.skinpath is set, transform it into an array of java objects // 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) // (strings for directory names and INodes for internal, db-stored skinsets)
ResponseTrans res = fesi.getResponse(); ResponseTrans res = fesi.getResponse();
Object[] skinpath = res.getTranslatedSkinpath (); Object[] skinpath = res.getSkinpath ();
if (skinpath == null) {
skinpath = new Object[0];
Object rawSkinpath = res.getSkinpath ();
if (rawSkinpath != null && rawSkinpath instanceof JSWrapper) {
JSWrapper jsw = (JSWrapper) rawSkinpath;
ESObject eso = jsw.getESObject ();
if (eso instanceof ArrayPrototype) {
ArrayPrototype array = (ArrayPrototype) eso;
skinpath = new Object[array.size()];
for (int i=0; i<skinpath.length; i++)
skinpath[i] = array.getProperty(i).toJavaObject ();
}
}
res.setTranslatedSkinpath (skinpath);
}
// ready... retrieve the skin and render it. // ready... retrieve the skin and render it.
Object javaObject = thisObject == null ? null : thisObject.toJavaObject (); Object javaObject = thisObject == null ? null : thisObject.toJavaObject ();