Class DefaultStyleFormattingContext
- All Implemented Interfaces:
DeclarationFormattingContext,StyleFormattingContext,Serializable
- Direct Known Subclasses:
InlineStyleFormattingContext
- See Also:
-
Constructor Summary
Constructors -
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(org.w3c.dom.css.CSSRule rule) Notify this context that the style was serialized for the given rule.voidendInlinePropertyDeclaration(io.sf.carte.util.SimpleWriter wri) End an inline property declaration.voidendPropertyDeclaration(io.sf.carte.util.SimpleWriter wri) Ends a property declaration in a rule style (does not apply to inline styles).voidEnds the serialization of a rule.voidendRuleList(io.sf.carte.util.SimpleWriter wri) Called after a list of rules is serialized.voidendStyleDeclaration(io.sf.carte.util.SimpleWriter wri) End a style declaration.voidsetParentContext(org.w3c.dom.css.CSSRule rule) Sets the parent of the rule being serialized, if any, providing additional context for the serialization.voidStarts the serialization of a rule.voidstartStyleDeclaration(io.sf.carte.util.SimpleWriter wri) Start a style declaration (of either properties or descriptors).voidupdateContext(org.w3c.dom.css.CSSRule rule) Update this context for the given rule.voidwriteComment(io.sf.carte.util.SimpleWriter wri, String comment) Serialize a comment that precedes a rule, with the appropriate indent.voidwriteFullIndent(io.sf.carte.util.SimpleWriter wri) Serialize a full paragraph indent to aSimpleWriter.voidwriteImportantPriority(io.sf.carte.util.SimpleWriter wri) Serialize animportantpriority declaration to aSimpleWriter.voidwriteLeftCurlyBracket(io.sf.carte.util.SimpleWriter wri) Serialize a left curly bracket to aSimpleWriter.voidwriteLevelIndent(io.sf.carte.util.SimpleWriter wri) Serialize one level of indentation to aSimpleWriter.voidwriteRightCurlyBracket(io.sf.carte.util.SimpleWriter wri) Serialize a right curly bracket to aSimpleWriter.voidwriteSemiColon(io.sf.carte.util.SimpleWriter wri) Serialize a semicolon to aSimpleWriter.voidSerialize a URL/URI to aSimpleWriter.Methods inherited from class io.sf.carte.doc.style.css.om.DefaultDeclarationFormattingContext
startPropertyDeclaration, writeColon, writeCommaMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.sf.carte.doc.style.css.DeclarationFormattingContext
startPropertyDeclaration, writeColon, writeComma, writeMinifiedValue, writeValueMethods inherited from interface io.sf.carte.doc.style.css.StyleFormattingContext
writeShorthandValue
-
Constructor Details
-
DefaultStyleFormattingContext
public DefaultStyleFormattingContext()
-
-
Method Details
-
deepenCurrentContext
public void deepenCurrentContext()Description copied from interface:StyleFormattingContextThis 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.- Specified by:
deepenCurrentContextin interfaceStyleFormattingContext
-
endCurrentContext
public void endCurrentContext(org.w3c.dom.css.CSSRule rule) Description copied from interface:StyleFormattingContextNotify this context that the style was serialized for the given rule.It is called before
StyleFormattingContext.endStyleDeclaration(SimpleWriter).- Specified by:
endCurrentContextin interfaceStyleFormattingContext- Parameters:
rule- the rule being serialized.
-
endPropertyDeclaration
Description copied from interface:DeclarationFormattingContextEnds a property declaration in a rule style (does not apply to inline styles).It is called after
DeclarationFormattingContext.writeSemiColon(SimpleWriter).- Specified by:
endPropertyDeclarationin interfaceDeclarationFormattingContext- Overrides:
endPropertyDeclarationin classDefaultDeclarationFormattingContext- Parameters:
wri- the writer.- Throws:
IOException- if an I/O problem happens while writing to theSimpleWriter.
-
endInlinePropertyDeclaration
Description copied from interface:StyleFormattingContextEnd an inline property declaration.Called after
DeclarationFormattingContext.writeSemiColon(SimpleWriter), only from inline styles.- Specified by:
endInlinePropertyDeclarationin interfaceStyleFormattingContext- Parameters:
wri- the writer to write to.- Throws:
IOException- if an I/O problem happens while writing to theSimpleWriter.
-
endRule
public void endRule(io.sf.carte.util.SimpleWriter wri, List<String> trailingComments) throws IOException Description copied from interface:StyleFormattingContextEnds the serialization of a rule.It is called after
StyleFormattingContext.writeRightCurlyBracket(SimpleWriter).- Specified by:
endRulein interfaceStyleFormattingContext- 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
Description copied from interface:StyleFormattingContextCalled after a list of rules is serialized.May be used for indentation.
- Specified by:
endRuleListin interfaceStyleFormattingContext- Parameters:
wri- the writer to write to.- Throws:
IOException- if an I/O problem happens while writing to theSimpleWriter.
-
endStyleDeclaration
Description copied from interface:StyleFormattingContextEnd a style declaration.Called after
StyleFormattingContext.endCurrentContext(CSSRule)and beforeStyleFormattingContext.writeRightCurlyBracket(SimpleWriter).- Specified by:
endStyleDeclarationin interfaceStyleFormattingContext- Parameters:
wri- the writer to write to.- Throws:
IOException- if an I/O problem happens while writing to theSimpleWriter.
-
setParentContext
public void setParentContext(org.w3c.dom.css.CSSRule rule) Description copied from interface:StyleFormattingContextSets the parent of the rule being serialized, if any, providing additional context for the serialization.It is called before
StyleFormattingContext.startRule(SimpleWriter, List). However, this method being called does not guarantee thatstartRule()will be called.- Specified by:
setParentContextin interfaceStyleFormattingContext- Parameters:
rule- the parent rule. May benull.
-
startRule
public void startRule(io.sf.carte.util.SimpleWriter wri, List<String> precedingComments) throws IOException Description copied from interface:StyleFormattingContextStarts 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.
- Specified by:
startRulein interfaceStyleFormattingContext- 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
Description copied from interface:StyleFormattingContextStart a style declaration (of either properties or descriptors).Called after
StyleFormattingContext.writeLeftCurlyBracket(SimpleWriter)and before serializing the style declaration.- Specified by:
startStyleDeclarationin interfaceStyleFormattingContext- Parameters:
wri- the writer to write to.- Throws:
IOException- if an I/O problem happens while writing to theSimpleWriter.
-
updateContext
public void updateContext(org.w3c.dom.css.CSSRule rule) Description copied from interface:StyleFormattingContextUpdate this context for the given rule.For style rules, it is called after serializing the selector list and before
StyleFormattingContext.writeLeftCurlyBracket(SimpleWriter). At-rules call it after writing the rule name.May be used for indentation.
- Specified by:
updateContextin interfaceStyleFormattingContext- Parameters:
rule- the rule being serialized.
-
writeComment
Description copied from interface:StyleFormattingContextSerialize a comment that precedes a rule, with the appropriate indent.Trailing comments are generally written directly by
StyleFormattingContext.endRule(SimpleWriter, List)because no indent is necessary.- Specified by:
writeCommentin interfaceStyleFormattingContext- Parameters:
wri- the writer to write to.comment- the comment to serialize.- Throws:
IOException- if an I/O problem happens while writing to theSimpleWriter.
-
writeFullIndent
Description copied from interface:DeclarationFormattingContextSerialize a full paragraph indent to aSimpleWriter.- Specified by:
writeFullIndentin interfaceDeclarationFormattingContext- Overrides:
writeFullIndentin classDefaultDeclarationFormattingContext- Parameters:
wri- the writer.- Throws:
IOException- if an I/O problem happens while writing to theSimpleWriter.
-
writeImportantPriority
Description copied from interface:StyleFormattingContextSerialize animportantpriority declaration to aSimpleWriter.If the property declaration has
importantpriority, it is called after the value is written and beforeDeclarationFormattingContext.writeSemiColon(SimpleWriter).- Specified by:
writeImportantPriorityin interfaceStyleFormattingContext- Parameters:
wri- the writer.- Throws:
IOException- if an I/O problem happens while writing to theSimpleWriter.
-
writeLeftCurlyBracket
Description copied from interface:StyleFormattingContextSerialize a left curly bracket to aSimpleWriter.Called after
StyleFormattingContext.updateContext(CSSRule)and beforeStyleFormattingContext.startStyleDeclaration(SimpleWriter).- Specified by:
writeLeftCurlyBracketin interfaceStyleFormattingContext- Parameters:
wri- the writer.- Throws:
IOException- if an I/O problem happens while writing to theSimpleWriter.
-
writeLevelIndent
Description copied from interface:StyleFormattingContextSerialize one level of indentation to aSimpleWriter.- Specified by:
writeLevelIndentin interfaceStyleFormattingContext- Parameters:
wri- the writer.- Throws:
IOException- if an I/O problem happens while writing to theSimpleWriter.
-
writeRightCurlyBracket
Description copied from interface:StyleFormattingContextSerialize a right curly bracket to aSimpleWriter.Called after
StyleFormattingContext.endStyleDeclaration(SimpleWriter)and beforeStyleFormattingContext.endRule(SimpleWriter, List).- Specified by:
writeRightCurlyBracketin interfaceStyleFormattingContext- Parameters:
wri- the writer.- Throws:
IOException- if an I/O problem happens while writing to theSimpleWriter.
-
writeSemiColon
Description copied from interface:DeclarationFormattingContextSerialize a semicolon to aSimpleWriter.Called after writing the property name.
- Specified by:
writeSemiColonin interfaceDeclarationFormattingContext- Overrides:
writeSemiColonin classDefaultDeclarationFormattingContext- Parameters:
wri- the writer.- Throws:
IOException- if an I/O problem happens while writing to theSimpleWriter.
-
writeURL
Description copied from interface:DeclarationFormattingContextSerialize a URL/URI to aSimpleWriter.- Specified by:
writeURLin interfaceDeclarationFormattingContext- Overrides:
writeURLin classDefaultDeclarationFormattingContext- Parameters:
wri- the writer.href- the URI.- Throws:
IOException- if an I/O problem happens while writing to theSimpleWriter.
-