Package com.iizix.text
Class KStringHTMLTag<TARGET>
java.lang.Object
com.iizix.text.KStringTag<TARGET>
com.iizix.text.KStringHTMLTag<TARGET>
- All Implemented Interfaces:
Cloneable
- Direct Known Subclasses:
KStringHTMLDynamicTag
Class for the HTML tag entry in the string. If not overridden, it handles the default tags.
- Author:
- Christopher Mindus
Nested Class Summary
Nested classes/interfaces inherited from class com.iizix.text.KStringTag
KStringTag.Type
Field Summary
Constructor Summary
ModifierConstructorDescriptionKStringHTMLTag
(int position, int ordinal) Creates a closed tag.protected
KStringHTMLTag
(KStringTag.Type type, int position, int ordinal, LinkedHashMap<String, String> attributes) Creates a normal or dynamic tag.Method Summary
Modifier and TypeMethodDescriptionstatic KStringHTMLTag<?>
create
(int position, int ordinal, LinkedHashMap<String, String> attributes, String inputString, int parsePosition, boolean isOpenClosed, boolean forEditor) Creates the correct tag class depending on the HTML tag.protected final void
Disposes of the tag reference, used in the Editor for references.boolean
equalsName
(KStringTag<?> kst) Checks for the same "name" (tag ordinal and closing tag for HTML, tag name for PLAIN).getHTMLString
(StringBuilder useme, IKStringInfoProvider provider) Gets the string representation of this tag in the HTML format.getHTMLTagText
(StringBuilder useme, IKStringInfoProvider provider) Gets the "unparsed" string representation of this tag in the HTML format.getPLAINString
(StringBuilder useme, IKStringInfoProvider provider) Gets the string representation of this tag in the PLAIN format, i.e.getPLAINTagText
(StringBuilder useme) Gets the "unparsed" string representation of this tag in the PLAIN format, i.e.boolean
Checks if this tag is of reference type, i.e.void
resolve
(KStringHolder holder, boolean doReCheck, GEvent triggerEvent) Resolves the reference.boolean
setReference
(String ref) Updates the tag reference.boolean
Checks if this string will lose formatting when translated to PLAIN.Methods inherited from class com.iizix.text.KStringTag
appendHTMLAttributes, appendHTMLAttributes, appendHTMLAttributesSkip, appendPLAINAttributes, appendPLAINValue, clone, equals, getAttribute, getReference, getReferenceClass, getReferenceError, getReferenceType, getSourceEndPosition, getSourceLength, getSourcePosition, getType, isReferenceValid, isRefreshRequired, isRefreshRequired, setAttribute, setSourceLocation, verify
Field Details
ordinal
protected final int ordinalThe ordinal.isClosed
protected final boolean isClosedTag closed flag.
Constructor Details
KStringHTMLTag
protected KStringHTMLTag(KStringTag.Type type, int position, int ordinal, LinkedHashMap<String, String> attributes) Creates a normal or dynamic tag.- Parameters:
position
- The position of the tag in the parsed string.ordinal
- The ordinal of the tag.attributes
- The tag attributes.
KStringHTMLTag
public KStringHTMLTag(int position, int ordinal) Creates a closed tag.
Method Details
create
public static KStringHTMLTag<?> create(int position, int ordinal, LinkedHashMap<String, String> attributes, String inputString, int parsePosition, boolean isOpenClosed, boolean forEditor) throws KStringParseExceptionCreates the correct tag class depending on the HTML tag.- Parameters:
position
- The position of the tag in the parsed string.ordinal
- The ordinal of the tag.attributes
- The tag attributes.inputString
- The input string to KString.parsePosition
- The parsing position where tag starts.forEditor
- Flag indicating an INPUT tag has been replaced with IZ.- Returns:
- The new HTML tag instance that corresponds with the tag name.
- Throws:
KStringParseException
- For invalid tag name or reference/missing attributes.
disposeTagReference
protected final void disposeTagReference()Disposes of the tag reference, used in the Editor for references.- Overrides:
disposeTagReference
in classKStringTag<TARGET>
willLoseFormatting
public boolean willLoseFormatting()Checks if this string will lose formatting when translated to PLAIN. Note that translating PLAIN to HTML never loses formatting.- Specified by:
willLoseFormatting
in classKStringTag<TARGET>
- Returns:
- Always true for opened tags.
isReferenceTag
public boolean isReferenceTag()Checks if this tag is of reference type, i.e. for HTML, the tags A, IMG, IZ. For PLAIN KString type, this method always returns true.- Specified by:
isReferenceTag
in classKStringTag<TARGET>
getPLAINTagText
Gets the "unparsed" string representation of this tag in the PLAIN format, i.e. this HTML tag will reformat or translate itself for PLAIN. For the basic HTML tags, this results in an empty string.- Specified by:
getPLAINTagText
in classKStringTag<TARGET>
getHTMLTagText
Gets the "unparsed" string representation of this tag in the HTML format.- Specified by:
getHTMLTagText
in classKStringTag<TARGET>
- Parameters:
useme
- Temporary StringBuilder for any use.provider
- The information provider or null for none.
getPLAINString
Gets the string representation of this tag in the PLAIN format, i.e. returns empty string.The only tag [BR] returns [LF] character code 0x10.
- Specified by:
getPLAINString
in classKStringTag<TARGET>
- Parameters:
useme
- Temporary StringBuilder for any use.provider
- The information provider or null for none.
getHTMLString
Gets the string representation of this tag in the HTML format.- Specified by:
getHTMLString
in classKStringTag<TARGET>
- Parameters:
useme
- Temporary StringBuilder for any use.provider
- The information provider or null for none.
equalsName
Checks for the same "name" (tag ordinal and closing tag for HTML, tag name for PLAIN).- Overrides:
equalsName
in classKStringTag<TARGET>
setReference
Updates the tag reference.- Specified by:
setReference
in classKStringTag<TARGET>
- Parameters:
ref
- The new reference.- Returns:
- true if changed, false for no change.
resolve
Resolves the reference. This method checks for any on* attributes for VS component references.- Overrides:
resolve
in classKStringTag<TARGET>
- Parameters:
holder
- The KString holder.doReCheck
- Rechecks the references.triggerEvent
- The trigger event.