|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.melati.template.AbstractMarkupLanguage
public abstract class AbstractMarkupLanguage
MarkupLanguage provides a variety of methods for rendering objects in a template. Each object to be rendered has 3 methods: 1 - String rendered(Object o) - this will render the object to a String 2 - void render(Object o) - renders the object to melati.getWriter() 3 - void render(Object o, MelatiWriter w) - render the object to w. When this class was written it was thought that for maximum efficiency one should render the object direct to the output stream using method (2) above. However now all but (1) is deprecated.
Field Summary | |
---|---|
static int |
DATE_FIELD_POSSIBILITIES_LIMIT
The maximum number of date field possibilities to render. |
static int |
FIELD_POSSIBILITIES_LIMIT
The maximum number of field possibilities to render. |
protected PoemLocale |
locale
|
protected Melati |
melati
|
protected TempletLoader |
templetLoader
|
Constructor Summary | |
---|---|
protected |
AbstractMarkupLanguage(String name,
AbstractMarkupLanguage other)
Construct a new MarkupLanguage given a new name and an existing MarkupLanguage. |
|
AbstractMarkupLanguage(String name,
Melati melati,
TempletLoader templetLoader,
PoemLocale locale)
Construct a Markup Language object. |
Method Summary | |
---|---|
protected void |
expandTemplet(Template templet,
TemplateContext tc,
MelatiWriter out)
Interpolate a templet and write it out. |
String |
getName()
Get the name of this Markup Language. |
String |
input(Field field)
Get an input widget for this Field. |
protected String |
input(Field field,
String templetName,
String nullValue,
boolean overrideNullable)
|
String |
inputAs(Field field,
String templetName)
Get an input widget for this Field defined by name. |
protected void |
render(Field field,
int style,
int limit,
MelatiWriter writer)
Render a Field Object in a MarkupLanguage specific way, rendering to supplied MelatiWriter. |
protected void |
render(Field field,
MelatiWriter writer)
Render a Field Object in a MarkupLanguage specific way, rendering to supplied MelatiWriter. |
protected void |
render(Object o)
Render an Object in a MarkupLanguage specific way, rendering to the MelatiWriter supplied by melati.getWriter() . |
protected void |
render(Object o,
MelatiWriter writer)
Render an Object in a MarkupLanguage specific way, rendering to a supplied Writer. |
protected void |
render(String s,
int limit,
MelatiWriter writer)
Render a String in a MarkupLanguage specific way, limiting it's length. |
protected abstract void |
render(String s,
MelatiWriter writer)
Render a String in a MarkupLanguage specific way to a supplied MelatiWriter. |
String |
rendered(Field field,
int style)
Render a Field Object in a MarkupLanguage specific way, returning a String. |
String |
rendered(Field field,
int style,
int limit)
Render a Field Object in a MarkupLanguage specific way, returning a String. |
String |
rendered(Object o)
Render an Object in a MarkupLanguage specific way, returning a String. |
String |
rendered(String s,
int limit)
Render a String in a MarkupLanguage specific way, limiting it's length. |
String |
renderedMarkup(String s)
|
String |
renderedStart(Field field)
Render a Date Field Object in a MarkupLanguage specific way, returning a START Date format String. |
protected abstract void |
renderMarkup(String s,
MelatiWriter writer)
Render a markup fragment in a MarkupLanguage specific way to a supplied MelatiWriter. |
protected void |
renderStart(Field field,
MelatiWriter writer)
|
String |
searchInput(Field field,
String nullValue)
Get an input widget for this Field specifying the null value. |
String |
toString()
Name and locale. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.melati.template.MarkupLanguage |
---|
decoded, encoded, escaped, escaped, getAttr |
Field Detail |
---|
protected TempletLoader templetLoader
protected Melati melati
protected PoemLocale locale
public static final int FIELD_POSSIBILITIES_LIMIT
public static final int DATE_FIELD_POSSIBILITIES_LIMIT
Constructor Detail |
---|
public AbstractMarkupLanguage(String name, Melati melati, TempletLoader templetLoader, PoemLocale locale)
name
- - the name associated with this markup language.
This is used to determine where to load
templates from ie 'html' templates are
found in the 'html' directory.melati
- - the melati currently in usetempletLoader
- - the template loader in use
(taken from org.melati.MelatiConfig.properties)locale
- - the locale in use
(taken from org.melati.MelatiConfig.properties)protected AbstractMarkupLanguage(String name, AbstractMarkupLanguage other)
name
- - the name of the new MarkupLanguageother
- - the Markup Language to base this one uponMethod Detail |
---|
public String getName()
getName
in interface MarkupLanguage
MarkupLanguage.getName()
public String toString()
toString
in class Object
Object.toString()
public String rendered(String s, int limit)
rendered
in interface MarkupLanguage
s
- - the string to be renderedlimit
- - the lenght to trim the string to
MarkupLanguage.rendered(java.lang.String, int)
public String rendered(Field field, int style, int limit) throws TemplateEngineException
rendered
in interface MarkupLanguage
field
- - the Field to be renderedstyle
- - a DateFormat style to format this Field.limit
- - the length to trim the rendered string to
TemplateEngineException
- - if there is a problem with the
ServletTemplateEngineMarkupLanguage.rendered(org.melati.poem.Field, int, int)
public String rendered(Field field, int style) throws TemplateEngineException
rendered
in interface MarkupLanguage
field
- - the Field to be renderedstyle
- - a style to format this Field.
TemplateEngineException
- - if there is a problem with the
ServletTemplateEngineMarkupLanguage.rendered(org.melati.poem.Field, int)
public String rendered(Object o)
rendered
in interface MarkupLanguage
o
- - the Object to be rendered
MarkupLanguage.rendered(java.lang.Object)
public String renderedMarkup(String s)
renderedMarkup
in interface MarkupLanguage
s
- markup fragment to render
MarkupLanguage.renderedMarkup(java.lang.String)
protected void render(String s, int limit, MelatiWriter writer)
s
- - the string to be renderedwriter
- - the MelatiWriter to render this String tolimit
- - the length to trim the string toprotected abstract void render(String s, MelatiWriter writer)
s
- - the string to be renderedwriter
- - the MelatiWriter to render this String toprotected abstract void renderMarkup(String s, MelatiWriter writer)
s
- - the fragment to be renderedwriter
- - the MelatiWriter to render this String toprotected void render(Field field, MelatiWriter writer)
field
- - the Field to be renderedwriter
- - the MelatiWriter to render this Object toprotected void render(Field field, int style, int limit, MelatiWriter writer)
field
- - the Field to be renderedstyle
- - a style to format this Field.limit
- - the length to trim the rendered string towriter
- - the MelatiWriter to render this Object to(java.lang.Object,org.melati.poem.PoemLocale, int)
public String renderedStart(Field field)
renderedStart
in interface MarkupLanguage
field
- - the Field to be rendered
MarkupLanguage.renderedStart(org.melati.poem.Field)
protected void renderStart(Field field, MelatiWriter writer)
protected void render(Object o)
MelatiWriter
supplied by melati.getWriter()
.
o
- - the Object to be rendered
TemplateEngineException
- - if there is a problem with the
ServletTemplateEngineprotected void render(Object o, MelatiWriter writer)
o
- - the Object to be renderedwriter
- - the MelatiWriter to render this Object topublic String input(Field field) throws TemplateEngineException, NotFoundException
input
in interface MarkupLanguage
field
- The Field
NotFoundException
- if template not found
TemplateEngineException
MarkupLanguage.input(org.melati.poem.Field)
public String inputAs(Field field, String templetName) throws TemplateEngineException, NotFoundException
inputAs
in interface MarkupLanguage
field
- The FieldtempletName
- the templet to use instead of the default
NotFoundException
- if template not found
TemplateEngineException
MarkupLanguage.inputAs(org.melati.poem.Field, java.lang.String)
public String searchInput(Field field, String nullValue) throws TemplateEngineException, NotFoundException
searchInput
in interface MarkupLanguage
field
- The FieldnullValue
- the value to use for null for example in a dropdown.
NotFoundException
- if template not found
TemplateEngineException
MarkupLanguage.searchInput(org.melati.poem.Field, java.lang.String)
protected String input(Field field, String templetName, String nullValue, boolean overrideNullable) throws NotFoundException
NotFoundException
protected void expandTemplet(Template templet, TemplateContext tc, MelatiWriter out)
templet
- Template
to interpolatetc
- TemplateContext
against which to instantiate variablesout
- MelatiWriter
to write results to
|
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |