to.etc.domui.component.buttons
Class DefaultButton

java.lang.Object
  extended by to.etc.domui.dom.css.CssBase
      extended by to.etc.domui.dom.html.NodeBase
          extended by to.etc.domui.dom.html.NodeContainer
              extended by to.etc.domui.dom.html.Button
                  extended by to.etc.domui.component.buttons.DefaultButton
All Implemented Interfaces:
java.lang.Iterable<NodeBase>, IModelBinding, INodeErrorDelegate

public class DefaultButton
extends Button

An HTML button containing a rendered image as the button content. This button creates a button by creating the full visible presence of the button as a server-side rendered image. The button can contain a text, an icon or both, and things like the text color, font and style can be manipulated. The actual rendering process uses a properties file 'defaultbutton.properties' present in the current theme. This property file contains all of the basic rendering options for rendering the button, like:

etc, etc.

Author:
Frits Jalvingh Created on Jul 21, 2008

Constructor Summary
DefaultButton()
          Create an empty button.
DefaultButton(java.lang.String txt)
          Create a button with a text.
DefaultButton(java.lang.String txt, IClicked<DefaultButton> clicked)
           
DefaultButton(java.lang.String txt, java.lang.String icon)
          Create a button with a text and an icon.
DefaultButton(java.lang.String txt, java.lang.String icon, IClicked<DefaultButton> clicked)
           
 
Method Summary
 java.lang.String getLiteralText()
          Returns the text currently set on the button.
 void onAddedToPage(Page p)
          When attached to a page, this causes the Button Image Renderer URL to be set in the image.
 void setConfig(java.lang.Class<?> resourceBase, java.lang.String name)
          Set the rendering properties file to be used to render the button image, as a class resource.
 void setConfig(java.lang.String src)
          Set the rendering properties file to be used to render the button image.
 void setIcon(java.lang.String name)
          Sets a (new) icon on this button.
 void setIconImage(java.lang.Class<?> resourceBase, java.lang.String name)
          Uses a resource as the base for the image.
 void setText(java.lang.String text)
          Set a (new) text on the button's surface.
 void setThemeConfig(java.lang.String name)
          Set the rendering properties file to be used to render the button image.
 
Methods inherited from class to.etc.domui.dom.html.Button
getAccessKey, getType, getValue, isDisabled, setAccessKey, setDisabled, setType, setValue, visit
 
Methods inherited from class to.etc.domui.dom.html.NodeContainer
add, add, add, addTable, canContain, delegateTo, findChildIndex, forceRebuild, getChild, getChildCount, getChildren, getDeepChild, getDeepChildren, getErrorFence, internalCheckNotDirty, internalClearDelta, internalClearDeltaFully, internalGetOldChildren, internalShelve, internalUnshelve, iterator, moveControlToModel, moveModelToControl, onRefresh, removeAllChildren, removeChild, removeChild, replaceChild, setControlsEnabled, setErrorFence, setErrorFence, setValue
 
Methods inherited from class to.etc.domui.dom.html.NodeBase
$, acceptRequestParameter, addCssClass, addGlobalMessage, afterCreateContent, appendAfterMe, appendBeforeMe, appendCreateJS, appendJavascript, build, changed, clearFocusRequested, clearGlobalMessage, clearGlobalMessage, clearGlobalMessage, clearMessage, componentHandleWebAction, createContent, findComponentBundle, getActualID, getAllocationTracepoint, getClicked, getComponentBundle, getCreateJS, getCssClass, getErrorDelegate, getErrorLocation, getMessage, getOnClickJS, getOnMouseDownJS, getPage, getParent, getParent, getParent, getSharedContext, getSpecialAttribute, getSpecialAttributeList, getTag, getTestID, getTitle, getUserObject, handleDrop, hasCssClass, hasError, internalGetOldParent, internalHasChangedAttributes, internalNeedClickHandler, internalOnClicked, internalOnValueChanged, internalSetHasChangedAttributes, internalSetHasChangedAttributes, internalSetLogAllocations, internalSetTag, isBuilt, isFocusRequested, isStretchHeight, onBeforeFullRender, onForceRebuild, onHeaderContributors, onRemoveFromPage, onShelve, onUnshelve, refresh, remove, removeCssClass, renderJavascriptState, replaceWith, setClicked, setComponentBundle, setCssClass, setErrorDelegate, setErrorLocation, setFocus, setMessage, setOnClickJS, setOnMouseDownJS, setSpecialAttribute, setStretchHeight, setTestID, setTitle, setUserObject, toString
 
Methods inherited from class to.etc.domui.dom.css.CssBase
getBackgroundAttachment, getBackgroundColor, getBackgroundImage, getBackgroundPosition, getBackgroundRepeat, getBorderBottomColor, getBorderBottomStyle, getBorderBottomWidth, getBorderLeftColor, getBorderLeftStyle, getBorderLeftWidth, getBorderRightColor, getBorderRightStyle, getBorderRightWidth, getBorderTopColor, getBorderTopStyle, getBorderTopWidth, getBottom, getCachedStyle, getClear, getColor, getDisplay, getFloat, getFontFamily, getFontSize, getFontSizeAdjust, getFontStyle, getFontVariant, getFontWeight, getHeight, getLeft, getLineHeight, getMarginBottom, getMarginLeft, getMarginRight, getMarginTop, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getOverflow, getPosition, getRight, getTextAlign, getTop, getTransform, getVerticalAlign, getVisibility, getWidth, getZIndex, internalSetDisplay, setBackgroundAttachment, setBackgroundColor, setBackgroundImage, setBackgroundPosition, setBackgroundRepeat, setBorder, setBorder, setBorderBottomColor, setBorderBottomStyle, setBorderBottomWidth, setBorderColor, setBorderLeftColor, setBorderLeftStyle, setBorderLeftWidth, setBorderRightColor, setBorderRightStyle, setBorderRightWidth, setBorderStyle, setBorderTopColor, setBorderTopStyle, setBorderTopWidth, setBorderWidth, setBottom, setBottom, setCachedStyle, setClear, setColor, setDisplay, setFloat, setFontFamily, setFontSize, setFontSizeAdjust, setFontStyle, setFontVariant, setFontWeight, setHeight, setLeft, setLeft, setLineHeight, setMargin, setMarginBottom, setMarginLeft, setMarginRight, setMarginTop, setMaxHeight, setMaxWidth, setMinHeight, setMinWidth, setOverflow, setPosition, setRight, setRight, setTextAlign, setTop, setTop, setTransform, setVerticalAlign, setVisibility, setWidth, setZIndex
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DefaultButton

public DefaultButton()
Create an empty button.


DefaultButton

public DefaultButton(java.lang.String txt)
Create a button with a text.

Parameters:
txt -

DefaultButton

public DefaultButton(java.lang.String txt,
                     java.lang.String icon)
Create a button with a text and an icon.

Parameters:
txt -
icon -

DefaultButton

public DefaultButton(java.lang.String txt,
                     IClicked<DefaultButton> clicked)

DefaultButton

public DefaultButton(java.lang.String txt,
                     java.lang.String icon,
                     IClicked<DefaultButton> clicked)
Method Detail

setConfig

public void setConfig(java.lang.String src)
Set the rendering properties file to be used to render the button image. Use an absolute path to the properties file. This overrides the default properties file which is 'defaultbutton.properties' in the current theme.

Parameters:
src -

setConfig

public void setConfig(java.lang.Class<?> resourceBase,
                      java.lang.String name)
Set the rendering properties file to be used to render the button image, as a class resource. This overrides the default properties file which is 'defaultbutton.properties' in the current theme.

Parameters:
resourceBase -
name -

setThemeConfig

public void setThemeConfig(java.lang.String name)
Set the rendering properties file to be used to render the button image. The name must refer to a file in the current theme. This overrides the default properties file which is 'defaultbutton.properties' in the current theme.

Parameters:
name -

setIconImage

public void setIconImage(java.lang.Class<?> resourceBase,
                         java.lang.String name)
Uses a resource as the base for the image.

Parameters:
resourceBase - The base location for the specified name. Name is resolved with this class as the base.
name - The resource's name relative to the class.

setIcon

public void setIcon(java.lang.String name)
Sets a (new) icon on this button. This requires an absolute image path.

Parameters:
name -

onAddedToPage

public void onAddedToPage(Page p)
When attached to a page, this causes the Button Image Renderer URL to be set in the image. It can only be done when the button is attached because the button can contain tilde-escaped keys.

Overrides:
onAddedToPage in class NodeBase
See Also:
NodeBase.onAddedToPage(to.etc.domui.dom.html.Page)

getLiteralText

public java.lang.String getLiteralText()
Returns the text currently set on the button.

Returns:

setText

public void setText(java.lang.String text)
Set a (new) text on the button's surface. The text may contain a '!' to specify an accelerator. To actually render the exclamation point precede it with a backslash.

Overrides:
setText in class NodeContainer
See Also:
NodeContainer.setText(java.lang.String)