From efa13b4a00ba331fbdbd8823f2e48c359d98b7c5 Mon Sep 17 00:00:00 2001 From: hns Date: Tue, 15 Oct 2002 17:54:04 +0000 Subject: [PATCH] Cleaned up SkinManager, added method to collect skins in other directories than the prototype directory. --- src/helma/framework/core/Application.java | 5 ++- src/helma/framework/core/SkinManager.java | 38 +++++++++++++++-------- 2 files changed, 29 insertions(+), 14 deletions(-) diff --git a/src/helma/framework/core/Application.java b/src/helma/framework/core/Application.java index d788e733..8732a5d4 100644 --- a/src/helma/framework/core/Application.java +++ b/src/helma/framework/core/Application.java @@ -613,7 +613,10 @@ public final class Application implements IPathElement, Runnable { * to use for the object, then looking up the skin for the prototype. */ public Skin getSkin (Object object, String skinname, Object[] skinpath) { - return skinmgr.getSkin (object, skinname, skinpath); + Prototype proto = getPrototype (object); + if (proto == null) + return null; + return skinmgr.getSkin (proto, skinname, skinpath); } /** diff --git a/src/helma/framework/core/SkinManager.java b/src/helma/framework/core/SkinManager.java index 1d0ac449..d638604b 100644 --- a/src/helma/framework/core/SkinManager.java +++ b/src/helma/framework/core/SkinManager.java @@ -3,8 +3,7 @@ package helma.framework.core; -import java.util.Map; -import java.util.Iterator; +import java.util.*; import helma.objectmodel.INode; import java.io.*; @@ -22,14 +21,8 @@ public final class SkinManager { this.app = app; } - public Skin getSkin (Object object, String skinname, Object[] skinpath) { - Prototype proto = app.getPrototype (object); - Skin skin = getSkin (proto, skinname, "skin", skinpath); - return skin; - } - - protected Skin getSkin (Prototype proto, String skinname, String extension, Object[] skinpath) { + protected Skin getSkin (Prototype proto, String skinname, Object[] skinpath) { if (proto == null) return null; Skin skin = null; @@ -38,7 +31,7 @@ public final class SkinManager { do { if (skinpath != null) { for (int i=0; i