|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectto.etc.domui.dom.css.CssBase
to.etc.domui.dom.html.NodeBase
public abstract class NodeBase
Base node for all non-container html dom nodes.
We need to be able to calculate a delta tree very fast. The speed of the delta calculation is a large factor in response time and server CPU utilization. Delta calculation works by defining a strict way in which the DOM is manipulated (conceptual):
For the mechanism to work properly it is very important that the BEFORE state is proper. This means that the BEFORE state may NOT be changed when, during the application-phase, nodes are removed and possibly re-added to the tree. For this event it is important that even when the node is added and removed the BEFORE state is kept as ATTACHED; it may not change as the result of the moves executed in between.
When nodes are removed from the tree and in a different request/response cycle are added again we must ensure that any state from the previous delta run leaks to the new delta run; if this happens it usually results in a "Hell Freezeth over" exception. Because nodes removed from the tree in a phase are not reachable anymore it is hard to clear this state after the delta run.
Constructor Summary | |
---|---|
protected |
NodeBase(java.lang.String tag)
|
Method Summary | ||
---|---|---|
java.lang.String |
$(java.lang.String key,
java.lang.Object... param)
Translate the key passed into a message string, using the component's message bundle. |
|
boolean |
acceptRequestParameter(java.lang.String[] values)
|
|
void |
addCssClass(java.lang.String name)
Add the class passed as another CSS class to the "class" attribute. |
|
UIMessage |
addGlobalMessage(UIMessage m)
This adds a message to the "global" message list. |
|
protected void |
afterCreateContent()
|
|
void |
appendAfterMe(NodeBase item)
Add the node passed immediately after this node in the tree. |
|
void |
appendBeforeMe(NodeBase item)
Add the node passed immediately before this node in the tree. |
|
void |
appendCreateJS(java.lang.CharSequence js)
This adds a Javascript segment to be executed when the component is (re)constructed. |
|
void |
appendJavascript(java.lang.CharSequence js)
This adds a Javascript segment to be executed one time, as soon as the current request returns. |
|
void |
build()
Not normally called from outside, this forces the node to call createContent if needed (if unbuilt). |
|
protected void |
changed()
Called on stylesheet changes. |
|
void |
clearFocusRequested()
Reset the "request focus" flag. |
|
void |
clearGlobalMessage()
|
|
void |
clearGlobalMessage(java.lang.String code)
|
|
void |
clearGlobalMessage(UIMessage m)
|
|
void |
clearMessage()
Remove this-component's "current" error message, if present. |
|
void |
componentHandleWebAction(RequestContextImpl ctx,
java.lang.String action)
Default handling for webui AJAX actions to a component. |
|
void |
createContent()
|
|
IBundle |
findComponentBundle()
Returns the component's message bundle stack. |
|
void |
forceRebuild()
Force this node to be rebuilt by fully clearing all it's content (removing all children). |
|
java.lang.String |
getActualID()
When the node is attached to a page this returns the ID assigned to it. |
|
IClicked<?> |
getClicked()
Return the click handler for this node, or null if none is associated with it. |
|
IBundle |
getComponentBundle()
Returns the component's message bundle stack. |
|
java.lang.StringBuilder |
getCreateJS()
|
|
java.lang.String |
getCssClass()
Return the full "class" (css class) attribute for this node. |
|
INodeErrorDelegate |
getErrorDelegate()
|
|
java.lang.String |
getErrorLocation()
When set this contains a user-understandable tekst indicating which control has the error. |
|
UIMessage |
getMessage()
|
|
java.lang.String |
getOnClickJS()
|
|
java.lang.String |
getOnMouseDownJS()
|
|
Page |
getPage()
Return the Page for this node, if attached, or null otherwise. |
|
NodeContainer |
getParent()
Return the current actual parent of this node. |
|
|
getParent(java.lang.Class<T> clz)
Walk the parents upwards to find the closest parent of the given class. |
|
NodeContainer |
getParent(int up)
Find the nth upward parent of this node. |
|
QDataContext |
getSharedContext()
|
|
java.lang.String |
getSpecialAttribute(java.lang.String name)
Return the value for the "special" attribute with the specified name, if present. |
|
java.util.List<java.lang.String> |
getSpecialAttributeList()
Return the list of special attributes and their value. |
|
java.lang.String |
getTag()
Return the node's tag name (the html tag this node represents). |
|
java.lang.String |
getTestID()
When set this causes a "testid" attribute to be rendered on the node. |
|
java.lang.String |
getTitle()
Returns the title as set verbatim; if it was set using a tilde key this returns the key without resource bundle replacement. |
|
java.lang.Object |
getUserObject()
Get whatever user object is set into this node as set by setUserObject(Object) . |
|
protected void |
handleDrop(RequestContextImpl ctx)
Called when a drop is done on a DropTarget node. |
|
boolean |
hasCssClass(java.lang.String cls)
Returns T if the css class passed is present in the current cssclass. |
|
boolean |
hasError()
Return T if this node currently has an error associated with it. |
|
void |
internalClearDelta()
|
|
void |
internalClearDeltaFully()
|
|
NodeContainer |
internalGetOldParent()
|
|
boolean |
internalHasChangedAttributes()
INTERNAL ONLY Set when this node has changed attributes. |
|
boolean |
internalNeedClickHandler()
Mostly internal only: override when this component has a clicked handler which must not be rendered as a Javascript "onclick". |
|
void |
internalOnClicked()
Internal, do the proper run sequence for a clicked event. |
|
void |
internalSetHasChangedAttributes()
Internal use only. |
|
void |
internalSetHasChangedAttributes(boolean d)
Internal only. |
|
protected void |
internalSetTag(java.lang.String tag)
INTERNAL USE ONLY, FOR SPECIAL CASES!!!! Node tags may NEVER change once rendered to the browser. |
|
protected void |
internalShelve()
|
|
protected void |
internalUnshelve()
|
|
boolean |
isBuilt()
Returns T if the node's content has been built (createContent() has been called). |
|
boolean |
isFocusRequested()
Returns T if this control has requested the focus. |
|
void |
moveControlToModel()
EXPERIMENTAL - DO NOT USE. |
|
void |
moveModelToControl()
EXPERIMENTAL - DO NOT USE. |
|
void |
onAddedToPage(Page p)
|
|
void |
onBeforeFullRender()
|
|
protected void |
onForceRebuild()
Called when forceRebuild is done on this node. |
|
void |
onHeaderContributors(Page page)
|
|
protected void |
onRefresh()
|
|
void |
onRemoveFromPage(Page p)
|
|
protected void |
onShelve()
|
|
protected void |
onUnshelve()
|
|
void |
refresh()
|
|
void |
remove()
Disconnect this node from it's parent. |
|
boolean |
removeCssClass(java.lang.String name)
Removes the specified CSS class. |
|
void |
renderJavascriptState(java.lang.StringBuilder sb)
This gets called when a component is re-rendered fully because of a full page refresh. |
|
void |
replaceWith(NodeBase nw)
Replace this node in it's parent with the node passed. |
|
void |
setClicked(IClicked<?> clicked)
Set a click handler for this node. |
|
void |
setComponentBundle(IBundle bundle)
Set a message bundle for this component. |
|
void |
setControlsEnabled(boolean on)
EXPERIMENTAL - DO NOT USE. |
|
void |
setCssClass(java.lang.String cssClass)
Set the value for the "class" (css class) attribute. |
|
void |
setErrorDelegate(INodeErrorDelegate errorDelegate)
|
|
void |
setErrorLocation(java.lang.String errorLocation)
When set this contains a user-understandable tekst indicating which control has the error. |
|
void |
setFocus()
Claim the focus for this component. |
|
UIMessage |
setMessage(UIMessage msg)
This sets a message (an error, warning or info message) on this control. |
|
void |
setOnClickJS(java.lang.String onClickJS)
|
|
void |
setOnMouseDownJS(java.lang.String onMouseDownJS)
|
|
void |
setSpecialAttribute(java.lang.String name,
java.lang.String value)
This is a generic method to add tag add attributes to a tag. |
|
void |
setTestID(java.lang.String testID)
Set an ID that can be used for finding this node in the HTML using test software. |
|
void |
setTitle(java.lang.String title)
Set the title attribute, using tilde replacement. |
|
void |
setUserObject(java.lang.Object userObject)
Set some user object into this node. |
|
void |
stretchHeight()
EXPERIMENTAL Method can be used to stretch height of element to take all available free space in parent container. |
|
java.lang.String |
toString()
|
|
abstract void |
visit(INodeVisitor v)
This must visit the appropriate method in the node visitor. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
protected NodeBase(@Nonnull java.lang.String tag)
Method Detail |
---|
public abstract void visit(INodeVisitor v) throws java.lang.Exception
v
-
java.lang.Exception
public final boolean internalHasChangedAttributes()
public final void internalSetHasChangedAttributes(boolean d)
d
- public final void internalSetHasChangedAttributes()
public void internalOnClicked() throws java.lang.Exception
java.lang.Exception
protected final void changed()
changed
in class CssBase
CssBase.changed()
public final NodeContainer internalGetOldParent()
public void internalClearDelta()
public void internalClearDeltaFully()
@Nonnull public final java.lang.String getActualID()
@Nonnull public final java.lang.String getTag()
protected final void internalSetTag(@Nonnull java.lang.String tag)
tag
- @Nullable public final Page getPage()
@Nullable public final java.lang.String getCssClass()
public void setCssClass(@Nullable java.lang.String cssClass)
cssClass
- public final boolean removeCssClass(@Nonnull java.lang.String name)
name
-
public final void addCssClass(@Nonnull java.lang.String name)
name
- public final boolean hasCssClass(@Nonnull java.lang.String cls)
cls
-
@Nullable public final NodeContainer getParent()
@Nullable public final NodeContainer getParent(int up)
up
-
@Nullable public final <T> T getParent(java.lang.Class<T> clz)
T
- clz
-
public final void remove()
public final void replaceWith(NodeBase nw)
nw
- public final void appendAfterMe(@Nonnull NodeBase item)
item
- public final void appendBeforeMe(@Nonnull NodeBase item)
item
- public final void build() throws java.lang.Exception
java.lang.Exception
@OverridingMethodsMustInvokeSuper public void forceRebuild()
public boolean isBuilt()
public void setTitle(java.lang.String title)
title
- public java.lang.String getTitle()
@Nullable public IClicked<?> getClicked()
public void setClicked(@Nullable IClicked<?> clicked)
clicked
- public boolean internalNeedClickHandler()
@Nullable public java.lang.Object getUserObject()
setUserObject(Object)
.
public void setUserObject(@Nullable java.lang.Object userObject)
userObject
- public java.lang.String getTestID()
public void setTestID(java.lang.String testID)
testID
- public java.lang.String getOnClickJS()
public void setOnClickJS(java.lang.String onClickJS)
public java.lang.String getOnMouseDownJS()
public void setOnMouseDownJS(java.lang.String onMouseDownJS)
public void appendJavascript(java.lang.CharSequence js)
appendCreateJS(CharSequence)
. This method can
be called from all code to add a Javascript to execute on the browser. This
Javascript should only reference global state or this specific component
because the order of execution for multiple components is explicitly undefined.
js
- public void appendCreateJS(java.lang.CharSequence js)
js
- public java.lang.StringBuilder getCreateJS()
public void setSpecialAttribute(@Nonnull java.lang.String name, @Nullable java.lang.String value)
name
- value
- @Nullable public java.util.List<java.lang.String> getSpecialAttributeList()
setSpecialAttribute(String, String)
for
details.
FIXME This should return a copy, not the actual attributes.
@Nullable public java.lang.String getSpecialAttribute(@Nonnull java.lang.String name)
name
-
public void componentHandleWebAction(@Nonnull RequestContextImpl ctx, @Nonnull java.lang.String action) throws java.lang.Exception
ctx
- action
-
java.lang.Exception
public boolean acceptRequestParameter(@Nonnull java.lang.String[] values) throws java.lang.Exception
java.lang.Exception
public void setErrorLocation(java.lang.String errorLocation)
errorLocation
- public java.lang.String getErrorLocation()
public UIMessage setMessage(UIMessage msg)
setMessage
in interface INodeErrorDelegate
mt
- code
- param
- public void clearMessage()
clearMessage
in interface INodeErrorDelegate
public UIMessage getMessage()
getMessage
in interface INodeErrorDelegate
public boolean hasError()
public void setErrorDelegate(INodeErrorDelegate errorDelegate)
public INodeErrorDelegate getErrorDelegate()
public UIMessage addGlobalMessage(UIMessage m)
mt
- code
- param
- public void clearGlobalMessage()
public void clearGlobalMessage(UIMessage m)
public void clearGlobalMessage(java.lang.String code)
public final void setComponentBundle(@Nullable IBundle bundle)
bundle
- @Nullable public final IBundle findComponentBundle()
setComponentBundle(IBundle)
, or
the component searches for a stack of message bundles by locating [classname] and "message" bundles for itself and all
it's parent classes. If no message bundles are found at all this will return null.
@Nonnull public final IBundle getComponentBundle()
setComponentBundle(IBundle)
, or
the component searches for a stack of message bundles by locating [classname] and "message" bundles for itself and all
it's parent classes. If no message bundles are found at all this throws an IllegalStateException.
public java.lang.String $(java.lang.String key, java.lang.Object... param)
setComponentBundle(IBundle)
and
findComponentBundle()
for details on how a component find it's messages.
key
- param
-
protected void internalShelve() throws java.lang.Exception
java.lang.Exception
protected void internalUnshelve() throws java.lang.Exception
java.lang.Exception
protected void onForceRebuild()
protected void onShelve() throws java.lang.Exception
java.lang.Exception
protected void onUnshelve() throws java.lang.Exception
java.lang.Exception
protected void onRefresh() throws java.lang.Exception
java.lang.Exception
public void renderJavascriptState(java.lang.StringBuilder sb) throws java.lang.Exception
sb
-
java.lang.Exception
public void onBeforeFullRender() throws java.lang.Exception
java.lang.Exception
public void createContent() throws java.lang.Exception
java.lang.Exception
protected void afterCreateContent() throws java.lang.Exception
java.lang.Exception
public void onAddedToPage(Page p)
public void onRemoveFromPage(Page p)
public void onHeaderContributors(Page page)
protected void handleDrop(RequestContextImpl ctx) throws java.lang.Exception
ctx
-
java.lang.Exception
public void moveControlToModel() throws java.lang.Exception
moveControlToModel
in interface IModelBinding
java.lang.Exception
IModelBinding.moveControlToModel()
public void moveModelToControl() throws java.lang.Exception
moveModelToControl
in interface IModelBinding
java.lang.Exception
IModelBinding.moveModelToControl()
public void setControlsEnabled(boolean on)
setControlsEnabled
in interface IModelBinding
IModelBinding.setControlsEnabled(boolean)
public QDataContext getSharedContext() throws java.lang.Exception
java.lang.Exception
public void setFocus()
public final boolean isFocusRequested()
public final void clearFocusRequested()
public final void refresh() throws java.lang.Exception
java.lang.Exception
public void stretchHeight()
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |