Ejemplo n.º 1
0
  /**
   * Compile a single hashCode for the tree of codes linked in a navigation.
   *
   * @param navigation the navigation
   * @param extension the extension of the codes
   * @param excludes exludes codes to exclude
   * @return the hash
   */
  public static int getHashes(CMNavigation navigation, String extension, List excludes) {
    List<CMAbstractCode> codes = new ArrayList<>();

    if (CSS_EXTENSION.equals(extension)) {
      codes = getCodeListForHash(navigation.getCss(), excludes, codes);
    } else if (JAVASCRIPT_EXTENSION.equals(extension)) {
      codes = getCodeListForHash(navigation.getJavaScript(), excludes, codes);
    }

    int hash = 0;

    for (CMAbstractCode code : codes) {

      if (code.getCode() != null) {
        hash += code.getCode().hashCode();
      }
    }

    return hash;
  }
Ejemplo n.º 2
0
 /** Return only JS linked to the given navigation that has a data url, excluding IE exclusives */
 public static List<CMAbstractCode> getJavaScriptExternalLinks(
     CMNavigation cmNavigation, List excludes) {
   return getFilteredCodeList(
       cmNavigation.getJavaScript(), excludes, new ArrayList<CMAbstractCode>(), false, true);
 }
Ejemplo n.º 3
0
 /**
  * Return only CSS linked to the given navigation that is IE exclusive, including external links
  */
 public static List<CMAbstractCode> getCSSIeExcludes(CMNavigation cmNavigation, List excludes) {
   return getFilteredCodeList(
       cmNavigation.getCss(), excludes, new ArrayList<CMAbstractCode>(), true, false);
 }