From 49f011ab87e0d4eb0819e0fa769e5424a63569d3 Mon Sep 17 00:00:00 2001 From: hns Date: Tue, 4 Mar 2003 18:19:33 +0000 Subject: [PATCH] Use new methods in Prototype to check whether an object is of this prototype or one of its parent prototypes when resolving macro handlers. --- src/helma/framework/core/RequestEvaluator.java | 6 +++--- src/helma/framework/core/Skin.java | 5 +++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/helma/framework/core/RequestEvaluator.java b/src/helma/framework/core/RequestEvaluator.java index 11df3a26..e9f31ae4 100644 --- a/src/helma/framework/core/RequestEvaluator.java +++ b/src/helma/framework/core/RequestEvaluator.java @@ -212,9 +212,9 @@ public final class RequestEvaluator implements Runnable { if (currentElement != null) { // add to requestPath array requestPath.add (currentElement); - String protoName = app.getPrototypeName (currentElement); - if (protoName != null) - macroHandlers.put (protoName, currentElement); + Prototype proto = app.getPrototype (currentElement); + if (proto != null) + proto.addToHandlerMap (macroHandlers, currentElement); } } } diff --git a/src/helma/framework/core/Skin.java b/src/helma/framework/core/Skin.java index 7b80b2be..7febc3d5 100644 --- a/src/helma/framework/core/Skin.java +++ b/src/helma/framework/core/Skin.java @@ -347,10 +347,11 @@ public final class Skin { // was called with this object - check it or its parents for matching prototype if (!handler.equals ("this") && !handler.equals (app.getPrototypeName (thisObject))) { // the handler object is not what we want - Object n = app.getParentElement (thisObject); + Object n = thisObject; // walk down parent chain to find handler object while (n != null) { - if (handler.equals (app.getPrototypeName (n))) { + Prototype proto = app.getPrototype (n); + if (proto != null && proto.isInstanceOf (handler)) { handlerObject = n; break; }