ItsNatDocument itsNatDoc = getItsNatDocument();
Document doc = itsNatDoc.getDocument();
ElementGroupManager factory = itsNatDoc.getElementGroupManager();
ElementRenderer renderer = factory.createDefaultElementRenderer();
renderer.render(null,value,doc.getElementById("elementId"),true);
ElementRenderer customRenderer = new ElementRenderer()
{
public void render(Object userObj, Object value, Element elem,boolean isNew)
{
/*
<table id="elementId2">
<tbody>
<tr><td>Year:</td><td>(year)</td></tr>
<tr><td>Month:</td><td>(month)</td></tr>
<tr><td>Day:</td><td>(day)</td></tr>
</tbody>
</table>
*/
DateFormat format = DateFormat.getDateInstance(DateFormat.LONG,Locale.US);
// Format: June 8,2007
String date = format.format(value);
int pos = date.indexOf(' ');
String month = date.substring(0,pos);
int pos2 = date.indexOf(',');
String day = date.substring(pos + 1,pos2);
String year = date.substring(pos2 + 1);
HTMLTableElement table = (HTMLTableElement)elem;
HTMLTableSectionElement tbody = (HTMLTableSectionElement)ItsNatTreeWalker.getFirstChildElement(table);
HTMLTableRowElement yearRow = (HTMLTableRowElement)ItsNatTreeWalker.getFirstChildElement(tbody);
HTMLTableCellElement yearCell = (HTMLTableCellElement)yearRow.getCells().item(1);
ItsNatDOMUtil.setTextContent(yearCell,year);
HTMLTableRowElement monthRow = (HTMLTableRowElement)ItsNatTreeWalker.getNextSiblingElement(yearRow);
HTMLTableCellElement monthCell = (HTMLTableCellElement)monthRow.getCells().item(1);
ItsNatDOMUtil.setTextContent(monthCell,month);
HTMLTableRowElement dayRow = (HTMLTableRowElement)ItsNatTreeWalker.getNextSiblingElement(monthRow);
HTMLTableCellElement dayCell = (HTMLTableCellElement)dayRow.getCells().item(1);
ItsNatDOMUtil.setTextContent(dayCell,day);
}
public void unrender(Object userObj,Element elem)
{
}
};
customRenderer.render(null,value,doc.getElementById("elementId2"),true);
}