コード例 #1
0
 @Override
 public void validateReferences() throws QuickFixException {
   DefDescriptor<ComponentDef> desc = Flavors.toComponentDescriptor(getDescriptor());
   ComponentDef def = desc.getDef();
   if (!def.hasFlavorableChild()
       && !def.inheritsFlavorableChild()
       && !def.isDynamicallyFlavorable()) {
     throw new InvalidDefinitionException(
         String.format("%s must contain at least one aura:flavorable element", desc),
         getLocation());
   }
 }
コード例 #2
0
  @Override
  public void appendDependencies(Set<DefDescriptor<?>> dependencies) {
    if (!getExpressions().isEmpty()) {
      DefDescriptor<ThemeDef> namespaceTheme = Themes.namespaceThemeDescriptor(descriptor);
      if (namespaceTheme.exists()) {
        dependencies.add(namespaceTheme);
      }
    }

    if (getDescriptor().getPrefix().equals(DefDescriptor.CUSTOM_FLAVOR_PREFIX)) {
      dependencies.add(Flavors.toComponentDescriptor(getDescriptor()));
    }
  }
コード例 #3
0
ファイル: FlavorIncludeDefImpl.java プロジェクト: synle/aura
  @Override
  public Table<DefDescriptor<ComponentDef>, String, FlavorOverrideLocation> computeOverrides()
      throws QuickFixException {
    // component / flavor (might be multiple per cmp) / override location (should only be one per
    // cmp/flavor combo)
    Table<DefDescriptor<ComponentDef>, String, FlavorOverrideLocation> table =
        HashBasedTable.create();

    for (DefDescriptor<FlavoredStyleDef> style : getDefs()) {
      DefDescriptor<ComponentDef> cmp = Flavors.toComponentDescriptor(style);
      Map<String, FlavorAnnotation> annotations = style.getDef().getFlavorAnnotations();
      for (FlavorAnnotation annotation : annotations.values()) {
        table.put(
            cmp,
            annotation.getFlavorName(),
            new FlavorOverrideLocationImpl(style, annotation.getOverridesIf().orNull()));
      }
    }

    return table;
  }