org.melati.template
Interface MarkupLanguage

Package class diagram package MarkupLanguage
All Known Subinterfaces:
AttributeMarkupLanguage
All Known Implementing Classes:
AbstractMarkupLanguage, HTMLAttributeMarkupLanguage, HTMLLikeMarkupLanguage, HTMLMarkupLanguage, WMLAttributeMarkupLanguage, WMLMarkupLanguage, XMLAttributeMarkupLanguage, XMLMarkupLanguage

public interface MarkupLanguage

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.


Method Summary
 String decoded(String s)
          Decode a UTF-8 URL encoded string.
 String encoded(String s)
          Encode a String as a UTF-8 URL.
 String escaped(Persistent o)
          Get the DisplayString of a Persistent and escape that using the current locale and a MEDIUM DateFormat.
 String escaped(String s)
          Escape a String.
 AttributeMarkupLanguage getAttr()
          The AttributeMarkupLanguage associated with this MarkupLanguage.
 String getName()
          Get the name of this Markup Language.
 String input(Field field)
          Get an input widget for this Field.
 String inputAs(Field field, String templetName)
          Get an input widget for this Field defined by name.
 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.
 String searchInput(Field field, String nullValue)
          Get an input widget for this Field specifying the null value.
 

Method Detail

getAttr

AttributeMarkupLanguage getAttr()
The AttributeMarkupLanguage associated with this MarkupLanguage. See org/melati/admin/EditHeader.wm See org/melati/admin/PrimarySelect.wm

Returns:
the AttributeMarkupLanguage to use for rendering attributes.

getName

String getName()
Get the name of this Markup Language.

Returns:
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.

rendered

String rendered(Object o)
Render an Object in a MarkupLanguage specific way, returning a String.

Parameters:
o - - the Object to be rendered
Returns:
- the object rendered as a String in a MarkupLanguage specific way.

renderedMarkup

String renderedMarkup(String s)
Parameters:
s - markup fragment to render
Returns:
fragment rendered with markup unchanged

rendered

String rendered(String s,
                int limit)
Render a String in a MarkupLanguage specific way, limiting it's length.

Parameters:
s - - the string to be rendered
limit - - the lenght to trim the string to
Returns:
- the String having been rendered in a MarkupLanguage specific way.

rendered

String rendered(Field field,
                int style)
                throws TemplateEngineException
Render a Field Object in a MarkupLanguage specific way, returning a String. Defaults to a limit of 10,000,000.

Parameters:
field - - the Field to be rendered
style - - a style to format this Field.
Returns:
- the Field rendered as a String in a MarkupLanguage specific way.
Throws:
TemplateEngineException - - if there is a problem with the ServletTemplateEngine
See Also:
(java.lang.Object,org.melati.poem.PoemLocale, int)

rendered

String rendered(Field field,
                int style,
                int limit)
                throws TemplateEngineException
Render a Field Object in a MarkupLanguage specific way, returning a String. see org.melati.poem.DatePoemType#_stringOfCooked (java.lang.Object,org.melati.poem.PoemLocale, int)

Parameters:
field - - the Field to be rendered
style - - a DateFormat style to format this Field.
limit - - the length to trim the rendered string to
Returns:
- the Field rendered as a String in a MarkupLanguage specific way.
Throws:
TemplateEngineException - - if there is a problem with the ServletTemplateEngine

renderedStart

String renderedStart(Field field)
Render a Date Field Object in a MarkupLanguage specific way, returning a START Date format String.

Parameters:
field - - the Field to be rendered
Returns:
- the Field rendered as a String in a MarkupLanguage specific way.
See Also:
(java.lang.Object,org.melati.poem.PoemLocale, int)

input

String input(Field field)
             throws TemplateEngineException,
                    NotFoundException
Get an input widget for this Field.

Parameters:
field - The Field
Returns:
The default input widget for the Field type
Throws:
NotFoundException - if template not found
TemplateEngineException

inputAs

String inputAs(Field field,
               String templetName)
               throws TemplateEngineException,
                      NotFoundException
Get an input widget for this Field defined by name.

Parameters:
field - The Field
templetName - the templet to use instead of the default
Returns:
The specified input widget for the Field type
Throws:
NotFoundException - if template not found
TemplateEngineException

searchInput

String searchInput(Field field,
                   String nullValue)
                   throws TemplateEngineException,
                          NotFoundException
Get an input widget for this Field specifying the null value.

Parameters:
field - The Field
nullValue - the value to use for null for example in a dropdown.
Returns:
The default input widget for the Field type with a specified null value
Throws:
NotFoundException - if template not found
TemplateEngineException

escaped

String escaped(String s)
Escape a String.

Parameters:
s - the String to escape
Returns:
the escaped String

escaped

String escaped(Persistent o)
Get the DisplayString of a Persistent and escape that using the current locale and a MEDIUM DateFormat. See org/melati/admin/SelectionWindowSelection.wm See org/melati/admin/Update.wm

Parameters:
o -
Returns:
the escaped DisplayString

encoded

String encoded(String s)
Encode a String as a UTF-8 URL.

Parameters:
s - the String to encode
Returns:
the encoded String

decoded

String decoded(String s)
Decode a UTF-8 URL encoded string.

Parameters:
s -
Returns:
the decoded String


Copyright © 2000-2010 PanEris. All Rights Reserved.