當前位置: 首頁>>代碼示例>>Java>>正文


Java GeneratorContext.getResourcesOracle方法代碼示例

本文整理匯總了Java中com.google.gwt.core.ext.GeneratorContext.getResourcesOracle方法的典型用法代碼示例。如果您正苦於以下問題:Java GeneratorContext.getResourcesOracle方法的具體用法?Java GeneratorContext.getResourcesOracle怎麽用?Java GeneratorContext.getResourcesOracle使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.google.gwt.core.ext.GeneratorContext的用法示例。


在下文中一共展示了GeneratorContext.getResourcesOracle方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getTemplateResource

import com.google.gwt.core.ext.GeneratorContext; //導入方法依賴的package包/類
private Resource getTemplateResource(GeneratorContext context) {
	String packageResourcePath = this.targetType.getPackage().getName().replace('.', '/') + "/";
	ResourceOracle resourceOracle = context.getResourcesOracle();
	Map<String, Resource> reourceMap = new HashMap<>();
	for (Resource resource : resourceOracle.getResources()) {
		reourceMap.put(resource.getPath(), resource);
	}
	String templatePath =
		packageResourcePath + this.templateName + "_" + this.locale + UiBinderLocalizedCreator.TEMPLATE_SUFFIX;
	Resource templateResource = reourceMap.get(templatePath);
	if (templateResource == null) {
		this.locale = null;
		templatePath = packageResourcePath + this.templateName + UiBinderLocalizedCreator.TEMPLATE_SUFFIX;
		templateResource = reourceMap.get(templatePath);
	}
	if (templateResource != null) {
		this.templateName = templatePath.replace(packageResourcePath, "");
	}
	return templateResource;
}
 
開發者ID:Putnami,項目名稱:putnami-web-toolkit,代碼行數:21,代碼來源:UiBinderLocalizedCreator.java

示例2: createTemplateImpl

import com.google.gwt.core.ext.GeneratorContext; //導入方法依賴的package包/類
/**
 * Create the template resource implementation based on the result of the template parser.
 * @param context The resource context (used to retrieve resources)
 * @param printWriter The source writer
 * @param componentTypeName The name of our Template class
 * @param templateParserResult The result of the HTML template parsed by {@link TemplateParser}
 * @throws UnableToCompleteException in case it fails to compile the HTML template to a JS
 * render function
 */
private void createTemplateImpl(GeneratorContext context, TreeLogger logger,
    PrintWriter printWriter, ClassName componentTypeName,
    TemplateParserResult templateParserResult) throws UnableToCompleteException
{
    // Resources are in the "client" folder to be included during GWT compilation
    Folder folder = new GwtResourceFolder(context.getResourcesOracle(),
        "com/axellience/vuegwt/gwt2/client/template/compiler");

    TemplateImplBuilder templateImplBuilder = new TemplateImplBuilder();
    TypeSpec templateImplType =
        templateImplBuilder.buildTemplateImpl(componentTypeName, templateParserResult, folder);

    // Write class
    JavaFile javaFile =
        JavaFile.builder(componentTypeName.packageName(), templateImplType).build();

    try
    {
        javaFile.writeTo(printWriter);
    }
    catch (IOException e)
    {
        logger.log(TreeLogger.ERROR,
            "Cannot write java file for component: " + componentTypeName.reflectionName());
        throw new UnableToCompleteException();
    }

    context.commit(logger, printWriter);
}
 
開發者ID:Axellience,項目名稱:vue-gwt,代碼行數:39,代碼來源:TemplateGwtGenerator.java

示例3: TypeXmlFinder

import com.google.gwt.core.ext.GeneratorContext; //導入方法依賴的package包/類
TypeXmlFinder(GeneratorContext context, TreeLogger logger){
  super(context, logger);
  this.resourceOracle = context.getResourcesOracle();

  JClassType[] _collectionOrMap = new JClassType[2];
  try{
    _collectionOrMap[0] = typeOracle.getType(Collection.class.getName());
    _collectionOrMap[1] = typeOracle.getType(Map.class.getName());
  }catch(NotFoundException e){
    _collectionOrMap = null;
  }
  collectionOrMap = _collectionOrMap;
}
 
開發者ID:seanchenxi,項目名稱:gwt-storage,代碼行數:14,代碼來源:TypeXmlFinder.java


注:本文中的com.google.gwt.core.ext.GeneratorContext.getResourcesOracle方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。