|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.formaria.builder.AriaBuilder
org.formaria.builder.generic.GenericBuilder
public class GenericBuilder
A generic builder for forms/pages based on generation markup. The builder can create Aria pages on-the-fly or it can be used to convert and save a page to a aria format.
Copyright (c) Formaria Ltd., 2001-2008, This software is licensed under the GNU Public License (GPL), please see license.txt for more details. If you make commercial use of this software you must purchase a commercial license from Formaria.
| Field Summary | |
|---|---|
protected java.util.ArrayList |
commonAttributeMapping
|
protected java.lang.String |
componentsNodeName
|
protected Panel |
decorationPanel
|
protected static java.net.URL |
documentUrl
|
protected java.util.ArrayList |
escapes
|
protected GenericBuilderAttributeEvaluator |
evaluator
|
protected java.lang.String |
fileExtension
|
protected Panel |
formPanel
|
protected java.awt.LayoutManager |
layoutManager
|
protected java.lang.String |
packageName
|
protected java.util.Hashtable |
processors
|
protected boolean |
reverseOrder
false for normal z-ordering of new components, true to reverse the order |
protected java.util.Hashtable |
typeMap
|
| Fields inherited from class org.formaria.builder.AriaBuilder |
|---|
adapter, attributeSets, checkBoxGroup, componentFactory, currentAttributes, currentProject, customizer, DEFAULT_PAGE_CLASS, eventHandler, includeFileName, layoutHelper, menuBar, page, rootPage, secondaryClassloader, validationFactories |
| Constructor Summary | |
|---|---|
GenericBuilder(Project project)
Create a new builder. |
|
| Method Summary | |
|---|---|
void |
addBinding(java.awt.Component targetComp,
java.lang.String srcStr)
Add a data binding for the component |
protected java.lang.Object |
addComponent(XmlElement childNode)
Adds an individual component element to the page (this method may be called recursively for nested elements). |
protected void |
addVocabulary(PageSupport page,
XmlElement model)
Adds data vocaulary associated with the page. |
protected java.lang.String |
escape(java.lang.String srcValue)
Replace the [...] escaped blocks with [idx] where idx is the index of the store for the escaped value |
java.lang.String |
getMappedValue(java.awt.Component comp,
java.lang.String srcValue)
Get the argument value in the specified format, substituting the value into the mapping string as appropriate. |
java.lang.String |
getMappedValue(java.lang.String srcValue,
java.lang.String mapping)
Get the argument value in the specified format, substituting the value into the mapping string as appropriate. |
java.lang.String |
getType()
Get the page loader type - a unique name identifying the loader |
protected java.io.InputStream |
getUrlInputStream(java.lang.String urlStr)
Attempt to get an input stream from the specified path |
protected void |
init(java.lang.String packageName)
Initialize the builder |
PageSupport |
loadPage(java.lang.String defPackageName,
java.lang.String pageName,
boolean include)
Loads an Page via a reader obtained from the Project (searches the classpath). |
PageSupport |
readPage(java.io.Reader reader,
java.lang.String pageName,
java.lang.String ext,
boolean include)
Read an XML description of the page and construct a new Page. |
protected void |
setComponentAttributes(java.awt.Component comp,
java.lang.String attribName,
java.lang.String attribValue,
XmlElement childNode)
Iterate through the attributes and set the attributes for a component |
void |
setStyle(java.awt.Component comp,
java.lang.String value)
Apply a style to a component |
void |
setupCommonAttributeMapping(XmlElement mappingNode)
Load the definition of the common attribute mapping |
protected void |
setupComponentMapping(XmlElement mappingNode)
Setup the mapping for component elements |
void |
setupFileTypeHandler(java.lang.String urlStr)
Setup the file type handling, mapping a file extension to a set of configuration files for a particular file format. |
protected void |
setupInstructionMapping(XmlElement mappingNode)
Setup the mapping for process/instruction elements |
protected void |
setupPage(XmlElement model,
java.lang.String pageName,
java.lang.String ext,
boolean include)
Loads the page based on the contents of the page tag or by using default values. |
void |
setupPageLayout(XmlElement componentsNode)
Setup the layout for this page |
protected java.lang.String |
unescape(java.lang.String srcValue)
Replace the [...] escaped blocks with [idx] where idx is the index of the store for the escaped value |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected GenericBuilderAttributeEvaluator evaluator
protected java.util.Hashtable typeMap
protected java.util.Hashtable processors
protected java.util.ArrayList commonAttributeMapping
protected java.lang.String packageName
protected static java.net.URL documentUrl
protected java.lang.String fileExtension
protected java.lang.String componentsNodeName
protected java.awt.LayoutManager layoutManager
protected Panel decorationPanel
protected Panel formPanel
protected java.util.ArrayList escapes
protected boolean reverseOrder
| Constructor Detail |
|---|
public GenericBuilder(Project project)
GenericBuilderConfig setting.
project - the current aria projectfactory - the component factory| Method Detail |
|---|
protected void init(java.lang.String packageName)
init in class AriaBuilderpackageName - the default componnet package or use AWT if none is specifiedpublic void setupFileTypeHandler(java.lang.String urlStr)
GenericBuilderConfig setting.
urlStr - a filename/url for the main configuration fileprotected void setupComponentMapping(XmlElement mappingNode)
mappingNode - the node whose children describe the mapping of the file
elements to componentsprotected void setupInstructionMapping(XmlElement mappingNode)
mappingNode - the node whose children describe the mapping of the file
elements to componentspublic void setupCommonAttributeMapping(XmlElement mappingNode)
protected java.io.InputStream getUrlInputStream(java.lang.String urlStr)
urlStr - the url string
public PageSupport loadPage(java.lang.String defPackageName,
java.lang.String pageName,
boolean include)
loadPage in interface PageLoaderloadPage in class AriaBuilderdefPackageName - the package or path to the pagepageName - the page name or the name of the class implementing the pageinclude - true if the page to be loaded is being included in another
page in which case any class attribute of the included page is ignored
public PageSupport readPage(java.io.Reader reader,
java.lang.String pageName,
java.lang.String ext,
boolean include)
readPage in interface PageLoaderreadPage in class AriaBuilderreader - a input stream from which to read the pagepageName - the name of the pageext - the file extensioninclude - the page to be loaded is being included in another page
protected void setupPage(XmlElement model,
java.lang.String pageName,
java.lang.String ext,
boolean include)
setupPage in class AriaBuilderpageName - the name of the pageext - the file extensioninclude - the page to be loaded is being included in another pagepublic void setupPageLayout(XmlElement componentsNode)
protected void addVocabulary(PageSupport page,
XmlElement model)
page - the page to which the component/data bindings are addedmodel - the vocabulary modelprotected java.lang.Object addComponent(XmlElement childNode)
addComponent in class AriaBuilderchildNode - the XML element containing the component specification.
protected void setComponentAttributes(java.awt.Component comp,
java.lang.String attribName,
java.lang.String attribValue,
XmlElement childNode)
comp - the componentattribName - the name of the attribute.attribValue - the value of the attribute.childNode - the source xml node
public java.lang.String getMappedValue(java.lang.String srcValue,
java.lang.String mapping)
mapping - e.g. /vocab/lists/${value}srcValue - the value that is used to replace $value, or the return
value if no substitution is specified in the mapping
public java.lang.String getMappedValue(java.awt.Component comp,
java.lang.String srcValue)
comp - the affected componentmapping - e.g. /vocab/lists/${value}srcValue - the value that is ${compName}
value if no substitution is specified in the mappingprotected java.lang.String escape(java.lang.String srcValue)
srcValue - the source/unescaped value
protected java.lang.String unescape(java.lang.String srcValue)
srcValue - the source/unescaped value
public void addBinding(java.awt.Component targetComp,
java.lang.String srcStr)
targetComp - the affected componentsrcStr - the data source path
public void setStyle(java.awt.Component comp,
java.lang.String value)
comp - the affected componentvalue - the style name/valuepublic java.lang.String getType()
getType in interface PageLoadergetType in class AriaBuilder
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||