From 89d000ad74a5599e69aa3c1c48f18a68d9aee97b Mon Sep 17 00:00:00 2001 From: "David A. Madore" Date: Wed, 27 Apr 2011 17:39:16 +0200 Subject: The DAML element is used for two different things. :-( Disambiguate. --- org/madore/damlengine/TodoElement.java | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'org') diff --git a/org/madore/damlengine/TodoElement.java b/org/madore/damlengine/TodoElement.java index 80565cc..a5784bb 100644 --- a/org/madore/damlengine/TodoElement.java +++ b/org/madore/damlengine/TodoElement.java @@ -12,6 +12,19 @@ public abstract class TodoElement extends TodoItem { TodoItem caller); } + public static class TitleDisambiguationFactory extends Factory { + Factory mainTitleFactory = new TodoTitleElement.Factory(); + Factory entryTitleFactory = new TodoDefaultElement.Factory(); + public TodoElement newItem(Element node, + Context ctx, + TodoItem caller) { + if ( caller instanceof TodoDamlElement ) + return mainTitleFactory.newItem(node, ctx, caller); + else + return entryTitleFactory.newItem(node, ctx, caller); + } + } + protected final static Map<String,Factory> damlFactories; protected final static Factory damlDefaultFactory; @@ -20,7 +33,7 @@ public abstract class TodoElement extends TodoItem { damlDefaultFactory = new TodoDefaultElement.Factory(); damlFactories.put("daml", new TodoDamlElement.Factory()); damlFactories.put("body", new TodoBodyElement.Factory()); - damlFactories.put("title", new TodoTitleElement.Factory()); + damlFactories.put("title", new TitleDisambiguationFactory()); damlFactories.put("subtitle", new TodoSubtitleElement.Factory()); damlFactories.put("translation", new TodoTranslationElement.Factory()); damlFactories.put("meta-description", new TodoMetaElement.Factory(TodoMetaElement.Type.DESCRIPTION)); -- cgit v1.2.3