Package com.helger.html.hc.html.forms
Class AbstractHCButton<IMPLTYPE extends AbstractHCButton<IMPLTYPE>>
- java.lang.Object
-
- com.helger.html.hc.impl.AbstractHCNode
-
- com.helger.html.hc.html.AbstractHCElement<IMPLTYPE>
-
- com.helger.html.hc.html.AbstractHCElementWithInternalChildren<IMPLTYPE,IHCNode>
-
- com.helger.html.hc.html.AbstractHCElementWithChildren<IMPLTYPE>
-
- com.helger.html.hc.html.forms.AbstractHCButton<IMPLTYPE>
-
- Type Parameters:
IMPLTYPE- Implementation type
- All Implemented Interfaces:
com.helger.commons.hierarchy.IHasChildren<IHCNode>,com.helger.commons.hierarchy.IHasChildrenRecursive<IHCNode>,com.helger.commons.hierarchy.IHasChildrenSorted<IHCNode>,com.helger.commons.traits.IGenericImplTrait<IMPLTYPE>,IHCButton<IMPLTYPE>,IHCHasFocus<IMPLTYPE>,IHCElement<IMPLTYPE>,IHCElementWithChildren<IMPLTYPE>,IHCElementWithInternalChildren<IMPLTYPE,IHCNode>,IHCHasCSSClasses<IMPLTYPE>,IHCHasCSSStyles<IMPLTYPE>,IHCHasState<IMPLTYPE>,IHCHasChildrenMutable<IMPLTYPE,IHCNode>,IHCHasID<IMPLTYPE>,IHCHasName<IMPLTYPE>,IHCNode,IHCNodeWithChildren<IMPLTYPE>,Serializable
- Direct Known Subclasses:
HCButton,HCButton_Reset,HCButton_Submit,HCLinkButton
public abstract class AbstractHCButton<IMPLTYPE extends AbstractHCButton<IMPLTYPE>> extends AbstractHCElementWithChildren<IMPLTYPE> implements IHCButton<IMPLTYPE>
Represents an HTML <button> element with type "button"- Author:
- Philip Helger
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static booleanDEFAULT_AUTO_FOCUSBy default auto focus is disabledstatic booleanDEFAULT_DISABLEDstatic booleanDEFAULT_FORMNOVALIDATEDefault value-
Fields inherited from class com.helger.html.hc.html.AbstractHCElement
DEFAULT_HIDDEN, DEFAULT_SPELLCHECK, DEFAULT_TRANSLATE, DEFAULT_UNFOCUSABLE
-
Fields inherited from interface com.helger.html.hc.html.IHCElement
DEFAULT_TABINDEX
-
-
Constructor Summary
Constructors Constructor Description AbstractHCButton()AbstractHCButton(String sLabel)AbstractHCButton(String sLabel, IHasJSCode aOnClick)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidfillMicroElement(com.helger.xml.microdom.IMicroElement aElement, IHCConversionSettingsToNode aConversionSettings)Set all attributes and child elements of this objectStringgetForm()IHasJSCodegetFormActionJS()com.helger.commons.url.ISimpleURLgetFormActionURL()com.helger.commons.mime.IMimeTypegetFormEncType()EHCFormMethodgetFormMethod()HC_TargetgetFormTarget()StringgetName()EHCButtonTypegetType()StringgetValue()booleanisAutoFocus()booleanisDisabled()booleanisFormNoValidate()protected voidonConsistencyCheck(IHCConversionSettingsToNode aConversionSettings)IMPLTYPEsetAutoFocus(boolean bAutoFocus)Change the auto focused state of this element.IMPLTYPEsetDisabled(boolean bDisabled)Set the disabled state of this element.IMPLTYPEsetForm(String sForm)IMPLTYPEsetFormAction(com.helger.commons.url.ISimpleURL aAction)IMPLTYPEsetFormAction(IHasJSCodeWithSettings aAction)IMPLTYPEsetFormEncType(com.helger.commons.mime.IMimeType aFormEncType)IMPLTYPEsetFormMethod(EHCFormMethod eFormMethod)IMPLTYPEsetFormNoValidate(boolean bFormNoValidate)IMPLTYPEsetFormTarget(HC_Target aFormTarget)IMPLTYPEsetName(String sName)Set the name of the element.IMPLTYPEsetType(EHCButtonType eType)Set the type of the button.IMPLTYPEsetValue(String sValue)Set the value of the button.StringtoString()-
Methods inherited from class com.helger.html.hc.html.AbstractHCElementWithInternalChildren
addChild, addChildAt, afterAddChild, afterRemoveChild, beforeAddChild, canConvertToMicroNode, children, findFirstChild, findFirstChildMapped, forAllChildren, forAllChildren, forAllChildrenBreakable, forAllChildrenMapped, getAllChildren, getAllChildrenAsNodeList, getChildAtIndex, getChildCount, getChildren, getChildrenFormEmitting, getFirstChild, getLastChild, getPlainText, hasChildren, removeAllChildren, removeChild, removeChildAt, sortAllChildren
-
Methods inherited from class com.helger.html.hc.html.AbstractHCElement
addClass, addEventHandler, addStyle, containsClass, containsEventHandler, containsStyle, createMicroElement, customAttrs, finishMicroElement, getAccessKey, getAllClasses, getAllClassesAsString, getAllClassNames, getAllStyles, getAllStylesAsString, getAllStyleValues, getContentEditable, getDirection, getDraggable, getElement, getEventHandler, getEventMap, getID, getLanguage, getRole, getStyleValue, getTabIndex, getTagName, getTitle, getTranslate, hasAnyClass, hasAnyStyle, hasStyle, internalConvertToMicroNode, isHidden, isSpellCheck, isTranslateOff, isTranslateOn, isTranslateUndefined, isUnfocusable, isValidID, onFinalizeNodeState, prependEventHandler, removeAllClasses, removeAllEventHandler, removeAllStyles, removeClass, removeStyle, setAccessKey, setContentEditable, setDirection, setDraggable, setEventHandler, setHidden, setID, setID, setLanguage, setRole, setSpellCheck, setTabIndex, setTitle, setTranslate, setUnfocusable
-
Methods inherited from class com.helger.html.hc.impl.AbstractHCNode
consistencyCheck, convertToMicroNode, customizeNode, finalizeNodeState, getNodeState, internalSetNodeState, onCustomizeNode, onRegisterExternalResources, registerExternalResources
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.helger.commons.hierarchy.IHasChildren
forAllChildren, forAllChildren, forAllChildrenBreakable, forAllChildrenMapped, getChildCount, getChildren, hasChildren, hasNoChildren
-
Methods inherited from interface com.helger.commons.hierarchy.IHasChildrenRecursive
forAllChildrenRecursive, forAllChildrenRecursive
-
Methods inherited from interface com.helger.commons.hierarchy.IHasChildrenSorted
findFirstChild, findFirstChildMapped, getAllChildren, getChildAtIndex, getFirstChild, getLastChild
-
Methods inherited from interface com.helger.html.hc.html.forms.IHCButton
addOnClick, addOnClick, setFormEncTypeFileUpload, setFormEncTypeTextPlain, setFormTargetBlank, setOnClick, setOnClick
-
Methods inherited from interface com.helger.html.hc.html.IHCElement
addEventHandler, containsEventHandler, customAttrs, getAccessKey, getContentEditable, getDirection, getDraggable, getElement, getEventHandler, getEventMap, getLanguage, getRole, getTabIndex, getTagName, getTitle, getTranslate, isHidden, isSpellCheck, isTranslateOff, isTranslateOn, isTranslateUndefined, isUnfocusable, prependEventHandler, removeAllEventHandler, setAccessKey, setContentEditable, setDirection, setDraggable, setEventHandler, setHidden, setLanguage, setRole, setSpellCheck, setTabIndex, setTitle, setTranslate, setTranslate, setUnfocusable, withCustomAttrs
-
Methods inherited from interface com.helger.html.hc.html.IHCElementWithInternalChildren
recursiveContainsChildWithTagName
-
Methods inherited from interface com.helger.html.hc.IHCHasChildrenMutable
addAndReturnChild, addAndReturnChildAt, addChild, addChildAt, addChildren, addChildren, addChildren, addChildrenAt, addChildrenAt, getAllChildrenAsNodeList, removeAllChildren, removeChild, removeChildAt, setChild, sortAllChildren
-
Methods inherited from interface com.helger.html.hc.html.IHCHasCSSClasses
addClass, addClasses, addClasses, addClasses, containsClass, getAllClasses, getAllClassesAsString, getAllClassNames, hasAnyClass, removeAllClasses, removeClass
-
Methods inherited from interface com.helger.html.hc.html.IHCHasCSSStyles
addStyle, addStyle, addStyles, addStyles, addStyles, containsStyle, getAllStyles, getAllStylesAsString, getAllStyleValues, getStyleValue, hasAnyStyle, hasStyle, removeAllStyles, removeStyle
-
Methods inherited from interface com.helger.html.hc.IHCHasID
ensureID, getID, hasID, hasNoID, setID, setUniqueID
-
Methods inherited from interface com.helger.html.hc.IHCNode
canConvertToMicroNode, consistencyCheck, convertToMicroNode, customizeNode, finalizeNodeState, getNodeState, getPlainText, registerExternalResources
-
Methods inherited from interface com.helger.html.hc.IHCNodeWithChildren
addChild, addChildAt, addChildren, addChildren, setChild
-
-
-
-
Field Detail
-
DEFAULT_AUTO_FOCUS
public static final boolean DEFAULT_AUTO_FOCUS
By default auto focus is disabled- See Also:
- Constant Field Values
-
DEFAULT_DISABLED
public static final boolean DEFAULT_DISABLED
- See Also:
- Constant Field Values
-
DEFAULT_FORMNOVALIDATE
public static final boolean DEFAULT_FORMNOVALIDATE
Default value- See Also:
- Constant Field Values
-
-
Method Detail
-
isAutoFocus
public final boolean isAutoFocus()
- Specified by:
isAutoFocusin interfaceIHCHasFocus<IMPLTYPE extends AbstractHCButton<IMPLTYPE>>- Returns:
trueif this element is focused,falseotherwise. By default an element is not focused.
-
setAutoFocus
@Nonnull public final IMPLTYPE setAutoFocus(boolean bAutoFocus)
Description copied from interface:IHCHasFocusChange the auto focused state of this element.- Specified by:
setAutoFocusin interfaceIHCHasFocus<IMPLTYPE extends AbstractHCButton<IMPLTYPE>>- Parameters:
bAutoFocus-trueto auto focus this element,falseto not focus the element.- Returns:
- this
-
isDisabled
public final boolean isDisabled()
- Specified by:
isDisabledin interfaceIHCHasState<IMPLTYPE extends AbstractHCButton<IMPLTYPE>>- Returns:
trueif the element is disabled,falseotherwise.
-
setDisabled
@Nonnull public final IMPLTYPE setDisabled(boolean bDisabled)
Description copied from interface:IHCHasStateSet the disabled state of this element.- Specified by:
setDisabledin interfaceIHCHasState<IMPLTYPE extends AbstractHCButton<IMPLTYPE>>- Parameters:
bDisabled-trueto disable,falseto enable- Returns:
- this
-
getForm
@Nullable public final String getForm()
- Specified by:
getFormin interfaceIHCButton<IMPLTYPE extends AbstractHCButton<IMPLTYPE>>
-
setForm
@Nonnull public final IMPLTYPE setForm(@Nullable String sForm)
- Specified by:
setFormin interfaceIHCButton<IMPLTYPE extends AbstractHCButton<IMPLTYPE>>
-
getFormActionURL
@Nullable public final com.helger.commons.url.ISimpleURL getFormActionURL()
- Specified by:
getFormActionURLin interfaceIHCButton<IMPLTYPE extends AbstractHCButton<IMPLTYPE>>
-
getFormActionJS
@Nullable public final IHasJSCode getFormActionJS()
- Specified by:
getFormActionJSin interfaceIHCButton<IMPLTYPE extends AbstractHCButton<IMPLTYPE>>
-
setFormAction
@Nonnull public final IMPLTYPE setFormAction(@Nullable com.helger.commons.url.ISimpleURL aAction)
- Specified by:
setFormActionin interfaceIHCButton<IMPLTYPE extends AbstractHCButton<IMPLTYPE>>
-
setFormAction
@Nonnull public final IMPLTYPE setFormAction(@Nullable IHasJSCodeWithSettings aAction)
- Specified by:
setFormActionin interfaceIHCButton<IMPLTYPE extends AbstractHCButton<IMPLTYPE>>
-
getFormEncType
@Nullable public final com.helger.commons.mime.IMimeType getFormEncType()
- Specified by:
getFormEncTypein interfaceIHCButton<IMPLTYPE extends AbstractHCButton<IMPLTYPE>>
-
setFormEncType
@Nonnull public final IMPLTYPE setFormEncType(@Nullable com.helger.commons.mime.IMimeType aFormEncType)
- Specified by:
setFormEncTypein interfaceIHCButton<IMPLTYPE extends AbstractHCButton<IMPLTYPE>>
-
getFormMethod
@Nullable public final EHCFormMethod getFormMethod()
- Specified by:
getFormMethodin interfaceIHCButton<IMPLTYPE extends AbstractHCButton<IMPLTYPE>>
-
setFormMethod
@Nonnull public final IMPLTYPE setFormMethod(@Nullable EHCFormMethod eFormMethod)
- Specified by:
setFormMethodin interfaceIHCButton<IMPLTYPE extends AbstractHCButton<IMPLTYPE>>
-
isFormNoValidate
public final boolean isFormNoValidate()
- Specified by:
isFormNoValidatein interfaceIHCButton<IMPLTYPE extends AbstractHCButton<IMPLTYPE>>
-
setFormNoValidate
@Nonnull public final IMPLTYPE setFormNoValidate(boolean bFormNoValidate)
- Specified by:
setFormNoValidatein interfaceIHCButton<IMPLTYPE extends AbstractHCButton<IMPLTYPE>>
-
getFormTarget
@Nullable public final HC_Target getFormTarget()
- Specified by:
getFormTargetin interfaceIHCButton<IMPLTYPE extends AbstractHCButton<IMPLTYPE>>
-
setFormTarget
@Nonnull public final IMPLTYPE setFormTarget(@Nullable HC_Target aFormTarget)
- Specified by:
setFormTargetin interfaceIHCButton<IMPLTYPE extends AbstractHCButton<IMPLTYPE>>
-
getName
public final String getName()
- Specified by:
getNamein interfaceIHCHasName<IMPLTYPE extends AbstractHCButton<IMPLTYPE>>- Returns:
- The name of the element. May be
null.
-
setName
@Nonnull public final IMPLTYPE setName(@Nullable String sName)
Description copied from interface:IHCHasNameSet the name of the element.- Specified by:
setNamein interfaceIHCHasName<IMPLTYPE extends AbstractHCButton<IMPLTYPE>>- Parameters:
sName- The new name. May benull.- Returns:
- this
-
getType
@Nonnull public final EHCButtonType getType()
- Specified by:
getTypein interfaceIHCButton<IMPLTYPE extends AbstractHCButton<IMPLTYPE>>- Returns:
- The type of the button (button, submit or reset). Never
null.
-
setType
@Nonnull public final IMPLTYPE setType(@Nonnull EHCButtonType eType)
Description copied from interface:IHCButtonSet the type of the button.- Specified by:
setTypein interfaceIHCButton<IMPLTYPE extends AbstractHCButton<IMPLTYPE>>- Parameters:
eType- The new type. May not benull.- Returns:
- this
-
getValue
public final String getValue()
- Specified by:
getValuein interfaceIHCButton<IMPLTYPE extends AbstractHCButton<IMPLTYPE>>- Returns:
- The value of the button. May be
null.
-
setValue
@Nonnull public final IMPLTYPE setValue(@Nullable String sValue)
Description copied from interface:IHCButtonSet the value of the button.- Specified by:
setValuein interfaceIHCButton<IMPLTYPE extends AbstractHCButton<IMPLTYPE>>- Parameters:
sValue- The value to set. May benull.- Returns:
- this
-
onConsistencyCheck
protected void onConsistencyCheck(@Nonnull IHCConversionSettingsToNode aConversionSettings)
- Overrides:
onConsistencyCheckin classAbstractHCElement<IMPLTYPE extends AbstractHCButton<IMPLTYPE>>- Parameters:
aConversionSettings- HC conversion settings
-
fillMicroElement
protected void fillMicroElement(com.helger.xml.microdom.IMicroElement aElement, IHCConversionSettingsToNode aConversionSettings)Description copied from class:AbstractHCElementSet all attributes and child elements of this object- Overrides:
fillMicroElementin classAbstractHCElementWithInternalChildren<IMPLTYPE extends AbstractHCButton<IMPLTYPE>,IHCNode>- Parameters:
aElement- The current micro element to be filled. Nevernull.aConversionSettings- The conversion settings to be used. Nevernull.
-
toString
public String toString()
- Overrides:
toStringin classAbstractHCElementWithInternalChildren<IMPLTYPE extends AbstractHCButton<IMPLTYPE>,IHCNode>
-
-