Package com.helger.css.decl.visit
Class CSSVisitorForUrl
- java.lang.Object
-
- com.helger.css.decl.visit.CSSVisitorForUrl
-
- All Implemented Interfaces:
ICSSVisitor
@NotThreadSafe public class CSSVisitorForUrl extends Object implements ICSSVisitor
A specialICSSVisitorthat is used to extract URLs from the available rules and call theICSSUrlVisitorvisitor. This visitor effectively only visits URLs that are in import rules and those in declaration expressions.- Author:
- Philip Helger
-
-
Constructor Summary
Constructors Constructor Description CSSVisitorForUrl(ICSSUrlVisitor aVisitor)Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbegin()Before visiting starts.
Note: This is only called for complete style sheets, and not when starting e.g. with a declaration list!voidend()After visiting is done.
Note: This is only called for complete style sheets, and not when starting e.g. with a declaration list!ICSSUrlVisitorgetVisitor()voidonBeginFontFaceRule(CSSFontFaceRule aFontFaceRule)Called when a font-face rule starts.
Note: contained declarations are handled byICSSVisitor.onDeclaration(CSSDeclaration)voidonBeginKeyframesBlock(CSSKeyframesBlock aKeyframesBlock)Called when a keyframes block starts.voidonBeginKeyframesRule(CSSKeyframesRule aKeyframesRule)Called when a keyframes rule starts.
Note: contained declarations are handled byICSSVisitor.onDeclaration(CSSDeclaration)voidonBeginMediaRule(CSSMediaRule aMediaRule)Called when a media rule starts.
Note: contained declarations are handled byICSSVisitor.onDeclaration(CSSDeclaration)voidonBeginPageMarginBlock(CSSPageMarginBlock aPageMarginBlock)Called when a page margin block starts.
Note: contained declarations are handled byICSSVisitor.onDeclaration(CSSDeclaration)voidonBeginPageRule(CSSPageRule aPageRule)Called when a page rule starts.
Note: contained declarations are handled byICSSVisitor.onDeclaration(CSSDeclaration), contained page margin blocks are handled withICSSVisitor.onBeginPageMarginBlock(CSSPageMarginBlock)andICSSVisitor.onEndPageMarginBlock(CSSPageMarginBlock).voidonBeginStyleRule(CSSStyleRule aStyleRule)Called when a style rule starts.
Note: contained declarations are handled byICSSVisitor.onDeclaration(CSSDeclaration)voidonBeginSupportsRule(CSSSupportsRule aSupportsRule)Called when a supports rule starts.voidonBeginViewportRule(CSSViewportRule aViewportRule)Called when a viewport rule starts.voidonDeclaration(CSSDeclaration aDeclaration)Called for each declarationvoidonEndFontFaceRule(CSSFontFaceRule aFontFaceRule)Called when a font-face rule ends.voidonEndKeyframesBlock(CSSKeyframesBlock aKeyframesBlock)Called when a keyframes block ends.voidonEndKeyframesRule(CSSKeyframesRule aKeyframesRule)Called when a keyframes rule ends.voidonEndMediaRule(CSSMediaRule aMediaRule)Called when a media rule ends.voidonEndPageMarginBlock(CSSPageMarginBlock aPageMarginBlock)Called when a page margin block ends.voidonEndPageRule(CSSPageRule aPageRule)Called when a page rule ends.voidonEndStyleRule(CSSStyleRule aStyleRule)Called when a style rule ends.voidonEndSupportsRule(CSSSupportsRule aSupportsRule)Called when a supports rule ends.voidonEndViewportRule(CSSViewportRule aViewportRule)Called when a viewport rule ends.voidonImport(CSSImportRule aImportRule)Called on CSS import statementvoidonNamespace(CSSNamespaceRule aNamespaceRule)Called on CSS namespace statementvoidonStyleRuleSelector(CSSSelector aSelector)Called for each selector of a style rulevoidonUnknownRule(CSSUnknownRule aUnknownRule)Called when an unknown rule is encountered.
-
-
-
Constructor Detail
-
CSSVisitorForUrl
public CSSVisitorForUrl(@Nonnull ICSSUrlVisitor aVisitor)
Constructor- Parameters:
aVisitor- The URL visitor to be used. May not benull.
-
-
Method Detail
-
getVisitor
@Nonnull public ICSSUrlVisitor getVisitor()
- Returns:
- The URL visitor passed in the constructor. Never
null.
-
begin
public void begin()
Description copied from interface:ICSSVisitorBefore visiting starts.
Note: This is only called for complete style sheets, and not when starting e.g. with a declaration list!- Specified by:
beginin interfaceICSSVisitor
-
onImport
public void onImport(@Nonnull CSSImportRule aImportRule)
Description copied from interface:ICSSVisitorCalled on CSS import statement- Specified by:
onImportin interfaceICSSVisitor- Parameters:
aImportRule- Other imported CSS. Nevernull.
-
onNamespace
public void onNamespace(@Nonnull CSSNamespaceRule aNamespaceRule)
Description copied from interface:ICSSVisitorCalled on CSS namespace statement- Specified by:
onNamespacein interfaceICSSVisitor- Parameters:
aNamespaceRule- The namespace rule. Nevernull.
-
onDeclaration
public void onDeclaration(@Nonnull CSSDeclaration aDeclaration)
Description copied from interface:ICSSVisitorCalled for each declaration- Specified by:
onDeclarationin interfaceICSSVisitor- Parameters:
aDeclaration- The declaration. Nevernull.
-
onBeginStyleRule
public void onBeginStyleRule(@Nonnull CSSStyleRule aStyleRule)
Description copied from interface:ICSSVisitorCalled when a style rule starts.
Note: contained declarations are handled byICSSVisitor.onDeclaration(CSSDeclaration)- Specified by:
onBeginStyleRulein interfaceICSSVisitor- Parameters:
aStyleRule- The style rule. Nevernull.
-
onStyleRuleSelector
public void onStyleRuleSelector(@Nonnull CSSSelector aSelector)
Description copied from interface:ICSSVisitorCalled for each selector of a style rule- Specified by:
onStyleRuleSelectorin interfaceICSSVisitor- Parameters:
aSelector- The style rule selector. Nevernull.
-
onEndStyleRule
public void onEndStyleRule(@Nonnull CSSStyleRule aStyleRule)
Description copied from interface:ICSSVisitorCalled when a style rule ends.- Specified by:
onEndStyleRulein interfaceICSSVisitor- Parameters:
aStyleRule- The style rule. Nevernull.
-
onBeginPageRule
public void onBeginPageRule(@Nonnull CSSPageRule aPageRule)
Description copied from interface:ICSSVisitorCalled when a page rule starts.
Note: contained declarations are handled byICSSVisitor.onDeclaration(CSSDeclaration), contained page margin blocks are handled withICSSVisitor.onBeginPageMarginBlock(CSSPageMarginBlock)andICSSVisitor.onEndPageMarginBlock(CSSPageMarginBlock).- Specified by:
onBeginPageRulein interfaceICSSVisitor- Parameters:
aPageRule- The page rule. Nevernull.
-
onBeginPageMarginBlock
public void onBeginPageMarginBlock(@Nonnull CSSPageMarginBlock aPageMarginBlock)
Description copied from interface:ICSSVisitorCalled when a page margin block starts.
Note: contained declarations are handled byICSSVisitor.onDeclaration(CSSDeclaration)- Specified by:
onBeginPageMarginBlockin interfaceICSSVisitor- Parameters:
aPageMarginBlock- The page margin block. Nevernull.
-
onEndPageMarginBlock
public void onEndPageMarginBlock(@Nonnull CSSPageMarginBlock aPageMarginBlock)
Description copied from interface:ICSSVisitorCalled when a page margin block ends.- Specified by:
onEndPageMarginBlockin interfaceICSSVisitor- Parameters:
aPageMarginBlock- The page margin block. Nevernull.
-
onEndPageRule
public void onEndPageRule(@Nonnull CSSPageRule aPageRule)
Description copied from interface:ICSSVisitorCalled when a page rule ends.- Specified by:
onEndPageRulein interfaceICSSVisitor- Parameters:
aPageRule- The page rule. Nevernull.
-
onBeginFontFaceRule
public void onBeginFontFaceRule(@Nonnull CSSFontFaceRule aFontFaceRule)
Description copied from interface:ICSSVisitorCalled when a font-face rule starts.
Note: contained declarations are handled byICSSVisitor.onDeclaration(CSSDeclaration)- Specified by:
onBeginFontFaceRulein interfaceICSSVisitor- Parameters:
aFontFaceRule- The font-face rule. Nevernull.
-
onEndFontFaceRule
public void onEndFontFaceRule(@Nonnull CSSFontFaceRule aFontFaceRule)
Description copied from interface:ICSSVisitorCalled when a font-face rule ends.- Specified by:
onEndFontFaceRulein interfaceICSSVisitor- Parameters:
aFontFaceRule- The font-face rule. Nevernull.
-
onBeginMediaRule
public void onBeginMediaRule(@Nonnull CSSMediaRule aMediaRule)
Description copied from interface:ICSSVisitorCalled when a media rule starts.
Note: contained declarations are handled byICSSVisitor.onDeclaration(CSSDeclaration)- Specified by:
onBeginMediaRulein interfaceICSSVisitor- Parameters:
aMediaRule- The media rule. Nevernull.
-
onEndMediaRule
public void onEndMediaRule(@Nonnull CSSMediaRule aMediaRule)
Description copied from interface:ICSSVisitorCalled when a media rule ends.- Specified by:
onEndMediaRulein interfaceICSSVisitor- Parameters:
aMediaRule- The media rule. Nevernull.
-
onBeginKeyframesRule
public void onBeginKeyframesRule(@Nonnull CSSKeyframesRule aKeyframesRule)
Description copied from interface:ICSSVisitorCalled when a keyframes rule starts.
Note: contained declarations are handled byICSSVisitor.onDeclaration(CSSDeclaration)- Specified by:
onBeginKeyframesRulein interfaceICSSVisitor- Parameters:
aKeyframesRule- The keyframes rule. Nevernull.
-
onBeginKeyframesBlock
public void onBeginKeyframesBlock(@Nonnull CSSKeyframesBlock aKeyframesBlock)
Description copied from interface:ICSSVisitorCalled when a keyframes block starts.- Specified by:
onBeginKeyframesBlockin interfaceICSSVisitor- Parameters:
aKeyframesBlock- The keyframes rule block. Nevernull.
-
onEndKeyframesBlock
public void onEndKeyframesBlock(@Nonnull CSSKeyframesBlock aKeyframesBlock)
Description copied from interface:ICSSVisitorCalled when a keyframes block ends.- Specified by:
onEndKeyframesBlockin interfaceICSSVisitor- Parameters:
aKeyframesBlock- The keyframes rule block. Nevernull.
-
onEndKeyframesRule
public void onEndKeyframesRule(@Nonnull CSSKeyframesRule aKeyframesRule)
Description copied from interface:ICSSVisitorCalled when a keyframes rule ends.- Specified by:
onEndKeyframesRulein interfaceICSSVisitor- Parameters:
aKeyframesRule- The keyframes rule. Nevernull.
-
onBeginViewportRule
public void onBeginViewportRule(@Nonnull CSSViewportRule aViewportRule)
Description copied from interface:ICSSVisitorCalled when a viewport rule starts.- Specified by:
onBeginViewportRulein interfaceICSSVisitor- Parameters:
aViewportRule- The viewport rule. Nevernull.
-
onEndViewportRule
public void onEndViewportRule(@Nonnull CSSViewportRule aViewportRule)
Description copied from interface:ICSSVisitorCalled when a viewport rule ends.- Specified by:
onEndViewportRulein interfaceICSSVisitor- Parameters:
aViewportRule- The viewport rule. Nevernull.
-
onBeginSupportsRule
public void onBeginSupportsRule(@Nonnull CSSSupportsRule aSupportsRule)
Description copied from interface:ICSSVisitorCalled when a supports rule starts.- Specified by:
onBeginSupportsRulein interfaceICSSVisitor- Parameters:
aSupportsRule- The supports rule. Nevernull.
-
onEndSupportsRule
public void onEndSupportsRule(@Nonnull CSSSupportsRule aSupportsRule)
Description copied from interface:ICSSVisitorCalled when a supports rule ends.- Specified by:
onEndSupportsRulein interfaceICSSVisitor- Parameters:
aSupportsRule- The supports rule. Nevernull.
-
onUnknownRule
public void onUnknownRule(@Nonnull CSSUnknownRule aUnknownRule)
Description copied from interface:ICSSVisitorCalled when an unknown rule is encountered.- Specified by:
onUnknownRulein interfaceICSSVisitor- Parameters:
aUnknownRule- The unknown rule. Nevernull.
-
end
public void end()
Description copied from interface:ICSSVisitorAfter visiting is done.
Note: This is only called for complete style sheets, and not when starting e.g. with a declaration list!- Specified by:
endin interfaceICSSVisitor
-
-