- All Superinterfaces:
DeclarationFormattingContext
- All Known Implementing Classes:
DefaultStyleFormattingContext,InlineStyleFormattingContext
Different implementations of this interface can provide different style text formatting.
If the rule does not contain a style declaration (of either properties or descriptors), the methods in this interface are not called.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoidThis auxiliary method can be used to deepen the indentation at places where the general serialization flow does not give the desired results.voidendCurrentContext(CSSRule rule) Notify this context that the contents of the given rule, either a declaration or a rule list, were serialized.voidEnd an inline property declaration.voidendRule(SimpleWriter wri, List<String> trailingComments) Ends the serialization of a rule.voidendRuleList(SimpleWriter wri) Called after a list of rules is serialized.voidEnd a style declaration.voidsetParentContext(CSSRule rule) Sets the parent of the rule being serialized, if any, providing additional context for the serialization.voidstartRule(SimpleWriter wri, List<String> precedingComments) Starts the serialization of a rule.voidStart a style declaration (of either properties or descriptors).voidupdateContext(CSSRule rule) Update this context for the given rule.voidwriteComment(SimpleWriter wri, String comment) Serialize a comment that precedes a rule, with the appropriate indent.voidSerialize animportantpriority declaration to aSimpleWriter.voidSerialize a left curly bracket to aSimpleWriter.voidSerialize one level of indentation to aSimpleWriter.voidSerialize a right curly bracket to aSimpleWriter.default voidwriteShorthandValue(SimpleWriter wri, String shorthandName, CSSShorthandValue value) Serialize a css shorthand value to the given writer.Methods inherited from interface io.sf.carte.doc.style.css.DeclarationFormattingContext
endPropertyDeclaration, startPropertyDeclaration, writeColon, writeComma, writeFullIndent, writeMinifiedValue, writeSemiColon, writeURL, writeValue
-
Method Details
-
deepenCurrentContext
void deepenCurrentContext()This auxiliary method can be used to deepen the indentation at places where the general serialization flow does not give the desired results.It is used only by the
@font-feature-valuesrule. -
endCurrentContext
Notify this context that the contents of the given rule, either a declaration or a rule list, were serialized.It is generally called before
endStyleDeclaration(SimpleWriter)andendRuleList(SimpleWriter).- Parameters:
rule- the rule being serialized.
-
endInlinePropertyDeclaration
End an inline property declaration.Called after
DeclarationFormattingContext.writeSemiColon(SimpleWriter), only from inline styles.- Parameters:
wri- the writer to write to.- Throws:
IOException- if an I/O problem happens while writing to theSimpleWriter.
-
endRule
Ends the serialization of a rule.It is called after
writeRightCurlyBracket(SimpleWriter).- Parameters:
wri- the writer to write to.trailingComments- the comments that go after the rule.- Throws:
IOException- if an I/O problem happens while writing to theSimpleWriter.
-
endRuleList
Called after a list of rules is serialized.May be used for indentation.
- Parameters:
wri- the writer to write to.- Throws:
IOException- if an I/O problem happens while writing to theSimpleWriter.
-
endStyleDeclaration
End a style declaration.Called after
endCurrentContext(CSSRule)and beforewriteRightCurlyBracket(SimpleWriter).- Parameters:
wri- the writer to write to.- Throws:
IOException- if an I/O problem happens while writing to theSimpleWriter.
-
setParentContext
Sets the parent of the rule being serialized, if any, providing additional context for the serialization.It is called before
startRule(SimpleWriter, List). However, this method being called does not guarantee thatstartRule()will be called.- Parameters:
rule- the parent rule. May benull.
-
startRule
Starts the serialization of a rule.It is the first stage of the serialization of a rule. For example, in the case of style rules it is called before serializing the rule selector list. At-rules call it before writing the @-rule name.
- Parameters:
wri- the writer to write to.precedingComments- the comments that precede the rule.- Throws:
IOException- if an I/O problem happens while writing to theSimpleWriter.
-
startStyleDeclaration
Start a style declaration (of either properties or descriptors).Called after
writeLeftCurlyBracket(SimpleWriter)and before serializing the style declaration.- Parameters:
wri- the writer to write to.- Throws:
IOException- if an I/O problem happens while writing to theSimpleWriter.
-
updateContext
Update this context for the given rule.For style rules, it is called after serializing the selector list and before
writeLeftCurlyBracket(SimpleWriter). At-rules call it after writing the rule name.May be used for indentation.
- Parameters:
rule- the rule being serialized.
-
writeComment
Serialize a comment that precedes a rule, with the appropriate indent.Trailing comments are generally written directly by
endRule(SimpleWriter, List)because no indent is necessary.- Parameters:
wri- the writer to write to.comment- the comment to serialize.- Throws:
IOException- if an I/O problem happens while writing to theSimpleWriter.
-
writeImportantPriority
Serialize animportantpriority declaration to aSimpleWriter.If the property declaration has
importantpriority, it is called after the value is written and beforeDeclarationFormattingContext.writeSemiColon(SimpleWriter).- Parameters:
wri- the writer.- Throws:
IOException- if an I/O problem happens while writing to theSimpleWriter.
-
writeLeftCurlyBracket
Serialize a left curly bracket to aSimpleWriter.Called after
updateContext(CSSRule)and beforestartStyleDeclaration(SimpleWriter).- Parameters:
wri- the writer.- Throws:
IOException- if an I/O problem happens while writing to theSimpleWriter.
-
writeLevelIndent
Serialize one level of indentation to aSimpleWriter.- Parameters:
wri- the writer.- Throws:
IOException- if an I/O problem happens while writing to theSimpleWriter.
-
writeRightCurlyBracket
Serialize a right curly bracket to aSimpleWriter.Called after
endStyleDeclaration(SimpleWriter)and beforeendRule(SimpleWriter, List).- Parameters:
wri- the writer.- Throws:
IOException- if an I/O problem happens while writing to theSimpleWriter.
-
writeShorthandValue
default void writeShorthandValue(SimpleWriter wri, String shorthandName, CSSShorthandValue value) throws IOException Serialize a css shorthand value to the given writer.Although the
CSSShorthandValuetype contains priority information, this method only writes the value.The default implementation just writes
CSSValue.getCssText().- Parameters:
wri- the writer.shorthandName- the name of the shorthand property whose value is being printed.value- the value to write.- Throws:
IOException- if an error happened while writing.
-