Package com.iizix.text
Class KStringTag<TARGET>
java.lang.Object
com.iizix.text.KStringTag<TARGET>
- All Implemented Interfaces:
- Cloneable
- Direct Known Subclasses:
- KStringHTMLTag,- KStringPLAINTag
Base class for Tags (HTMLTag and PlainTag) in KString.
- Author:
- Christopher Mindus
- Nested Class SummaryNested Classes
- Constructor SummaryConstructorsConstructorDescription- KStringTag- (KStringTag.Type type, int position, LinkedHashMap<String, - String> attributes) Constructs a tag.
- Method SummaryModifier and TypeMethodDescription- final void- appendHTMLAttributes- (StringBuilder useme, IKStringInfoProvider provider) Appends the attributes for HTML raw format.- final void- appendHTMLAttributes- (StringBuilder useme, IKStringInfoProvider provider, String... possibleAttributeList) Appends the attributes for HTML raw format that are present in the "possibleAttributeList".- final void- appendHTMLAttributesSkip- (StringBuilder useme, IKStringInfoProvider provider, String... skipAttributes) Appends the attributes for HTML raw format.- final voidAppends the attributes for PLAIN raw format.- static void- appendPLAINValue- (StringBuilder useme, String value) Appends a string as quoted value.- protected KStringTag- <TARGET> - clone()Cloneable.- protected voidDisposes of the tag reference, used in the Editor for references.- booleanEquality check: tags must be of same class (i.e.- boolean- equalsName- (KStringTag<?> kst) Checks for the same "name" (tag ordinal and closing tag for HTML, tag name for PLAIN).- final String- getAttribute- (String attributeName) Gets the attribute value.- abstract String- getHTMLString- (StringBuilder useme, IKStringInfoProvider provider) Gets the string representation of this tag in the HTML format, i.e.- abstract String- getHTMLTagText- (StringBuilder useme, IKStringInfoProvider provider) Gets the "unparsed" string representation of this tag in the HTML format, i.e.- abstract String- getPLAINString- (StringBuilder useme, IKStringInfoProvider provider) Gets the string representation of this tag in the PLAIN format, i.e.- abstract String- getPLAINTagText- (StringBuilder useme) Gets the "unparsed" string representation of this tag in the PLAIN format, i.e.Gets the reference of this tag.- Class- <?> Returns the reference class used by this tag, e.g.Gets the validation error.- final IPropReference.RefTypeGets the reference type.- final intGets the ending position of this tag in the source string.- final intGets the length of this tag in the source string.- final intGets the source position of this tag in the source string.- final KStringTag.Type- getType()Gets the type of this tag.- abstract booleanChecks if this tag is of reference type, i.e.- boolean- isReferenceValid- (KStringHolder holder, GProp<?> gp) Validates a reference.- boolean- isRefreshRequired- (GEvent event, TARGET target) Upon a property event received on the target reference property (or its children), this method verifies if the event would affect the KString contents needing to be refreshed.- boolean- isRefreshRequired- (RefreshEvent event) Returns whether the tags needs a refresh for the specified refresh type.- void- resolve- (KStringHolder holder, boolean doReCheck, GEvent triggerEvent) Resolves the reference.- final boolean- setAttribute- (String attributeName, String value) Updates an attribute value or removes it.- abstract boolean- setReference- (String ref) Updates the tag reference.- final void- setSourceLocation- (int startPos, int endPos) Sets the source position for the tag.- void- verify- (KStringHolder holder, PropVerification verification, String location, int id) Verifies the KString for a KString holder.- abstract booleanChecks if this string will lose formatting when translated to PLAIN.
- Constructor Details- KStringTagConstructs a tag.- Parameters:
- type- The connector type.
- position- The position in the character based and parsed string.
- attributes- The attributes for the tag.
 
 
- Method Details- disposeTagReferenceprotected void disposeTagReference()Disposes of the tag reference, used in the Editor for references.
- setSourceLocationSets the source position for the tag. This can only be done once, next time an IllegalArgumentException is thrown.- Parameters:
- startPos- The start position in the source string.
- endPos- The end position in the source string.
- Throws:
- IllegalArgumentException
 
- getTypeGets the type of this tag.
- getSourcePositionpublic final int getSourcePosition()Gets the source position of this tag in the source string.- Returns:
- The start position of the tag.
 
- getSourceEndPositionpublic final int getSourceEndPosition()Gets the ending position of this tag in the source string.- Returns:
- The end position of the tag.
 
- getSourceLengthpublic final int getSourceLength()Gets the length of this tag in the source string.- Returns:
- The length in characters of the tag.
 
- isReferenceTagpublic abstract 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.
- getReferenceGets the reference of this tag.- Returns:
- The reference, or null for none.
 
- setReferenceUpdates the tag reference.- Parameters:
- ref- The new reference.
- Returns:
- true if changed, false for no change.
 
- getReferenceClassReturns the reference class used by this tag, e.g. KStringProp for text table, or the image class IImageTarget.class.- Returns:
- The class, or null for no references.
 
- appendPLAINAttributesAppends the attributes for PLAIN raw format.
- appendPLAINValueAppends a string as quoted value. The chosen quote can be either single- or double-quote, whichever is shortest.
- appendHTMLAttributesAppends the attributes for HTML raw format.
- appendHTMLAttributesSkippublic final void appendHTMLAttributesSkip- (StringBuilder useme, IKStringInfoProvider provider, String... skipAttributes) Appends the attributes for HTML raw format.
- appendHTMLAttributespublic final void appendHTMLAttributes- (StringBuilder useme, IKStringInfoProvider provider, String... possibleAttributeList) Appends the attributes for HTML raw format that are present in the "possibleAttributeList".
- getAttributeGets the attribute value.- Parameters:
- attributeName- The name of the attribute.
- Returns:
- The value, or null if the attribute is not present.
 
- setAttributeUpdates an attribute value or removes it.- Parameters:
- attributeName- The attribute name.
- value- The value to set, or null to remove the attribute.
- Returns:
- true if changed, false otherwise.
 
- willLoseFormattingpublic abstract boolean willLoseFormatting()Checks if this string will lose formatting when translated to PLAIN. Note that translating PLAIN to HTML never loses formatting.
- getPLAINTagTextGets the "unparsed" string representation of this tag in the PLAIN format, i.e. a HTML tag will reformat or translate itself for PLAIN, or vice versa.
- getHTMLTagTextGets the "unparsed" string representation of this tag in the HTML format, i.e. a PLAIN tag will reformat or translate itself for HTML, or vice versa.- Parameters:
- useme- Temporary StringBuilder for any use.
- provider- The information provider or null for none.
 
- getPLAINStringGets the string representation of this tag in the PLAIN format, i.e. a HTML tag will reformat or translate itself for PLAIN, or vice versa.- Parameters:
- useme- Temporary StringBuilder for any use.
- provider- The information provider or null for none.
 
- getHTMLStringGets the string representation of this tag in the HTML format, i.e. a PLAIN tag will reformat or translate itself for HTML, or vice versa.- Parameters:
- useme- Temporary StringBuilder for any use.
- provider- The information provider or null for none.
 
- equalsEquality check: tags must be of same class (i.e. exactly same type) and have the same attributes.
- equalsNameChecks for the same "name" (tag ordinal and closing tag for HTML, tag name for PLAIN).
- cloneCloneable.
- getReferenceTypeGets the reference type.- Returns:
- The reference type (shown for reference view in the Designer).
 
- isReferenceValidValidates a reference.- Parameters:
- holder- The KString holder.
- gp- The reference found.
- Returns:
- Validates the reference.
 
- getReferenceErrorGets the validation error.- Returns:
- null for OK, otherwise the error text.
 
- resolveResolves the reference.- Parameters:
- holder- The KString holder.
- doReCheck- Rechecks the references.
- triggerEvent- The trigger event.
 
- verifyVerifies the KString for a KString holder.- Parameters:
- holder- The KString holder.
- verification- The property verification class.
- location- The location.
- id- The tag ID.
 
- isRefreshRequiredReturns whether the tags needs a refresh for the specified refresh type.- Parameters:
- event- The refresh event.
- Returns:
- true for refresh needed, false otherwise.
 
- isRefreshRequiredUpon a property event received on the target reference property (or its children), this method verifies if the event would affect the KString contents needing to be refreshed.- Parameters:
- event- The event.
- target- The target property for the tag.
- Returns:
- true to refresh the KString, false not to.