EchoPoint
1.0

echopoint
Class HtmlTemplatePanel

java.lang.Object
  extended bynextapp.echo.Component
      extended bynextapp.echo.Panel
          extended byechopoint.Panel
              extended byechopoint.ScrollablePanel
                  extended byechopoint.HtmlTemplatePanel
All Implemented Interfaces:
Borderable, Clippable, LayoutManageable, MouseCursorable, Positionable, ReflectionSetter, Scrollable, ScrollableContainer, java.io.Serializable

public class HtmlTemplatePanel
extends ScrollablePanel

The HtmlTemplatePanel class can be used as a Component that will use an HTML template as a basis to render other Components within.

This component uses an underlying HtmlTemplateLayoutManager class as the basis for providing HTML support. See HtmlTemplateLayoutManager for more details.

Most of the methods in this class are convenience methods to the HtmlTemplateLayoutManager equivalents.

See Also:
HtmlTemplateLayoutManager, Serialized Form

Nested Class Summary
 
Nested classes inherited from class echopoint.positionable.ScrollableContainer
ScrollableContainer.NestedStyleInfo
 
Nested classes inherited from class echopoint.positionable.MouseCursorable
MouseCursorable.NestedStyleInfo
 
Field Summary
static java.lang.String TEMPLATE_CHANGED_PROPERTY
          Propery Change Names
 
Fields inherited from class echopoint.ScrollablePanel
DEFAULT_POSITONABLE_POLICY, DEFAULT_SCROLLBAR_POLICY
 
Fields inherited from class nextapp.echo.Panel
DEFAULT_INSETS, HORIZONTAL_ALIGNMENT_CHANGED_PROPERTY, INSETS_CHANGED_PROPERTY, STYLE_HORIZONTAL_ALIGNMENT, STYLE_INSETS, STYLE_VERTICAL_ALIGNMENT, VERTICAL_ALIGNMENT_CHANGED_PROPERTY
 
Fields inherited from class nextapp.echo.Component
BACKGROUND_CHANGED_PROPERTY, CHILDREN_CHANGED_PROPERTY, ENABLED_CHANGED_PROPERTY, FONT_CHANGED_PROPERTY, FOREGROUND_CHANGED_PROPERTY, IDENTIFIER_CHANGED_PROPERTY, listenerList, LOCALE_CHANGED_PROPERTY, MODEL_CHANGED_PROPERTY, STYLE_BACKGROUND, STYLE_FONT, STYLE_FOREGROUND, UPDATE_PROPERTY, VISIBLE_CHANGED_PROPERTY
 
Fields inherited from interface echopoint.positionable.ScrollableContainer
HORIZONTAL_ALIGNMENT_CHANGED_PROPERTY, INSETS_CHANGED_PROPERTY, STYLE_HORIZONTAL_ALIGNMENT, STYLE_INSETS, STYLE_VERTICAL_ALIGNMENT, VERTICAL_ALIGNMENT_CHANGED_PROPERTY
 
Fields inherited from interface echopoint.positionable.Scrollable
HEIGHT_CHANGED_PROPERTY, SCROLL_BAR_X_CHANGED_PROPERTY, SCROLL_BAR_Y_CHANGED_PROPERTY, SCROLLBAR_POLICY_CHANGED_PROPERTY, SCROLLBARS_ALWAYS, SCROLLBARS_AUTO, SCROLLBARS_CLIPHIDE, SCROLLBARS_NEVER, STYLE_HEIGHT, STYLE_SCROLL_BAR_POLICY, STYLE_WIDTH, UNDEFINED, undefinedSymbolic, WIDTH_CHANGED_PROPERTY
 
Fields inherited from interface echopoint.positionable.Positionable
POSITION_CHANGED_PROPERTY, POSITIONING_ABSOLUTE, POSITIONING_FLOW, POSITIONING_RELATIVE, positioningSymbolics, STYLE_BOTTOM, STYLE_LEFT, STYLE_POSITIONING, STYLE_RIGHT, STYLE_TOP, STYLE_ZINDEX, UNDEFINED, undefinedSymbolic
 
Fields inherited from interface echopoint.positionable.Clippable
CLIP_RECT_CHANGED_PROPERTY, STYLE_CLIP_RECT
 
Fields inherited from interface echopoint.positionable.Borderable
BORDER_DASHED, BORDER_DOTTED, BORDER_DOUBLE, BORDER_GROOVE, BORDER_INSET, BORDER_NONE, BORDER_OUTSET, BORDER_RIDGE, BORDER_SOLID, borderStyleSymbolics, STYLE_BORDER_COLOR, STYLE_BORDER_SIZE, STYLE_BORDER_STYLE, STYLE_BOTTOM_BORDER_COLOR, STYLE_BOTTOM_BORDER_SIZE, STYLE_BOTTOM_BORDER_STYLE, STYLE_LEFT_BORDER_COLOR, STYLE_LEFT_BORDER_SIZE, STYLE_LEFT_BORDER_STYLE, STYLE_RIGHT_BORDER_COLOR, STYLE_RIGHT_BORDER_SIZE, STYLE_RIGHT_BORDER_STYLE, STYLE_TOP_BORDER_COLOR, STYLE_TOP_BORDER_SIZE, STYLE_TOP_BORDER_STYLE
 
Fields inherited from interface echopoint.layout.LayoutManageable
LAYOUT_MANAGED_CHANGED_PROPERTY
 
Fields inherited from interface echopoint.positionable.MouseCursorable
borderStyleSymbolics, CURSOR_AUTO, CURSOR_CROSSHAIR, CURSOR_CUSTOM_URI, CURSOR_DEFAULT, CURSOR_E_RESIZE, CURSOR_HELP, CURSOR_MOVE, CURSOR_N_RESIZE, CURSOR_NE_RESIZE, CURSOR_NW_RESIZE, CURSOR_POINTER, CURSOR_S_RESIZE, CURSOR_SE_RESIZE, CURSOR_SW_RESIZE, CURSOR_TEXT, CURSOR_W_RESIZE, CURSOR_WAIT, STYLE_MOUSE_CURSOR, STYLE_MOUSE_CURSOR_URI
 
Constructor Summary
HtmlTemplatePanel()
          Constructs a HtmlTemplatePanel with an empty StringDataSource.
HtmlTemplatePanel(java.io.File tmplFile)
          Creates a HtmlTemplatePanel that reads its template from a File with the default character encoding.
HtmlTemplatePanel(java.io.File tmplFile, java.lang.String encoding)
          Creates a HtmlTemplatePanel that reads its template from a File with the provided character encoding.
HtmlTemplatePanel(java.lang.String stringTemplate)
          Creates a HtmlTemplatePanel that reads its template from the String stringTemplate.
HtmlTemplatePanel(java.net.URL url)
          Creates a HtmlTemplatePanel that reads its template from an URL with the default character encoding.
HtmlTemplatePanel(java.net.URL url, java.lang.String encoding)
          Creates a HtmlTemplatePanel that reads its template from an URL with the provided character encoding.
 
Method Summary
 CompilationUnit compileDataSource()
          Compiles the associated DataSource and returns a CompilationUnit representing the compiled output.
 nextapp.echo.Component getComponent(java.lang.String constraintName)
          Returns a Component given a constraint name This is a convenience method for calling into the apppropriate underlying HtmlTemplateLayoutManager method.
 java.util.Map getComponentMap()
          Returns a map of the constraint/component.
 DataSource getDataSource()
          Returns the DataSource currently in use.
 int getFileCacheSizeLimit()
          Returns the maximum size of a cache entry, after which template files will not be internally cached.
 TextSubstitution getTextSubstitution()
          Returns the TextSubstitution object used to substitute TEXT tags.
 boolean isLoudErrorsUsed()
          This returns true if "loud" error messages are to be used during template compilation.
 boolean isPropertiesUsed()
          Returns whether component properties will be set from the template HTML tag attributes.
 java.lang.Object set(java.lang.reflect.Field field, java.lang.Object newValue)
          Called to save the old value of a field, set in a new value and return the old value of a field.
 void setFileCacheSizeLimit(int newFileCacheSizeLimit)
          Sets the maximum size of a cache entry, after which template files will not be internally cached.
 void setLayoutManager(LayoutManager newLayoutManager)
          Sets a new LayoutManager into the LayoutManageable container.
 void setLoudErrorsUsed(boolean b)
          Controls whether loud error messages are to be used during template compilation.
 void setPropertiesUsed(boolean flag)
          Sets whether component properties will be set from the template HTML tag attributes.
 void setTemplate(DataSource source)
          Sets the template from the DataSource.
 void setTemplate(java.io.File templateFile)
          Set the template to the template stored in the given file.
 void setTemplate(java.io.File templateFile, java.lang.String encoding)
          Set the template to the template stored in the given file with the provided character encoding.
 void setTemplate(java.lang.String templateString)
          Set the template via the string contents of templateString This is a convenience method for calling into the apppropriate underlying HtmlTemplateLayoutManager method.
 void setTemplate(java.net.URL templateURL)
          Set the template to the template which can be retrieved from the given URL.
 void setTemplate(java.net.URL templateURL, java.lang.String encoding)
          Set the template to the template which can be retrieved from the given URL with the provided character encoding.
 void setTextSubstitution(TextSubstitution newTextSubstitution)
          Sets the TextSubstitution object used to substitute TEXT tags.
 
Methods inherited from class echopoint.ScrollablePanel
applyStyle, clearPositioning, getBottom, getClipRect, getHeight, getLeft, getPositioning, getRight, getScreenHeight, getScreenWidth, getScrollBarPolicy, getScrollBarX, getScrollBarY, getTop, getWidth, getzIndex, isPositioned, setBottom, setClipRect, setClipRect, setClipRect, setHeight, setLeft, setPositioning, setRight, setScrollBarPolicy, setScrollBarX, setScrollBarY, setTop, setWidth, setzIndex
 
Methods inherited from class echopoint.Panel
add, add, add, add, addImpl, getBorderColor, getBorderSize, getBorderStyle, getBottomBorderColor, getBottomBorderSize, getBottomBorderStyle, getLayoutManager, getLeftBorderColor, getLeftBorderSize, getLeftBorderStyle, getMouseCursor, getMouseCursorURI, getRightBorderColor, getRightBorderSize, getRightBorderStyle, getTopBorderColor, getTopBorderSize, getTopBorderStyle, remove, remove, setBorderColor, setBorderSize, setBorderStyle, setBottomBorderColor, setBottomBorderSize, setBottomBorderStyle, setLeftBorderColor, setLeftBorderSize, setLeftBorderStyle, setMouseCursor, setMouseCursorURI, setRightBorderColor, setRightBorderSize, setRightBorderStyle, setTopBorderColor, setTopBorderSize, setTopBorderStyle
 
Methods inherited from class nextapp.echo.Panel
getHorizontalAlignment, getInsets, getVerticalAlignment, setHorizontalAlignment, setInsets, setVerticalAlignment
 
Methods inherited from class nextapp.echo.Component
addHierarchyListener, addPropertyChangeListener, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getComponent, getComponentCount, getComponents, getEchoInstance, getFont, getForeground, getIdentifier, getLocale, getParent, indexOf, init, isAncestorOf, isEnabled, isRegistered, isShowing, isVisible, removeAll, removeHierarchyListener, removePropertyChangeListener, setBackground, setEnabled, setFont, setForeground, setIdentifier, setLocale, setVisible, update, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface echopoint.positionable.ScrollableContainer
getHorizontalAlignment, getInsets, getVerticalAlignment, setHorizontalAlignment, setInsets, setVerticalAlignment
 
Methods inherited from interface echopoint.positionable.Borderable
getBorderColor, getBorderSize, getBorderStyle, getBottomBorderColor, getBottomBorderSize, getBottomBorderStyle, getLeftBorderColor, getLeftBorderSize, getLeftBorderStyle, getRightBorderColor, getRightBorderSize, getRightBorderStyle, getTopBorderColor, getTopBorderSize, getTopBorderStyle, setBorderColor, setBorderSize, setBorderStyle, setBottomBorderColor, setBottomBorderSize, setBottomBorderStyle, setLeftBorderColor, setLeftBorderSize, setLeftBorderStyle, setRightBorderColor, setRightBorderSize, setRightBorderStyle, setTopBorderColor, setTopBorderSize, setTopBorderStyle
 
Methods inherited from interface echopoint.layout.LayoutManageable
add, add, add, add, getLayoutManager, remove, remove
 

Field Detail

TEMPLATE_CHANGED_PROPERTY

public static final java.lang.String TEMPLATE_CHANGED_PROPERTY
Propery Change Names

See Also:
Constant Field Values
Constructor Detail

HtmlTemplatePanel

public HtmlTemplatePanel()
Constructs a HtmlTemplatePanel with an empty StringDataSource. This Constructs a new underlying HtmlTemplateLayoutManager object with the same contructor form.


HtmlTemplatePanel

public HtmlTemplatePanel(java.io.File tmplFile)
                  throws java.io.IOException
Creates a HtmlTemplatePanel that reads its template from a File with the default character encoding.

The contents are read once into a cache.

This Constructs a new underlying HtmlTemplateLayoutManager object with the same contructor form.

Throws:
java.io.IOException

HtmlTemplatePanel

public HtmlTemplatePanel(java.io.File tmplFile,
                         java.lang.String encoding)
                  throws java.io.IOException
Creates a HtmlTemplatePanel that reads its template from a File with the provided character encoding.

The contents are read once into a cache.

This Constructs a new underlying HtmlTemplateLayoutManager object with the same contructor form.

Throws:
java.io.IOException

HtmlTemplatePanel

public HtmlTemplatePanel(java.lang.String stringTemplate)
Creates a HtmlTemplatePanel that reads its template from the String stringTemplate. This Constructs a new underlying HtmlTemplateLayoutManager object with the same contructor form.


HtmlTemplatePanel

public HtmlTemplatePanel(java.net.URL url)
                  throws java.io.IOException
Creates a HtmlTemplatePanel that reads its template from an URL with the default character encoding.

This Constructs a new underlying HtmlTemplateLayoutManager object with the same contructor form.

Throws:
java.io.IOException

HtmlTemplatePanel

public HtmlTemplatePanel(java.net.URL url,
                         java.lang.String encoding)
                  throws java.io.IOException
Creates a HtmlTemplatePanel that reads its template from an URL with the provided character encoding.

This Constructs a new underlying HtmlTemplateLayoutManager object with the same contructor form.

Throws:
java.io.IOException
Method Detail

compileDataSource

public CompilationUnit compileDataSource()
                                  throws java.io.IOException
Compiles the associated DataSource and returns a CompilationUnit representing the compiled output. During this method, the various properties in the template will be applied to the Components managed by the underlying layout manager.

Therefore it is important to have all the Components first before calling this method otherwise properties may not be set as expected.

Throws:
java.io.IOException

getComponent

public nextapp.echo.Component getComponent(java.lang.String constraintName)
Returns a Component given a constraint name This is a convenience method for calling into the apppropriate underlying HtmlTemplateLayoutManager method.


getComponentMap

public java.util.Map getComponentMap()
Returns a map of the constraint/component. This is a convenience method for calling into the apppropriate underlying HtmlTemplateLayoutManager method.


getDataSource

public DataSource getDataSource()
Returns the DataSource currently in use. This is a convenience method for calling into the apppropriate underlying HtmlTemplateLayoutManager method.


getFileCacheSizeLimit

public int getFileCacheSizeLimit()
Returns the maximum size of a cache entry, after which template files will not be internally cached. Any template file less than this limit will be internally cached and hence will execute faster (at the expense of requiring more memory) This is a convenience method for calling into the apppropriate underlying HtmlTemplateLayoutManager method.

Returns:
int

getTextSubstitution

public TextSubstitution getTextSubstitution()
Returns the TextSubstitution object used to substitute TEXT tags.

Returns:
echopoint.template.TextSubstitution

isPropertiesUsed

public boolean isPropertiesUsed()
Returns whether component properties will be set from the template HTML tag attributes.

Returns:
boolean

setPropertiesUsed

public void setPropertiesUsed(boolean flag)
Sets whether component properties will be set from the template HTML tag attributes.

Parameters:
flag - boolean

setFileCacheSizeLimit

public void setFileCacheSizeLimit(int newFileCacheSizeLimit)
Sets the maximum size of a cache entry, after which template files will not be internally cached. Any template file less than this limit will be internally cached and hence will execute faster (at the expense of requiring more memory) This is a convenience method for calling into the apppropriate underlying HtmlTemplateLayoutManager method.

Parameters:
newFileCacheSizeLimit - int

setLayoutManager

public void setLayoutManager(LayoutManager newLayoutManager)
Sets a new LayoutManager into the LayoutManageable container. This must non null and an HtmlTemplateLayoutManager otherwise an IllegalArgumentException is thrown.

Specified by:
setLayoutManager in interface LayoutManageable
Overrides:
setLayoutManager in class Panel
See Also:
LayoutManageable.setLayoutManager(echopoint.layout.LayoutManager)

setTemplate

public void setTemplate(DataSource source)
Sets the template from the DataSource. Use this, if you hold your templates in databases etc. and write your own DataSource. This is a convenience method for calling into the apppropriate underlying HtmlTemplateLayoutManager method.


setTemplate

public void setTemplate(java.io.File templateFile)
                 throws java.io.IOException
Set the template to the template stored in the given file. This is a convenience method for calling into the apppropriate underlying HtmlTemplateLayoutManager method.

Throws:
java.io.IOException

setTemplate

public void setTemplate(java.io.File templateFile,
                        java.lang.String encoding)
                 throws java.io.IOException
Set the template to the template stored in the given file with the provided character encoding. This is a convenience method for calling into the apppropriate underlying HtmlTemplateLayoutManager method.

Throws:
java.io.IOException

setTemplate

public void setTemplate(java.lang.String templateString)
Set the template via the string contents of templateString This is a convenience method for calling into the apppropriate underlying HtmlTemplateLayoutManager method.


setTemplate

public void setTemplate(java.net.URL templateURL)
                 throws java.io.IOException
Set the template to the template which can be retrieved from the given URL. This is a convenience method for calling into the apppropriate underlying HtmlTemplateLayoutManager method.

Throws:
java.io.IOException

setTemplate

public void setTemplate(java.net.URL templateURL,
                        java.lang.String encoding)
                 throws java.io.IOException
Set the template to the template which can be retrieved from the given URL with the provided character encoding. This is a convenience method for calling into the apppropriate underlying HtmlTemplateLayoutManager method.

Throws:
java.io.IOException

setTextSubstitution

public void setTextSubstitution(TextSubstitution newTextSubstitution)
Sets the TextSubstitution object used to substitute TEXT tags.

Parameters:
newTextSubstitution - echopoint.template.TextSubstitution

isLoudErrorsUsed

public boolean isLoudErrorsUsed()
This returns true if "loud" error messages are to be used during template compilation.

Returns:
true if lound error messages are to be displayed

setLoudErrorsUsed

public void setLoudErrorsUsed(boolean b)
Controls whether loud error messages are to be used during template compilation.


set

public java.lang.Object set(java.lang.reflect.Field field,
                            java.lang.Object newValue)
                     throws java.lang.Exception
Description copied from interface: ReflectionSetter
Called to save the old value of a field, set in a new value and return the old value of a field. This interface allows a field set operation to be "delegated" back into the class that has permission to perform the field set.

 public Object set(Field f, Object newValue) throws Exception {
      Object oldValue = f.get(this);
      f.set(this,newValue);
      return oldValue;
 }
 

Specified by:
set in interface ReflectionSetter
Overrides:
set in class ScrollablePanel
Throws:
java.lang.Exception
See Also:
ReflectionSetter.set(Field, Object)

EchoPoint
1.0