From 83d696e98b57cb58acd41edb99f40e8aff797024 Mon Sep 17 00:00:00 2001 From: hns Date: Sun, 9 Sep 2001 18:05:52 +0000 Subject: [PATCH] Removed all dependencies of FESI. Yay! --- src/helma/framework/core/Skin.java | 69 ++++++++++++++---------------- 1 file changed, 32 insertions(+), 37 deletions(-) diff --git a/src/helma/framework/core/Skin.java b/src/helma/framework/core/Skin.java index 0df8420d..b6f926f0 100644 --- a/src/helma/framework/core/Skin.java +++ b/src/helma/framework/core/Skin.java @@ -6,8 +6,6 @@ package helma.framework.core; import java.io.*; import java.util.*; import helma.framework.*; -import FESI.Data.*; -import FESI.Exceptions.*; import helma.scripting.*; import helma.scripting.fesi.*; import helma.objectmodel.INode; @@ -87,24 +85,14 @@ public class Skin { /** * Render this skin */ - public void render (RequestEvaluator reval, ESObject thisObject, ESObject paramObject) throws RedirectException { + public void render (RequestEvaluator reval, Object thisObject, HashMap paramObject) throws RedirectException { if (parts == null) return; - IPathElement elem = null; - - if (thisObject != null) { - try { - elem = (IPathElement) thisObject.toJavaObject (); - } catch (ClassCastException wrongClass) { - throw new RuntimeException ("Can't render a skin on something that is not a path element: "+wrongClass); - } - } - for (int i=0; i=0; i--) { - IPathElement pathelem = (IPathElement) reval.reqPath.getProperty (i).toJavaObject (); - if (handler.equalsIgnoreCase (pathelem.getPrototype ())) { - handlerObject = (ESNode) reval.reqPath.getProperty(i); + Object pathelem = reval.reqPath.getProperty (i).toJavaObject (); + if (handler.equalsIgnoreCase (app.getPrototypeName (pathelem))) { + handlerObject = pathelem; break; } } } + + // the macro handler object couldn't be found + if (handlerObject == null) + objectFound = false; } else { // this is a global macro with no handler specified - handlerObject = reval.global; + handlerObject = null; } - if (handlerObject != null) { - ESValue v = handlerObject.doIndirectCall (reval.evaluator, handlerObject, name+"_macro", arguments); - if (v != ESUndefined.theUndefined && v != ESNull.theNull) + if (objectFound) { + Object v = reval.invokeDirectFunction (handlerObject, name+"_macro", arguments); + // ESValue v = handlerObject.doIndirectCall (reval.evaluator, handlerObject, name+"_macro", arguments); + if (v != null) reval.res.write (v); } else { String msg = "[HopMacro unhandled: "+getFullName()+"]"; @@ -319,6 +315,7 @@ public class Skin { } catch (ConcurrencyException concur) { throw concur; } catch (Exception x) { + x.printStackTrace(); String msg = "[HopMacro error: "+x+"]"; reval.res.write (" "+msg+" "); app.logEvent (msg); @@ -344,16 +341,14 @@ public class Skin { reval.res.write (encode (value.toString (), encoding)); } - private void renderFromParam (RequestEvaluator reval, ESObject paramObject) { + private void renderFromParam (RequestEvaluator reval, HashMap paramObject) { String encoding = (String) parameters.get ("encoding"); if (paramObject == null) reval.res.write ("[HopMacro error: Skin requires a parameter object]"); else { - try { - ESValue value = paramObject.getProperty (name, name.hashCode()); - if (value != null && value != ESUndefined.theUndefined && value != ESNull.theNull) - reval.res.write (encode (value.toString (), encoding)); - } catch (EcmaScriptException ignore) {} + Object value = paramObject.get (name); + if (value != null) + reval.res.write (encode (value.toString (), encoding)); } }