From 3e6e9c87a03c2bc70320fd3d42a4e535a5f9b462 Mon Sep 17 00:00:00 2001 From: administrateur Date: Fri, 26 Jan 2007 01:30:24 +0100 Subject: [PATCH] Add TODO file. --- TODO | 7 +++++ src/xid/Presenter.java | 57 ++++++++++++++++++++++++++++++++++-- src/xid/TagsDataByIndex.java | 4 +-- 3 files changed, 64 insertions(+), 4 deletions(-) create mode 100644 TODO diff --git a/TODO b/TODO new file mode 100644 index 0000000..ad5a329 --- /dev/null +++ b/TODO @@ -0,0 +1,7 @@ + +20070126, to Epo: +
bla
+
blabla
+datas.setAttribute ("
", "class", "border-color: red;") + +content too. diff --git a/src/xid/Presenter.java b/src/xid/Presenter.java index f3c0f22..0828a56 100644 --- a/src/xid/Presenter.java +++ b/src/xid/Presenter.java @@ -298,9 +298,62 @@ public class Presenter // TODO Analyze IterationStragy if datas is a TagsData. - for (int i = 0; i < childrenCount; i++) + // Determine + NamedNodeMap attrs = node.getAttributes (); + Node idAttr = attrs.getNamedItem ("id"); + String tag = node.getNodeName(); + String idValue = idAttr.getNodeValue(); + + TagDataCore tagDataCore = datas.getId (idValue); + if (tagDataCore instanceof TagsDataByIndex) { - result.append (process (children.item(i), datas, webappPath, prefix, errorOutput)); + TagsDataByIndex tagsData = (TagsDataByIndex) tagDataCore; + switch (tagsData.getIterationStrategy ()) + { + case TagsDataByIndex.ONLY_FIRST_ROW: + result.append (process (children.item (0), datas, webappPath, prefix, errorOutput)); + break; + + case TagsDataByIndex.ONLY_ROWS_WITH_ID: + for (int i = 0; i < childrenCount; i++) + { + NamedNodeMap attrs2 = children.item (i); + Node idAttr2 = attrs2.getNamedItem ("id"); + + if (idAttr2 != null) + { + result.append (process (children.item(i), datas, webappPath, prefix, errorOutput)); + } + } + break; + + case TagsDataByIndex.ONLY_ROWS_WITHOUT_ID: + for (int i = 0; i < childrenCount; i++) + { + NamedNodeMap attrs2 = children.item (i); + Node idAttr2 = attrs2.getNamedItem ("id"); + + if (idAttr2 == null) + { + result.append (process (children.item(i), datas, webappPath, prefix, errorOutput)); + } + } + break; + + case TagsDataByIndex.ALL_ROWS: + for (int i = 0; i < childrenCount; i++) + { + result.append (process (children.item(i), datas, webappPath, prefix, errorOutput)); + } + break; + } + } + else + { + for (int i = 0; i < childrenCount; i++) + { + result.append (process (children.item(i), datas, webappPath, prefix, errorOutput)); + } } } diff --git a/src/xid/TagsDataByIndex.java b/src/xid/TagsDataByIndex.java index 9fe2cb1..73a34f4 100644 --- a/src/xid/TagsDataByIndex.java +++ b/src/xid/TagsDataByIndex.java @@ -8,7 +8,7 @@ import java.io.*; */ public class TagsDataByIndex extends Vector implements TagDataCore { - public enum IterationStrategy {ONLY_FIRST_ROW, ONLY_ROW_WITH_ID, ONLY_ROW_WITHOU_ID, ALL_ROWS} + public enum IterationStrategy {ONLY_FIRST_ROW, ONLY_ROWS_WITH_ID, ONLY_ROWS_WITHOU_ID, ALL_ROWS} protected IterationStrategy iterationStrategy; @@ -34,7 +34,7 @@ public class TagsDataByIndex extends Vector implements TagDataCore /** * */ - public IterationStrategy setIterationStrategy () + public IterationStrategy getIterationStrategy () { IterationStrategy result;