TagData family class rename IdData.
This commit is contained in:
parent
dd4b054b15
commit
16e7939445
19 changed files with 619 additions and 409 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
dist/test.jar
vendored
BIN
dist/test.jar
vendored
Binary file not shown.
BIN
dist/xid.jar
vendored
BIN
dist/xid.jar
vendored
Binary file not shown.
139
src/xid/IdData.java
Normal file
139
src/xid/IdData.java
Normal file
|
@ -0,0 +1,139 @@
|
||||||
|
package xid;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import java.io.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* IdData class is used to hold application data and
|
||||||
|
* the business logic that operates on the data.
|
||||||
|
*
|
||||||
|
* The only requirement of a IdData class is that it must implement a
|
||||||
|
* display method. The display method must return a text representation
|
||||||
|
* of the data, suitable for display in a web page.
|
||||||
|
*
|
||||||
|
* XID provides a User Input IdData, Text IdData and ...
|
||||||
|
* application may also implement it's own IdData classes.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class IdData implements Serializable, IdDataCore
|
||||||
|
{
|
||||||
|
public enum MODE {REPLACE, APPEND, IGNORE};
|
||||||
|
|
||||||
|
protected Attributes attributes;
|
||||||
|
protected boolean excludeSection;
|
||||||
|
protected MODE displayMode = MODE.REPLACE;
|
||||||
|
protected String content;
|
||||||
|
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public IdData ()
|
||||||
|
{
|
||||||
|
this.attributes = null;
|
||||||
|
this.excludeSection = false;
|
||||||
|
this.displayMode = MODE.REPLACE;
|
||||||
|
this.content = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public IdData (String text)
|
||||||
|
{
|
||||||
|
this.attributes = null;
|
||||||
|
this.excludeSection = false;
|
||||||
|
this.displayMode = MODE.REPLACE;
|
||||||
|
this.content = text;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public String display ()
|
||||||
|
{
|
||||||
|
String result;
|
||||||
|
|
||||||
|
if (this.content == null)
|
||||||
|
{
|
||||||
|
result = "";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result = this.content;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
return (result);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public void setContent (String text)
|
||||||
|
{
|
||||||
|
this.content = text;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public void setDisplayMode(MODE displayMode)
|
||||||
|
{
|
||||||
|
this.displayMode = displayMode;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public MODE getDisplayMode()
|
||||||
|
{
|
||||||
|
MODE result;
|
||||||
|
|
||||||
|
result = this.displayMode;
|
||||||
|
|
||||||
|
return (result);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public Attributes getAttributes ()
|
||||||
|
{
|
||||||
|
Attributes result;
|
||||||
|
|
||||||
|
if (this.attributes == null)
|
||||||
|
{
|
||||||
|
this.attributes = new Attributes ();
|
||||||
|
}
|
||||||
|
|
||||||
|
result = this.attributes;
|
||||||
|
|
||||||
|
//
|
||||||
|
return (result);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public void setExcludeSection(boolean excludeSection)
|
||||||
|
{
|
||||||
|
this.excludeSection = excludeSection;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public boolean getExcludeSection()
|
||||||
|
{
|
||||||
|
return excludeSection;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -13,6 +13,6 @@ import java.io.*;
|
||||||
* This interface helps to express this fact.
|
* This interface helps to express this fact.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public interface TagDataCore
|
public interface IdDataCore
|
||||||
{
|
{
|
||||||
}
|
}
|
223
src/xid/IdsData.java
Normal file
223
src/xid/IdsData.java
Normal file
|
@ -0,0 +1,223 @@
|
||||||
|
package xid;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import java.io.*;
|
||||||
|
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class IdsData extends IdsDataById
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public IdsData ()
|
||||||
|
{
|
||||||
|
super ();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public IdData getIdData (String id)
|
||||||
|
{
|
||||||
|
IdData result;
|
||||||
|
|
||||||
|
// Be sure that IdData is existing and get item.
|
||||||
|
result = (IdData) this.get (id);
|
||||||
|
|
||||||
|
if (result == null)
|
||||||
|
{
|
||||||
|
this.put (id, new IdData ());
|
||||||
|
|
||||||
|
result = (IdData) this.get (id);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
return (result);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public IdData getIdData (String id, int line)
|
||||||
|
{
|
||||||
|
IdData result;
|
||||||
|
|
||||||
|
// Be sure that IdsData are existing.
|
||||||
|
IdsDataByIndex tags = (IdsDataByIndex) this.get (id);
|
||||||
|
if (tags == null)
|
||||||
|
{
|
||||||
|
this.put (id, new IdsDataByIndex ());
|
||||||
|
|
||||||
|
tags = (IdsDataByIndex) this.get (id);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Be sure that lines are existing.
|
||||||
|
int nbLines = tags.size ();
|
||||||
|
for (int nLine = nbLines; nLine < line + 1; nLine++)
|
||||||
|
{
|
||||||
|
tags.add (nLine, new IdData ());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get item.
|
||||||
|
result = (IdData) tags.elementAt (line);
|
||||||
|
|
||||||
|
//
|
||||||
|
return (result);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public IdData getIdData (String id, int line, String column)
|
||||||
|
{
|
||||||
|
IdData result;
|
||||||
|
|
||||||
|
// Be sure that IdsData are existing.
|
||||||
|
IdsDataByIndex tags = (IdsDataByIndex) this.get (id);
|
||||||
|
if (tags == null)
|
||||||
|
{
|
||||||
|
this.put (id, new IdsDataByIndex ());
|
||||||
|
|
||||||
|
tags = (IdsDataByIndex) this.get (id);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Be sure that lines are existing.
|
||||||
|
int nbLines = tags.size ();
|
||||||
|
for (int nLine = nbLines; nLine < line + 1; nLine++)
|
||||||
|
{
|
||||||
|
tags.add (nLine, new IdsDataById ());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get item.
|
||||||
|
IdsDataById lineData = (IdsDataById) tags.elementAt (line);
|
||||||
|
|
||||||
|
result = (IdData) lineData.get (column);
|
||||||
|
|
||||||
|
if (result == null)
|
||||||
|
{
|
||||||
|
lineData.put (column, new IdData ());
|
||||||
|
|
||||||
|
result = (IdData) lineData.get (column);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
return (result);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public void setIterationStrategy (String id, IdsDataByIndex.IterationStrategy strategy)
|
||||||
|
{
|
||||||
|
IdsDataByIndex tags = (IdsDataByIndex) this.get (id);
|
||||||
|
|
||||||
|
tags.setIterationStrategy (strategy);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public void setContent (String id, String content)
|
||||||
|
{
|
||||||
|
IdData tag = this.getIdData (id);
|
||||||
|
|
||||||
|
tag.setContent (content);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public void setContent (String id, int line, String content)
|
||||||
|
{
|
||||||
|
IdData tag = this.getIdData (id, line);
|
||||||
|
|
||||||
|
tag.setContent (content);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public void setContent (String id, int line, String column, String content)
|
||||||
|
{
|
||||||
|
IdData tag = this.getIdData (id, line, column);
|
||||||
|
|
||||||
|
tag.setContent (content);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public void setAttribute (String id, String label, String value)
|
||||||
|
{
|
||||||
|
IdData tag = this.getIdData (id);
|
||||||
|
|
||||||
|
tag.getAttributes ().setAttribute (label, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public void setAttribute (String id, int line, String label, String value)
|
||||||
|
{
|
||||||
|
IdData tag = this.getIdData (id, line);
|
||||||
|
|
||||||
|
tag.getAttributes ().setAttribute (label, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public void setAttribute (String id, int line, String column, String label, String value)
|
||||||
|
{
|
||||||
|
IdData tag = this.getIdData (id, line, column);
|
||||||
|
|
||||||
|
tag.getAttributes ().setAttribute (label, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public void appendAttribute (String id, String label, String value)
|
||||||
|
{
|
||||||
|
IdData tag = this.getIdData (id);
|
||||||
|
|
||||||
|
tag.getAttributes ().appendAttribute (label, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public void appendContent (String id, int line, String label, String value)
|
||||||
|
{
|
||||||
|
IdData tag = this.getIdData (id, line);
|
||||||
|
|
||||||
|
tag.getAttributes ().appendAttribute (label, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public void appendContent (String id, int line, String column, String label, String value)
|
||||||
|
{
|
||||||
|
IdData tag = this.getIdData (id, line, column);
|
||||||
|
|
||||||
|
tag.getAttributes ().appendAttribute (label, value);
|
||||||
|
}
|
||||||
|
}
|
40
src/xid/IdsDataById.java
Normal file
40
src/xid/IdsDataById.java
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
package xid;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import java.io.*;
|
||||||
|
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class IdsDataById extends HashMap<String, IdDataCore> implements IdDataCore
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public IdsDataById ()
|
||||||
|
{
|
||||||
|
super ();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public void setId (String id, IdDataCore data)
|
||||||
|
{
|
||||||
|
this.put (id, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public IdDataCore getId (String id)
|
||||||
|
{
|
||||||
|
IdDataCore result;
|
||||||
|
|
||||||
|
result = this.get (id);
|
||||||
|
|
||||||
|
//
|
||||||
|
return (result);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -6,7 +6,7 @@ import java.io.*;
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class TagsDataByIndex extends Vector<TagDataCore> implements TagDataCore
|
public class IdsDataByIndex extends Vector<IdDataCore> implements IdDataCore
|
||||||
{
|
{
|
||||||
public enum IterationStrategy {ONLY_FIRST_ROW, ONLY_ROWS_WITH_ID, ONLY_ROWS_WITHOUT_ID, ALL_ROWS}
|
public enum IterationStrategy {ONLY_FIRST_ROW, ONLY_ROWS_WITH_ID, ONLY_ROWS_WITHOUT_ID, ALL_ROWS}
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ public class TagsDataByIndex extends Vector<TagDataCore> implements TagDataCore
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public TagsDataByIndex ()
|
public IdsDataByIndex ()
|
||||||
{
|
{
|
||||||
super ();
|
super ();
|
||||||
this.iterationStrategy = IterationStrategy.ONLY_FIRST_ROW;
|
this.iterationStrategy = IterationStrategy.ONLY_FIRST_ROW;
|
|
@ -91,7 +91,15 @@ public class Presenter
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public StringBuffer doXid (TagsDataById datas, StringBuffer errorOutput)
|
public StringBuffer doXid (IdsDataById datas, StringBuffer errorOutput)
|
||||||
|
{
|
||||||
|
return (doXid (datas, null, errorOutput));
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public StringBuffer doXid (IdsDataById datas, TagsDataById tagsData, StringBuffer errorOutput)
|
||||||
{
|
{
|
||||||
StringBuffer result;
|
StringBuffer result;
|
||||||
|
|
||||||
|
@ -127,7 +135,7 @@ public class Presenter
|
||||||
}
|
}
|
||||||
|
|
||||||
// Build the web page.
|
// Build the web page.
|
||||||
result = Presenter.doXid (doc, datas, this.webappPath, errorOutput);
|
result = Presenter.doXid (doc, datas, tagsData, this.webappPath, errorOutput);
|
||||||
|
|
||||||
//
|
//
|
||||||
return (result);
|
return (result);
|
||||||
|
@ -151,7 +159,7 @@ public class Presenter
|
||||||
{
|
{
|
||||||
Presenter.addMetaTag (doc, "generator", "XID 0.0");
|
Presenter.addMetaTag (doc, "generator", "XID 0.0");
|
||||||
|
|
||||||
result = Presenter.doXid (doc, null, webappPath, errorOutput);
|
result = Presenter.doXid (doc, null, null, webappPath, errorOutput);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -162,7 +170,15 @@ public class Presenter
|
||||||
/*
|
/*
|
||||||
* Xid a string with html in.
|
* Xid a string with html in.
|
||||||
*/
|
*/
|
||||||
static public StringBuffer doXid (String html, TagsDataById datas, String webappPath, StringBuffer errorOutput)
|
static public StringBuffer doXid (String html, IdsDataById datas, String webappPath, StringBuffer errorOutput)
|
||||||
|
{
|
||||||
|
return (doXid (html, datas, null, webappPath, errorOutput));
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Xid a string with html in.
|
||||||
|
*/
|
||||||
|
static public StringBuffer doXid (String html, IdsDataById datas, TagsDataById tagsData, String webappPath, StringBuffer errorOutput)
|
||||||
{
|
{
|
||||||
StringBuffer result;
|
StringBuffer result;
|
||||||
|
|
||||||
|
@ -186,7 +202,7 @@ public class Presenter
|
||||||
doc = buildTree (new ByteArrayInputStream (htmlSource.getBytes ()), errorOutput);
|
doc = buildTree (new ByteArrayInputStream (htmlSource.getBytes ()), errorOutput);
|
||||||
|
|
||||||
StringBuffer htmlTarget;
|
StringBuffer htmlTarget;
|
||||||
htmlTarget = Presenter.process (doc, datas, webappPath, errorOutput);
|
htmlTarget = Presenter.process (doc, datas, tagsData, webappPath, errorOutput);
|
||||||
|
|
||||||
if (htmlTarget == null)
|
if (htmlTarget == null)
|
||||||
{
|
{
|
||||||
|
@ -221,11 +237,19 @@ public class Presenter
|
||||||
/*
|
/*
|
||||||
* Xid a file with data.
|
* Xid a file with data.
|
||||||
*/
|
*/
|
||||||
static public StringBuffer doXid (Document doc, TagsDataById datas, String webappPath, StringBuffer errorOutput)
|
static public StringBuffer doXid (Document doc, IdsDataById datas, String webappPath, StringBuffer errorOutput)
|
||||||
|
{
|
||||||
|
return (doXid (doc, datas, null, webappPath, errorOutput));
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Xid a file with data.
|
||||||
|
*/
|
||||||
|
static public StringBuffer doXid (Document doc, IdsDataById datas, TagsDataById tagsData, String webappPath, StringBuffer errorOutput)
|
||||||
{
|
{
|
||||||
StringBuffer result;
|
StringBuffer result;
|
||||||
|
|
||||||
result = Presenter.process (doc, datas, webappPath, errorOutput);
|
result = Presenter.process (doc, datas, tagsData, webappPath, errorOutput);
|
||||||
|
|
||||||
//
|
//
|
||||||
return (result);
|
return (result);
|
||||||
|
@ -313,11 +337,11 @@ public class Presenter
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static protected StringBuffer processChildren (Node node, TagsDataById datas, String webappPath, StringBuffer errorOutput)
|
static protected StringBuffer processChildren (Node node, IdsDataById datas, TagsDataById tagsData, String webappPath, StringBuffer errorOutput)
|
||||||
{
|
{
|
||||||
StringBuffer result;
|
StringBuffer result;
|
||||||
|
|
||||||
result = processChildren (node, datas, webappPath, "", errorOutput);
|
result = processChildren (node, datas, tagsData, webappPath, "", errorOutput);
|
||||||
|
|
||||||
//
|
//
|
||||||
return (result);
|
return (result);
|
||||||
|
@ -327,7 +351,12 @@ public class Presenter
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static protected StringBuffer processChildren (Node node, TagsDataById datas, String webappPath, String prefix, StringBuffer errorOutput)
|
static protected StringBuffer processChildren (Node node,
|
||||||
|
IdsDataById datas,
|
||||||
|
TagsDataById tagsData,
|
||||||
|
String webappPath,
|
||||||
|
String suffix,
|
||||||
|
StringBuffer errorOutput)
|
||||||
{
|
{
|
||||||
StringBuffer result;
|
StringBuffer result;
|
||||||
result = new StringBuffer ();
|
result = new StringBuffer ();
|
||||||
|
@ -342,9 +371,9 @@ public class Presenter
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// Is there a TagsDataByIndex associated with the first ELEMENT_NODE child?
|
// Is there a IdsDataByIndex associated with the first ELEMENT_NODE child?
|
||||||
//
|
//
|
||||||
TagsDataByIndex tagsData;
|
IdsDataByIndex idsData;
|
||||||
|
|
||||||
// Find the first ELEMENT_NODE child.
|
// Find the first ELEMENT_NODE child.
|
||||||
int childIndex = 0;
|
int childIndex = 0;
|
||||||
|
@ -370,7 +399,7 @@ public class Presenter
|
||||||
|
|
||||||
if (child == null)
|
if (child == null)
|
||||||
{
|
{
|
||||||
tagsData = null;
|
idsData = null;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -402,39 +431,39 @@ public class Presenter
|
||||||
// Searching for the datas associated to the childId.
|
// Searching for the datas associated to the childId.
|
||||||
if (childId == null)
|
if (childId == null)
|
||||||
{
|
{
|
||||||
tagsData = null;
|
idsData = null;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Check if the data is a TagsDataByIndex.
|
// Check if the data is a IdsDataByIndex.
|
||||||
if (datas.getId (childId) instanceof TagsDataByIndex)
|
if (datas.getId (childId) instanceof IdsDataByIndex)
|
||||||
{
|
{
|
||||||
tagsData = (TagsDataByIndex) datas.getId (childId);
|
idsData = (IdsDataByIndex) datas.getId (childId);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
tagsData = null;
|
idsData = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// So, is there?
|
// So, is there?
|
||||||
if (tagsData == null)
|
if (idsData == null)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < childrenCount; i++)
|
for (int i = 0; i < childrenCount; i++)
|
||||||
{
|
{
|
||||||
result.append (process (children.item(i), datas, webappPath, prefix, errorOutput));
|
result.append (process (children.item(i), datas, tagsData, webappPath, suffix, errorOutput));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
switch (tagsData.getIterationStrategy ())
|
switch (idsData.getIterationStrategy ())
|
||||||
{
|
{
|
||||||
case ONLY_FIRST_ROW:
|
case ONLY_FIRST_ROW:
|
||||||
for (int i = 0; i <= childIndex; i++)
|
for (int i = 0; i <= childIndex; i++)
|
||||||
{
|
{
|
||||||
result.append (process (children.item (i), datas, webappPath, prefix, errorOutput));
|
result.append (process (children.item (i), datas, tagsData, webappPath, suffix, errorOutput));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -446,7 +475,7 @@ public class Presenter
|
||||||
if ((attrs2 != null) &&
|
if ((attrs2 != null) &&
|
||||||
(attrs2.getNamedItem ("id") != null))
|
(attrs2.getNamedItem ("id") != null))
|
||||||
{
|
{
|
||||||
result.append (process (children.item(i), datas, webappPath, prefix, errorOutput));
|
result.append (process (children.item(i), datas, tagsData, webappPath, suffix, errorOutput));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -461,7 +490,7 @@ public class Presenter
|
||||||
if ((attrs2 == null) ||
|
if ((attrs2 == null) ||
|
||||||
(attrs2.getNamedItem ("id") == null))
|
(attrs2.getNamedItem ("id") == null))
|
||||||
{
|
{
|
||||||
result.append (process (children.item(i), datas, webappPath, prefix, errorOutput));
|
result.append (process (children.item(i), datas, tagsData, webappPath, suffix, errorOutput));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -469,7 +498,7 @@ public class Presenter
|
||||||
case ALL_ROWS:
|
case ALL_ROWS:
|
||||||
for (int i = 0; i < childrenCount; i++)
|
for (int i = 0; i < childrenCount; i++)
|
||||||
{
|
{
|
||||||
result.append (process (children.item(i), datas, webappPath, prefix, errorOutput));
|
result.append (process (children.item(i), datas, tagsData, webappPath, suffix, errorOutput));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -489,7 +518,7 @@ public class Presenter
|
||||||
* @param attrMap
|
* @param attrMap
|
||||||
* @param idAttr
|
* @param idAttr
|
||||||
*/
|
*/
|
||||||
static protected StringBuffer processObjectTag (Node node, NamedNodeMap attrMap, Node idAttr, TagsDataById datas, String webappPath, StringBuffer errorOutput)
|
static protected StringBuffer processObjectTag (Node node, NamedNodeMap attrMap, Node idAttr, IdsDataById datas, TagsDataById tagsData, String webappPath, StringBuffer errorOutput)
|
||||||
{
|
{
|
||||||
StringBuffer result;
|
StringBuffer result;
|
||||||
|
|
||||||
|
@ -518,7 +547,7 @@ public class Presenter
|
||||||
(attrMap.getNamedItem ("data") == null))
|
(attrMap.getNamedItem ("data") == null))
|
||||||
{
|
{
|
||||||
// STU: do default action.
|
// STU: do default action.
|
||||||
Presenter.processElementBasically (node, datas, webappPath, errorOutput);
|
Presenter.processElementBasically (node, datas, tagsData, webappPath, errorOutput);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -571,7 +600,7 @@ public class Presenter
|
||||||
int childCount = bodyChildren.getLength ();
|
int childCount = bodyChildren.getLength ();
|
||||||
for (int childCounter = 0; childCounter < childCount; childCounter++)
|
for (int childCounter = 0; childCounter < childCount; childCounter++)
|
||||||
{
|
{
|
||||||
result.append (process (bodyChildren.item (childCounter), datas, webappPath, errorOutput));
|
result.append (process (bodyChildren.item (childCounter), datas, tagsData, webappPath, errorOutput));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -599,14 +628,14 @@ public class Presenter
|
||||||
static protected StringBuffer processElementWithId (Node node,
|
static protected StringBuffer processElementWithId (Node node,
|
||||||
NamedNodeMap attrs,
|
NamedNodeMap attrs,
|
||||||
Node idAttr,
|
Node idAttr,
|
||||||
TagsDataById datas,
|
IdsDataById datas,
|
||||||
String webappPath,
|
String webappPath,
|
||||||
StringBuffer errorOutput)
|
StringBuffer errorOutput)
|
||||||
|
|
||||||
{
|
{
|
||||||
StringBuffer result;
|
StringBuffer result;
|
||||||
|
|
||||||
result = processElementWithId (node, attrs, idAttr, datas, "", webappPath, errorOutput);
|
result = processElementWithId (node, attrs, idAttr, datas, null, "", webappPath, errorOutput);
|
||||||
|
|
||||||
//
|
//
|
||||||
return (result);
|
return (result);
|
||||||
|
@ -627,9 +656,10 @@ public class Presenter
|
||||||
static protected StringBuffer processElementWithId (Node node,
|
static protected StringBuffer processElementWithId (Node node,
|
||||||
NamedNodeMap attrs,
|
NamedNodeMap attrs,
|
||||||
Node idAttr,
|
Node idAttr,
|
||||||
TagsDataById datas,
|
IdsDataById datas,
|
||||||
|
TagsDataById tagsData,
|
||||||
String webappPath,
|
String webappPath,
|
||||||
String prefix,
|
String suffix,
|
||||||
StringBuffer errorOutput)
|
StringBuffer errorOutput)
|
||||||
{
|
{
|
||||||
StringBuffer result;
|
StringBuffer result;
|
||||||
|
@ -641,15 +671,15 @@ public class Presenter
|
||||||
log.debug ("tag=" + tag);
|
log.debug ("tag=" + tag);
|
||||||
|
|
||||||
// Get data of this id.
|
// Get data of this id.
|
||||||
TagDataCore dataCore = datas.get (idAttr.getNodeValue ());
|
IdDataCore dataCore = datas.get (idAttr.getNodeValue ());
|
||||||
|
|
||||||
if (dataCore == null)
|
if (dataCore == null)
|
||||||
{
|
{
|
||||||
result.append (Presenter.processElementBasically (node, datas, webappPath, prefix, errorOutput));
|
result.append (Presenter.processElementBasically (node, datas, tagsData, webappPath, suffix, errorOutput));
|
||||||
}
|
}
|
||||||
else if (dataCore instanceof TagData)
|
else if (dataCore instanceof IdData)
|
||||||
{
|
{
|
||||||
TagData data = (TagData) dataCore;
|
IdData data = (IdData) dataCore;
|
||||||
|
|
||||||
String theClass;
|
String theClass;
|
||||||
if (data == null)
|
if (data == null)
|
||||||
|
@ -669,7 +699,25 @@ public class Presenter
|
||||||
result.append (node.getNodeName());
|
result.append (node.getNodeName());
|
||||||
|
|
||||||
// Build attributes.
|
// Build attributes.
|
||||||
result.append (processAttributes (attrs, data.getAttributes (), datas.getNamedTagAttributes (node.getNodeName ()), prefix));
|
Attributes tagAttributes;
|
||||||
|
if (tagsData == null)
|
||||||
|
{
|
||||||
|
tagAttributes = null;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
TagData tagData = tagsData.getId (node.getNodeName ());
|
||||||
|
if (tagData == null)
|
||||||
|
{
|
||||||
|
tagAttributes = null;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
tagAttributes = tagData.getAttributes ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
result.append (processAttributes (attrs, data.getAttributes (), tagAttributes, suffix));
|
||||||
|
|
||||||
if ((node.getChildNodes () == null) &&
|
if ((node.getChildNodes () == null) &&
|
||||||
((data == null) || data.display ().equals ("")))
|
((data == null) || data.display ().equals ("")))
|
||||||
|
@ -685,7 +733,7 @@ public class Presenter
|
||||||
if ((data == null) ||
|
if ((data == null) ||
|
||||||
(data.display ().equals ("")))
|
(data.display ().equals ("")))
|
||||||
{
|
{
|
||||||
result.append (processChildren (node, datas, webappPath, prefix, errorOutput));
|
result.append (processChildren (node, datas, tagsData, webappPath, suffix, errorOutput));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -699,23 +747,41 @@ public class Presenter
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (dataCore instanceof TagsDataByIndex)
|
else if (dataCore instanceof IdsDataByIndex)
|
||||||
{
|
{
|
||||||
TagsDataByIndex tags = (TagsDataByIndex) dataCore;
|
IdsDataByIndex tags = (IdsDataByIndex) dataCore;
|
||||||
|
|
||||||
int nbLines = tags.size ();
|
int nbLines = tags.size ();
|
||||||
for (int nLine = 0; nLine < nbLines; nLine++)
|
for (int nLine = 0; nLine < nbLines; nLine++)
|
||||||
{
|
{
|
||||||
if (tags.elementAt (nLine) instanceof TagData)
|
if (tags.elementAt (nLine) instanceof IdData)
|
||||||
{
|
{
|
||||||
TagData data = (TagData) tags.elementAt (nLine);
|
IdData data = (IdData) tags.elementAt (nLine);
|
||||||
|
|
||||||
// Open the tag.
|
// Open the tag.
|
||||||
result.append ("<");
|
result.append ("<");
|
||||||
result.append (node.getNodeName());
|
result.append (node.getNodeName());
|
||||||
|
|
||||||
// Build attributes.
|
// Build attributes.
|
||||||
result.append (processAttributes (attrs, data.getAttributes (), datas.getNamedTagAttributes (node.getNodeName ()), Integer.toString (nLine)));
|
Attributes tagAttributes;
|
||||||
|
if (tagsData == null)
|
||||||
|
{
|
||||||
|
tagAttributes = null;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
TagData tagData = tagsData.getId (node.getNodeName ());
|
||||||
|
if (tagData == null)
|
||||||
|
{
|
||||||
|
tagAttributes = null;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
tagAttributes = tagData.getAttributes ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
result.append (processAttributes (attrs, data.getAttributes (), tagAttributes, Integer.toString (nLine)));
|
||||||
|
|
||||||
if ((node.getChildNodes () == null) &&
|
if ((node.getChildNodes () == null) &&
|
||||||
((data == null) || data.display ().equals ("")))
|
((data == null) || data.display ().equals ("")))
|
||||||
|
@ -731,7 +797,7 @@ public class Presenter
|
||||||
if ((data == null) ||
|
if ((data == null) ||
|
||||||
(data.display ().equals ("")))
|
(data.display ().equals ("")))
|
||||||
{
|
{
|
||||||
result.append (processChildren (node, datas, webappPath, prefix, errorOutput));
|
result.append (processChildren (node, datas, tagsData, webappPath, suffix, errorOutput));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -747,16 +813,16 @@ public class Presenter
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Manage a Hashmap.
|
// Manage a Hashmap.
|
||||||
TagsDataById data = (TagsDataById) tags.elementAt (nLine);
|
IdsDataById data = (IdsDataById) tags.elementAt (nLine);
|
||||||
|
|
||||||
result.append (Presenter.processElementWithId (node, attrs, idAttr, data, webappPath, Integer.toString (nLine), errorOutput));
|
result.append (Presenter.processElementWithId (node, attrs, idAttr, data, tagsData, webappPath, Integer.toString (nLine), errorOutput));
|
||||||
result.append ('\n');
|
result.append ('\n');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
log.warn ("Unknow type of TagDataId");
|
log.warn ("Unknow type of IdDataId");
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -769,11 +835,11 @@ public class Presenter
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static protected StringBuffer process (Node node, TagsDataById datas, String webappPath, StringBuffer errorOutput)
|
static protected StringBuffer process (Node node, IdsDataById datas, TagsDataById tagsData, String webappPath, StringBuffer errorOutput)
|
||||||
{
|
{
|
||||||
StringBuffer result;
|
StringBuffer result;
|
||||||
|
|
||||||
result = Presenter.process (node, datas, webappPath, "", errorOutput);
|
result = Presenter.process (node, datas, tagsData, webappPath, "", errorOutput);
|
||||||
|
|
||||||
//
|
//
|
||||||
return (result);
|
return (result);
|
||||||
|
@ -784,7 +850,7 @@ public class Presenter
|
||||||
* Recursive method that processes a node and any child nodes.
|
* Recursive method that processes a node and any child nodes.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static protected StringBuffer process (Node node, TagsDataById datas, String webappPath, String prefix, StringBuffer errorOutput)
|
static protected StringBuffer process (Node node, IdsDataById datas, TagsDataById tagsData, String webappPath, String suffix, StringBuffer errorOutput)
|
||||||
{
|
{
|
||||||
log.debug ("Enter");
|
log.debug ("Enter");
|
||||||
String TRANSITIONAL_DTD = "xhtml1-transitional.dtd";
|
String TRANSITIONAL_DTD = "xhtml1-transitional.dtd";
|
||||||
|
@ -828,7 +894,7 @@ public class Presenter
|
||||||
// Log.write(Log.TRACE,"systemId = " + systemId);
|
// Log.write(Log.TRACE,"systemId = " + systemId);
|
||||||
}
|
}
|
||||||
|
|
||||||
result.append (Presenter.process (((Document) node).getDocumentElement(), datas, webappPath, prefix, errorOutput));
|
result.append (Presenter.process (((Document) node).getDocumentElement(), datas, tagsData, webappPath, suffix, errorOutput));
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -842,11 +908,18 @@ public class Presenter
|
||||||
|
|
||||||
if (idAttr != null)
|
if (idAttr != null)
|
||||||
{
|
{
|
||||||
result.append (Presenter.processElementWithId (node, attrs, idAttr, datas, webappPath, prefix, errorOutput));
|
result.append (Presenter.processElementWithId (node,
|
||||||
|
attrs,
|
||||||
|
idAttr,
|
||||||
|
datas,
|
||||||
|
tagsData,
|
||||||
|
webappPath,
|
||||||
|
suffix,
|
||||||
|
errorOutput));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
result.append (Presenter.processElementBasically (node, datas, webappPath, prefix, errorOutput));
|
result.append (Presenter.processElementBasically (node, datas, tagsData, webappPath, suffix, errorOutput));
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
@ -913,11 +986,11 @@ public class Presenter
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static StringBuffer processElementBasically (Node node, TagsDataById datas, String webappPath, StringBuffer errorOutput)
|
static StringBuffer processElementBasically (Node node, IdsDataById datas, TagsDataById tagsData, String webappPath, StringBuffer errorOutput)
|
||||||
{
|
{
|
||||||
StringBuffer result;
|
StringBuffer result;
|
||||||
|
|
||||||
result = processElementBasically (node, datas, webappPath, "", errorOutput);
|
result = processElementBasically (node, datas, tagsData, webappPath, "", errorOutput);
|
||||||
|
|
||||||
//
|
//
|
||||||
return (result);
|
return (result);
|
||||||
|
@ -927,7 +1000,7 @@ public class Presenter
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static StringBuffer processElementBasically (Node node, TagsDataById datas, String webappPath, String prefix, StringBuffer errorOutput)
|
static StringBuffer processElementBasically (Node node, IdsDataById datas, TagsDataById tagsData, String webappPath, String suffix, StringBuffer errorOutput)
|
||||||
{
|
{
|
||||||
StringBuffer result;
|
StringBuffer result;
|
||||||
result = new StringBuffer ();
|
result = new StringBuffer ();
|
||||||
|
@ -937,10 +1010,28 @@ public class Presenter
|
||||||
result.append (node.getNodeName());
|
result.append (node.getNodeName());
|
||||||
|
|
||||||
// Build the tag attributes.
|
// Build the tag attributes.
|
||||||
|
Attributes tagAttributes;
|
||||||
|
if (tagsData == null)
|
||||||
|
{
|
||||||
|
tagAttributes = null;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
TagData tagData = tagsData.getId (node.getNodeName ());
|
||||||
|
if (tagData == null)
|
||||||
|
{
|
||||||
|
tagAttributes = null;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
tagAttributes = tagData.getAttributes ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
result.append (processAttributes (node.getAttributes (),
|
result.append (processAttributes (node.getAttributes (),
|
||||||
datas.getNamedTagAttributes (node.getNodeName ()),
|
tagAttributes,
|
||||||
null,
|
null,
|
||||||
prefix));
|
suffix));
|
||||||
|
|
||||||
//
|
//
|
||||||
if (node.getChildNodes () == null)
|
if (node.getChildNodes () == null)
|
||||||
|
@ -951,7 +1042,7 @@ public class Presenter
|
||||||
{
|
{
|
||||||
result.append('>');
|
result.append('>');
|
||||||
|
|
||||||
result.append (processChildren (node, datas, webappPath, prefix, errorOutput));
|
result.append (processChildren (node, datas, tagsData, webappPath, suffix, errorOutput));
|
||||||
|
|
||||||
result.append("</");
|
result.append("</");
|
||||||
result.append(node.getNodeName());
|
result.append(node.getNodeName());
|
||||||
|
@ -1265,11 +1356,11 @@ public class Presenter
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static protected StringBuffer processAttributes (NamedNodeMap attrs, Attributes dataAttributes, Attributes namedDataAttributes, String prefix)
|
static protected StringBuffer processAttributes (NamedNodeMap attrs, Attributes dataAttributes, Attributes namedDataAttributes, String suffix)
|
||||||
{
|
{
|
||||||
StringBuffer result;
|
StringBuffer result;
|
||||||
|
|
||||||
result = processAttributes (attrs, mergeAttributes (dataAttributes, namedDataAttributes), prefix);
|
result = processAttributes (attrs, mergeAttributes (dataAttributes, namedDataAttributes), suffix);
|
||||||
|
|
||||||
//
|
//
|
||||||
return (result);
|
return (result);
|
||||||
|
@ -1307,7 +1398,7 @@ public class Presenter
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static protected StringBuffer processAttributes (NamedNodeMap attrs, Attributes dataAttributes, String prefix)
|
static protected StringBuffer processAttributes (NamedNodeMap attrs, Attributes dataAttributes, String suffix)
|
||||||
{
|
{
|
||||||
StringBuffer result;
|
StringBuffer result;
|
||||||
|
|
||||||
|
@ -1356,9 +1447,9 @@ public class Presenter
|
||||||
{
|
{
|
||||||
Map.Entry<String, String> attribute = (Map.Entry<String, String>) iterator.next();
|
Map.Entry<String, String> attribute = (Map.Entry<String, String>) iterator.next();
|
||||||
|
|
||||||
if ((attribute.getKey ().equals ("id")) && (prefix.length () != 0))
|
if ((attribute.getKey ().equals ("id")) && (suffix.length () != 0))
|
||||||
{
|
{
|
||||||
result.append(" " + attribute.getKey () + "=\"" + attribute.getValue () + Presenter.INDEX_SEPARATOR + prefix + "\"");
|
result.append(" " + attribute.getKey () + "=\"" + attribute.getValue () + Presenter.INDEX_SEPARATOR + suffix + "\"");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -4,137 +4,33 @@ import java.util.*;
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TagData class is used to hold application data and
|
* IdData class is used to hold application data and
|
||||||
* the business logic that operates on the data.
|
* the business logic that operates on the data.
|
||||||
*
|
*
|
||||||
* The only requirement of a TagData class is that it must implement a
|
* The only requirement of a IdData class is that it must implement a
|
||||||
* display method. The display method must return a text representation
|
* display method. The display method must return a text representation
|
||||||
* of the data, suitable for display in a web page.
|
* of the data, suitable for display in a web page.
|
||||||
*
|
*
|
||||||
* XID provides a User Input TagData, Text TagData and ...
|
* XID provides a User Input IdData, Text IdData and ...
|
||||||
* application may also implement it's own TagData classes.
|
* application may also implement it's own IdData classes.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class TagData implements Serializable, TagDataCore
|
public class TagData extends IdData implements Serializable
|
||||||
{
|
{
|
||||||
public enum MODE {REPLACE, APPEND, IGNORE};
|
|
||||||
|
|
||||||
protected Attributes attributes;
|
|
||||||
protected boolean excludeSection;
|
|
||||||
protected MODE displayMode = MODE.REPLACE;
|
|
||||||
|
|
||||||
String content;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public TagData ()
|
public TagData ()
|
||||||
{
|
{
|
||||||
this.attributes = null;
|
super ();
|
||||||
this.excludeSection = false;
|
|
||||||
this.displayMode = MODE.REPLACE;
|
|
||||||
this.content = "";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public TagData (String text)
|
public TagData (String text)
|
||||||
{
|
{
|
||||||
this.attributes = null;
|
super (text);
|
||||||
this.excludeSection = false;
|
|
||||||
this.displayMode = MODE.REPLACE;
|
|
||||||
this.content = text;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public String display ()
|
|
||||||
{
|
|
||||||
String result;
|
|
||||||
|
|
||||||
if (this.content == null)
|
|
||||||
{
|
|
||||||
result = "";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
result = this.content;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
return (result);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public void setContent (String text)
|
|
||||||
{
|
|
||||||
this.content = text;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public void setDisplayMode(MODE displayMode)
|
|
||||||
{
|
|
||||||
this.displayMode = displayMode;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public MODE getDisplayMode()
|
|
||||||
{
|
|
||||||
MODE result;
|
|
||||||
|
|
||||||
result = this.displayMode;
|
|
||||||
|
|
||||||
return (result);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public Attributes getAttributes ()
|
|
||||||
{
|
|
||||||
Attributes result;
|
|
||||||
|
|
||||||
if (this.attributes == null)
|
|
||||||
{
|
|
||||||
this.attributes = new Attributes ();
|
|
||||||
}
|
|
||||||
|
|
||||||
result = this.attributes;
|
|
||||||
|
|
||||||
//
|
|
||||||
return (result);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public void setExcludeSection(boolean excludeSection)
|
|
||||||
{
|
|
||||||
this.excludeSection = excludeSection;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public boolean getExcludeSection()
|
|
||||||
{
|
|
||||||
return excludeSection;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@ public class TagsData extends TagsDataById
|
||||||
{
|
{
|
||||||
TagData result;
|
TagData result;
|
||||||
|
|
||||||
// Be sure that TagData is existing and get item.
|
// Be sure that data is existing and get item.
|
||||||
result = (TagData) this.get (id);
|
result = (TagData) this.get (id);
|
||||||
|
|
||||||
if (result == null)
|
if (result == null)
|
||||||
|
@ -40,89 +40,6 @@ public class TagsData extends TagsDataById
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public TagData getTagData (String id, int line)
|
|
||||||
{
|
|
||||||
TagData result;
|
|
||||||
|
|
||||||
// Be sure that TagsData are existing.
|
|
||||||
TagsDataByIndex tags = (TagsDataByIndex) this.get (id);
|
|
||||||
if (tags == null)
|
|
||||||
{
|
|
||||||
this.put (id, new TagsDataByIndex ());
|
|
||||||
|
|
||||||
tags = (TagsDataByIndex) this.get (id);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Be sure that lines are existing.
|
|
||||||
int nbLines = tags.size ();
|
|
||||||
for (int nLine = nbLines; nLine < line + 1; nLine++)
|
|
||||||
{
|
|
||||||
tags.add (nLine, new TagData ());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get item.
|
|
||||||
result = (TagData) tags.elementAt (line);
|
|
||||||
|
|
||||||
//
|
|
||||||
return (result);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public TagData getTagData (String id, int line, String column)
|
|
||||||
{
|
|
||||||
TagData result;
|
|
||||||
|
|
||||||
// Be sure that TagsData are existing.
|
|
||||||
TagsDataByIndex tags = (TagsDataByIndex) this.get (id);
|
|
||||||
if (tags == null)
|
|
||||||
{
|
|
||||||
this.put (id, new TagsDataByIndex ());
|
|
||||||
|
|
||||||
tags = (TagsDataByIndex) this.get (id);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Be sure that lines are existing.
|
|
||||||
int nbLines = tags.size ();
|
|
||||||
for (int nLine = nbLines; nLine < line + 1; nLine++)
|
|
||||||
{
|
|
||||||
tags.add (nLine, new TagsDataById ());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get item.
|
|
||||||
TagsDataById lineData = (TagsDataById) tags.elementAt (line);
|
|
||||||
|
|
||||||
result = (TagData) lineData.get (column);
|
|
||||||
|
|
||||||
if (result == null)
|
|
||||||
{
|
|
||||||
lineData.put (column, new TagData ());
|
|
||||||
|
|
||||||
result = (TagData) lineData.get (column);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
return (result);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public void setIterationStrategy (String id, TagsDataByIndex.IterationStrategy strategy)
|
|
||||||
{
|
|
||||||
TagsDataByIndex tags = (TagsDataByIndex) this.get (id);
|
|
||||||
|
|
||||||
tags.setIterationStrategy (strategy);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@ -134,28 +51,6 @@ public class TagsData extends TagsDataById
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public void setContent (String id, int line, String content)
|
|
||||||
{
|
|
||||||
TagData tag = this.getTagData (id, line);
|
|
||||||
|
|
||||||
tag.setContent (content);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public void setContent (String id, int line, String column, String content)
|
|
||||||
{
|
|
||||||
TagData tag = this.getTagData (id, line, column);
|
|
||||||
|
|
||||||
tag.setContent (content);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@ -167,28 +62,6 @@ public class TagsData extends TagsDataById
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public void setAttribute (String id, int line, String label, String value)
|
|
||||||
{
|
|
||||||
TagData tag = this.getTagData (id, line);
|
|
||||||
|
|
||||||
tag.getAttributes ().setAttribute (label, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public void setAttribute (String id, int line, String column, String label, String value)
|
|
||||||
{
|
|
||||||
TagData tag = this.getTagData (id, line, column);
|
|
||||||
|
|
||||||
tag.getAttributes ().setAttribute (label, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@ -198,26 +71,4 @@ public class TagsData extends TagsDataById
|
||||||
|
|
||||||
tag.getAttributes ().appendAttribute (label, value);
|
tag.getAttributes ().appendAttribute (label, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public void appendContent (String id, int line, String label, String value)
|
|
||||||
{
|
|
||||||
TagData tag = this.getTagData (id, line);
|
|
||||||
|
|
||||||
tag.getAttributes ().appendAttribute (label, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public void appendContent (String id, int line, String column, String label, String value)
|
|
||||||
{
|
|
||||||
TagData tag = this.getTagData (id, line, column);
|
|
||||||
|
|
||||||
tag.getAttributes ().appendAttribute (label, value);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@ import java.io.*;
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class TagsDataById extends HashMap<String, TagDataCore> implements TagDataCore
|
public class TagsDataById extends HashMap<String, TagData>
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
|
@ -19,7 +19,7 @@ public class TagsDataById extends HashMap<String, TagDataCore> implements TagDat
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public void setId (String id, TagDataCore data)
|
public void setId (String id, TagData data)
|
||||||
{
|
{
|
||||||
this.put (id, data);
|
this.put (id, data);
|
||||||
}
|
}
|
||||||
|
@ -27,9 +27,9 @@ public class TagsDataById extends HashMap<String, TagDataCore> implements TagDat
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public TagDataCore getId (String id)
|
public TagData getId (String id)
|
||||||
{
|
{
|
||||||
TagDataCore result;
|
TagData result;
|
||||||
|
|
||||||
result = this.get (id);
|
result = this.get (id);
|
||||||
|
|
||||||
|
@ -37,38 +37,4 @@ public class TagsDataById extends HashMap<String, TagDataCore> implements TagDat
|
||||||
return (result);
|
return (result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public Attributes getNamedTagAttributes (String name)
|
|
||||||
{
|
|
||||||
Attributes result;
|
|
||||||
|
|
||||||
if (name == null)
|
|
||||||
{
|
|
||||||
result = null;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
TagDataCore dataCore = this.getId ("<" + name + ">");
|
|
||||||
if (dataCore == null)
|
|
||||||
{
|
|
||||||
result = null;
|
|
||||||
}
|
|
||||||
else if (!(dataCore instanceof TagData))
|
|
||||||
{
|
|
||||||
result = null;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
TagData data = (TagData) dataCore;
|
|
||||||
|
|
||||||
result = data.getAttributes ();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
return (result);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,8 +47,8 @@ class Test
|
||||||
//test ();
|
//test ();
|
||||||
|
|
||||||
//
|
//
|
||||||
TagsData datas;
|
IdsData datas;
|
||||||
TagData tag;
|
IdData tag;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -58,16 +58,16 @@ class Test
|
||||||
|
|
||||||
// Populate attributes of Test 03.
|
// Populate attributes of Test 03.
|
||||||
System.out.println ("----------------------------");
|
System.out.println ("----------------------------");
|
||||||
datas = new TagsData ();
|
datas = new IdsData ();
|
||||||
tag = new TagData ();
|
tag = new IdData ();
|
||||||
tag.setContent ("Superman");
|
tag.setContent ("Superman");
|
||||||
datas.put ("name", tag);
|
datas.put ("name", tag);
|
||||||
|
|
||||||
errorMessage = new StringBuffer ();
|
errorMessage = new StringBuffer ();
|
||||||
html = Presenter.doXid ("<div id='name'>a name</div >", datas, "", errorMessage);
|
html = Presenter.doXid ("<div id='name'>a name</div >", datas, "", errorMessage);
|
||||||
|
|
||||||
System.out.println ("datas = new TagsData ();");
|
System.out.println ("datas = new IdsData ();");
|
||||||
System.out.println ("tag = new TagData ();");
|
System.out.println ("tag = new IdData ();");
|
||||||
System.out.println ("tag.setContent (\"Superman\");");
|
System.out.println ("tag.setContent (\"Superman\");");
|
||||||
System.out.println ("datas.put (\"name\", tag););");
|
System.out.println ("datas.put (\"name\", tag););");
|
||||||
System.out.println ("+");
|
System.out.println ("+");
|
||||||
|
@ -78,13 +78,13 @@ class Test
|
||||||
|
|
||||||
// Populate attributes of Test 03.
|
// Populate attributes of Test 03.
|
||||||
System.out.println ("----------------------------");
|
System.out.println ("----------------------------");
|
||||||
datas = new TagsData ();
|
datas = new IdsData ();
|
||||||
datas.setContent ("name", "Superman");
|
datas.setContent ("name", "Superman");
|
||||||
|
|
||||||
errorMessage = new StringBuffer ();
|
errorMessage = new StringBuffer ();
|
||||||
html = Presenter.doXid ("<div id='name'>a name</div >", datas, "", errorMessage);
|
html = Presenter.doXid ("<div id='name'>a name</div >", datas, "", errorMessage);
|
||||||
|
|
||||||
System.out.println ("datas = new TagsData ();");
|
System.out.println ("datas = new IdsData ();");
|
||||||
System.out.println ("datas.setContent (\"name\", \"Superman\");");
|
System.out.println ("datas.setContent (\"name\", \"Superman\");");
|
||||||
System.out.println ("+");
|
System.out.println ("+");
|
||||||
System.out.println ("<div id='name'>a name</div >");
|
System.out.println ("<div id='name'>a name</div >");
|
||||||
|
@ -94,8 +94,8 @@ class Test
|
||||||
|
|
||||||
// Populate attributes of Test 03.
|
// Populate attributes of Test 03.
|
||||||
System.out.println ("----------------------------");
|
System.out.println ("----------------------------");
|
||||||
datas = new TagsData ();
|
datas = new IdsData ();
|
||||||
tag = new TagData ();
|
tag = new IdData ();
|
||||||
tag.setContent ("Spiderman");
|
tag.setContent ("Spiderman");
|
||||||
tag.getAttributes ().appendAttribute ("style", "background: blue;");
|
tag.getAttributes ().appendAttribute ("style", "background: blue;");
|
||||||
tag.getAttributes ().appendAttribute ("style", "foreground: red;");
|
tag.getAttributes ().appendAttribute ("style", "foreground: red;");
|
||||||
|
@ -106,8 +106,8 @@ class Test
|
||||||
errorMessage = new StringBuffer ();
|
errorMessage = new StringBuffer ();
|
||||||
html = Presenter.doXid ("<div id='lastname'>a last name</div >", datas, "", errorMessage);
|
html = Presenter.doXid ("<div id='lastname'>a last name</div >", datas, "", errorMessage);
|
||||||
|
|
||||||
System.out.println ("datas = new TagsData ();");
|
System.out.println ("datas = new IdsData ();");
|
||||||
System.out.println ("tag = new TagData ();");
|
System.out.println ("tag = new IdData ();");
|
||||||
System.out.println ("tag.getAttributes ().setAttribute (\"class\", \"lastnameClass\");");
|
System.out.println ("tag.getAttributes ().setAttribute (\"class\", \"lastnameClass\");");
|
||||||
System.out.println ("tag.getAttributes ().appendAttribute (\"style\", \"background: blue;\");");
|
System.out.println ("tag.getAttributes ().appendAttribute (\"style\", \"background: blue;\");");
|
||||||
System.out.println ("tag.getAttributes ().appendAttribute (\"style\", \"foreground: red;\");");
|
System.out.println ("tag.getAttributes ().appendAttribute (\"style\", \"foreground: red;\");");
|
||||||
|
@ -121,7 +121,7 @@ class Test
|
||||||
|
|
||||||
// Populate attributes of Test 03.
|
// Populate attributes of Test 03.
|
||||||
System.out.println ("----------------------------");
|
System.out.println ("----------------------------");
|
||||||
datas = new TagsData ();
|
datas = new IdsData ();
|
||||||
datas.setContent ("lastname", "Spiderman");
|
datas.setContent ("lastname", "Spiderman");
|
||||||
datas.appendAttribute ("lastname", "style", "background: blue;");
|
datas.appendAttribute ("lastname", "style", "background: blue;");
|
||||||
datas.appendAttribute ("lastname", "style", "foreground: red;");
|
datas.appendAttribute ("lastname", "style", "foreground: red;");
|
||||||
|
@ -131,7 +131,7 @@ class Test
|
||||||
errorMessage = new StringBuffer ();
|
errorMessage = new StringBuffer ();
|
||||||
html = Presenter.doXid ("<div id='lastname'>a last name</div >", datas, "", errorMessage);
|
html = Presenter.doXid ("<div id='lastname'>a last name</div >", datas, "", errorMessage);
|
||||||
|
|
||||||
System.out.println ("datas = new TagsData ();");
|
System.out.println ("datas = new IdsData ();");
|
||||||
System.out.println ("datas.setContent (\"lastname\", \"Spiderman\");");
|
System.out.println ("datas.setContent (\"lastname\", \"Spiderman\");");
|
||||||
System.out.println ("datas.appendAttribute (\"lastname\", \"style\", \"background: blue;\");");
|
System.out.println ("datas.appendAttribute (\"lastname\", \"style\", \"background: blue;\");");
|
||||||
System.out.println ("datas.appendAttribute (\"lastname\", \"style\", \"foreground: red;\");");
|
System.out.println ("datas.appendAttribute (\"lastname\", \"style\", \"foreground: red;\");");
|
||||||
|
@ -144,7 +144,7 @@ class Test
|
||||||
|
|
||||||
// Populate attributes of Test 03.
|
// Populate attributes of Test 03.
|
||||||
System.out.println ("----------------------------");
|
System.out.println ("----------------------------");
|
||||||
datas = new TagsData ();
|
datas = new IdsData ();
|
||||||
datas.setContent ("words", 0, "alpha");
|
datas.setContent ("words", 0, "alpha");
|
||||||
datas.setContent ("words", 1, "bravo");
|
datas.setContent ("words", 1, "bravo");
|
||||||
datas.setContent ("words", 2, "charlie");
|
datas.setContent ("words", 2, "charlie");
|
||||||
|
@ -156,7 +156,7 @@ class Test
|
||||||
errorMessage = new StringBuffer ();
|
errorMessage = new StringBuffer ();
|
||||||
html = Presenter.doXid ("<ul>\n <li id='words'>a word</li>\n</ul>", datas, "", errorMessage);
|
html = Presenter.doXid ("<ul>\n <li id='words'>a word</li>\n</ul>", datas, "", errorMessage);
|
||||||
|
|
||||||
System.out.println ("datas = new TagsData ();");
|
System.out.println ("datas = new IdsData ();");
|
||||||
System.out.println ("datas.setContent (\"words\", 0, \"alpha\");");
|
System.out.println ("datas.setContent (\"words\", 0, \"alpha\");");
|
||||||
System.out.println ("datas.setContent (\"words\", 1, \"bravo\");");
|
System.out.println ("datas.setContent (\"words\", 1, \"bravo\");");
|
||||||
System.out.println ("datas.setContent (\"words\", 2, \"charlie\");");
|
System.out.println ("datas.setContent (\"words\", 2, \"charlie\");");
|
||||||
|
@ -173,7 +173,7 @@ class Test
|
||||||
|
|
||||||
// Populate attributes of Test 03.
|
// Populate attributes of Test 03.
|
||||||
System.out.println ("----------------------------");
|
System.out.println ("----------------------------");
|
||||||
datas = new TagsData ();
|
datas = new IdsData ();
|
||||||
datas.setContent ("identity", 0, "nom", "Jemba");
|
datas.setContent ("identity", 0, "nom", "Jemba");
|
||||||
datas.setContent ("identity", 0, "prenom", "Epo");
|
datas.setContent ("identity", 0, "prenom", "Epo");
|
||||||
datas.setContent ("identity", 1, "nom", "Momon");
|
datas.setContent ("identity", 1, "nom", "Momon");
|
||||||
|
@ -190,7 +190,7 @@ class Test
|
||||||
htmlSource = source.toString ();
|
htmlSource = source.toString ();
|
||||||
html = Presenter.doXid (htmlSource, datas, "", errorMessage);
|
html = Presenter.doXid (htmlSource, datas, "", errorMessage);
|
||||||
|
|
||||||
System.out.println ("datas = new TagsData ();");
|
System.out.println ("datas = new IdsData ();");
|
||||||
System.out.println ("datas.setContent (\"identity\", 0, \"nom\", \"Jemba\");");
|
System.out.println ("datas.setContent (\"identity\", 0, \"nom\", \"Jemba\");");
|
||||||
System.out.println ("datas.setContent (\"identity\", 0, \"prenom\", \"Epo\");");
|
System.out.println ("datas.setContent (\"identity\", 0, \"prenom\", \"Epo\");");
|
||||||
System.out.println ("datas.setContent (\"identity\", 1, \"nom\", \"Momon\");");
|
System.out.println ("datas.setContent (\"identity\", 1, \"nom\", \"Momon\");");
|
||||||
|
@ -206,17 +206,17 @@ class Test
|
||||||
|
|
||||||
// Populate attributes of Test 03.
|
// Populate attributes of Test 03.
|
||||||
System.out.println ("----------------------------");
|
System.out.println ("----------------------------");
|
||||||
datas = new TagsData ();
|
datas = new IdsData ();
|
||||||
datas.setContent ("identity", 0, "nom", "Jemba");
|
datas.setContent ("identity", 0, "nom", "Jemba");
|
||||||
datas.setContent ("identity", 0, "prenom", "Epo");
|
datas.setContent ("identity", 0, "prenom", "Epo");
|
||||||
datas.setContent ("identity", 1, "nom", "Momon");
|
datas.setContent ("identity", 1, "nom", "Momon");
|
||||||
datas.setContent ("identity", 1, "prenom", "Christian");
|
datas.setContent ("identity", 1, "prenom", "Christian");
|
||||||
datas.setContent ("identity", 2, "nom", "Tronche");
|
datas.setContent ("identity", 2, "nom", "Tronche");
|
||||||
datas.setContent ("identity", 2, "prenom", "Christophe");
|
datas.setContent ("identity", 2, "prenom", "Christophe");
|
||||||
datas.setIterationStrategy ("identity", TagsDataByIndex.IterationStrategy.ONLY_FIRST_ROW);
|
datas.setIterationStrategy ("identity", IdsDataByIndex.IterationStrategy.ONLY_FIRST_ROW);
|
||||||
//datas.setIterationStrategy ("identity", TagsDataByIndex.IterationStrategy.ONLY_ROWS_WITH_ID);
|
//datas.setIterationStrategy ("identity", IdsDataByIndex.IterationStrategy.ONLY_ROWS_WITH_ID);
|
||||||
//datas.setIterationStrategy ("identity", TagsDataByIndex.IterationStrategy.ONLY_ROWS_WITHOUT_ID);
|
//datas.setIterationStrategy ("identity", IdsDataByIndex.IterationStrategy.ONLY_ROWS_WITHOUT_ID);
|
||||||
//datas.setIterationStrategy ("identity", TagsDataByIndex.IterationStrategy.ALL_ROWS);
|
//datas.setIterationStrategy ("identity", IdsDataByIndex.IterationStrategy.ALL_ROWS);
|
||||||
|
|
||||||
|
|
||||||
errorMessage = new StringBuffer ();
|
errorMessage = new StringBuffer ();
|
||||||
|
@ -228,7 +228,7 @@ class Test
|
||||||
source.append ("</table>");
|
source.append ("</table>");
|
||||||
htmlSource = source.toString ();
|
htmlSource = source.toString ();
|
||||||
|
|
||||||
System.out.println ("datas = new TagsData ();");
|
System.out.println ("datas = new IdsData ();");
|
||||||
System.out.println ("datas.setContent (\"identity\", 0, \"nom\", \"Jemba\");");
|
System.out.println ("datas.setContent (\"identity\", 0, \"nom\", \"Jemba\");");
|
||||||
System.out.println ("datas.setContent (\"identity\", 0, \"prenom\", \"Epo\");");
|
System.out.println ("datas.setContent (\"identity\", 0, \"prenom\", \"Epo\");");
|
||||||
System.out.println ("datas.setContent (\"identity\", 1, \"nom\", \"Momon\");");
|
System.out.println ("datas.setContent (\"identity\", 1, \"nom\", \"Momon\");");
|
||||||
|
@ -241,22 +241,22 @@ class Test
|
||||||
System.out.println ("=>");
|
System.out.println ("=>");
|
||||||
|
|
||||||
|
|
||||||
datas.setIterationStrategy ("identity", TagsDataByIndex.IterationStrategy.ONLY_FIRST_ROW);
|
datas.setIterationStrategy ("identity", IdsDataByIndex.IterationStrategy.ONLY_FIRST_ROW);
|
||||||
System.out.println ("ONLY_FIRST_ROW:");
|
System.out.println ("ONLY_FIRST_ROW:");
|
||||||
html = Presenter.doXid (htmlSource, datas, "", errorMessage);
|
html = Presenter.doXid (htmlSource, datas, "", errorMessage);
|
||||||
System.out.println (html);
|
System.out.println (html);
|
||||||
|
|
||||||
datas.setIterationStrategy ("identity", TagsDataByIndex.IterationStrategy.ONLY_ROWS_WITH_ID);
|
datas.setIterationStrategy ("identity", IdsDataByIndex.IterationStrategy.ONLY_ROWS_WITH_ID);
|
||||||
System.out.println ("ONLY_ROWS_WITH_ID:");
|
System.out.println ("ONLY_ROWS_WITH_ID:");
|
||||||
html = Presenter.doXid (htmlSource, datas, "", errorMessage);
|
html = Presenter.doXid (htmlSource, datas, "", errorMessage);
|
||||||
System.out.println (html);
|
System.out.println (html);
|
||||||
|
|
||||||
datas.setIterationStrategy ("identity", TagsDataByIndex.IterationStrategy.ONLY_ROWS_WITHOUT_ID);
|
datas.setIterationStrategy ("identity", IdsDataByIndex.IterationStrategy.ONLY_ROWS_WITHOUT_ID);
|
||||||
System.out.println ("ONLY_ROWS_WITHOUT_ID:");
|
System.out.println ("ONLY_ROWS_WITHOUT_ID:");
|
||||||
html = Presenter.doXid (htmlSource, datas, "", errorMessage);
|
html = Presenter.doXid (htmlSource, datas, "", errorMessage);
|
||||||
System.out.println (html);
|
System.out.println (html);
|
||||||
|
|
||||||
datas.setIterationStrategy ("identity", TagsDataByIndex.IterationStrategy.ALL_ROWS);
|
datas.setIterationStrategy ("identity", IdsDataByIndex.IterationStrategy.ALL_ROWS);
|
||||||
System.out.println ("ALL_ROWS:");
|
System.out.println ("ALL_ROWS:");
|
||||||
html = Presenter.doXid (htmlSource, datas, "", errorMessage);
|
html = Presenter.doXid (htmlSource, datas, "", errorMessage);
|
||||||
System.out.println (html);
|
System.out.println (html);
|
||||||
|
@ -264,8 +264,9 @@ class Test
|
||||||
|
|
||||||
|
|
||||||
// Populate attributes of Test 03.
|
// Populate attributes of Test 03.
|
||||||
|
/*
|
||||||
System.out.println ("----------------------------");
|
System.out.println ("----------------------------");
|
||||||
datas = new TagsData ();
|
datas = new IdsData ();
|
||||||
datas.setAttribute ("<div>", "class", "aDivClass");
|
datas.setAttribute ("<div>", "class", "aDivClass");
|
||||||
datas.setAttribute ("<div>", "style", "background-color: #000000;");
|
datas.setAttribute ("<div>", "style", "background-color: #000000;");
|
||||||
datas.setAttribute ("number", "style", "background-color: #0000FF;");
|
datas.setAttribute ("number", "style", "background-color: #0000FF;");
|
||||||
|
@ -284,14 +285,13 @@ class Test
|
||||||
|
|
||||||
System.out.println (htmlSource);
|
System.out.println (htmlSource);
|
||||||
System.out.println ("+");
|
System.out.println ("+");
|
||||||
System.out.println ("datas = new TagsData ();");
|
System.out.println ("datas = new IdsData ();");
|
||||||
System.out.println ("datas.setAttribute (\"<div>\", \"class\", \"aDivClass\");");
|
System.out.println ("datas.setAttribute (\"<div>\", \"class\", \"aDivClass\");");
|
||||||
System.out.println ("datas.setAttribute (\"<div>\", \"style\", \"background-color: #000000;\");");
|
System.out.println ("datas.setAttribute (\"<div>\", \"style\", \"background-color: #000000;\");");
|
||||||
System.out.println ("datas.setAttribute (\"number\", \"style\", \"background-color: #0000FF;\");");
|
System.out.println ("datas.setAttribute (\"number\", \"style\", \"background-color: #0000FF;\");");
|
||||||
|
|
||||||
System.out.println ("=>");
|
System.out.println ("=>");
|
||||||
System.out.println (html);
|
System.out.println (html);
|
||||||
|
*/
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,6 +57,7 @@ class Test
|
||||||
StringBuffer errorMessage;
|
StringBuffer errorMessage;
|
||||||
|
|
||||||
// Populate attributes of Test 03.
|
// Populate attributes of Test 03.
|
||||||
|
System.out.println ("----------------------------");
|
||||||
datas = new TagsData ();
|
datas = new TagsData ();
|
||||||
tag = new TagData ();
|
tag = new TagData ();
|
||||||
tag.setContent ("Superman");
|
tag.setContent ("Superman");
|
||||||
|
@ -65,7 +66,6 @@ class Test
|
||||||
errorMessage = new StringBuffer ();
|
errorMessage = new StringBuffer ();
|
||||||
html = Presenter.doXid ("<div id='name'>a name</div >", datas, "", errorMessage);
|
html = Presenter.doXid ("<div id='name'>a name</div >", datas, "", errorMessage);
|
||||||
|
|
||||||
System.out.println ("----------------------------");
|
|
||||||
System.out.println ("datas = new TagsData ();");
|
System.out.println ("datas = new TagsData ();");
|
||||||
System.out.println ("tag = new TagData ();");
|
System.out.println ("tag = new TagData ();");
|
||||||
System.out.println ("tag.setContent (\"Superman\");");
|
System.out.println ("tag.setContent (\"Superman\");");
|
||||||
|
@ -77,13 +77,13 @@ class Test
|
||||||
|
|
||||||
|
|
||||||
// Populate attributes of Test 03.
|
// Populate attributes of Test 03.
|
||||||
|
System.out.println ("----------------------------");
|
||||||
datas = new TagsData ();
|
datas = new TagsData ();
|
||||||
datas.setContent ("name", "Superman");
|
datas.setContent ("name", "Superman");
|
||||||
|
|
||||||
errorMessage = new StringBuffer ();
|
errorMessage = new StringBuffer ();
|
||||||
html = Presenter.doXid ("<div id='name'>a name</div >", datas, "", errorMessage);
|
html = Presenter.doXid ("<div id='name'>a name</div >", datas, "", errorMessage);
|
||||||
|
|
||||||
System.out.println ("----------------------------");
|
|
||||||
System.out.println ("datas = new TagsData ();");
|
System.out.println ("datas = new TagsData ();");
|
||||||
System.out.println ("datas.setContent (\"name\", \"Superman\");");
|
System.out.println ("datas.setContent (\"name\", \"Superman\");");
|
||||||
System.out.println ("+");
|
System.out.println ("+");
|
||||||
|
@ -93,6 +93,7 @@ class Test
|
||||||
|
|
||||||
|
|
||||||
// Populate attributes of Test 03.
|
// Populate attributes of Test 03.
|
||||||
|
System.out.println ("----------------------------");
|
||||||
datas = new TagsData ();
|
datas = new TagsData ();
|
||||||
tag = new TagData ();
|
tag = new TagData ();
|
||||||
tag.setContent ("Spiderman");
|
tag.setContent ("Spiderman");
|
||||||
|
@ -105,7 +106,6 @@ class Test
|
||||||
errorMessage = new StringBuffer ();
|
errorMessage = new StringBuffer ();
|
||||||
html = Presenter.doXid ("<div id='lastname'>a last name</div >", datas, "", errorMessage);
|
html = Presenter.doXid ("<div id='lastname'>a last name</div >", datas, "", errorMessage);
|
||||||
|
|
||||||
System.out.println ("----------------------------");
|
|
||||||
System.out.println ("datas = new TagsData ();");
|
System.out.println ("datas = new TagsData ();");
|
||||||
System.out.println ("tag = new TagData ();");
|
System.out.println ("tag = new TagData ();");
|
||||||
System.out.println ("tag.getAttributes ().setAttribute (\"class\", \"lastnameClass\");");
|
System.out.println ("tag.getAttributes ().setAttribute (\"class\", \"lastnameClass\");");
|
||||||
|
@ -120,6 +120,7 @@ class Test
|
||||||
|
|
||||||
|
|
||||||
// Populate attributes of Test 03.
|
// Populate attributes of Test 03.
|
||||||
|
System.out.println ("----------------------------");
|
||||||
datas = new TagsData ();
|
datas = new TagsData ();
|
||||||
datas.setContent ("lastname", "Spiderman");
|
datas.setContent ("lastname", "Spiderman");
|
||||||
datas.appendAttribute ("lastname", "style", "background: blue;");
|
datas.appendAttribute ("lastname", "style", "background: blue;");
|
||||||
|
@ -130,7 +131,6 @@ class Test
|
||||||
errorMessage = new StringBuffer ();
|
errorMessage = new StringBuffer ();
|
||||||
html = Presenter.doXid ("<div id='lastname'>a last name</div >", datas, "", errorMessage);
|
html = Presenter.doXid ("<div id='lastname'>a last name</div >", datas, "", errorMessage);
|
||||||
|
|
||||||
System.out.println ("----------------------------");
|
|
||||||
System.out.println ("datas = new TagsData ();");
|
System.out.println ("datas = new TagsData ();");
|
||||||
System.out.println ("datas.setContent (\"lastname\", \"Spiderman\");");
|
System.out.println ("datas.setContent (\"lastname\", \"Spiderman\");");
|
||||||
System.out.println ("datas.appendAttribute (\"lastname\", \"style\", \"background: blue;\");");
|
System.out.println ("datas.appendAttribute (\"lastname\", \"style\", \"background: blue;\");");
|
||||||
|
@ -143,6 +143,7 @@ class Test
|
||||||
|
|
||||||
|
|
||||||
// Populate attributes of Test 03.
|
// Populate attributes of Test 03.
|
||||||
|
System.out.println ("----------------------------");
|
||||||
datas = new TagsData ();
|
datas = new TagsData ();
|
||||||
datas.setContent ("words", 0, "alpha");
|
datas.setContent ("words", 0, "alpha");
|
||||||
datas.setContent ("words", 1, "bravo");
|
datas.setContent ("words", 1, "bravo");
|
||||||
|
@ -155,7 +156,6 @@ class Test
|
||||||
errorMessage = new StringBuffer ();
|
errorMessage = new StringBuffer ();
|
||||||
html = Presenter.doXid ("<ul>\n <li id='words'>a word</li>\n</ul>", datas, "", errorMessage);
|
html = Presenter.doXid ("<ul>\n <li id='words'>a word</li>\n</ul>", datas, "", errorMessage);
|
||||||
|
|
||||||
System.out.println ("----------------------------");
|
|
||||||
System.out.println ("datas = new TagsData ();");
|
System.out.println ("datas = new TagsData ();");
|
||||||
System.out.println ("datas.setContent (\"words\", 0, \"alpha\");");
|
System.out.println ("datas.setContent (\"words\", 0, \"alpha\");");
|
||||||
System.out.println ("datas.setContent (\"words\", 1, \"bravo\");");
|
System.out.println ("datas.setContent (\"words\", 1, \"bravo\");");
|
||||||
|
@ -172,6 +172,7 @@ class Test
|
||||||
|
|
||||||
|
|
||||||
// Populate attributes of Test 03.
|
// Populate attributes of Test 03.
|
||||||
|
System.out.println ("----------------------------");
|
||||||
datas = new TagsData ();
|
datas = new TagsData ();
|
||||||
datas.setContent ("identity", 0, "nom", "Jemba");
|
datas.setContent ("identity", 0, "nom", "Jemba");
|
||||||
datas.setContent ("identity", 0, "prenom", "Epo");
|
datas.setContent ("identity", 0, "prenom", "Epo");
|
||||||
|
@ -182,10 +183,13 @@ class Test
|
||||||
|
|
||||||
|
|
||||||
errorMessage = new StringBuffer ();
|
errorMessage = new StringBuffer ();
|
||||||
htmlSource = "<table>\n <tr id='identity'><td>noid</td><td id='nom'>un nom</td><td id='prenom'>un prenom</td></tr>\n</table>";
|
StringBuffer source = new StringBuffer ();
|
||||||
|
source.append ("<table>\n");
|
||||||
|
source.append (" <tr id='identity'><td>noid</td><td id='nom'>un nom</td><td id='prenom'>un prenom</td></tr>\n");
|
||||||
|
source.append ("</table>");
|
||||||
|
htmlSource = source.toString ();
|
||||||
html = Presenter.doXid (htmlSource, datas, "", errorMessage);
|
html = Presenter.doXid (htmlSource, datas, "", errorMessage);
|
||||||
|
|
||||||
System.out.println ("----------------------------");
|
|
||||||
System.out.println ("datas = new TagsData ();");
|
System.out.println ("datas = new TagsData ();");
|
||||||
System.out.println ("datas.setContent (\"identity\", 0, \"nom\", \"Jemba\");");
|
System.out.println ("datas.setContent (\"identity\", 0, \"nom\", \"Jemba\");");
|
||||||
System.out.println ("datas.setContent (\"identity\", 0, \"prenom\", \"Epo\");");
|
System.out.println ("datas.setContent (\"identity\", 0, \"prenom\", \"Epo\");");
|
||||||
|
@ -201,6 +205,7 @@ class Test
|
||||||
|
|
||||||
|
|
||||||
// Populate attributes of Test 03.
|
// Populate attributes of Test 03.
|
||||||
|
System.out.println ("----------------------------");
|
||||||
datas = new TagsData ();
|
datas = new TagsData ();
|
||||||
datas.setContent ("identity", 0, "nom", "Jemba");
|
datas.setContent ("identity", 0, "nom", "Jemba");
|
||||||
datas.setContent ("identity", 0, "prenom", "Epo");
|
datas.setContent ("identity", 0, "prenom", "Epo");
|
||||||
|
@ -215,7 +220,7 @@ class Test
|
||||||
|
|
||||||
|
|
||||||
errorMessage = new StringBuffer ();
|
errorMessage = new StringBuffer ();
|
||||||
StringBuffer source = new StringBuffer ();
|
source = new StringBuffer ();
|
||||||
source.append ("<table>\n");
|
source.append ("<table>\n");
|
||||||
source.append (" <tr id='identity'><td>noid</td><td id='nom'>un nom</td><td id='prenom'>un prenom</td></tr>\n");
|
source.append (" <tr id='identity'><td>noid</td><td id='nom'>un nom</td><td id='prenom'>un prenom</td></tr>\n");
|
||||||
source.append (" <tr id='identity2'><td>noid</td><td id='nom2'>un nom</td><td id='prenom2'>un prenom</td></tr>\n");
|
source.append (" <tr id='identity2'><td>noid</td><td id='nom2'>un nom</td><td id='prenom2'>un prenom</td></tr>\n");
|
||||||
|
@ -223,7 +228,6 @@ class Test
|
||||||
source.append ("</table>");
|
source.append ("</table>");
|
||||||
htmlSource = source.toString ();
|
htmlSource = source.toString ();
|
||||||
|
|
||||||
System.out.println ("----------------------------");
|
|
||||||
System.out.println ("datas = new TagsData ();");
|
System.out.println ("datas = new TagsData ();");
|
||||||
System.out.println ("datas.setContent (\"identity\", 0, \"nom\", \"Jemba\");");
|
System.out.println ("datas.setContent (\"identity\", 0, \"nom\", \"Jemba\");");
|
||||||
System.out.println ("datas.setContent (\"identity\", 0, \"prenom\", \"Epo\");");
|
System.out.println ("datas.setContent (\"identity\", 0, \"prenom\", \"Epo\");");
|
||||||
|
|
Loading…
Reference in a new issue