\n");
@@ -283,13 +234,12 @@ class Demo
System.out.println (htmlSource);
System.out.println ("+");
- System.out.println ("datas = new IdsData ();");
+ System.out.println ("datas = new Data ();");
System.out.println ("datas.setAttribute (\"
\", \"class\", \"aDivClass\");");
System.out.println ("datas.setAttribute (\"
\", \"style\", \"background-color: #000000;\");");
System.out.println ("datas.setAttribute (\"number\", \"style\", \"background-color: #0000FF;\");");
System.out.println ("=>");
System.out.println (html);
- */
}
}
diff --git a/dist/xid.jar b/dist/xid.jar
deleted file mode 100644
index 31716c8..0000000
Binary files a/dist/xid.jar and /dev/null differ
diff --git a/src/xid/IdsData.java b/src/xid/Data.java
similarity index 59%
rename from src/xid/IdsData.java
rename to src/xid/Data.java
index 503ec5b..991953b 100644
--- a/src/xid/IdsData.java
+++ b/src/xid/Data.java
@@ -6,14 +6,47 @@ import java.io.*;
/*
*
*/
-public class IdsData extends IdsDataById
+public class Data
{
+ protected IdsDataById idsDataById;
+ protected TagsDataById tagsDataById;
+
+
/**
*
*/
- public IdsData ()
+ public Data ()
{
- super ();
+ this.idsDataById = new IdsDataById ();
+ this.tagsDataById = new TagsDataById ();
+ }
+
+
+ /**
+ *
+ */
+ public IdsDataById getIdsDataById ()
+ {
+ IdsDataById result;
+
+ result = this.idsDataById;
+
+ //
+ return (result);
+ }
+
+
+ /**
+ *
+ */
+ public TagsDataById getTagsDataById ()
+ {
+ TagsDataById result;
+
+ result = this.tagsDataById;
+
+ //
+ return (result);
}
@@ -25,13 +58,13 @@ public class IdsData extends IdsDataById
IdData result;
// Be sure that IdData is existing and get item.
- result = (IdData) this.get (id);
+ result = (IdData) this.idsDataById.getId (id);
if (result == null)
{
- this.put (id, new IdData ());
+ this.idsDataById.setId (id, new IdData ());
- result = (IdData) this.get (id);
+ result = (IdData) this.idsDataById.getId (id);
}
@@ -48,12 +81,12 @@ public class IdsData extends IdsDataById
IdData result;
// Be sure that IdsData are existing.
- IdsDataByIndex tags = (IdsDataByIndex) this.get (id);
+ IdsDataByIndex tags = (IdsDataByIndex) this.idsDataById.getId (id);
if (tags == null)
{
- this.put (id, new IdsDataByIndex ());
+ this.idsDataById.setId (id, new IdsDataByIndex ());
- tags = (IdsDataByIndex) this.get (id);
+ tags = (IdsDataByIndex) this.idsDataById.getId (id);
}
// Be sure that lines are existing.
@@ -79,12 +112,12 @@ public class IdsData extends IdsDataById
IdData result;
// Be sure that IdsData are existing.
- IdsDataByIndex tags = (IdsDataByIndex) this.get (id);
+ IdsDataByIndex tags = (IdsDataByIndex) this.idsDataById.getId (id);
if (tags == null)
{
- this.put (id, new IdsDataByIndex ());
+ this.idsDataById.setId (id, new IdsDataByIndex ());
- tags = (IdsDataByIndex) this.get (id);
+ tags = (IdsDataByIndex) this.idsDataById.getId (id);
}
// Be sure that lines are existing.
@@ -116,7 +149,7 @@ public class IdsData extends IdsDataById
*/
public void setIterationStrategy (String id, IdsDataByIndex.IterationStrategy strategy)
{
- IdsDataByIndex tags = (IdsDataByIndex) this.get (id);
+ IdsDataByIndex tags = (IdsDataByIndex) this.idsDataById.getId (id);
tags.setIterationStrategy (strategy);
}
@@ -128,9 +161,25 @@ public class IdsData extends IdsDataById
*/
public void setContent (String id, String content)
{
- IdData tag = this.getIdData (id);
+ if (id.startsWith ("<"))
+ {
+ String tagName = id.substring (1, id.length () - 1);
+
+ TagData tag = this.tagsDataById.getId (tagName);
+ if (tag == null)
+ {
+ tag = new TagData ();
+ this.tagsDataById.setId (tagName, tag);
+ }
- tag.setContent (content);
+ tag.setContent (content);
+ }
+ else
+ {
+ IdData idData = this.getIdData (id);
+
+ idData.setContent (content);
+ }
}
@@ -161,9 +210,25 @@ public class IdsData extends IdsDataById
*/
public void setAttribute (String id, String label, String value)
{
- IdData tag = this.getIdData (id);
+ if (id.startsWith ("<"))
+ {
+ String tagName = id.substring (1, id.length () - 1);
+
+ TagData tag = this.tagsDataById.getId (tagName);
+ if (tag == null)
+ {
+ tag = new TagData ();
+ this.tagsDataById.setId (tagName, tag);
+ }
- tag.getAttributes ().setAttribute (label, value);
+ tag.getAttributes ().setAttribute (label, value);
+ }
+ else
+ {
+ IdData tag = this.getIdData (id);
+
+ tag.getAttributes ().setAttribute (label, value);
+ }
}
diff --git a/src/xid/Presenter.java b/src/xid/Presenter.java
index 0f3ce99..941fcae 100644
--- a/src/xid/Presenter.java
+++ b/src/xid/Presenter.java
@@ -167,6 +167,17 @@ public class Presenter
}
+
+ /*
+ *
+ */
+ static public StringBuffer doXid (String html, Data datas, String webappPath, StringBuffer errorOutput)
+ {
+ return (doXid (html, datas.getIdsDataById (), datas.getTagsDataById (), webappPath, errorOutput));
+ }
+
+
+
/*
* Xid a string with html in.
*/
diff --git a/src/xid/TagsData.java b/src/xid/TagsData.java
deleted file mode 100644
index 9cbc888..0000000
--- a/src/xid/TagsData.java
+++ /dev/null
@@ -1,74 +0,0 @@
-package xid;
-
-import java.util.*;
-import java.io.*;
-
-/*
- *
- */
-public class TagsData extends TagsDataById
-{
- /**
- *
- */
- public TagsData ()
- {
- super ();
- }
-
-
- /**
- *
- */
- public TagData getTagData (String id)
- {
- TagData result;
-
- // Be sure that data is existing and get item.
- result = (TagData) this.get (id);
-
- if (result == null)
- {
- this.put (id, new TagData ());
-
- result = (TagData) this.get (id);
- }
-
-
- //
- return (result);
- }
-
-
- /**
- *
- */
- public void setContent (String id, String content)
- {
- TagData tag = this.getTagData (id);
-
- tag.setContent (content);
- }
-
-
- /**
- *
- */
- public void setAttribute (String id, String label, String value)
- {
- TagData tag = this.getTagData (id);
-
- tag.getAttributes ().setAttribute (label, value);
- }
-
-
- /**
- *
- */
- public void appendAttribute (String id, String label, String value)
- {
- TagData tag = this.getTagData (id);
-
- tag.getAttributes ().appendAttribute (label, value);
- }
-}