**/
private void writeTemplate(IMarkupWriter writer, IRequestCycle cycle)
{
IComponent inspectedComponent = getInspectedComponent();
ComponentTemplate template = null;
ITemplateSource source = getPage().getEngine().getTemplateSource();
try
{
template = source.getTemplate(cycle, inspectedComponent);
}
catch (Exception ex)
{
return;
}
writer.begin("pre");
int count = template.getTokenCount();
for (int i = 0; i < count; i++)
{
TemplateToken token = template.getToken(i);
TokenType type = token.getType();
if (type == TokenType.TEXT)
{
write(writer, (TextToken) token);
continue;
}
if (type == TokenType.CLOSE)
{
write(writer, (CloseToken) token);
continue;
}
if (token.getType() == TokenType.LOCALIZATION)
{
write(writer, (LocalizationToken) token);
continue;
}
if (token.getType() == TokenType.OPEN)
{
boolean nextIsClose =
(i + 1 < count) && (template.getToken(i + 1).getType() == TokenType.CLOSE);
write(writer, nextIsClose, (OpenToken) token);
if (nextIsClose)
i++;