Class DefaultSheetErrorHandler

java.lang.Object
io.sf.carte.doc.style.css.om.DefaultSheetErrorHandler
All Implemented Interfaces:
SACErrorHandler, SheetErrorHandler, Serializable

public class DefaultSheetErrorHandler extends Object implements SheetErrorHandler, Serializable
See Also:
  • Constructor Details

    • DefaultSheetErrorHandler

      public DefaultSheetErrorHandler(CSSStyleSheet<? extends CSSRule> sheet)
  • Method Details

    • badAtRule

      public void badAtRule(DOMException e, String atRule)
      Description copied from interface: SheetErrorHandler
      A fatal problem was found parsing an at-rule.
      Specified by:
      badAtRule in interface SheetErrorHandler
      Parameters:
      e - the exception explaining the problem.
      atRule - the text containing the at-rule.
    • badMediaList

      public void badMediaList(MediaQueryList media)
      Description copied from interface: SheetErrorHandler
      Found a media-related rule with a wrong media list.
      Specified by:
      badMediaList in interface SheetErrorHandler
      Parameters:
      media - the media list.
    • emptyStyleRule

      public void emptyStyleRule(String selector)
      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 interface SheetErrorHandler
      Parameters:
      selector - the selector for the empty rule.
    • handleSacError

      public void handleSacError(CSSParseException exception)
      Description copied from interface: SACErrorHandler
      Handle a SAC error or fatal error.
      Specified by:
      handleSacError in interface SACErrorHandler
      Parameters:
      exception - the parse exception.
    • handleSacWarning

      public void handleSacWarning(CSSParseException exception)
      Description copied from interface: SACErrorHandler
      Handle a SAC warning.
      Specified by:
      handleSacWarning in interface SACErrorHandler
      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 interface SheetErrorHandler
      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 interface SheetErrorHandler
      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 interface SACErrorHandler
      Returns:
      true if SAC errors or fatal errors were notified since last SheetErrorHandler.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 interface SACErrorHandler
      Returns:
      true if SAC warnings were notified since last SheetErrorHandler.reset(), false otherwise.
    • ignoredImport

      public void ignoredImport(String uri)
      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 interface SheetErrorHandler
      Parameters:
      uri - the uri for the ignored rule.
    • inlineStyleError

      public void inlineStyleError(DOMException e, Element elm, String attr)
      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 interface SheetErrorHandler
      Parameters:
      e - the exception found.
      elm - the element whose inline style was parsed.
      attr - the contents of the attribute containing the inline style (generally style).
    • ruleParseError

      public void ruleParseError(CSSRule rule, CSSParseException ex)
      Description copied from interface: SheetErrorHandler
      An error was found when parsing a rule.
      Specified by:
      ruleParseError in interface SheetErrorHandler
      Parameters:
      rule - the rule.
      ex - the exception.
    • ruleParseWarning

      public void ruleParseWarning(CSSRule rule, CSSParseException ex)
      Description copied from interface: SheetErrorHandler
      A warning was produced when parsing a rule.
      Specified by:
      ruleParseWarning in interface SheetErrorHandler
      Parameters:
      rule - the rule.
      ex - the exception.
    • fontFormatError

      public void fontFormatError(CSSFontFaceRule rule, Exception exception)
      Description copied from interface: SheetErrorHandler
      Found a font format error when loading a font-face rule.
      Specified by:
      fontFormatError in interface SheetErrorHandler
      Parameters:
      rule - the font-face rule.
      exception - the exception describing the error.
    • unknownRule

      public void unknownRule(String rule)
      Description copied from interface: SheetErrorHandler
      Notify this handler that a rule of unknown type was found.
      Specified by:
      unknownRule in interface SheetErrorHandler
      Parameters:
      rule - the unknown rule.
    • mapError

      public void mapError(CSSParseException exception, CSSRule rule)
      Description copied from interface: SACErrorHandler
      Map a SAC error or fatal error to a specific rule.
      Specified by:
      mapError in interface SACErrorHandler
      Parameters:
      exception - the parse exception.
      rule - the rule having the error.
    • getBadAtRules

      public LinkedList<String> getBadAtRules()
    • getBadInlineStyles

      public LinkedList<String> getBadInlineStyles()
    • getBadMediaLists

      public LinkedList<MediaQueryList> getBadMediaLists()
    • getEmptyStyleRules

      public LinkedList<String> getEmptyStyleRules()
    • getIgnoredImports

      public LinkedList<String> getIgnoredImports()
    • getRuleAtError

      public CSSRule getRuleAtError(int index)
    • getRuleParseErrors

      public LinkedList<RuleParseException> getRuleParseErrors()
    • getSacErrors

      public List<CSSParseException> getSacErrors()
    • getSacWarnings

      public List<CSSParseException> getSacWarnings()
    • getUnknownRules

      public LinkedList<String> getUnknownRules()
    • mergeState

      public void mergeState(SheetErrorHandler other)
      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 interface SheetErrorHandler
      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 interface SheetErrorHandler
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • sacMalfunction

      public void sacMalfunction(String message)
      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 interface SheetErrorHandler
      Parameters:
      message - the message.