public class Widget<O extends PatternOptions>
extends java.lang.Object
A creatable widget allows the caller to preview the category and type of widget to create. Creating a new instance of the widget will properly databind the widget to the underlying model used to create the creatable widget.
Binding categories are defined by the model and are arbitrary. They should closely match, however, the different binding types related to JSR 227 definition metadata.
Modifier and Type | Method and Description |
---|---|
BinderResult |
bind(BinderParams<O> params)
Binds the given subtree to the model.
|
void |
bind(org.w3c.dom.Node insertionSubTreeRoot,
org.w3c.dom.Element subtreeToBind)
Deprecated.
Use bind(BinderParams) instead.
|
void |
bind(org.w3c.dom.Node insertionSubTreeRoot,
ModelProvider parent,
java.util.Map properties,
org.w3c.dom.Element subtreeToBind)
Deprecated.
Use bind(BinderParams) instead.
|
org.w3c.dom.DocumentFragment |
create()
Deprecated.
Use create(CreatorParams) instead.
|
CreatorResult |
create(CreatorParams<O> params)
Returns an
Element representing the root of the subtree
of elements making up this widget. |
org.w3c.dom.DocumentFragment |
create(org.w3c.dom.Node insertionSubTreeRoot,
ModelProvider parent,
java.util.Map properties)
Deprecated.
Use create(CreatorParams) instead.
|
BinderParams<O> |
createBaseBinderParams(org.w3c.dom.Node bindRootParent,
org.w3c.dom.Node toBind)
Builds a
CreatorParams with the existing dt context and creation context,
and the model provider. |
CreatorParams<O> |
createBaseCreatorParams(org.w3c.dom.Node insertionRoot)
Builds a
CreatorParams with the existing dt context and creation context,
and the model provider. |
O |
createOptions(CreatorParams<O> params)
Generates the PatternOptions with the default set of values.
|
boolean |
equals(java.lang.Object obj) |
O |
generateBinderOptions(BinderParams<O> params)
Generates the PatternOptions based on the current set of nodes and bindings already
existing in the document.
|
java.lang.String |
getCategory()
The binding category this widget falls in.
|
CreatorInfo |
getCreator()
Returns the
CreatorInfo used in the widget generation. |
java.lang.String |
getId()
Returns the id for this widget.
|
ModelProvider |
getModelProvider()
Returns the
ModelProvider used in the widget generation. |
java.lang.String |
getName()
Returns a short description of what the widget will create.
|
CreatorPresentation |
getPresentation()
Returns the
CreatorPresentation of the widget if the widget supports
presentations, and if the widget has a presentation. |
int |
hashCode() |
boolean |
isWidgetModified()
Returns the widget modified status.
|
void |
runConfigurations()
Runs all necessary configurations as determined by the environmental
ADFDesignTimeContext . |
void |
setOptions(O patternOptions)
Sets options to be used for all subsequent create and bind operations.
|
public java.lang.String getCategory()
The binding category this widget falls in. Some examples of binding categories include:
public java.lang.String getName()
Returns a short description of what the widget will create. Some examples include:
public java.lang.String getId()
Returns the id for this widget.
public void runConfigurations()
Runs all necessary configurations as determined by the environmental
ADFDesignTimeContext
. Specifcally, this sets up the
environment for:
@Deprecated public org.w3c.dom.DocumentFragment create()
Returns an Element
representing the root of the subtree
of elements making up this widget. The returned widget is fully
databound to the underlying model, as specified when the creatable widget
is vended.
Element
subtree of the widget.@Deprecated public org.w3c.dom.DocumentFragment create(org.w3c.dom.Node insertionSubTreeRoot, ModelProvider parent, java.util.Map properties)
Returns an Element
representing the root of the subtree
of elements making up this widget. The returned widget is fully
databound to the underlying model, as specified when the creatable widget
is vended.
This signature allows the created ModelProvider
to be
initialized by a parent model provider. This can be used by providers
in ModelProvider.initializeFromParent(parent)
You can also pass in the parent subtree Node
as well as
additional properties to passed on to the CreatorInfo
.
insertionSubTreeRoot
- insertion subtree rootparent
- parent model providerproperties
- map of propertiesElement
subtree of the widget.public CreatorResult create(CreatorParams<O> params)
Returns an Element
representing the root of the subtree
of elements making up this widget. The returned widget is fully
databound to the underlying model, as specified when the creatable widget
is vended.
This signature allows the created ModelProvider
to be
initialized by a parent model provider. This can be used by providers
in ModelProvider.initializeFromParent(parent)
You can also pass in the parent subtree Node
as well as
additional properties to passed on to the CreatorInfo
.
params
- creator parametersElement
subtree of the widget.public CreatorParams<O> createBaseCreatorParams(org.w3c.dom.Node insertionRoot)
Builds a CreatorParams
with the existing dt context and creation context,
and the model provider. All other fields of the params is optional.
insertionRoot
- insertion root@Deprecated public void bind(org.w3c.dom.Node insertionSubTreeRoot, org.w3c.dom.Element subtreeToBind)
Binds the given subtree to the model.
insertionSubTreeRoot
- insertion subtree root nodesubtreeToBind
- subtree node to bind@Deprecated public void bind(org.w3c.dom.Node insertionSubTreeRoot, ModelProvider parent, java.util.Map properties, org.w3c.dom.Element subtreeToBind)
Binds the given subtree to the model.
This signature allows the bound ModelProvider
to be
initialized by a parent model provider. This can be used by providers
in ModelProvider.initializeFromParent(parent)
You can also pass in the parent subtree Node
as well as
additional properties to passed on to the CreatorInfo
.
insertionSubTreeRoot
- insertion subtree root nodeparent
- parent model providerproperties
- map of propertiessubtreeToBind
- element subtree to bindpublic BinderResult bind(BinderParams<O> params)
Binds the given subtree to the model.
This signature allows the bound ModelProvider
to be
initialized by a parent model provider. This can be used by providers
in ModelProvider.initializeFromParent(parent)
You can add binder options, and other properties on the BinderParams
.
This should be created with the createBinderParams(.)
method.
params
- parameterspublic O createOptions(CreatorParams<O> params)
Generates the PatternOptions with the default set of values. Useful for create cases.
params
- creator parameterspublic O generateBinderOptions(BinderParams<O> params)
Generates the PatternOptions based on the current set of nodes and bindings already existing in the document.
params
- bindinger parameterspublic void setOptions(O patternOptions)
Sets options to be used for all subsequent create and bind operations. Typically, calling this method is redundant, as options can be set on either CreatorParams or BinderParams that are passed into their respective methods. However, there are certain cases where patterns will delegate to subpatterns. In these cases, the user may not have an opportunity to set options as the calls to create and bind are made by the super pattern.
In effect, then, this call (re)sets the default options that will be used when this widget is asked to create or bind. Generally, the programming pattern that is used is delegation. That is, specific widgets are set on the super pattern, which then in turn calls into those widgets to generate the sub parts of the pattern. In this programming paradigm, this method is the only affective way to alter how those subpatterns are created.
There are cases when this default is set on the widget, and an additional set of options is passed in during create or bind. In those cases, the patterns will be merged via the merge() method on PatternOperations. The default options method will be called with the new options as the parameter. Refer to individual patterns to see if this is implemented and to see additional details.
To ensure that no default set of options is set, it is acceptable to call this method with null as a parameter to effectively clear out any default option. When a widget is created the first time, there will be no default options set.
patternOptions
- The defaul options (see createOptions or generateBinderOptions)public boolean isWidgetModified()
public BinderParams<O> createBaseBinderParams(org.w3c.dom.Node bindRootParent, org.w3c.dom.Node toBind)
Builds a CreatorParams
with the existing dt context and creation context,
and the model provider. All other fields of the params is optional.
bindRootParent
- The node representing the parent of where the bound nodes are attached to the DOM
tree.toBind
- The element or document fragment representing the nodes to bind.public CreatorPresentation getPresentation()
Returns the CreatorPresentation
of the widget if the widget supports
presentations, and if the widget has a presentation.
If a presentation exists and is used, the selected variation should be added to the create or bind params via the mergeProperties(...) method prior to the create(.) or bind(.) method being called.
Note that it should always be optional to use presentations, as not using it would cause the pattern to use it's default settings.
public CreatorInfo getCreator()
Returns the CreatorInfo
used in the widget generation. This
can be used to get more detailed information concerning the widget.
public ModelProvider getModelProvider()
Returns the ModelProvider
used in the widget generation.
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object