EchoPoint API - 3.0.0b5
App Webcontainer

echopoint
Class TemplatePanel

java.lang.Object
  extended by nextapp.echo.app.Component
      extended by echopoint.TemplatePanel
All Implemented Interfaces:
Serializable, PaneContainer, RenderIdSupport

public class TemplatePanel
extends Component
implements PaneContainer

TemplatePanel is a container that uses a TemplateLayoutData to render a template of content.

This layout data can itself contained "named" Components and "named" Text Substitutions.

A singleton TemplateDataSource can be used for more than one TemplatePanel and hence the memory footprint is reduced if used in this way.

Supplied Implementation

The supplied template implementation reads XHTML template data from a number of different sources including Files, Strings, Resources and JSP pages.

The markup :




   <component name="xxx" />


 
is used to indicate where in the template a named component will be placed.

In EchopointNG it was possible to set style and css properties. This feature is not implemented yet.

See Also:
Serialized Form

Field Summary
static String PROPERTY_COMPONENT_MAPPING
           
static String PROPERTY_TEMPLATE_DATA_SOURCE
           
 
Fields inherited from class nextapp.echo.app.Component
CHILD_VISIBLE_CHANGED_PROPERTY, CHILDREN_CHANGED_PROPERTY, ENABLED_CHANGED_PROPERTY, FOCUS_NEXT_ID_CHANGED_PROPERTY, FOCUS_PREVIOUS_ID_CHANGED_PROPERTY, LAYOUT_DIRECTION_CHANGED_PROPERTY, LOCALE_CHANGED_PROPERTY, PROPERTY_BACKGROUND, PROPERTY_FONT, PROPERTY_FOREGROUND, PROPERTY_LAYOUT_DATA, STYLE_CHANGED_PROPERTY, STYLE_NAME_CHANGED_PROPERTY, VISIBLE_CHANGED_PROPERTY
 
Constructor Summary
TemplatePanel()
          Constructs a TemplatePanel with no template data as yet.
TemplatePanel(TemplateDataSource tds)
          Constructs a TemplatePanel with the specified TemplateDataSource.
 
Method Summary
 void addNamedComponent(Component component, String componentName)
          Adds a component to the TemplatePanel with the associated name which can the be references from the template data.
 String getComponentName(Component component)
          Returns the name associated with the component or null if it cant be found.
 Component getNamedComponent(String componentName)
          Returns a component associated with the name or null if it cant be found.
 String[] getNamedComponents()
           
 TemplateDataSource getTemplateDataSource()
          Returns the TemplateDataSource which contains the template data.
 void remove(Component c)
           
 void removeNamedComponent(String componentName)
          Removes a named component from the TemplatePanel that was previously added via the addNamedComponent() method.
 void setTemplateDataSource(TemplateDataSource templateDataSource)
          Sets the TemplateDataSource to be used
 
Methods inherited from class nextapp.echo.app.Component
add, add, addPropertyChangeListener, addPropertyChangeListener, dispose, firePropertyChange, get, getApplicationInstance, getBackground, getComponent, getComponent, getComponentCount, getComponents, getEventListenerList, getFocusNextId, getFocusPreviousId, getFont, getForeground, getId, getIndex, getLayoutData, getLayoutDirection, getLocale, getLocalStyle, getParent, getRenderId, getRenderIndexedProperty, getRenderIndexedProperty, getRenderLocale, getRenderProperty, getRenderProperty, getStyle, getStyleName, getVisibleComponent, getVisibleComponentCount, getVisibleComponents, hasEventListenerList, indexOf, init, isAncestorOf, isEnabled, isFocusTraversalParticipant, isRegistered, isRenderEnabled, isRenderVisible, isValidChild, isValidParent, isVisible, processInput, remove, removeAll, removePropertyChangeListener, removePropertyChangeListener, set, setBackground, setComponents, setEnabled, setFocusNextId, setFocusPreviousId, setFocusTraversalParticipant, setFont, setForeground, setId, setIndex, setLayoutData, setLayoutDirection, setLocale, setRenderId, setStyle, setStyleName, setVisible, validate, verifyInput, visibleIndexOf
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROPERTY_TEMPLATE_DATA_SOURCE

public static final String PROPERTY_TEMPLATE_DATA_SOURCE
See Also:
Constant Field Values

PROPERTY_COMPONENT_MAPPING

public static final String PROPERTY_COMPONENT_MAPPING
See Also:
Constant Field Values
Constructor Detail

TemplatePanel

public TemplatePanel()
Constructs a TemplatePanel with no template data as yet.


TemplatePanel

public TemplatePanel(TemplateDataSource tds)
Constructs a TemplatePanel with the specified TemplateDataSource.

Parameters:
tds - - the source for the template data.
Method Detail

setTemplateDataSource

public void setTemplateDataSource(TemplateDataSource templateDataSource)
Sets the TemplateDataSource to be used

Parameters:
templateDataSource - the TemplateDataSource to be used

getTemplateDataSource

public TemplateDataSource getTemplateDataSource()
Returns the TemplateDataSource which contains the template data.

Returns:
the TemplateDataSource in place

addNamedComponent

public void addNamedComponent(Component component,
                              String componentName)
Adds a component to the TemplatePanel with the associated name which can the be references from the template data.

Parameters:
component - the component to add
componentName - - the name to use when referencing this component in the template data.

getComponentName

public String getComponentName(Component component)
Returns the name associated with the component or null if it cant be found.

Parameters:
component - - the component associated with the name
Returns:
a name associated with component

getNamedComponent

public Component getNamedComponent(String componentName)
Returns a component associated with the name or null if it cant be found.

Parameters:
componentName - - the name associated with the component
Returns:
a component associated with componentName

getNamedComponents

public String[] getNamedComponents()
Returns:
an array of all the component names in the TemplatePanel.

remove

public void remove(Component c)
Overrides:
remove in class Component
See Also:
Component.remove(nextapp.echo.app.Component)

removeNamedComponent

public void removeNamedComponent(String componentName)
Removes a named component from the TemplatePanel that was previously added via the addNamedComponent() method.

Parameters:
componentName - - the name of the component

EchoPoint API - 3.0.0b5
App Webcontainer