Examples of TextResource


Examples of com.google.gwt.resources.client.TextResource

public class CordovaResources {

  public static void configure() {
    Resources res = Resources.RESOURCES;
    String platform = determinePlatform();
    TextResource javascript;

    if ("android".equals(platform)) {
      javascript = res.cordovaAndroid();
    } else if ("ios".equals(platform)) {
      javascript = res.cordovaIOS();
    } else if ("blackberry".equals(platform)) {
      javascript = res.cordovaBlackberry();
    } else if ("window7".equals(platform)) {
      javascript = res.cordovaWindows7();
    } else if ("window8".equals(platform)) {
      javascript = res.cordovaWindows8();
    } else {
      javascript = res.cordovaIOS();
    }

    JavascriptInjector.inject(javascript.getText());
  }
View Full Code Here

Examples of com.google.gwt.resources.client.TextResource

      }

      // Populate the TextResponse cache array
      for (int i = 0; i < cache.length; i++) {
        final String resourceText = extractString(jso, i);
        cache[i] = new TextResource() {

          public String getName() {
            return name;
          }
View Full Code Here

Examples of com.google.gwt.resources.client.TextResource

  private Event<GeoFencingEvent> geoFencingEventEvent;

  public GeoFencingStandardProvider() {
    initRegionListener();
    TextResource javascript = Resources.RESOURCES.javascript();
    JavascriptInjector.inject(javascript.getText());
  }
View Full Code Here

Examples of com.google.gwt.resources.client.TextResource

    }

    @Override
    public void execute(Control<BootstrapContext> control) {

        TextResource compat = TextResources.INSTANCE.compat();

        JSONValue root = JSONParser.parseLenient(compat.getText());
        JSONObject versionList = root.isObject();
        Set<String> keys = versionList.keySet();
        for(String key : keys)
        {
            modelVersions.put(key, versionList.get(key).isString().stringValue());
View Full Code Here

Examples of com.google.gwt.resources.client.TextResource

    }-*/;


    public static final void forceLocale(String locale_) {
        locale = locale_;
        TextResource t = setupLocale();
        if (!loaded.contains(locale) && t != null) {
            JavaScriptInjector.inject(t.getText());
        }
    }
View Full Code Here

Examples of com.google.gwt.resources.client.TextResource

        }
    }

    private static TextResource setupLocale() {
        Resources r = Resources.RESOURCES;
        TextResource tr = null;

        /*
           Script used to gen the basic if-else block:
           for a in `ls`; do echo "else if(locale.equals(\"`echo $a | cut -f2 -d.`\")) { tr = r.`echo $a | cut -f2 -d.`(); LANGUAGE = \"`echo $a | cut -f2 -d.`\"; }"; done
        */
 
View Full Code Here

Examples of com.liferay.faces.util.io.TextResource

    }

    URL resourceURL = relativeClass.getResource(resourcePath);

    if (resourceURL != null) {
      TextResource textResource = TextResourceUtil.read(resourceURL);
      String templateText = textResource.getText();

      return getTemplate(templateText, contentType);
    }
    else {
      throw new IOException("Unable to read file " + resourcePath);
View Full Code Here

Examples of com.liferay.faces.util.io.TextResource

  private static final String XML = "xml";

  public static CodeExample read(URL sourceFileURL, String sourceFileName, boolean productionMode)
    throws IOException {

    TextResource textResource = TextResourceUtil.read(sourceFileURL);
    String sourceCodeText = textResource.getText();

    if (sourceCodeText != null) {

      String fileExtension;

      if (sourceFileName.endsWith(JAVA_EXTENSION)) {
        fileExtension = JAVA;

        Matcher matcher = JAVA_MULTILINE_COMMENTS_PATTERN.matcher(sourceCodeText);
        sourceCodeText = matcher.replaceAll(StringPool.BLANK);
      }
      else {
        fileExtension = XML;
        sourceCodeText = TEMPLATE_ATTRIBUTE_PATTERN.matcher(sourceCodeText).replaceAll(StringPool.BLANK);
        sourceCodeText = SHOWCASE_NAMESPACE_PATTERN.matcher(sourceCodeText).replaceAll(StringPool.BLANK);

        StringReader stringReader = new StringReader(sourceCodeText);
        StringBuffer buf = new StringBuffer();
        BufferedReader bufferedReader = new BufferedReader(stringReader);
        int trimTab = 0;
        String line;
        boolean ignoreNextLine = false;

        while ((line = bufferedReader.readLine()) != null) {
          String trimmedLine = line.trim();

          if (ignoreNextLine) {
            ignoreNextLine = !trimmedLine.endsWith(StringPool.GREATER_THAN);
          }
          else {

            if (trimmedLine.startsWith("<showcase") || trimmedLine.startsWith("<ui:define")) {
              trimTab++;
              ignoreNextLine = !trimmedLine.endsWith(StringPool.GREATER_THAN);
            }
            else if (trimmedLine.startsWith("</showcase") || trimmedLine.startsWith("</ui:define")) {
              trimTab--;
            }
            else {

              for (int i = 0; i < trimTab; i++) {

                if (line.startsWith(StringPool.TAB)) {
                  line = line.substring(1);
                }
              }

              int pos = line.indexOf(OUTPUTMODEL_MODELVALUE);

              if (pos > 0) {
                line = line.substring(0, pos) + ":modelValue" +
                  line.substring(pos + OUTPUTMODEL_MODELVALUE.length());
              }

              pos = line.indexOf(RENDER_EXAMPLE_FORM);

              if (pos > 0) {
                line = line.substring(0, pos) + "render=\"" +
                  line.substring(pos + RENDER_EXAMPLE_FORM.length());
              }

              pos = line.indexOf(RENDER_FORM_EXAMPLE);

              if (pos > 0) {
                line = line.substring(0, pos) + "render=\":exampleForm" +
                  line.substring(pos + RENDER_FORM_EXAMPLE.length());
              }

              if (productionMode) {
                pos = line.indexOf(RENDERED);

                if (pos > 0) {
                  line = line.substring(0, pos) + line.substring(pos + RENDERED.length());
                }
              }

              // Strip empty lines
              Pattern BLANK_LINE_PATTERN = Pattern.compile("\\t+$");
              Matcher matcher = BLANK_LINE_PATTERN.matcher(line);
              if (!matcher.matches()) {
                buf.append(line);
                buf.append(StringPool.NEW_LINE);
              }
            }
          }
        }

        sourceCodeText = buf.toString();
      }

      sourceCodeText = sourceCodeText.trim();

      return new CodeExample(sourceFileName, fileExtension, sourceFileURL, textResource.getLastModified(),
          sourceCodeText);
    }
    else {
      throw new IOException("Unable to locate " + sourceFileURL);
    }
View Full Code Here

Examples of us.monoid.web.TextResource

        Resty.ignoreAllCerts();

        Resty resty = new Resty();

        TextResource response = resty.text(String.format("https://localhost:%d%s", getPort(), HelloWorldTestResource.HELLO_WORLD_PATH));

        assertThat(response.toString(), equalTo(HelloWorldTestResource.HELLO_WORLD));
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.