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) {
res.setTranslatedSkinpath (arr);
res.setSkinpath (arr);
}
public Object[] getskinpath () {
return res.getTranslatedSkinpath ();
return res.getSkinpath ();
}
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.
private transient Stack buffers;
// the path used to resolve skin names
private transient Object skinpath = null;
// the processed skinpath as array of Nodes or directory names
private transient Object[] translatedSkinpath = null;
// the path used to tell where to look for skins
private transient Object[] skinpath = null;
// hashmap for skin caching
private transient HashMap skincache;
@ -329,24 +327,17 @@ public final class ResponseTrans implements Externalizable {
return contentType;
}
public void setSkinpath (Object obj) {
skinpath = obj;
translatedSkinpath = null;
public void setSkinpath (Object[] arr) {
this.skinpath = arr;
skincache = null;
}
public Object getSkinpath () {
public Object[] getSkinpath () {
if (skinpath == null)
skinpath = new Object[0];
return skinpath;
}
public void setTranslatedSkinpath (Object[] arr) {
this.translatedSkinpath = arr;
}
public Object[] getTranslatedSkinpath () {
return translatedSkinpath;
}
public Skin getCachedSkin (String id) {
if (skincache == null)
return null;

View file

@ -476,25 +476,10 @@ public final class HopExtension {
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)
ResponseTrans res = fesi.getResponse();
Object[] skinpath = res.getTranslatedSkinpath ();
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);
}
Object[] skinpath = res.getSkinpath ();
// ready... retrieve the skin and render it.
Object javaObject = thisObject == null ? null : thisObject.toJavaObject ();