public List<Asset> getJavaScriptLibraries() {
    String jQueryUIPath = symbolSource.valueForSymbol(JQuerySymbolConstants.JQUERY_UI_PATH);
    if (!jQueryUIPath.endsWith("/")) {

      jQueryUIPath += "/";
    }

    final List<Asset> javaScriptStack = new ArrayList<Asset>();

    javaScriptStack.add(
        assetSource.getClasspathAsset(
            String.format(
                "%s%s/jquery.ui.datepicker%s.js",
                jQueryUIPath,
                (!productionMode ? "/minified" : ""),
                (!productionMode ? ".min" : ""))));

    final Asset datePickerI18nAsset = getLocaleAsset(threadLocale.getLocale(), jQueryUIPath);

    if (datePickerI18nAsset != null) {
      javaScriptStack.add(datePickerI18nAsset);
    }

    javaScriptStack.add(
        assetSource.getExpandedAsset("${assets.path}/components/datefield/datefield.js"));

    return javaScriptStack;
  }
 public List<StylesheetLink> getStylesheets() {
   List<StylesheetLink> css = new ArrayList<StylesheetLink>();
   css.add(
       new StylesheetLink(
           assetSource.getContextAsset("css/sunny/jquery-ui-1.8.19.custom.css", null)));
   return css;
 }
示例#3
0
  public Resource getResourceFormStylesheetLink(StylesheetLink link) {

    String[] path = link.getURL().split("/");

    StringBuilder sb = new StringBuilder();

    Boolean flag = false;

    for (int i = 0; i < path.length; i++) {

      if (path[i].equalsIgnoreCase("css")) flag = true;

      if (flag) {
        sb.append("/");

        sb.append(path[i]);
      }
    }

    String ctxPath = "context:" + sb.toString().substring(1);

    Asset a = assetSource.getExpandedAsset(ctxPath);

    return a.getResource();
  }
  private Asset getLocaleAsset(Locale locale, String jQueryUIPath) {

    final String prefix =
        String.format("%s/i18n/jquery.ui.datepicker-%s", jQueryUIPath, locale.getLanguage());
    final Resource withCountryExtension =
        typeCoercer.coerce(String.format("%s-%s.js", prefix, locale.getCountry()), Resource.class);

    if (withCountryExtension.exists()) {

      return assetSource.getClasspathAsset(withCountryExtension.getPath());
    }

    final Resource withLanguageExtension =
        typeCoercer.coerce(String.format("%s.js", prefix), Resource.class);

    if (withLanguageExtension.exists()) {

      return assetSource.getClasspathAsset(withLanguageExtension.getPath());
    }

    return null;
  }
  /** Tapestry render phase method. Start a tag here, end it in afterRender */
  void beginRender(MarkupWriter writer) {
    String cssStyleFile;

    String scriptPathSymbolValue =
        symbolSource.expandSymbols("${ck.components}") + "/window/themes";

    if (className.endsWith("lighting")) cssStyleFile = "lighting.css";
    else if (className.equals("dialog")) cssStyleFile = "default.css";
    else if (className.endsWith("_os_x")) cssStyleFile = "mac_os_x.css";
    else cssStyleFile = className + ".css";

    String assetString = scriptPathSymbolValue + "/" + cssStyleFile;
    Asset cssAsset = assetSource.getClasspathAsset(assetString);
    if (cssAsset != null) {
      javaScriptSupport.importStylesheet(cssAsset);
    }
  }
 /** Get path to star image in function of the number of stars */
 public Asset getHotelRating() {
   return assetSource.getContextAsset(String.format("/static/%d-star.gif", stars), null);
 }
        public Asset map(String path) {
          Asset asset = assetSource.getExpandedAsset(path);

          return asset;
        }