first implementation of skin file enumeration through
app.skinfiles.
This commit is contained in:
parent
8bf1a54727
commit
3009a40358
3 changed files with 27 additions and 1 deletions
|
@ -7,6 +7,7 @@ import helma.objectmodel.*;
|
|||
import FESI.Exceptions.*;
|
||||
import FESI.Data.*;
|
||||
import FESI.Interpreter.Evaluator;
|
||||
import java.util.Iterator;
|
||||
|
||||
/**
|
||||
* ESApp represents the app node of an application, providing an app-wide transient shared
|
||||
|
@ -47,6 +48,21 @@ public class ESAppNode extends ESNode {
|
|||
if ("upSince".equals (propname)) {
|
||||
return createtime;
|
||||
}
|
||||
if ("skinfiles".equals (propname)) {
|
||||
ESObject skinz = new ObjectPrototype (null, evaluator);
|
||||
for (Iterator it = app.typemgr.prototypes.values().iterator(); it.hasNext(); ) {
|
||||
Prototype p = (Prototype) it.next ();
|
||||
ESObject proto = new ObjectPrototype (null, evaluator);
|
||||
for (Iterator it2 = p.skins.values().iterator(); it2.hasNext(); ) {
|
||||
SkinFile sf = (SkinFile) it2.next ();
|
||||
String name = sf.getName ();
|
||||
Skin skin = sf.getSkin ();
|
||||
proto.putProperty (name, new ESString (skin.getSource ()), name.hashCode ());
|
||||
}
|
||||
skinz.putProperty (p.getName (), proto, p.getName ().hashCode ());
|
||||
}
|
||||
return skinz;
|
||||
}
|
||||
if ("__app__".equals (propname)) {
|
||||
return new ESWrapper (app, evaluator);
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@ public class Skin {
|
|||
|
||||
Object[] parts;
|
||||
Application app;
|
||||
String source;
|
||||
|
||||
public Skin (String content, Application app) {
|
||||
this.app = app;
|
||||
|
@ -30,6 +31,7 @@ public class Skin {
|
|||
|
||||
public void parse (String content) {
|
||||
|
||||
this.source = content;
|
||||
ArrayList partBuffer = new ArrayList ();
|
||||
int l = content.length ();
|
||||
char cnt[] = new char[l];
|
||||
|
@ -56,7 +58,11 @@ public class Skin {
|
|||
partBuffer.add (new String (cnt, lastIdx, l - lastIdx));
|
||||
|
||||
parts = partBuffer.toArray ();
|
||||
}
|
||||
}
|
||||
|
||||
public String getSource () {
|
||||
return source;
|
||||
}
|
||||
|
||||
public void render (RequestEvaluator reval, ESNode thisNode, ESObject paramObject) {
|
||||
if (parts == null)
|
||||
|
|
|
@ -71,6 +71,10 @@ public class SkinFile implements Updatable {
|
|||
read ();
|
||||
return skin;
|
||||
}
|
||||
|
||||
public String getName () {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String toString () {
|
||||
return prototype.getName()+"/"+file.getName();
|
||||
|
|
Loading…
Add table
Reference in a new issue