Rename classes: Id -> Tag.
This commit is contained in:
parent
bc9b2b5dd4
commit
8928ad2f6f
13 changed files with 341 additions and 341 deletions
|
@ -88,7 +88,7 @@ org.eclipse.jdt.core.formatter.indent_empty_lines=false
|
|||
org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
|
||||
org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
|
||||
org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
|
||||
org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false
|
||||
org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true
|
||||
org.eclipse.jdt.core.formatter.indentation.size=4
|
||||
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert
|
||||
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
* XidDemo
|
||||
*/
|
||||
|
||||
import fr.devinsy.xidyn.Data;
|
||||
import fr.devinsy.xidyn.IdData;
|
||||
import fr.devinsy.xidyn.TagDataManager;
|
||||
import fr.devinsy.xidyn.TagData;
|
||||
import fr.devinsy.xidyn.StringPresenter;
|
||||
|
||||
/**
|
||||
|
@ -31,21 +31,21 @@ class XidDemo
|
|||
// test ();
|
||||
|
||||
//
|
||||
Data datas;
|
||||
TagDataManager data;
|
||||
|
||||
// Step #01.
|
||||
{
|
||||
System.out.println("----------------------------");
|
||||
|
||||
// Populate attributes.
|
||||
datas = new Data();
|
||||
datas.setContent("name", "Superman");
|
||||
data = new TagDataManager();
|
||||
data.setContent("name", "Superman");
|
||||
|
||||
String htmlSource = "<div id='name'>a name</div >";
|
||||
StringBuffer htmlTarget;
|
||||
try
|
||||
{
|
||||
htmlTarget = StringPresenter.dynamize(htmlSource, datas);
|
||||
htmlTarget = StringPresenter.dynamize(htmlSource, data);
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
|
@ -65,17 +65,17 @@ class XidDemo
|
|||
{
|
||||
System.out.println("----------------------------");
|
||||
// Populate attributes.
|
||||
datas = new Data();
|
||||
datas.setContent("lastname", "Spiderman");
|
||||
datas.appendAttribute("lastname", "style", "background: blue;");
|
||||
datas.appendAttribute("lastname", "style", "foreground: red;");
|
||||
datas.setAttribute("lastname", "class", "nameClass");
|
||||
data = new TagDataManager();
|
||||
data.setContent("lastname", "Spiderman");
|
||||
data.appendAttribute("lastname", "style", "background: blue;");
|
||||
data.appendAttribute("lastname", "style", "foreground: red;");
|
||||
data.setAttribute("lastname", "class", "nameClass");
|
||||
|
||||
String htmlSource = "<div id='lastname'>a last name</div >";
|
||||
StringBuffer htmlTarget;
|
||||
try
|
||||
{
|
||||
htmlTarget = StringPresenter.dynamize(htmlSource, datas);
|
||||
htmlTarget = StringPresenter.dynamize(htmlSource, data);
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
|
@ -99,19 +99,19 @@ class XidDemo
|
|||
{
|
||||
System.out.println("----------------------------");
|
||||
// Populate attributes.
|
||||
datas = new Data();
|
||||
datas.setContent("words", 0, "alpha");
|
||||
datas.setContent("words", 1, "bravo");
|
||||
datas.setContent("words", 2, "charlie");
|
||||
datas.setContent("words", 3, "delta");
|
||||
datas.setContent("words", 4, "echo");
|
||||
datas.setContent("words", 5, "fox");
|
||||
data = new TagDataManager();
|
||||
data.setContent("words", 0, "alpha");
|
||||
data.setContent("words", 1, "bravo");
|
||||
data.setContent("words", 2, "charlie");
|
||||
data.setContent("words", 3, "delta");
|
||||
data.setContent("words", 4, "echo");
|
||||
data.setContent("words", 5, "fox");
|
||||
|
||||
String htmlSource = "<ul>\n <li id='words'>a word</li>\n</ul>";
|
||||
StringBuffer htmlTarget;
|
||||
try
|
||||
{
|
||||
htmlTarget = StringPresenter.dynamize(htmlSource, datas);
|
||||
htmlTarget = StringPresenter.dynamize(htmlSource, data);
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
|
@ -139,13 +139,13 @@ class XidDemo
|
|||
{
|
||||
System.out.println("----------------------------");
|
||||
// Populate attributes.
|
||||
datas = new Data();
|
||||
datas.setContent("identity", 0, "last_name", "Jemba");
|
||||
datas.setContent("identity", 0, "first_name", "Epo");
|
||||
datas.setContent("identity", 1, "last_name", "Momon");
|
||||
datas.setContent("identity", 1, "first_name", "Christian");
|
||||
datas.setContent("identity", 2, "last_name", "Tronche");
|
||||
datas.setContent("identity", 2, "first_name", "Christophe");
|
||||
data = new TagDataManager();
|
||||
data.setContent("identity", 0, "last_name", "Jemba");
|
||||
data.setContent("identity", 0, "first_name", "Epo");
|
||||
data.setContent("identity", 1, "last_name", "Momon");
|
||||
data.setContent("identity", 1, "first_name", "Christian");
|
||||
data.setContent("identity", 2, "last_name", "Tronche");
|
||||
data.setContent("identity", 2, "first_name", "Christophe");
|
||||
|
||||
StringBuffer source = new StringBuffer();
|
||||
source.append("<table>\n");
|
||||
|
@ -156,7 +156,7 @@ class XidDemo
|
|||
StringBuffer htmlTarget;
|
||||
try
|
||||
{
|
||||
htmlTarget = StringPresenter.dynamize(htmlSource, datas);
|
||||
htmlTarget = StringPresenter.dynamize(htmlSource, data);
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
|
@ -183,13 +183,13 @@ class XidDemo
|
|||
{
|
||||
System.out.println("----------------------------");
|
||||
// Populate attributes.
|
||||
datas = new Data();
|
||||
datas.setContent("identity", 0, "last_name", "Jemba");
|
||||
datas.setContent("identity", 0, "first_name", "Epo");
|
||||
datas.setContent("identity", 1, "last_name", "Momon");
|
||||
datas.setContent("identity", 1, "first_name", "Christian");
|
||||
datas.setContent("identity", 2, "last_name", "Tronche");
|
||||
datas.setContent("identity", 2, "first_name", "Christophe");
|
||||
data = new TagDataManager();
|
||||
data.setContent("identity", 0, "last_name", "Jemba");
|
||||
data.setContent("identity", 0, "first_name", "Epo");
|
||||
data.setContent("identity", 1, "last_name", "Momon");
|
||||
data.setContent("identity", 1, "first_name", "Christian");
|
||||
data.setContent("identity", 2, "last_name", "Tronche");
|
||||
data.setContent("identity", 2, "first_name", "Christophe");
|
||||
// datas.setIterationStrategy ("identity",
|
||||
// IdsDataByIndex.IterationStrategy.ONLY_ROWS_WITH_ID);
|
||||
// datas.setIterationStrategy ("identity",
|
||||
|
@ -220,12 +220,12 @@ class XidDemo
|
|||
System.out.println("=>");
|
||||
|
||||
// #05.1
|
||||
datas.setIterationStrategy("identities", IdData.IterationStrategy.ONLY_FIRST_ROW);
|
||||
data.setIterationStrategy("identities", TagData.IterationStrategy.ONLY_FIRST_ROW);
|
||||
System.out.println("ONLY_FIRST_ROW:");
|
||||
StringBuffer html;
|
||||
try
|
||||
{
|
||||
html = StringPresenter.dynamize(htmlSource, datas);
|
||||
html = StringPresenter.dynamize(htmlSource, data);
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
|
@ -236,11 +236,11 @@ class XidDemo
|
|||
System.out.println("");
|
||||
|
||||
// #05.2
|
||||
datas.setIterationStrategy("identities", IdData.IterationStrategy.ONLY_FIRST_TWO_ROWS);
|
||||
data.setIterationStrategy("identities", TagData.IterationStrategy.ONLY_FIRST_TWO_ROWS);
|
||||
System.out.println("ONLY_FIRST_TWO_ROWS:");
|
||||
try
|
||||
{
|
||||
html = StringPresenter.dynamize(htmlSource, datas);
|
||||
html = StringPresenter.dynamize(htmlSource, data);
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
|
@ -251,11 +251,11 @@ class XidDemo
|
|||
System.out.println("");
|
||||
|
||||
// #05.3
|
||||
datas.setIterationStrategy("identities", IdData.IterationStrategy.ONLY_ROWS_WITH_ID);
|
||||
data.setIterationStrategy("identities", TagData.IterationStrategy.ONLY_ROWS_WITH_ID);
|
||||
System.out.println("ONLY_ROWS_WITH_ID:");
|
||||
try
|
||||
{
|
||||
html = StringPresenter.dynamize(htmlSource, datas);
|
||||
html = StringPresenter.dynamize(htmlSource, data);
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
|
@ -266,11 +266,11 @@ class XidDemo
|
|||
System.out.println("");
|
||||
|
||||
// #05.4
|
||||
datas.setIterationStrategy("identities", IdData.IterationStrategy.ONLY_ROWS_WITHOUT_ID);
|
||||
data.setIterationStrategy("identities", TagData.IterationStrategy.ONLY_ROWS_WITHOUT_ID);
|
||||
System.out.println("ONLY_ROWS_WITHOUT_ID:");
|
||||
try
|
||||
{
|
||||
html = StringPresenter.dynamize(htmlSource, datas);
|
||||
html = StringPresenter.dynamize(htmlSource, data);
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
|
@ -281,11 +281,11 @@ class XidDemo
|
|||
System.out.println("");
|
||||
|
||||
// #05.5
|
||||
datas.setIterationStrategy("identities", IdData.IterationStrategy.ALL_ROWS);
|
||||
data.setIterationStrategy("identities", TagData.IterationStrategy.ALL_ROWS);
|
||||
System.out.println("ALL_ROWS:");
|
||||
try
|
||||
{
|
||||
html = StringPresenter.dynamize(htmlSource, datas);
|
||||
html = StringPresenter.dynamize(htmlSource, data);
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
|
|
|
@ -46,7 +46,7 @@ public class DomPresenter extends Presenter
|
|||
/**
|
||||
*
|
||||
*/
|
||||
public StringBuffer dynamize(final IdsDataById datas) throws Exception
|
||||
public StringBuffer dynamize(final TagsDataById datas) throws Exception
|
||||
{
|
||||
StringBuffer result;
|
||||
|
||||
|
@ -72,7 +72,7 @@ public class DomPresenter extends Presenter
|
|||
/**
|
||||
*
|
||||
*/
|
||||
public StringBuffer dynamize(final Data datas) throws Exception
|
||||
public StringBuffer dynamize(final TagDataManager datas) throws Exception
|
||||
{
|
||||
return (dynamize(datas.getIdsDataById()));
|
||||
}
|
||||
|
@ -110,7 +110,7 @@ public class DomPresenter extends Presenter
|
|||
/**
|
||||
* Xid a file with data.
|
||||
*/
|
||||
static public StringBuffer dynamize(final Document doc, final IdsDataById datas) throws Exception
|
||||
static public StringBuffer dynamize(final Document doc, final TagsDataById datas) throws Exception
|
||||
{
|
||||
StringBuffer result;
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ public class FilePresenter extends DomPresenter
|
|||
*
|
||||
*/
|
||||
@Override
|
||||
public StringBuffer dynamize(final Data datas) throws Exception
|
||||
public StringBuffer dynamize(final TagDataManager datas) throws Exception
|
||||
{
|
||||
return (dynamize(datas.getIdsDataById()));
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ public class FilePresenter extends DomPresenter
|
|||
* No need to be synchronized.
|
||||
*/
|
||||
@Override
|
||||
public StringBuffer dynamize(final IdsDataById datas) throws Exception
|
||||
public StringBuffer dynamize(final TagsDataById datas) throws Exception
|
||||
{
|
||||
StringBuffer result;
|
||||
|
||||
|
@ -124,7 +124,7 @@ public class FilePresenter extends DomPresenter
|
|||
|
||||
FilePresenter presenter = new FilePresenter(filePathname);
|
||||
|
||||
result = presenter.dynamize((Data) null);
|
||||
result = presenter.dynamize((TagDataManager) null);
|
||||
|
||||
//
|
||||
return (result);
|
||||
|
@ -133,7 +133,7 @@ public class FilePresenter extends DomPresenter
|
|||
/**
|
||||
* Dynamize a file.
|
||||
*/
|
||||
static public StringBuffer dynamize(final String filePathname, final Data datas) throws Exception
|
||||
static public StringBuffer dynamize(final String filePathname, final TagDataManager datas) throws Exception
|
||||
{
|
||||
StringBuffer result;
|
||||
|
||||
|
|
|
@ -135,11 +135,11 @@ public class Presenter
|
|||
}
|
||||
|
||||
/**
|
||||
* Xid a file with data.
|
||||
* Dynamize a file with data.
|
||||
*/
|
||||
static public void dynamize(final Writer result, final Document doc, final IdsDataById datas) throws Exception
|
||||
static public void dynamize(final Writer result, final Document doc, final TagsDataById data) throws Exception
|
||||
{
|
||||
Presenter.process(result, doc, datas);
|
||||
Presenter.process(result, doc, data);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -236,40 +236,40 @@ public class Presenter
|
|||
switch (type)
|
||||
{
|
||||
// print document
|
||||
case Node.DOCUMENT_NODE:
|
||||
{
|
||||
headNode = findHeadNode(((Document) node).getDocumentElement());
|
||||
break;
|
||||
}
|
||||
|
||||
case Node.ELEMENT_NODE:
|
||||
{
|
||||
String tag = node.getNodeName();
|
||||
|
||||
if ("head".equals(tag))
|
||||
case Node.DOCUMENT_NODE:
|
||||
{
|
||||
headNode = node;
|
||||
headNode = findHeadNode(((Document) node).getDocumentElement());
|
||||
break;
|
||||
}
|
||||
|
||||
NodeList children = node.getChildNodes();
|
||||
int numChildren = 0;
|
||||
|
||||
if (children != null)
|
||||
case Node.ELEMENT_NODE:
|
||||
{
|
||||
numChildren = children.getLength();
|
||||
}
|
||||
String tag = node.getNodeName();
|
||||
|
||||
for (int i = 0; i < numChildren; i++)
|
||||
{
|
||||
headNode = findHeadNode(children.item(i));
|
||||
if (headNode != null)
|
||||
if ("head".equals(tag))
|
||||
{
|
||||
headNode = node;
|
||||
break;
|
||||
}
|
||||
|
||||
NodeList children = node.getChildNodes();
|
||||
int numChildren = 0;
|
||||
|
||||
if (children != null)
|
||||
{
|
||||
numChildren = children.getLength();
|
||||
}
|
||||
|
||||
for (int i = 0; i < numChildren; i++)
|
||||
{
|
||||
headNode = findHeadNode(children.item(i));
|
||||
if (headNode != null)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return headNode;
|
||||
}
|
||||
|
@ -356,9 +356,9 @@ public class Presenter
|
|||
/**
|
||||
*
|
||||
*/
|
||||
static public Attributes mergeAttributes(final Attributes target, final Attributes source)
|
||||
static public TagAttributes mergeAttributes(final TagAttributes target, final TagAttributes source)
|
||||
{
|
||||
Attributes result;
|
||||
TagAttributes result;
|
||||
|
||||
//
|
||||
if (target == null)
|
||||
|
@ -371,7 +371,7 @@ public class Presenter
|
|||
}
|
||||
else
|
||||
{
|
||||
result = new Attributes(target);
|
||||
result = new TagAttributes(target);
|
||||
|
||||
Iterator<Map.Entry<String, String>> iterator = source.entrySet().iterator();
|
||||
|
||||
|
@ -427,7 +427,7 @@ public class Presenter
|
|||
/**
|
||||
*
|
||||
*/
|
||||
static protected void process(final Writer result, final Node node, final IdsDataById datas) throws Exception
|
||||
static protected void process(final Writer result, final Node node, final TagsDataById datas) throws Exception
|
||||
{
|
||||
Presenter.process(result, node, datas, "");
|
||||
}
|
||||
|
@ -436,7 +436,7 @@ public class Presenter
|
|||
* Recursive method that processes a node and any child nodes.
|
||||
*
|
||||
*/
|
||||
static protected void process(final Writer result, final Node node, final IdsDataById datas, final String suffix) throws Exception
|
||||
static protected void process(final Writer result, final Node node, final TagsDataById datas, final String suffix) throws Exception
|
||||
{
|
||||
logger.debug("process - started");
|
||||
String TRANSITIONAL_DTD = "xhtml1-transitional.dtd";
|
||||
|
@ -455,96 +455,96 @@ public class Presenter
|
|||
int type = node.getNodeType();
|
||||
switch (type)
|
||||
{
|
||||
case Node.DOCUMENT_NODE:
|
||||
{
|
||||
logger.debug("case Node.DOCUMENT_NODE");
|
||||
DocumentType dt = ((Document) node).getDoctype();
|
||||
|
||||
if (dt != null)
|
||||
case Node.DOCUMENT_NODE:
|
||||
{
|
||||
// String publicId = dt.getPublicId();
|
||||
String systemId = dt.getSystemId();
|
||||
logger.debug("case Node.DOCUMENT_NODE");
|
||||
DocumentType dt = ((Document) node).getDoctype();
|
||||
|
||||
if (systemId.equals(TRANSITIONAL_DTD))
|
||||
if (dt != null)
|
||||
{
|
||||
result.append(TRANSITIONAL_DOCTYPE);
|
||||
// String publicId = dt.getPublicId();
|
||||
String systemId = dt.getSystemId();
|
||||
|
||||
if (systemId.equals(TRANSITIONAL_DTD))
|
||||
{
|
||||
result.append(TRANSITIONAL_DOCTYPE);
|
||||
}
|
||||
|
||||
// Log.write(Log.TRACE,"publicId = " + publicId);
|
||||
// Log.write(Log.TRACE,"systemId = " + systemId);
|
||||
}
|
||||
|
||||
// Log.write(Log.TRACE,"publicId = " + publicId);
|
||||
// Log.write(Log.TRACE,"systemId = " + systemId);
|
||||
Presenter.process(result, ((Document) node).getDocumentElement(), datas, suffix);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
Presenter.process(result, ((Document) node).getDocumentElement(), datas, suffix);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case Node.ELEMENT_NODE:
|
||||
{
|
||||
logger.debug("case Node.ELEMENT_NODE");
|
||||
|
||||
NamedNodeMap attrs = node.getAttributes();
|
||||
Node idAttr = attrs.getNamedItem("id");
|
||||
|
||||
if (idAttr != null)
|
||||
case Node.ELEMENT_NODE:
|
||||
{
|
||||
Presenter.processElementWithId(result, node, attrs, idAttr, datas, suffix);
|
||||
logger.debug("case Node.ELEMENT_NODE");
|
||||
|
||||
NamedNodeMap attrs = node.getAttributes();
|
||||
Node idAttr = attrs.getNamedItem("id");
|
||||
|
||||
if (idAttr != null)
|
||||
{
|
||||
Presenter.processElementWithId(result, node, attrs, idAttr, datas, suffix);
|
||||
}
|
||||
else
|
||||
{
|
||||
Presenter.processElementBasically(result, node, datas, suffix);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
else
|
||||
|
||||
// handle entity reference nodes
|
||||
case Node.ENTITY_REFERENCE_NODE:
|
||||
{
|
||||
Presenter.processElementBasically(result, node, datas, suffix);
|
||||
logger.debug("case Node.ENTITY_REFERENCE_NODE");
|
||||
|
||||
result.append('&');
|
||||
result.append(node.getNodeName());
|
||||
result.append(';');
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
// handle entity reference nodes
|
||||
case Node.ENTITY_REFERENCE_NODE:
|
||||
{
|
||||
logger.debug("case Node.ENTITY_REFERENCE_NODE");
|
||||
|
||||
result.append('&');
|
||||
result.append(node.getNodeName());
|
||||
result.append(';');
|
||||
break;
|
||||
}
|
||||
|
||||
// print cdata sections
|
||||
case Node.CDATA_SECTION_NODE:
|
||||
{
|
||||
logger.debug("case Node.CDATA_SECTION_NODE");
|
||||
|
||||
result.append("<![CDATA[");
|
||||
result.append(node.getNodeValue());
|
||||
result.append("]]>");
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
// print text
|
||||
case Node.TEXT_NODE:
|
||||
{
|
||||
logger.debug("case Node.TEXTE_NODE");
|
||||
result.append(restoreEntities(new StringBuffer(node.getNodeValue())));
|
||||
break;
|
||||
}
|
||||
|
||||
// print processing instruction
|
||||
case Node.PROCESSING_INSTRUCTION_NODE:
|
||||
{
|
||||
logger.debug("Node.PROCESSING_INSTRUCTION_NODE");
|
||||
|
||||
result.append("<?");
|
||||
result.append(node.getNodeName());
|
||||
String data = node.getNodeValue();
|
||||
if ((data != null) && (data.length() > 0))
|
||||
// print cdata sections
|
||||
case Node.CDATA_SECTION_NODE:
|
||||
{
|
||||
result.append(' ');
|
||||
result.append(data);
|
||||
logger.debug("case Node.CDATA_SECTION_NODE");
|
||||
|
||||
result.append("<![CDATA[");
|
||||
result.append(node.getNodeValue());
|
||||
result.append("]]>");
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
// print text
|
||||
case Node.TEXT_NODE:
|
||||
{
|
||||
logger.debug("case Node.TEXTE_NODE");
|
||||
result.append(restoreEntities(new StringBuffer(node.getNodeValue())));
|
||||
break;
|
||||
}
|
||||
|
||||
// print processing instruction
|
||||
case Node.PROCESSING_INSTRUCTION_NODE:
|
||||
{
|
||||
logger.debug("Node.PROCESSING_INSTRUCTION_NODE");
|
||||
|
||||
result.append("<?");
|
||||
result.append(node.getNodeName());
|
||||
String value = node.getNodeValue();
|
||||
if ((value != null) && (value.length() > 0))
|
||||
{
|
||||
result.append(' ');
|
||||
result.append(value);
|
||||
}
|
||||
result.append("?>");
|
||||
break;
|
||||
}
|
||||
result.append("?>");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -570,7 +570,7 @@ public class Presenter
|
|||
/**
|
||||
*
|
||||
*/
|
||||
static protected StringBuffer processAttributes(final NamedNodeMap attrs, final Attributes dataAttributes)
|
||||
static protected StringBuffer processAttributes(final NamedNodeMap attrs, final TagAttributes dataAttributes)
|
||||
{
|
||||
StringBuffer result;
|
||||
|
||||
|
@ -583,20 +583,7 @@ public class Presenter
|
|||
/**
|
||||
*
|
||||
*/
|
||||
static protected StringBuffer processAttributes(final NamedNodeMap attrs, final Attributes dataAttributes, final Attributes namedDataAttributes, final String suffix)
|
||||
{
|
||||
StringBuffer result;
|
||||
|
||||
result = processAttributes(attrs, mergeAttributes(dataAttributes, namedDataAttributes), suffix);
|
||||
|
||||
//
|
||||
return (result);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
static protected StringBuffer processAttributes(final NamedNodeMap attrs, final Attributes dataAttributes, final String suffix)
|
||||
static protected StringBuffer processAttributes(final NamedNodeMap attrs, final TagAttributes dataAttributes, final String suffix)
|
||||
{
|
||||
StringBuffer result;
|
||||
|
||||
|
@ -661,7 +648,20 @@ public class Presenter
|
|||
/**
|
||||
*
|
||||
*/
|
||||
static protected void processChildren(final Writer result, final Node node, final IdsDataById datas) throws Exception
|
||||
static protected StringBuffer processAttributes(final NamedNodeMap attrs, final TagAttributes dataAttributes, final TagAttributes namedDataAttributes, final String suffix)
|
||||
{
|
||||
StringBuffer result;
|
||||
|
||||
result = processAttributes(attrs, mergeAttributes(dataAttributes, namedDataAttributes), suffix);
|
||||
|
||||
//
|
||||
return (result);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
static protected void processChildren(final Writer result, final Node node, final TagsDataById datas) throws Exception
|
||||
{
|
||||
processChildren(result, node, datas, "");
|
||||
}
|
||||
|
@ -669,15 +669,15 @@ public class Presenter
|
|||
/**
|
||||
*
|
||||
*/
|
||||
static protected void processChildren(final Writer result, final Node node, final IdsDataById datas, final String suffix) throws Exception
|
||||
static protected void processChildren(final Writer result, final Node node, final TagsDataById datas, final String suffix) throws Exception
|
||||
{
|
||||
// Get the iteration strategy.
|
||||
IdData.IterationStrategy strategy;
|
||||
TagData.IterationStrategy strategy;
|
||||
|
||||
NamedNodeMap attributes = node.getAttributes();
|
||||
if (attributes == null)
|
||||
{
|
||||
strategy = IdData.IterationStrategy.ALL_ROWS;
|
||||
strategy = TagData.IterationStrategy.ALL_ROWS;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -685,23 +685,23 @@ public class Presenter
|
|||
|
||||
if (id == null)
|
||||
{
|
||||
strategy = IdData.IterationStrategy.ALL_ROWS;
|
||||
strategy = TagData.IterationStrategy.ALL_ROWS;
|
||||
}
|
||||
else
|
||||
{
|
||||
IdDataCore dataCore = datas.getId(id.getNodeValue());
|
||||
TagDataCore dataCore = datas.getId(id.getNodeValue());
|
||||
if (dataCore == null)
|
||||
{
|
||||
strategy = IdData.IterationStrategy.ALL_ROWS;
|
||||
strategy = TagData.IterationStrategy.ALL_ROWS;
|
||||
}
|
||||
else if (dataCore instanceof IdData)
|
||||
else if (dataCore instanceof TagData)
|
||||
{
|
||||
IdData data = (IdData) dataCore;
|
||||
TagData data = (TagData) dataCore;
|
||||
strategy = data.iterationStrategy();
|
||||
}
|
||||
else
|
||||
{
|
||||
strategy = IdData.IterationStrategy.ALL_ROWS;
|
||||
strategy = TagData.IterationStrategy.ALL_ROWS;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -712,95 +712,95 @@ public class Presenter
|
|||
|
||||
switch (strategy)
|
||||
{
|
||||
case ONLY_FIRST_ROW:
|
||||
int lineCounter = 0;
|
||||
for (int childIndex = 0; childIndex < childrenCount; childIndex++)
|
||||
{
|
||||
if (children.item(childIndex).getNodeType() == Node.ELEMENT_NODE)
|
||||
case ONLY_FIRST_ROW:
|
||||
int lineCounter = 0;
|
||||
for (int childIndex = 0; childIndex < childrenCount; childIndex++)
|
||||
{
|
||||
lineCounter += 1;
|
||||
if (lineCounter == 1)
|
||||
if (children.item(childIndex).getNodeType() == Node.ELEMENT_NODE)
|
||||
{
|
||||
lineCounter += 1;
|
||||
if (lineCounter == 1)
|
||||
{
|
||||
process(result, children.item(childIndex), datas, suffix);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
process(result, children.item(childIndex), datas, suffix);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
process(result, children.item(childIndex), datas, suffix);
|
||||
}
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
case ONLY_FIRST_TWO_ROWS:
|
||||
lineCounter = 0;
|
||||
for (int childIndex = 0; childIndex < childrenCount; childIndex++)
|
||||
{
|
||||
if (children.item(childIndex).getNodeType() == Node.ELEMENT_NODE)
|
||||
case ONLY_FIRST_TWO_ROWS:
|
||||
lineCounter = 0;
|
||||
for (int childIndex = 0; childIndex < childrenCount; childIndex++)
|
||||
{
|
||||
lineCounter += 1;
|
||||
if (children.item(childIndex).getNodeType() == Node.ELEMENT_NODE)
|
||||
{
|
||||
lineCounter += 1;
|
||||
|
||||
if ((lineCounter == 1) || (lineCounter == 2))
|
||||
if ((lineCounter == 1) || (lineCounter == 2))
|
||||
{
|
||||
process(result, children.item(childIndex), datas, suffix);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
process(result, children.item(childIndex), datas, suffix);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
process(result, children.item(childIndex), datas, suffix);
|
||||
}
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
case ONLY_ROWS_WITH_ID:
|
||||
for (int childIndex = 0; childIndex < childrenCount; childIndex++)
|
||||
{
|
||||
if (children.item(childIndex).getNodeType() == Node.ELEMENT_NODE)
|
||||
case ONLY_ROWS_WITH_ID:
|
||||
for (int childIndex = 0; childIndex < childrenCount; childIndex++)
|
||||
{
|
||||
NamedNodeMap attrs2 = children.item(childIndex).getAttributes();
|
||||
if (children.item(childIndex).getNodeType() == Node.ELEMENT_NODE)
|
||||
{
|
||||
NamedNodeMap attrs2 = children.item(childIndex).getAttributes();
|
||||
|
||||
if ((attrs2 != null) && (attrs2.getNamedItem("id") != null))
|
||||
if ((attrs2 != null) && (attrs2.getNamedItem("id") != null))
|
||||
{
|
||||
process(result, children.item(childIndex), datas, suffix);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
process(result, children.item(childIndex), datas, suffix);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
process(result, children.item(childIndex), datas, suffix);
|
||||
}
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
case ONLY_ROWS_WITHOUT_ID:
|
||||
for (int childIndex = 0; childIndex < childrenCount; childIndex++)
|
||||
{
|
||||
if (children.item(childIndex).getNodeType() == Node.ELEMENT_NODE)
|
||||
case ONLY_ROWS_WITHOUT_ID:
|
||||
for (int childIndex = 0; childIndex < childrenCount; childIndex++)
|
||||
{
|
||||
NamedNodeMap attrs2 = children.item(childIndex).getAttributes();
|
||||
if ((attrs2 == null) || (attrs2.getNamedItem("id") == null))
|
||||
if (children.item(childIndex).getNodeType() == Node.ELEMENT_NODE)
|
||||
{
|
||||
NamedNodeMap attrs2 = children.item(childIndex).getAttributes();
|
||||
if ((attrs2 == null) || (attrs2.getNamedItem("id") == null))
|
||||
{
|
||||
process(result, children.item(childIndex), datas, suffix);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
process(result, children.item(childIndex), datas, suffix);
|
||||
}
|
||||
}
|
||||
else
|
||||
break;
|
||||
|
||||
case ALL_ROWS:
|
||||
for (int childIndex = 0; childIndex < childrenCount; childIndex++)
|
||||
{
|
||||
process(result, children.item(childIndex), datas, suffix);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case ALL_ROWS:
|
||||
for (int childIndex = 0; childIndex < childrenCount; childIndex++)
|
||||
{
|
||||
process(result, children.item(childIndex), datas, suffix);
|
||||
}
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
static void processElementBasically(final Writer result, final Node node, final IdsDataById datas) throws Exception
|
||||
static void processElementBasically(final Writer result, final Node node, final TagsDataById datas) throws Exception
|
||||
{
|
||||
processElementBasically(result, node, datas, "");
|
||||
}
|
||||
|
@ -808,7 +808,7 @@ public class Presenter
|
|||
/**
|
||||
*
|
||||
*/
|
||||
static void processElementBasically(final Writer result, final Node node, final IdsDataById datas, final String suffix) throws Exception
|
||||
static void processElementBasically(final Writer result, final Node node, final TagsDataById datas, final String suffix) throws Exception
|
||||
{
|
||||
logger.debug("processElementBasically - started");
|
||||
|
||||
|
@ -851,7 +851,7 @@ public class Presenter
|
|||
* @param idAttr
|
||||
* The ID.
|
||||
*/
|
||||
static protected void processElementWithId(final Writer result, final Node node, final NamedNodeMap attrs, final Node idAttr, final IdsDataById datas) throws Exception
|
||||
static protected void processElementWithId(final Writer result, final Node node, final NamedNodeMap attrs, final Node idAttr, final TagsDataById datas) throws Exception
|
||||
|
||||
{
|
||||
processElementWithId(result, node, attrs, idAttr, datas, "");
|
||||
|
@ -868,7 +868,7 @@ public class Presenter
|
|||
* @param idAttr
|
||||
* The ID.
|
||||
*/
|
||||
static protected void processElementWithId(final Writer result, final Node node, final NamedNodeMap attrs, final Node idAttr, final IdsDataById datas, final String suffix) throws Exception
|
||||
static protected void processElementWithId(final Writer result, final Node node, final NamedNodeMap attrs, final Node idAttr, final TagsDataById datas, final String suffix) throws Exception
|
||||
{
|
||||
String tag = node.getNodeName();
|
||||
|
||||
|
@ -877,15 +877,15 @@ public class Presenter
|
|||
logger.debug("tag=" + tag);
|
||||
|
||||
// Get data of this id.
|
||||
IdDataCore dataCore = datas.get(idAttr.getNodeValue());
|
||||
TagDataCore dataCore = datas.get(idAttr.getNodeValue());
|
||||
|
||||
if (dataCore == null)
|
||||
{
|
||||
Presenter.processElementBasically(result, node, datas, suffix);
|
||||
}
|
||||
else if (dataCore instanceof IdData)
|
||||
else if (dataCore instanceof TagData)
|
||||
{
|
||||
IdData data = (IdData) dataCore;
|
||||
TagData data = (TagData) dataCore;
|
||||
|
||||
String theClass = data.attributes().getAttribute("class");
|
||||
|
||||
|
@ -926,16 +926,16 @@ public class Presenter
|
|||
}
|
||||
}
|
||||
}
|
||||
else if (dataCore instanceof IdsDataByIndex)
|
||||
else if (dataCore instanceof TagsDataByIndex)
|
||||
{
|
||||
IdsDataByIndex tags = (IdsDataByIndex) dataCore;
|
||||
TagsDataByIndex tags = (TagsDataByIndex) dataCore;
|
||||
|
||||
int nbLines = tags.size();
|
||||
for (int nLine = 0; nLine < nbLines; nLine++)
|
||||
{
|
||||
if (tags.elementAt(nLine) instanceof IdData)
|
||||
if (tags.elementAt(nLine) instanceof TagData)
|
||||
{
|
||||
IdData data = (IdData) tags.elementAt(nLine);
|
||||
TagData data = (TagData) tags.elementAt(nLine);
|
||||
|
||||
// Open the tag.
|
||||
result.append("<");
|
||||
|
@ -973,7 +973,7 @@ public class Presenter
|
|||
else
|
||||
{
|
||||
// Manage a Hashmap.
|
||||
IdsDataById data = (IdsDataById) tags.elementAt(nLine);
|
||||
TagsDataById data = (TagsDataById) tags.elementAt(nLine);
|
||||
|
||||
Presenter.processElementWithId(result, node, attrs, idAttr, data, Integer.toString(nLine));
|
||||
result.append('\n');
|
||||
|
@ -1015,28 +1015,28 @@ public class Presenter
|
|||
char ch = s.charAt(i);
|
||||
switch (ch)
|
||||
{
|
||||
case '<':
|
||||
{
|
||||
str.append("<");
|
||||
break;
|
||||
}
|
||||
case '<':
|
||||
{
|
||||
str.append("<");
|
||||
break;
|
||||
}
|
||||
|
||||
case '>':
|
||||
{
|
||||
str.append(">");
|
||||
break;
|
||||
}
|
||||
case '>':
|
||||
{
|
||||
str.append(">");
|
||||
break;
|
||||
}
|
||||
|
||||
case '&':
|
||||
{
|
||||
str.append("&");
|
||||
break;
|
||||
}
|
||||
case '&':
|
||||
{
|
||||
str.append("&");
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
{
|
||||
str.append(ch);
|
||||
}
|
||||
default:
|
||||
{
|
||||
str.append(ch);
|
||||
}
|
||||
}
|
||||
}
|
||||
result = str.toString();
|
||||
|
|
|
@ -39,7 +39,7 @@ public class StringPresenter extends DomPresenter
|
|||
*
|
||||
*/
|
||||
@Override
|
||||
public StringBuffer dynamize(final Data datas) throws Exception
|
||||
public StringBuffer dynamize(final TagDataManager datas) throws Exception
|
||||
{
|
||||
return (dynamize(datas.getIdsDataById()));
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ public class StringPresenter extends DomPresenter
|
|||
*
|
||||
*/
|
||||
@Override
|
||||
public StringBuffer dynamize(final IdsDataById datas) throws Exception
|
||||
public StringBuffer dynamize(final TagsDataById datas) throws Exception
|
||||
{
|
||||
StringBuffer result;
|
||||
|
||||
|
@ -131,7 +131,7 @@ public class StringPresenter extends DomPresenter
|
|||
/**
|
||||
*
|
||||
*/
|
||||
static public StringBuffer dynamize(final String html, final Data datas) throws Exception
|
||||
static public StringBuffer dynamize(final String html, final TagDataManager datas) throws Exception
|
||||
{
|
||||
return (dynamize(html, datas.getIdsDataById()));
|
||||
}
|
||||
|
@ -139,7 +139,7 @@ public class StringPresenter extends DomPresenter
|
|||
/**
|
||||
* Xid a string with html in.
|
||||
*/
|
||||
static public StringBuffer dynamize(final String html, final IdsDataById datas) throws Exception
|
||||
static public StringBuffer dynamize(final String html, final TagsDataById datas) throws Exception
|
||||
{
|
||||
StringBuffer result;
|
||||
|
||||
|
|
|
@ -7,14 +7,14 @@ import java.util.HashMap;
|
|||
* Note: no more AttrValue as in Brill, because the exception of style is
|
||||
* managed in the attribute merging on the "style" string detection.
|
||||
*/
|
||||
public class Attributes extends HashMap<String, String>
|
||||
public class TagAttributes extends HashMap<String, String>
|
||||
{
|
||||
private static final long serialVersionUID = 2802739066295665336L;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public Attributes()
|
||||
public TagAttributes()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ public class Attributes extends HashMap<String, String>
|
|||
/**
|
||||
* Useful for the merge attributes.
|
||||
*/
|
||||
public Attributes(final Attributes attributes)
|
||||
public TagAttributes(final TagAttributes attributes)
|
||||
{
|
||||
super(attributes);
|
||||
}
|
|
@ -14,7 +14,7 @@ import java.io.Serializable;
|
|||
* implement it's own IdData classes.
|
||||
*
|
||||
*/
|
||||
public class IdData implements Serializable, IdDataCore
|
||||
public class TagData implements Serializable, TagDataCore
|
||||
{
|
||||
public enum IterationStrategy
|
||||
{
|
||||
|
@ -29,7 +29,7 @@ public class IdData implements Serializable, IdDataCore
|
|||
private static final long serialVersionUID = 8976245034682639923L;;
|
||||
|
||||
private IterationStrategy iterationStrategy;
|
||||
private Attributes attributes;
|
||||
private TagAttributes attributes;
|
||||
private boolean excludeSection;
|
||||
private MODE displayMode = MODE.REPLACE;
|
||||
private String content;
|
||||
|
@ -37,7 +37,7 @@ public class IdData implements Serializable, IdDataCore
|
|||
/**
|
||||
*
|
||||
*/
|
||||
public IdData()
|
||||
public TagData()
|
||||
{
|
||||
this.attributes = null;
|
||||
this.excludeSection = false;
|
||||
|
@ -49,7 +49,7 @@ public class IdData implements Serializable, IdDataCore
|
|||
/**
|
||||
*
|
||||
*/
|
||||
public IdData(final String text)
|
||||
public TagData(final String text)
|
||||
{
|
||||
this.attributes = null;
|
||||
this.excludeSection = false;
|
||||
|
@ -76,13 +76,13 @@ public class IdData implements Serializable, IdDataCore
|
|||
/**
|
||||
*
|
||||
*/
|
||||
public Attributes attributes()
|
||||
public TagAttributes attributes()
|
||||
{
|
||||
Attributes result;
|
||||
TagAttributes result;
|
||||
|
||||
if (this.attributes == null)
|
||||
{
|
||||
this.attributes = new Attributes();
|
||||
this.attributes = new TagAttributes();
|
||||
}
|
||||
|
||||
result = this.attributes;
|
|
@ -10,6 +10,6 @@ package fr.devinsy.xidyn;
|
|||
* This interface helps to express this fact.
|
||||
*
|
||||
*/
|
||||
public interface IdDataCore
|
||||
public interface TagDataCore
|
||||
{
|
||||
}
|
|
@ -3,16 +3,16 @@ package fr.devinsy.xidyn;
|
|||
/*
|
||||
*
|
||||
*/
|
||||
public class Data
|
||||
public class TagDataManager
|
||||
{
|
||||
private IdsDataById idsDataById;
|
||||
private TagsDataById idsDataById;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public Data()
|
||||
public TagDataManager()
|
||||
{
|
||||
this.idsDataById = new IdsDataById();
|
||||
this.idsDataById = new TagsDataById();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -20,7 +20,7 @@ public class Data
|
|||
*/
|
||||
public void appendAttribute(final String id, final int line, final String column, final String label, final String value)
|
||||
{
|
||||
IdData tag = this.getIdData(id, line, column);
|
||||
TagData tag = this.getIdData(id, line, column);
|
||||
|
||||
tag.attributes().appendAttribute(label, value);
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ public class Data
|
|||
*/
|
||||
public void appendAttribute(final String id, final String label, final String value)
|
||||
{
|
||||
IdData tag = this.getIdData(id);
|
||||
TagData tag = this.getIdData(id);
|
||||
|
||||
tag.attributes().appendAttribute(label, value);
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ public class Data
|
|||
*/
|
||||
public void appendContent(final String id, final int line, final String value)
|
||||
{
|
||||
IdData tag = this.getIdData(id, line);
|
||||
TagData tag = this.getIdData(id, line);
|
||||
|
||||
tag.appendContent(value);
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ public class Data
|
|||
*/
|
||||
public void appendContent(final String id, final int line, final String column, final String value)
|
||||
{
|
||||
IdData tag = this.getIdData(id, line, column);
|
||||
TagData tag = this.getIdData(id, line, column);
|
||||
|
||||
tag.appendContent(value);
|
||||
}
|
||||
|
@ -82,18 +82,18 @@ public class Data
|
|||
/**
|
||||
*
|
||||
*/
|
||||
public IdData getIdData(final String id)
|
||||
public TagData getIdData(final String id)
|
||||
{
|
||||
IdData result;
|
||||
TagData result;
|
||||
|
||||
// Be sure that IdData is existing and get item.
|
||||
result = (IdData) this.idsDataById.getId(id);
|
||||
result = (TagData) this.idsDataById.getId(id);
|
||||
|
||||
if (result == null)
|
||||
{
|
||||
this.idsDataById.setId(id, new IdData());
|
||||
this.idsDataById.setId(id, new TagData());
|
||||
|
||||
result = (IdData) this.idsDataById.getId(id);
|
||||
result = (TagData) this.idsDataById.getId(id);
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -103,28 +103,28 @@ public class Data
|
|||
/**
|
||||
*
|
||||
*/
|
||||
public IdData getIdData(final String id, final int line)
|
||||
public TagData getIdData(final String id, final int line)
|
||||
{
|
||||
IdData result;
|
||||
TagData result;
|
||||
|
||||
// Be sure that IdsData are existing.
|
||||
IdsDataByIndex tags = (IdsDataByIndex) this.idsDataById.getId(id);
|
||||
TagsDataByIndex tags = (TagsDataByIndex) this.idsDataById.getId(id);
|
||||
if (tags == null)
|
||||
{
|
||||
this.idsDataById.setId(id, new IdsDataByIndex());
|
||||
this.idsDataById.setId(id, new TagsDataByIndex());
|
||||
|
||||
tags = (IdsDataByIndex) this.idsDataById.getId(id);
|
||||
tags = (TagsDataByIndex) this.idsDataById.getId(id);
|
||||
}
|
||||
|
||||
// Be sure that lines are existing.
|
||||
int nbLines = tags.size();
|
||||
for (int nLine = nbLines; nLine < line + 1; nLine++)
|
||||
{
|
||||
tags.add(nLine, new IdData());
|
||||
tags.add(nLine, new TagData());
|
||||
}
|
||||
|
||||
// Get item.
|
||||
result = (IdData) tags.elementAt(line);
|
||||
result = (TagData) tags.elementAt(line);
|
||||
|
||||
//
|
||||
return (result);
|
||||
|
@ -133,36 +133,36 @@ public class Data
|
|||
/**
|
||||
*
|
||||
*/
|
||||
public IdData getIdData(final String id, final int line, final String column)
|
||||
public TagData getIdData(final String id, final int line, final String column)
|
||||
{
|
||||
IdData result;
|
||||
TagData result;
|
||||
|
||||
// Be sure that IdsData are existing.
|
||||
IdsDataByIndex tags = (IdsDataByIndex) this.idsDataById.getId(id);
|
||||
TagsDataByIndex tags = (TagsDataByIndex) this.idsDataById.getId(id);
|
||||
if (tags == null)
|
||||
{
|
||||
this.idsDataById.setId(id, new IdsDataByIndex());
|
||||
this.idsDataById.setId(id, new TagsDataByIndex());
|
||||
|
||||
tags = (IdsDataByIndex) this.idsDataById.getId(id);
|
||||
tags = (TagsDataByIndex) this.idsDataById.getId(id);
|
||||
}
|
||||
|
||||
// Be sure that lines are existing.
|
||||
int nbLines = tags.size();
|
||||
for (int nLine = nbLines; nLine < line + 1; nLine++)
|
||||
{
|
||||
tags.add(nLine, new IdsDataById());
|
||||
tags.add(nLine, new TagsDataById());
|
||||
}
|
||||
|
||||
// Get item.
|
||||
IdsDataById lineData = (IdsDataById) tags.elementAt(line);
|
||||
TagsDataById lineData = (TagsDataById) tags.elementAt(line);
|
||||
|
||||
result = (IdData) lineData.get(column);
|
||||
result = (TagData) lineData.get(column);
|
||||
|
||||
if (result == null)
|
||||
{
|
||||
lineData.put(column, new IdData());
|
||||
lineData.put(column, new TagData());
|
||||
|
||||
result = (IdData) lineData.get(column);
|
||||
result = (TagData) lineData.get(column);
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -172,9 +172,9 @@ public class Data
|
|||
/**
|
||||
*
|
||||
*/
|
||||
public IdsDataById getIdsDataById()
|
||||
public TagsDataById getIdsDataById()
|
||||
{
|
||||
IdsDataById result;
|
||||
TagsDataById result;
|
||||
|
||||
result = this.idsDataById;
|
||||
|
||||
|
@ -195,7 +195,7 @@ public class Data
|
|||
*/
|
||||
public void setAttribute(final String id, final int line, final String label, final String value)
|
||||
{
|
||||
IdData tag = this.getIdData(id, line);
|
||||
TagData tag = this.getIdData(id, line);
|
||||
|
||||
tag.attributes().setAttribute(label, value);
|
||||
}
|
||||
|
@ -213,7 +213,7 @@ public class Data
|
|||
*/
|
||||
public void setAttribute(final String id, final int line, final String column, final String label, final String value)
|
||||
{
|
||||
IdData tag = this.getIdData(id, line, column);
|
||||
TagData tag = this.getIdData(id, line, column);
|
||||
|
||||
tag.attributes().setAttribute(label, value);
|
||||
}
|
||||
|
@ -231,7 +231,7 @@ public class Data
|
|||
*/
|
||||
public void setAttribute(final String id, final String label, final String value)
|
||||
{
|
||||
IdData tag = this.getIdData(id);
|
||||
TagData tag = this.getIdData(id);
|
||||
|
||||
tag.attributes().setAttribute(label, value);
|
||||
}
|
||||
|
@ -257,7 +257,7 @@ public class Data
|
|||
*/
|
||||
public void setContent(final String id, final int line, final String content)
|
||||
{
|
||||
IdData tag = this.getIdData(id, line);
|
||||
TagData tag = this.getIdData(id, line);
|
||||
|
||||
tag.setContent(content);
|
||||
}
|
||||
|
@ -285,7 +285,7 @@ public class Data
|
|||
*/
|
||||
public void setContent(final String id, final int line, final String column, final String content)
|
||||
{
|
||||
IdData tag = this.getIdData(id, line, column);
|
||||
TagData tag = this.getIdData(id, line, column);
|
||||
|
||||
tag.setContent(content);
|
||||
}
|
||||
|
@ -295,7 +295,7 @@ public class Data
|
|||
*/
|
||||
public void setContent(final String id, final String content)
|
||||
{
|
||||
IdData idData = this.getIdData(id);
|
||||
TagData idData = this.getIdData(id);
|
||||
|
||||
idData.setContent(content);
|
||||
}
|
||||
|
@ -303,9 +303,9 @@ public class Data
|
|||
/**
|
||||
*
|
||||
*/
|
||||
public void setIterationStrategy(final String id, final IdData.IterationStrategy strategy)
|
||||
public void setIterationStrategy(final String id, final TagData.IterationStrategy strategy)
|
||||
{
|
||||
IdData tag = this.getIdData(id);
|
||||
TagData tag = this.getIdData(id);
|
||||
|
||||
tag.setIterationStrategy(strategy);
|
||||
}
|
|
@ -5,7 +5,7 @@ import java.util.HashMap;
|
|||
/**
|
||||
*
|
||||
*/
|
||||
public class IdsDataById extends HashMap<String, IdDataCore> implements IdDataCore
|
||||
public class TagsDataById extends HashMap<String, TagDataCore> implements TagDataCore
|
||||
{
|
||||
|
||||
private static final long serialVersionUID = -5787252043825503554L;
|
||||
|
@ -13,7 +13,7 @@ public class IdsDataById extends HashMap<String, IdDataCore> implements IdDataCo
|
|||
/**
|
||||
*
|
||||
*/
|
||||
public IdsDataById()
|
||||
public TagsDataById()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
@ -21,9 +21,9 @@ public class IdsDataById extends HashMap<String, IdDataCore> implements IdDataCo
|
|||
/**
|
||||
*
|
||||
*/
|
||||
public IdDataCore getId(final String id)
|
||||
public TagDataCore getId(final String id)
|
||||
{
|
||||
IdDataCore result;
|
||||
TagDataCore result;
|
||||
|
||||
result = this.get(id);
|
||||
|
||||
|
@ -34,7 +34,7 @@ public class IdsDataById extends HashMap<String, IdDataCore> implements IdDataCo
|
|||
/**
|
||||
*
|
||||
*/
|
||||
public void setId(final String id, final IdDataCore data)
|
||||
public void setId(final String id, final TagDataCore data)
|
||||
{
|
||||
this.put(id, data);
|
||||
}
|
|
@ -5,7 +5,7 @@ import java.util.Vector;
|
|||
/**
|
||||
*
|
||||
*/
|
||||
public class IdsDataByIndex extends Vector<IdDataCore> implements IdDataCore
|
||||
public class TagsDataByIndex extends Vector<TagDataCore> implements TagDataCore
|
||||
{
|
||||
|
||||
private static final long serialVersionUID = 215545720925753884L;
|
||||
|
@ -13,7 +13,7 @@ public class IdsDataByIndex extends Vector<IdDataCore> implements IdDataCore
|
|||
/**
|
||||
*
|
||||
*/
|
||||
public IdsDataByIndex()
|
||||
public TagsDataByIndex()
|
||||
{
|
||||
super();
|
||||
}
|
|
@ -2,8 +2,8 @@
|
|||
* XidTest.
|
||||
*/
|
||||
|
||||
import fr.devinsy.xidyn.Data;
|
||||
import fr.devinsy.xidyn.IdData;
|
||||
import fr.devinsy.xidyn.TagDataManager;
|
||||
import fr.devinsy.xidyn.TagData;
|
||||
import fr.devinsy.xidyn.StringPresenter;
|
||||
|
||||
/**
|
||||
|
@ -54,15 +54,15 @@ class XidTest
|
|||
{
|
||||
System.out.println("Automatic test action for Xid!");
|
||||
|
||||
Data datas;
|
||||
IdData tag;
|
||||
TagDataManager datas;
|
||||
TagData tag;
|
||||
|
||||
String htmlSource;
|
||||
StringBuffer html;
|
||||
|
||||
// Populate attributes of Test 03.
|
||||
System.out.println("----------------------------");
|
||||
datas = new Data();
|
||||
datas = new TagDataManager();
|
||||
datas.setContent("name", "Superman");
|
||||
try
|
||||
{
|
||||
|
@ -78,7 +78,7 @@ class XidTest
|
|||
|
||||
// Populate attributes of Test 03.
|
||||
System.out.println("----------------------------");
|
||||
datas = new Data();
|
||||
datas = new TagDataManager();
|
||||
datas.setContent("lastname", "Spiderman");
|
||||
datas.appendAttribute("lastname", "style", "background: blue;");
|
||||
datas.appendAttribute("lastname", "style", "foreground: red;");
|
||||
|
@ -97,7 +97,7 @@ class XidTest
|
|||
|
||||
// Populate attributes of Test 03.
|
||||
System.out.println("----------------------------");
|
||||
datas = new Data();
|
||||
datas = new TagDataManager();
|
||||
datas.setContent("words", 0, "alpha");
|
||||
datas.setContent("words", 1, "bravo");
|
||||
datas.setContent("words", 2, "charlie");
|
||||
|
@ -124,7 +124,7 @@ class XidTest
|
|||
|
||||
// Populate attributes of Test 03.
|
||||
System.out.println("----------------------------");
|
||||
datas = new Data();
|
||||
datas = new TagDataManager();
|
||||
datas.setContent("identity", 0, "nom", "Jemba");
|
||||
datas.setContent("identity", 0, "prenom", "Epo");
|
||||
datas.setContent("identity", 1, "nom", "Momon");
|
||||
|
|
Loading…
Reference in a new issue