Package com.helger.html.hc.html
Interface IHCElement<IMPLTYPE extends IHCElement<IMPLTYPE>>
-
- Type Parameters:
IMPLTYPE- The implementation type
- All Superinterfaces:
com.helger.commons.traits.IGenericImplTrait<IMPLTYPE>,com.helger.commons.hierarchy.IHasChildren<IHCNode>,com.helger.commons.hierarchy.IHasChildrenRecursive<IHCNode>,com.helger.commons.hierarchy.IHasChildrenSorted<IHCNode>,IHCHasCSSClasses<IMPLTYPE>,IHCHasCSSStyles<IMPLTYPE>,IHCHasID<IMPLTYPE>,IHCNode,Serializable
- All Known Subinterfaces:
IHCA<IMPLTYPE>,IHCArea<IMPLTYPE>,IHCButton<IMPLTYPE>,IHCCanvas<IMPLTYPE>,IHCCell<IMPLTYPE>,IHCCol<IMPLTYPE>,IHCControl<IMPLTYPE>,IHCDefinitionItem<IMPLTYPE>,IHCDiv<IMPLTYPE>,IHCElementWithChildren<IMPLTYPE>,IHCElementWithInternalChildren<IMPLTYPE,CHILDTYPE>,IHCFooter<IMPLTYPE>,IHCForm<IMPLTYPE>,IHCIFrame<IMPLTYPE>,IHCImg<IMPLTYPE>,IHCInput<IMPLTYPE>,IHCLabel<IMPLTYPE>,IHCLI<IMPLTYPE>,IHCList<IMPLTYPE,ITEMTYPE>,IHCMediaElement<IMPLTYPE>,IHCMediaElementChild<IMPLTYPE>,IHCMeter<IMPLTYPE>,IHCNav<IMPLTYPE>,IHCObject<IMPLTYPE>,IHCOL<IMPLTYPE>,IHCOLBase<IMPLTYPE,ITEMTYPE>,IHCPre<IMPLTYPE>,IHCProgress<IMPLTYPE>,IHCRubyChild<IMPLTYPE>,IHCScript<IMPLTYPE>,IHCScriptInline<IMPLTYPE>,IHCSelect<IMPLTYPE>,IHCSpan<IMPLTYPE>,IHCTable<IMPLTYPE>,IHCTablePart<IMPLTYPE>,IHCTextArea<IMPLTYPE>,IHCUL<IMPLTYPE>,IHCULBase<IMPLTYPE,ITEMTYPE>
- All Known Implementing Classes:
AbstractHCA,AbstractHCArea,AbstractHCBaseTable,AbstractHCBlockQuote,AbstractHCButton,AbstractHCCanvas,AbstractHCCell,AbstractHCCheckBox,AbstractHCCol,AbstractHCControl,AbstractHCDefinitionItem,AbstractHCDiv,AbstractHCElement,AbstractHCElementWithChildren,AbstractHCElementWithInternalChildren,AbstractHCFooter,AbstractHCForm,AbstractHCH1,AbstractHCH2,AbstractHCH3,AbstractHCH4,AbstractHCH5,AbstractHCH6,AbstractHCIFrame,AbstractHCImg,AbstractHCInput,AbstractHCLabel,AbstractHCLI,AbstractHCList,AbstractHCListLI,AbstractHCMediaElement,AbstractHCMediaElementChild,AbstractHCMeter,AbstractHCNav,AbstractHCObject,AbstractHCOL,AbstractHCOLBase,AbstractHCPre,AbstractHCProgress,AbstractHCRadioButton,AbstractHCRubyChild,AbstractHCScript,AbstractHCScriptInline,AbstractHCSelect,AbstractHCSpan,AbstractHCTable,AbstractHCTablePart,AbstractHCTextArea,AbstractHCUL,AbstractHCULBase,HCA,HCA_JS,HCA_MailTo,HCAbbr,HCAddress,HCArea,HCArticle,HCAside,HCAudio,HCB,HCBase,HCBDI,HCBDO,HCBlockQuote,HCBody,HCBR,HCButton,HCButton_Reset,HCButton_Submit,HCCanvas,HCCaption,HCCenter,HCCheckBox,HCCite,HCCode,HCCol,HCColGroup,HCCommand,HCData,HCDataList,HCDD,HCDel,HCDetails,HCDFN,HCDialog,HCDir,HCDiv,HCDL,HCDT,HCEdit,HCEditFile,HCEditPassword,HCEM,HCEmbed,HCFieldSet,HCFigCaption,HCFigure,HCFont,HCFooter,HCForm,HCFrame,HCFrameset,HCGenericElement,HCGenericElementWithChildren,HCH1,HCH2,HCH3,HCH4,HCH5,HCH6,HCHead,HCHeader,HCHGroup,HCHiddenField,HCHR,HCHtml,HCI,HCIFrame,HCImg,HCInput,HCIns,HCKBD,HCLabel,HCLegend,HCLI,HCLink,HCLinkButton,HCMain,HCMap,HCMark,HCMenu,HCMenuItem,HCMeta,HCMeter,HCNav,HCNoBR,HCNoScript,HCObject,HCOL,HCOptGroup,HCOption,HCOutput,HCP,HCParam,HCPicture,HCPre,HCProgress,HCQ,HCRadioButton,HCRow,HCRP,HCRT,HCRuby,HCS,HCSamp,HCScriptFile,HCScriptInline,HCScriptInlineOnDocumentReady,HCSection,HCSelect,HCSlot,HCSmall,HCSource,HCSpan,HCStrong,HCStyle,HCSub,HCSummary,HCSup,HCTable,HCTBody,HCTD,HCTextArea,HCTFoot,HCTH,HCTHead,HCTime,HCTitle,HCTrack,HCU,HCUL,HCVar,HCVideo,HCWBR
public interface IHCElement<IMPLTYPE extends IHCElement<IMPLTYPE>> extends IHCNode, IHCHasID<IMPLTYPE>, IHCHasCSSStyles<IMPLTYPE>, IHCHasCSSClasses<IMPLTYPE>
Base interface for an HC element- Author:
- Philip Helger
-
-
Field Summary
Fields Modifier and Type Field Description static longDEFAULT_TABINDEXThe default value for an unset tab index, as -1 is used for "none"
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description IMPLTYPEaddEventHandler(EJSEvent eJSEvent, IHasJSCode aJSHandler)Add a JS event handler at the end.booleancontainsEventHandler(EJSEvent eJSEvent)Check if any event handler is registered for the specified event.IHCAttrContainercustomAttrs()StringgetAccessKey()EHCContentEditablegetContentEditable()EHCTextDirectiongetDirection()EHCDraggablegetDraggable()EHTMLElementgetElement()IHasJSCodegetEventHandler(EJSEvent eJSEvent)Get the event handler of the specified event.JSEventMapgetEventMap()StringgetLanguage()EHTMLRolegetRole()longgetTabIndex()StringgetTagName()StringgetTitle()com.helger.commons.state.ETriStategetTranslate()booleanisHidden()booleanisSpellCheck()booleanisTranslateOff()booleanisTranslateOn()booleanisTranslateUndefined()booleanisUnfocusable()IMPLTYPEprependEventHandler(EJSEvent eJSEvent, IHasJSCode aJSHandler)Add a JS event handler at the front.IMPLTYPEremoveAllEventHandler(EJSEvent eJSEvent)Remove all event handler for the specified JS event.IMPLTYPEsetAccessKey(String sAccessKey)Set the value of the HTMLaccesskeyattribute.IMPLTYPEsetContentEditable(EHCContentEditable eContentEditable)Change the content editable stateIMPLTYPEsetDirection(EHCTextDirection eDirection)Set the value of the HTMLdirattribute.IMPLTYPEsetDraggable(EHCDraggable eDraggable)Set the draggable state of this elementIMPLTYPEsetEventHandler(EJSEvent eJSEvent, IHasJSCode aJSHandler)Set a JS event handler.IMPLTYPEsetHidden(boolean bHidden)Set the hidden state of this elementIMPLTYPEsetLanguage(String sLanguage)Set the value of the HTMLlangattribute.IMPLTYPEsetRole(EHTMLRole eRole)Set the role attribute of this element.IMPLTYPEsetSpellCheck(boolean bSpellCheck)Set the value of the HTMLspellcheckattribute.IMPLTYPEsetTabIndex(long nTabIndex)Set the tab index of this object.IMPLTYPEsetTitle(String sTitle)Set the value of the HTMLtitleattribute.default IMPLTYPEsetTranslate(boolean bTranslate)Set the value of the HTMLtranslateattribute.IMPLTYPEsetTranslate(com.helger.commons.state.ETriState eTranslate)Set the value of the HTMLtranslateattribute.IMPLTYPEsetUnfocusable(boolean bUnfocusable)Set the unfocusable state of this element.default IMPLTYPEwithCustomAttrs(Consumer<? super IHCAttrContainer> aConsumer)A helper method that deals with custom attributes, but maintains the chainable manner of this API.-
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.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
-
-
-
-
Field Detail
-
DEFAULT_TABINDEX
static final long DEFAULT_TABINDEX
The default value for an unset tab index, as -1 is used for "none"- See Also:
- Constant Field Values
-
-
Method Detail
-
getElement
@Nonnull EHTMLElement getElement()
- Returns:
- The contained HTML element. Never
null.
-
getTagName
@Nonnull @Nonempty String getTagName()
- Returns:
- The tag name of this element (without namespace)
-
setTitle
@Nonnull IMPLTYPE setTitle(String sTitle)
Set the value of the HTMLtitleattribute.- Parameters:
sTitle- The new title. May benull.- Returns:
- this
-
getDirection
@Nullable EHCTextDirection getDirection()
- Returns:
- The value of the HTML
dirattribute. May benull.
-
setDirection
@Nonnull IMPLTYPE setDirection(@Nullable EHCTextDirection eDirection)
Set the value of the HTMLdirattribute.- Parameters:
eDirection- The new direction. May benull.- Returns:
- this
-
getLanguage
@Nullable String getLanguage()
- Returns:
- The value of the HTML
langattribute. May benull.
-
setLanguage
@Nonnull IMPLTYPE setLanguage(@Nullable String sLanguage)
Set the value of the HTMLlangattribute.- Parameters:
sLanguage- The new language. May benull.- Returns:
- this
-
getEventMap
@Nullable @ReturnsMutableObject("design") JSEventMap getEventMap()
-
getEventHandler
@Nullable IHasJSCode getEventHandler(@Nullable EJSEvent eJSEvent)
Get the event handler of the specified event.- Parameters:
eJSEvent- The event to query. May benull.- Returns:
nullif no such event handler is registered.
-
containsEventHandler
boolean containsEventHandler(@Nullable EJSEvent eJSEvent)
Check if any event handler is registered for the specified event.- Parameters:
eJSEvent- The event to be queried. May benull.- Returns:
trueof a non-nullevent is specified, and if a handler is present.
-
addEventHandler
@Nonnull IMPLTYPE addEventHandler(@Nonnull EJSEvent eJSEvent, @Nullable IHasJSCode aJSHandler)
Add a JS event handler at the end.- Parameters:
eJSEvent- The event to use. May not benull.aJSHandler- The JSCode to be executed on the specified event. May benullin which case nothing happens.- Returns:
- this.
-
prependEventHandler
@Nonnull IMPLTYPE prependEventHandler(@Nonnull EJSEvent eJSEvent, @Nullable IHasJSCode aJSHandler)
Add a JS event handler at the front.- Parameters:
eJSEvent- The event to use. May not benull.aJSHandler- The JSCode to be executed on the specified event. May benullin which case nothing happens.- Returns:
- this.
-
setEventHandler
@Nonnull IMPLTYPE setEventHandler(@Nonnull EJSEvent eJSEvent, @Nullable IHasJSCode aJSHandler)
Set a JS event handler. All eventually present event handlers are overwritten.- Parameters:
eJSEvent- The event to set. May not benull.aJSHandler- The JSCode to be executed on the specified event. May benullin which case no event handler will be present after the call.- Returns:
- this.
-
removeAllEventHandler
@Nonnull IMPLTYPE removeAllEventHandler(@Nullable EJSEvent eJSEvent)
Remove all event handler for the specified JS event.- Parameters:
eJSEvent- The JS event to remove the handler. May benull.- Returns:
- this
-
isUnfocusable
boolean isUnfocusable()
- Returns:
trueif this element cannot be focused.
-
setUnfocusable
@Nonnull IMPLTYPE setUnfocusable(boolean bUnfocusable)
Set the unfocusable state of this element.- Parameters:
bUnfocusable-trueto make it unfocusable,falseotherwise.- Returns:
- this
-
isHidden
boolean isHidden()
- Returns:
trueif this is hidden
-
setHidden
IMPLTYPE setHidden(boolean bHidden)
Set the hidden state of this element- Parameters:
bHidden-trueif it is hidden,falseotherwise- Returns:
- this
-
getTabIndex
@CheckForSigned long getTabIndex()
- Returns:
- The tab index of this object. The semantics of negative values
depends on the browser! In HTML5 negative values are allowed but
won't set a focus when tabbing. The default value is indicated by
DEFAULT_TABINDEX
-
setTabIndex
@Nonnull IMPLTYPE setTabIndex(long nTabIndex)
Set the tab index of this object. This is a common element in HTML5 only. The default value isDEFAULT_TABINDEX- Parameters:
nTabIndex- The tab-index of this object. The semantics of negative values depends on the browser! In HTML5 negative values are allowed but won't set a focus when tabbing.- Returns:
- this
-
getAccessKey
@Nullable String getAccessKey()
- Returns:
- The value of the HTML
accesskeyattribute. May benull.
-
setAccessKey
@Nonnull IMPLTYPE setAccessKey(@Nullable String sAccessKey)
Set the value of the HTMLaccesskeyattribute.- Parameters:
sAccessKey- The new accesskey. May benull.- Returns:
- this
-
getDraggable
@Nullable EHCDraggable getDraggable()
- Returns:
- the draggable state. May be
null.
-
setDraggable
@Nonnull IMPLTYPE setDraggable(@Nullable EHCDraggable eDraggable)
Set the draggable state of this element- Parameters:
eDraggable- Value to set. May benull.- Returns:
- this
-
isTranslateOn
boolean isTranslateOn()
- Returns:
trueif HTMLtranslateistrue.
-
isTranslateOff
boolean isTranslateOff()
- Returns:
trueif HTMLtranslateisfalse.
-
isTranslateUndefined
boolean isTranslateUndefined()
- Returns:
trueif HTMLtranslateis not set.
-
getTranslate
@Nonnull com.helger.commons.state.ETriState getTranslate()
- Returns:
- The value of the HTML
translateattribute. Nevernull.
-
setTranslate
@Nonnull default IMPLTYPE setTranslate(boolean bTranslate)
Set the value of the HTMLtranslateattribute.- Parameters:
bTranslate-trueto translate,falseotherwise.- Returns:
- this
-
setTranslate
@Nonnull IMPLTYPE setTranslate(@Nonnull com.helger.commons.state.ETriState eTranslate)
Set the value of the HTMLtranslateattribute.- Parameters:
eTranslate- The new translate state. May not benull.- Returns:
- this
-
getContentEditable
@Nullable EHCContentEditable getContentEditable()
- Returns:
- The current state of content editable
-
setContentEditable
@Nonnull IMPLTYPE setContentEditable(@Nullable EHCContentEditable eContentEditable)
Change the content editable state- Parameters:
eContentEditable- New value. May benull.- Returns:
- this
-
isSpellCheck
boolean isSpellCheck()
- Returns:
trueif spell check is enabled,falseotherwise.
-
setSpellCheck
@Nonnull IMPLTYPE setSpellCheck(boolean bSpellCheck)
Set the value of the HTMLspellcheckattribute.- Parameters:
bSpellCheck-trueto enabled,falseotherwise.- Returns:
- this
-
getRole
@Nullable EHTMLRole getRole()
- Returns:
- The role of this element. May be
null. By default an element has no role.
-
setRole
@Nonnull IMPLTYPE setRole(@Nullable EHTMLRole eRole)
Set the role attribute of this element.- Parameters:
eRole- The role to set. May benull. According to the specs, abstract roles should not be used!- Returns:
- this
-
customAttrs
@Nonnull @ReturnsMutableObject IHCAttrContainer customAttrs()
- Returns:
- A non-
nullset of "custom" attributes for which no predefined method binding is available. Used e.g. for "aria-*" and "data-*" attributes.
-
withCustomAttrs
@Nonnull default IMPLTYPE withCustomAttrs(@Nonnull Consumer<? super IHCAttrContainer> aConsumer)
A helper method that deals with custom attributes, but maintains the chainable manner of this API.- Parameters:
aConsumer- The consumer that deals with the custom attributes. May not benull.- Returns:
- this for chaining
- Since:
- 8.4.4
-
-