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.Exceptions.*;
|
||||||
import FESI.Data.*;
|
import FESI.Data.*;
|
||||||
import FESI.Interpreter.Evaluator;
|
import FESI.Interpreter.Evaluator;
|
||||||
|
import java.util.Iterator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ESApp represents the app node of an application, providing an app-wide transient shared
|
* 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)) {
|
if ("upSince".equals (propname)) {
|
||||||
return createtime;
|
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)) {
|
if ("__app__".equals (propname)) {
|
||||||
return new ESWrapper (app, evaluator);
|
return new ESWrapper (app, evaluator);
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,7 @@ public class Skin {
|
||||||
|
|
||||||
Object[] parts;
|
Object[] parts;
|
||||||
Application app;
|
Application app;
|
||||||
|
String source;
|
||||||
|
|
||||||
public Skin (String content, Application app) {
|
public Skin (String content, Application app) {
|
||||||
this.app = app;
|
this.app = app;
|
||||||
|
@ -30,6 +31,7 @@ public class Skin {
|
||||||
|
|
||||||
public void parse (String content) {
|
public void parse (String content) {
|
||||||
|
|
||||||
|
this.source = content;
|
||||||
ArrayList partBuffer = new ArrayList ();
|
ArrayList partBuffer = new ArrayList ();
|
||||||
int l = content.length ();
|
int l = content.length ();
|
||||||
char cnt[] = new char[l];
|
char cnt[] = new char[l];
|
||||||
|
@ -58,6 +60,10 @@ public class Skin {
|
||||||
parts = partBuffer.toArray ();
|
parts = partBuffer.toArray ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getSource () {
|
||||||
|
return source;
|
||||||
|
}
|
||||||
|
|
||||||
public void render (RequestEvaluator reval, ESNode thisNode, ESObject paramObject) {
|
public void render (RequestEvaluator reval, ESNode thisNode, ESObject paramObject) {
|
||||||
if (parts == null)
|
if (parts == null)
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -72,6 +72,10 @@ public class SkinFile implements Updatable {
|
||||||
return skin;
|
return skin;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getName () {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
public String toString () {
|
public String toString () {
|
||||||
return prototype.getName()+"/"+file.getName();
|
return prototype.getName()+"/"+file.getName();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue