Example usage for com.google.gwt.resources.ext ClientBundleFields define

List of usage examples for com.google.gwt.resources.ext ClientBundleFields define

Introduction

In this page you can find the example usage for com.google.gwt.resources.ext ClientBundleFields define.

Prototype

String define(JType type, String name, String initializer, boolean isStatic, boolean isFinal);

Source Link

Document

Adds a field to the bundle.

Usage

From source file:org.vectomatic.dev.svg.impl.gen.ExternalSVGResourceGenerator.java

License:Apache License

@Override
public void createFields(TreeLogger logger, ResourceContext context, ClientBundleFields fields)
        throws UnableToCompleteException {
    data.append(']');

    urlExpression = context.deploy(/*w  ww .  ja  v  a 2  s .  co m*/
            context.getClientBundleType().getQualifiedSourceName().replace('.', '_') + "_jsonbundle.txt",
            "text/plain", data.toString().getBytes(), true);

    TypeOracle typeOracle = context.getGeneratorContext().getTypeOracle();
    JClassType stringType = typeOracle.findType(String.class.getName());
    assert stringType != null;

    externalSVGUrlIdent = fields.define(stringType, "externalSVGUrl", urlExpression, true, true);

    JClassType textResourceType = typeOracle.findType(SVGResource.class.getName());
    assert textResourceType != null;
    JType textResourceArrayType = typeOracle.getArrayType(textResourceType);

    externalSVGCacheIdent = fields.define(textResourceArrayType, "externalSVGCache",
            "new " + SVGResource.class.getName() + "[" + currentIndex + "]", true, true);
}