| com.xoetrope.builder.generic.XGenericBuilder
All known Subclasses: com.xoetrope.builder.pojo.XPojoFormBuilder,
XGenericBuilder | public class XGenericBuilder extends XuiBuilder (Code) | | A generic builder for forms/pages based on generation markup. The builder can
create XUI pages on-the-fly or it can be used to convert and save a page to a
xui format.
Copyright (c) Xoetrope 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 Xoetrope.
|
Constructor Summary | |
public | XGenericBuilder(XProject project) Create a new builder. |
Method Summary | |
public void | addBinding(Component targetComp, String srcStr) | protected 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 String | escape(String srcValue) | public String | getMappedValue(String srcValue, String mapping) Get the argument value in the specified format, substituting the value
into the mapping string as appropriate. | public String | getMappedValue(Component comp, String srcValue) Get the argument value in the specified format, substituting the value
into the mapping string as appropriate. | public String | getType() | protected InputStream | getUrlInputStream(String urlStr) | protected void | init(String packageName) | public PageSupport | loadPage(String defPackageName, String pageName, boolean include) Loads an XPage via a reader obtained from the XProject (searches
the classpath). | public PageSupport | readPage(Reader reader, String pageName, String ext, boolean include) Read an XML description of the page and construct a new XPage. | protected void | setComponentAttributes(Component comp, String attribName, String attribValue, XmlElement childNode) | public void | setStyle(Component comp, String value) | public void | setupCommonAttributeMapping(XmlElement mappingNode) | protected void | setupComponentMapping(XmlElement mappingNode) | public void | setupFileTypeHandler(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) | protected void | setupPage(XmlElement model, String pageName, String ext, boolean include) Loads the page based on the contents of the page tag or by using default
values. | public void | setupPageLayout(XmlElement componentsNode) | protected String | unescape(String srcValue) |
decorationPanelformPanel | protected XPanel decorationPanelformPanel(Code) | | |
documentUrl | protected static URL documentUrl(Code) | | |
XGenericBuilder | public XGenericBuilder(XProject project)(Code) | | Create a new builder. An attempt is made to configure the builder with a
configuration file when the builder is constructed if the configuration file is
specified as part of the startup properties via the
XGenericBuilderConfig setting.
Parameters: project - the current xui project Parameters: factory - the component factory |
addBinding | public void addBinding(Component targetComp, String srcStr)(Code) | | Add a data binding for the component
Parameters: targetComp - the affected component Parameters: srcStr - the data source path |
addComponent | protected Object addComponent(XmlElement childNode)(Code) | | Adds an individual component element to the page (this method may be called
recursively for nested elements). Several methods will be attempted until a
component is successfully created. Firstly the built-in component types are
checked, then any additional registered component constructors. The types
can be specified by type ID, type name or class name.
Parameters: childNode - the XML element containing the component specification. the new component |
addVocabulary | protected void addVocabulary(PageSupport page, XmlElement model)(Code) | | Adds data vocaulary associated with the page.
Parameters: page - the page to which the component/data bindings are added Parameters: model - the vocabulary model |
escape | protected String escape(String srcValue)(Code) | | Replace the [...] escaped blocks with [idx] where idx is the index of the
store for the escaped value
Parameters: srcValue - the source/unescaped value the escaped value |
getMappedValue | public String getMappedValue(String srcValue, String mapping)(Code) | | Get the argument value in the specified format, substituting the value
into the mapping string as appropriate. The mapping allows a value to
be included from a model or a path within the model
Parameters: mapping - e.g. /vocab/lists/${value} Parameters: srcValue - the value that is used to replace $value, or the returnvalue if no substitution is specified in the mapping |
getMappedValue | public String getMappedValue(Component comp, String srcValue)(Code) | | Get the argument value in the specified format, substituting the value
into the mapping string as appropriate. The mapping allows a value to
be included from a model or a path within the model
Parameters: comp - the affected component Parameters: mapping - e.g. /vocab/lists/${value} Parameters: srcValue - the value that is ${compName}value if no substitution is specified in the mapping |
getType | public String getType()(Code) | | Get the page loader type - a unique name identifying the loader
"generic" |
getUrlInputStream | protected InputStream getUrlInputStream(String urlStr)(Code) | | Attempt to get an input stream from the specified path
Parameters: urlStr - the url string the inputstream or null if the strean cannot be opened. |
init | protected void init(String packageName)(Code) | | Initialize the builder
|
loadPage | public PageSupport loadPage(String defPackageName, String pageName, boolean include)(Code) | | Loads an XPage via a reader obtained from the XProject (searches
the classpath). The pageName is assumed to be the name of an XML file. For
example if the pageName is 'welcome' then the 'welcome.xml' file is read as
a UTF8 encoded XML file (by default).
Parameters: defPackageName - the package or path to the page Parameters: pageName - the page name or the name of the class implementing the page Parameters: include - true if the page to be loaded is being included in anotherpage in which case any class attribute of the included page is ignored the page |
readPage | public PageSupport readPage(Reader reader, String pageName, String ext, boolean include)(Code) | | Read an XML description of the page and construct a new XPage. An instance
of the class specified by the class attribute is constructed or else an
instance of XPage if no class attribute is specified. The new page is
populated but is not yet added to its parent.
The startup file parameter 'DefaultClass' is used to obtain a default for
each page's class if a class parameter is not specified in the page's XML
The startup file parameter 'Validations' is used to obtain a default for
each page's set of validation rules
Parameters: reader - a input stream from which to read the page Parameters: pageName - the name of the page Parameters: ext - the file extension Parameters: include - the page to be loaded is being included in another page the page |
setComponentAttributes | protected void setComponentAttributes(Component comp, String attribName, String attribValue, XmlElement childNode)(Code) | | Iterate through the attributes and set the attributes for a component
Parameters: comp - the component Parameters: attribName - the name of the attribute. Parameters: attribValue - the value of the attribute. Parameters: childNode - the source xml node |
setStyle | public void setStyle(Component comp, String value)(Code) | | Apply a style to a component
Parameters: comp - the affected component Parameters: value - the style name/value |
setupCommonAttributeMapping | public void setupCommonAttributeMapping(XmlElement mappingNode)(Code) | | Load the definition of the common attribute mapping
|
setupComponentMapping | protected void setupComponentMapping(XmlElement mappingNode)(Code) | | Setup the mapping for component elements
Parameters: mappingNode - the node whose children describe the mapping of the fileelements to components |
setupFileTypeHandler | public void setupFileTypeHandler(String urlStr)(Code) | | Setup the file type handling, mapping a file extension to a set of
configuration files for a particular file format. An attempt is made to
load this file when the builder is constructed if the configuration file is
specified as part of the startup properties via the
XGenericBuilderConfig setting.
Parameters: urlStr - a filename/url for the main configuration file |
setupInstructionMapping | protected void setupInstructionMapping(XmlElement mappingNode)(Code) | | Setup the mapping for process/instruction elements
Parameters: mappingNode - the node whose children describe the mapping of the fileelements to components |
setupPage | protected void setupPage(XmlElement model, String pageName, String ext, boolean include)(Code) | | Loads the page based on the contents of the page tag or by using default
values.
Parameters: pageName - the name of the page Parameters: ext - the file extension Parameters: include - the page to be loaded is being included in another page |
setupPageLayout | public void setupPageLayout(XmlElement componentsNode)(Code) | | Setup the layout for this page
|
unescape | protected String unescape(String srcValue)(Code) | | Replace the [...] escaped blocks with [idx] where idx is the index of the
store for the escaped value
Parameters: srcValue - the source/unescaped value the escaped value |
|
|