Package io.sf.carte.doc.style.css.om
Class DefaultSheetErrorHandler
java.lang.Object
io.sf.carte.doc.style.css.om.DefaultSheetErrorHandler
- All Implemented Interfaces:
SACErrorHandler
,SheetErrorHandler
,Serializable
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
badAtRule
(DOMException e, String atRule) A fatal problem was found parsing an at-rule.void
badMediaList
(MediaQueryList media) Found a media-related rule with a wrong media list.void
emptyStyleRule
(String selector) Notify this handler that an empty style rule (a style rule without property value declarations) was found.void
fontFormatError
(CSSFontFaceRule rule, Exception exception) Found a font format error when loading a font-face rule.getRuleAtError
(int index) void
handleSacError
(CSSParseException exception) Handle a SAC error or fatal error.void
handleSacWarning
(CSSParseException exception) Handle a SAC warning.boolean
Check whether this object has handled higher-level object model errors.boolean
Check whether this object has handled higher-level object model warnings.boolean
Check whether this handler has been notified of SAC errors (or fatal errors).boolean
Check whether this handler has been notified of SAC warnings.void
ignoredImport
(String uri) Notify this handler that an import rule was ignored for the given uri.void
inlineStyleError
(DOMException e, Element elm, String attr) Report an error processing an inline style.void
mapError
(CSSParseException exception, CSSRule rule) Map a SAC error or fatal error to a specific rule.void
mergeState
(SheetErrorHandler other) Merge the error state from the error handler of another sheet.void
reset()
Reset the error handler, getting it ready for a new run.void
ruleParseError
(CSSRule rule, CSSParseException ex) An error was found when parsing a rule.void
ruleParseWarning
(CSSRule rule, CSSParseException ex) A warning was produced when parsing a rule.void
sacMalfunction
(String message) the NSAC parser is malfunctioning.toString()
void
unknownRule
(String rule) Notify this handler that a rule of unknown type was found.
-
Constructor Details
-
DefaultSheetErrorHandler
-
-
Method Details
-
badAtRule
Description copied from interface:SheetErrorHandler
A fatal problem was found parsing an at-rule.- Specified by:
badAtRule
in interfaceSheetErrorHandler
- Parameters:
e
- the exception explaining the problem.atRule
- the text containing the at-rule.
-
badMediaList
Description copied from interface:SheetErrorHandler
Found a media-related rule with a wrong media list.- Specified by:
badMediaList
in interfaceSheetErrorHandler
- Parameters:
media
- the media list.
-
emptyStyleRule
Description copied from interface:SheetErrorHandler
Notify this handler that an empty style rule (a style rule without property value declarations) was found.- Specified by:
emptyStyleRule
in interfaceSheetErrorHandler
- Parameters:
selector
- the selector for the empty rule.
-
handleSacError
Description copied from interface:SACErrorHandler
Handle a SAC error or fatal error.- Specified by:
handleSacError
in interfaceSACErrorHandler
- Parameters:
exception
- the parse exception.
-
handleSacWarning
Description copied from interface:SACErrorHandler
Handle a SAC warning.- Specified by:
handleSacWarning
in interfaceSACErrorHandler
- Parameters:
exception
- the parse exception.
-
hasOMErrors
public boolean hasOMErrors()Description copied from interface:SheetErrorHandler
Check whether this object has handled higher-level object model errors.- Specified by:
hasOMErrors
in interfaceSheetErrorHandler
- Returns:
true
if this object has handled higher-level object model errors.
-
hasOMWarnings
public boolean hasOMWarnings()Description copied from interface:SheetErrorHandler
Check whether this object has handled higher-level object model warnings.- Specified by:
hasOMWarnings
in interfaceSheetErrorHandler
- Returns:
true
if this object has handled higher-level object model warnings.
-
hasSacErrors
public boolean hasSacErrors()Description copied from interface:SACErrorHandler
Check whether this handler has been notified of SAC errors (or fatal errors).- Specified by:
hasSacErrors
in interfaceSACErrorHandler
- Returns:
true
if SAC errors or fatal errors were notified since lastSheetErrorHandler.reset()
,false
otherwise.
-
hasSacWarnings
public boolean hasSacWarnings()Description copied from interface:SACErrorHandler
Check whether this handler has been notified of SAC warnings.- Specified by:
hasSacWarnings
in interfaceSACErrorHandler
- Returns:
true
if SAC warnings were notified since lastSheetErrorHandler.reset()
,false
otherwise.
-
ignoredImport
Description copied from interface:SheetErrorHandler
Notify this handler that an import rule was ignored for the given uri.Imports can be ignored if they happen at the wrong place.
- Specified by:
ignoredImport
in interfaceSheetErrorHandler
- Parameters:
uri
- the uri for the ignored rule.
-
inlineStyleError
Description copied from interface:SheetErrorHandler
Report an error processing an inline style.In HTML, it means that the style declration within the
style
attribute could not be parsed.- Specified by:
inlineStyleError
in interfaceSheetErrorHandler
- Parameters:
e
- the exception found.elm
- the element whose inline style was parsed.attr
- the contents of the attribute containing the inline style (generallystyle
).
-
ruleParseError
Description copied from interface:SheetErrorHandler
An error was found when parsing a rule.- Specified by:
ruleParseError
in interfaceSheetErrorHandler
- Parameters:
rule
- the rule.ex
- the exception.
-
ruleParseWarning
Description copied from interface:SheetErrorHandler
A warning was produced when parsing a rule.- Specified by:
ruleParseWarning
in interfaceSheetErrorHandler
- Parameters:
rule
- the rule.ex
- the exception.
-
fontFormatError
Description copied from interface:SheetErrorHandler
Found a font format error when loading a font-face rule.- Specified by:
fontFormatError
in interfaceSheetErrorHandler
- Parameters:
rule
- the font-face rule.exception
- the exception describing the error.
-
unknownRule
Description copied from interface:SheetErrorHandler
Notify this handler that a rule of unknown type was found.- Specified by:
unknownRule
in interfaceSheetErrorHandler
- Parameters:
rule
- the unknown rule.
-
mapError
Description copied from interface:SACErrorHandler
Map a SAC error or fatal error to a specific rule.- Specified by:
mapError
in interfaceSACErrorHandler
- Parameters:
exception
- the parse exception.rule
- the rule having the error.
-
getBadAtRules
-
getBadInlineStyles
-
getBadMediaLists
-
getEmptyStyleRules
-
getIgnoredImports
-
getRuleAtError
-
getRuleParseErrors
-
getSacErrors
-
getSacWarnings
-
getUnknownRules
-
mergeState
Merge the error state from the error handler of another sheet.Implementations are only required to merge boolean state of NSAC errors and warnings. Merging other state is optional.
- Specified by:
mergeState
in interfaceSheetErrorHandler
- Parameters:
other
- the other style sheet error handler.
-
reset
public void reset()Description copied from interface:SheetErrorHandler
Reset the error handler, getting it ready for a new run.- Specified by:
reset
in interfaceSheetErrorHandler
-
toString
-
sacMalfunction
Description copied from interface:SheetErrorHandler
the NSAC parser is malfunctioning. Implementations may just ignore this method.It may be called if a property was received for being processed outside of a rule.
- Specified by:
sacMalfunction
in interfaceSheetErrorHandler
- Parameters:
message
- the message.
-