| |
|
| java.lang.Object org.wings.SAbstractLayoutManager org.wings.STemplateLayout
All known Subclasses: org.wings.SRootLayout, org.wings.CmsLayout,
STemplateLayout | public class STemplateLayout extends SAbstractLayoutManager (Code) | | Static layout manager that uses template files to arrange components.
Like any other layout manager it allows to place arbitrary elements, but you can
write a simple HTML-page being the template for your container component.
Though we encourage the use of the dynamic layout managers, this layout manager can be
very useful in realising the main page layout of your web application.
To use this layout manager you have to define a template file required by the STemplateLayout
instance. Inside this template file you can insert inside your custom HTML code desired
wingS objects using tags like
<input name="compname">
or
<object name="compname"></object>
The name attribute of these input or object tag is the name
you have to use as layout constraint when you add the desired component to the
template layout managed
SContainer :
panel.add(new SLabel("a test label), "compname"));
Besides this simple inlining mechanism the STemplateLayout manager has also another
very powerful feature: Specific components bean attributes can be overwritten by
specific optional inline attributes attached to your object html tags i.e. like
<object name="compname" background="#ff0000" text="new text"></object>
Please refer to javadoc of
PropertyManager for more information on this feature.
Sample template file:
<HTML><BODY>
Name der Person: <COMPONENT NAME=NAME><BR>
Vorname der Person: <COMPONENT NAME=VORNAME ICON="vorname.gif"><BR>
Wohnort der Person: <COMPONENT NAME=WOHNORT><BR>
</BODY></HTML>
According java sample code::
templateContainer.setLayout(new STemplateLayout("templatefile"));
templateContainer.addComponent(new SLabel("Haaf"), "NAME");
templateContainer.addComponent(new SButton("Armin"), "VORNAME");
templateContainer.addComponent(new SLabel("Neu-Ulm"), "WOHNORT");
See Also: PropertyManager author: Armin Haaf author: Jochen Woehrle author: Henner Zeller |
components | protected HashMap components(Code) | | Abstraction of the template source (file, resource, ..)
|
STemplateLayout | public STemplateLayout()(Code) | | |
STemplateLayout | public STemplateLayout(TemplateSource source)(Code) | | Create a TemplateLayout that reads its content from the generic
TemplateSource . The template source can be implemented
to be read from any source you want to, e.g. database BLOBs. Whenever
the source changes (i.e. lastModified() returns a different
modification time the last time this source has been parsed), the
template is reparsed.
Parameters: source - the TemplateSource this template is to be read from. |
STemplateLayout | public STemplateLayout(String tmplFileName) throws java.io.IOException(Code) | | Open a template from a file with the given name.
Whenever the file changes, the Template is reloaded.
Parameters: tmplFileName - the filename to read the file from. throws: java.io.IOException - |
STemplateLayout | public STemplateLayout(File tmplFile) throws java.io.IOException(Code) | | Read the template from a file.
Open a template from a file.
Whenever the file changes, the Template is reloaded.
Parameters: tmplFile - the File to read the template from. throws: java.io.IOException - |
addComponent | public void addComponent(SComponent c, Object constraint, int index)(Code) | | add a component with the given constraint. The contstraint in the
TemplateLayout is the value of the name attribute of the object in
the HTML-template.
Parameters: c - the component to be added Parameters: constraint - the string describing the |
addPropertyManager | final public static void addPropertyManager(PropertyManager p)(Code) | | Adds a PropertyManager.
A Property Manager provides a mapping from properties given in
template tags to properties of components.
PropertyManager are responsible for a number of component classes; if
there is already a mapping for a certain class, then this mapping
is not added.
|
getPageParser | public PageParser getPageParser()(Code) | | Retrieve the PageParser of this instance
the current PageParser |
getPropertyManager | final public static PropertyManager getPropertyManager(Class c)(Code) | | Determines appropriate property manager for the given SComponent or
derived class. Goes up the hierarchy.
|
removeComponent | public void removeComponent(SComponent comp)(Code) | | removes the given component.
Parameters: comp - the component to be removed. |
setPageParser | public void setPageParser(PageParser pageParser)(Code) | | Set the PageParser for this instance
Parameters: pageParser - the new PageParser |
setTemplate | public void setTemplate(TemplateSource source)(Code) | | Sets the template from the DataSource. Use this, if you hold your
templates in databases etc. and write your own DataSource.
Parameters: source - the source this template is to be read. See Also: org.wings.template.TemplateSource |
|
|
|