com.google.gwt.resources.gss

## Class ExternalClassesCollector

- java.lang.Object
- - com.google.gwt.thirdparty.common.css.compiler.ast.DefaultTreeVisitor
  - - com.google.gwt.resources.gss.ExternalClassesCollector

- All Implemented Interfaces:
    com.google.gwt.thirdparty.common.css.compiler.ast.AtRuleHandler, com.google.gwt.thirdparty.common.css.compiler.ast.CssCompilerPass, com.google.gwt.thirdparty.common.css.compiler.ast.CssTreeVisitor

      public class ExternalClassesCollector
      extends com.google.gwt.thirdparty.common.css.compiler.ast.DefaultTreeVisitor
      implements com.google.gwt.thirdparty.common.css.compiler.ast.CssCompilerPass

  Compiler pass that collects external styles declared with the `@external` at-rule.

  This pass also removes the `@external` nodes from the AST.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static java.lang.String` | `EXTERNAL_AT_RULE`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ExternalClassesCollector(com.google.gwt.thirdparty.common.css.compiler.ast.MutatingVisitController visitController, com.google.gwt.thirdparty.common.css.compiler.ast.ErrorManager errorManager)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `enterClassSelector(com.google.gwt.thirdparty.common.css.compiler.ast.CssClassSelectorNode classSelector)`
    `com.google.gwt.thirdparty.guava.common.collect.ImmutableSet<java.lang.String>` | `getExternalClassNames(java.util.Set<java.lang.String> styleClassesSet, java.util.Set<java.lang.String> orphanClassName)` Returns an immutable set of external class names that should not be renamed.
    `void` | `leaveUnknownAtRule(com.google.gwt.thirdparty.common.css.compiler.ast.CssUnknownAtRuleNode node)`
    `void` | `runPass()`

    - ### Methods inherited from class com.google.gwt.thirdparty.common.css.compiler.ast.DefaultTreeVisitor

      `enterArgumentNode, enterAttributeSelector, enterBlock, enterCombinator, enterComponent, enterCompositeValueNode, enterCompositeValueNodeOperator, enterConditionalBlock, enterConditionalRule, enterDeclaration, enterDeclarationBlock, enterDefinition, enterFontFace, enterForLoop, enterFunctionNode, enterIdSelector, enterImportBlock, enterImportRule, enterKey, enterKeyBlock, enterKeyframeRuleset, enterKeyframesRule, enterMediaRule, enterMediaTypeListDelimiter, enterMixin, enterMixinDefinition, enterPageRule, enterPageSelector, enterPropertyValue, enterProvideNode, enterPseudoClass, enterPseudoElement, enterRequireNode, enterRuleset, enterSelector, enterSelectorBlock, enterTree, enterUnknownAtRule, enterValueNode, leaveArgumentNode, leaveAttributeSelector, leaveBlock, leaveClassSelector, leaveCombinator, leaveComponent, leaveCompositeValueNode, leaveCompositeValueNodeOperator, leaveConditionalBlock, leaveConditionalRule, leaveDeclaration, leaveDeclarationBlock, leaveDefinition, leaveFontFace, leaveForLoop, leaveFunctionNode, leaveIdSelector, leaveImportBlock, leaveImportRule, leaveKey, leaveKeyBlock, leaveKeyframeRuleset, leaveKeyframesRule, leaveMediaRule, leaveMediaTypeListDelimiter, leaveMixin, leaveMixinDefinition, leavePageRule, leavePageSelector, leavePropertyValue, leaveProvideNode, leavePseudoClass, leavePseudoElement, leaveRequireNode, leaveRuleset, leaveSelector, leaveSelectorBlock, leaveTree, leaveValueNode, visit`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### EXTERNAL_AT_RULE

          public static final java.lang.String EXTERNAL_AT_RULE

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### ExternalClassesCollector

          public ExternalClassesCollector(com.google.gwt.thirdparty.common.css.compiler.ast.MutatingVisitController visitController,
                                          com.google.gwt.thirdparty.common.css.compiler.ast.ErrorManager errorManager)

  - ### Method Detail

    - #### runPass

          public void runPass()

      Specified by:
        `runPass` in interface `com.google.gwt.thirdparty.common.css.compiler.ast.CssCompilerPass`

    - #### enterClassSelector

          public boolean enterClassSelector(com.google.gwt.thirdparty.common.css.compiler.ast.CssClassSelectorNode classSelector)

      Specified by:
        `enterClassSelector` in interface `com.google.gwt.thirdparty.common.css.compiler.ast.CssTreeVisitor`
      Overrides:
        `enterClassSelector` in class `com.google.gwt.thirdparty.common.css.compiler.ast.DefaultTreeVisitor`

    - #### leaveUnknownAtRule

          public void leaveUnknownAtRule(com.google.gwt.thirdparty.common.css.compiler.ast.CssUnknownAtRuleNode node)

      Specified by:
        `leaveUnknownAtRule` in interface `com.google.gwt.thirdparty.common.css.compiler.ast.AtRuleHandler`
      Overrides:
        `leaveUnknownAtRule` in class `com.google.gwt.thirdparty.common.css.compiler.ast.DefaultTreeVisitor`

    - #### getExternalClassNames

          public com.google.gwt.thirdparty.guava.common.collect.ImmutableSet<java.lang.String> getExternalClassNames(java.util.Set<java.lang.String> styleClassesSet,
                                                                                                                     java.util.Set<java.lang.String> orphanClassName)

      Returns an immutable set of external class names that should not be renamed. The returned set contains all complete class names defined with `@external` as well as all of the class names from `styleClassesSet` that match prefixes defined with `@external`.

      The set will contain also the class names that are not in the AST anymore (defined in a conditional node that has been evaluated to false) and are not associated to a java method. That doesn't make sense to rename these class names because they are not in the final css and javascript. Moreover we handle the case where an `@external` related to these style classes has been removed from the AST (because it was also defined in a conditional node evaluated to false) and the compiler doesn't have to throw and error for this case.

             / * conditional node evaluated to false at compile time  */

      Parameters:
        `styleClassesSet` - a set of class names that should be filtered to return those matching external prefixes. Note that the passed-in set is not modified.
        `orphanClassName` - a set of class names that aren't associated to a java method of the CssResource interface.
      Returns:
        an immutable set of class names. Note that the returned names are not prefixed with "."; they are the raw name.