• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java Resource类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.google.gwt.dev.resource.Resource的典型用法代码示例。如果您正苦于以下问题:Java Resource类的具体用法?Java Resource怎么用?Java Resource使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Resource类属于com.google.gwt.dev.resource包,在下文中一共展示了Resource类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getTemplateContent

import com.google.gwt.dev.resource.Resource; //导入依赖的package包/类
private String getTemplateContent(ResourceOracle resourceOracle, TreeLogger logger,
    ClassName componentTypeName) throws UnableToCompleteException
{
    String path = slashify(componentTypeName.reflectionName()) + TEMPLATE_EXTENSION;
    Resource resource = resourceOracle.getResource(path);

    // No resource for the template
    if (resource == null)
    {
        logger.log(TreeLogger.ERROR,
            "\nCouldn't find template for component \""
                + componentTypeName.reflectionName()
                + "\". If it doesn't have a template please set hasTemplate to false in the @Component annotation.");
        throw new UnableToCompleteException();
    }

    // Get template content from HTML file
    try
    {
        return Util.readStreamAsString(resource.openContents());
    }
    catch (IOException e)
    {
        logger.log(TreeLogger.ERROR,
            "\nFailed to open template file for component \""
                + componentTypeName.reflectionName());
        throw new UnableToCompleteException();
    }
}
 
开发者ID:Axellience,项目名称:vue-gwt,代码行数:30,代码来源:TemplateGwtGenerator.java


示例2: getTemplateResource

import com.google.gwt.dev.resource.Resource; //导入依赖的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


示例3: getW3cDoc

import com.google.gwt.dev.resource.Resource; //导入依赖的package包/类
private Document getW3cDoc(MortalLogger logger, DesignTimeUtils designTime,
    ResourceOracle resourceOracle, String templatePath, Resource resource)
    throws UnableToCompleteException {

  Document doc = null;
  try {
    String content = designTime.getTemplateContent(templatePath);
    if (content == null) {
      content = Util.readStreamAsString(resource.openContents());
    }
    doc = new W3cDomHelper(logger.getTreeLogger(), resourceOracle).documentFor(
        content, resource.getPath());
  } catch (IOException iex) {
    logger.die("Error opening resource:" + resource.getLocation(), iex);
  } catch (SAXParseException e) {
    logger.die(
        "Error parsing XML (line " + e.getLineNumber() + "): "
            + e.getMessage(), e);
  }
  return doc;
}
 
开发者ID:ahome-it,项目名称:ahome-core,代码行数:22,代码来源:UiBinderGenerator.java


示例4: getFile

import com.google.gwt.dev.resource.Resource; //导入依赖的package包/类
@Override
public String getFile(String name)
{
    Resource resource = resourceOracle.getResource(getPath() + "/" + name);
    if (resource == null)
        return null;

    return Util.readURLAsString(resource.getURL());
}
 
开发者ID:Axellience,项目名称:vue-gwt,代码行数:10,代码来源:GwtResourceFolder.java


示例5: getContentType

import com.google.gwt.dev.resource.Resource; //导入依赖的package包/类
private static String getContentType(TreeLogger logger, Resource resource) {
  String name = resource.getPath().toLowerCase();
  int pos = name.lastIndexOf('.');
  String extension = pos == -1 ? "" : name.substring(pos);
  String contentType = EXTENSION_MAP.get(extension);
  if (contentType == null) {
    logger.log(
        TreeLogger.WARN,
        "No Content Type mapping for files with '" + extension
            + "' extension. Please add a mapping to the "
            + AutoClientBundleGenerator.class.getCanonicalName() + " class.");
    contentType = "application/octet-stream";
  }
  return contentType;
}
 
开发者ID:playn,项目名称:playn,代码行数:16,代码来源:AutoClientBundleGenerator.java


示例6: preferMp3

import com.google.gwt.dev.resource.Resource; //导入依赖的package包/类
/**
 * Filter file set, preferring *.mp3 files where alternatives exist.
 */
private HashSet<Resource> preferMp3(HashSet<Resource> files) {
  HashMap<String, Resource> map = new HashMap<String, Resource>();
  for (Resource file : files) {
    String path = stripExtension(file.getPath());
    if (file.getPath().endsWith(".mp3") || !map.containsKey(path)) {
      map.put(path, file);
    }
  }
  return new HashSet<Resource>(map.values());
}
 
开发者ID:playn,项目名称:playn,代码行数:14,代码来源:AutoClientBundleGenerator.java


示例7: getResources

import com.google.gwt.dev.resource.Resource; //导入依赖的package包/类
/**
 * Get all related resources of the auto resource bundler.
 */
private HashSet<Resource> getResources(GeneratorContext context, JClassType userType, FileFilter filter) {
  final String pack = userType.getPackage().getName().replace('.', '/');

  HashSet<Resource> resourceList = new HashSet<Resource>();
  for (String path : context.getResourcesOracle().getPathNames()) {
    if (!path.startsWith(pack))
      continue;
    String ext = getExtension(path);
    if (EXTENSION_MAP.containsKey(ext))
      resourceList.add(context.getResourcesOracle().getResource(path));
  }

  return resourceList;
}
 
开发者ID:playn,项目名称:playn,代码行数:18,代码来源:AutoClientBundleGenerator.java


示例8: create

import com.google.gwt.dev.resource.Resource; //导入依赖的package包/类
public String create(TreeLogger logger, GeneratorContext context) {
	Resource templateResource = this.getTemplateResource(context);
	if (templateResource == null) {
		throw new NullPointerException("no template found");
	}
	this.binderProxySimpleName =
		this.targetType.getSimpleSourceName() + "_" + this.binderType.getSimpleSourceName()
			+ UiBinderLocalizedCreator.PROXY_SUFFIX;
	if (this.locale != null) {
		this.binderProxySimpleName += "_" + this.locale.toString();
	}
	this.binderProxyQualifiedName = this.targetType.getPackage().getName() + "." + this.binderProxySimpleName;

	PrintWriter printWriter = this.getPrintWriter(logger, context, this.binderProxyQualifiedName);
	if (printWriter == null) {
		return this.binderProxyQualifiedName;
	}

	SourceWriter srcWriter = this.getSourceWriter(printWriter, context);

	srcWriter.println();
	srcWriter.indent();
	this.generateProxy(logger, srcWriter);
	srcWriter.println();
	srcWriter.outdent();

	srcWriter.commit(logger);

	return this.binderProxyQualifiedName;
}
 
开发者ID:Putnami,项目名称:putnami-web-toolkit,代码行数:31,代码来源:UiBinderLocalizedCreator.java


示例9: generateOnce

import com.google.gwt.dev.resource.Resource; //导入依赖的package包/类
private void generateOnce(JClassType interfaceType, String implName,
    PrintWriter binderPrintWriter, TreeLogger treeLogger, TypeOracle oracle,
    ResourceOracle resourceOracle, PropertyOracle propertyOracle,
    PrintWriterManager writerManager, DesignTimeUtils designTime)
throws UnableToCompleteException {

  MortalLogger logger = new MortalLogger(treeLogger);
  String templatePath = deduceTemplateFile(logger, interfaceType);
  MessagesWriter messages = new MessagesWriter(oracle, BINDER_URI, logger,
      templatePath, interfaceType.getPackage().getName(), implName);

  boolean useLazyWidgetBuilders =
      useLazyWidgetBuilders(logger, propertyOracle) && !designTime.isDesignTime();
  FieldManager fieldManager = new FieldManager(oracle, logger, useLazyWidgetBuilders);

  UiBinderWriter uiBinderWriter = new UiBinderWriter(interfaceType, implName, templatePath,
      oracle, logger, fieldManager, messages, designTime, uiBinderCtx,
      useSafeHtmlTemplates(logger, propertyOracle), useLazyWidgetBuilders, BINDER_URI,
      resourceOracle);

  Resource resource = getTemplateResource(logger, templatePath, resourceOracle);

  // Ensure that generated uibinder source is modified at least as often as synthesized .cssmap
  // resources, otherwise it would be possible to synthesize a modified .cssmap resource but fail
  // to retrigger the InlineClientBundleGenerator that processes it.
  binderPrintWriter.println("// .ui.xml template last modified: " + resource.getLastModified());
  Document doc = getW3cDoc(logger, designTime, resourceOracle, templatePath, resource);
  designTime.rememberPathForElements(doc);

  uiBinderWriter.parseDocument(doc, binderPrintWriter);

  if (messages.hasMessages()) {
    messages.write(writerManager.makePrintWriterFor(messages.getMessagesClassName()));
  }

  ImplicitClientBundle bundleClass = uiBinderWriter.getBundleClass();
  new BundleWriter(bundleClass, writerManager, oracle, logger).write();

  writerManager.commit();
}
 
开发者ID:ahome-it,项目名称:ahome-core,代码行数:41,代码来源:UiBinderGenerator.java


示例10: getTemplateResource

import com.google.gwt.dev.resource.Resource; //导入依赖的package包/类
private Resource getTemplateResource(MortalLogger logger, String templatePath,
    ResourceOracle resourceOracle) throws UnableToCompleteException {
  Resource resource = resourceOracle.getResource(templatePath);
  if (null == resource) {
    logger.die("Unable to find resource: " + templatePath);
  }
  return resource;
}
 
开发者ID:ahome-it,项目名称:ahome-core,代码行数:9,代码来源:UiBinderGenerator.java


示例11: getView

import com.google.gwt.dev.resource.Resource; //导入依赖的package包/类
@Override
public Resource getView(String id) throws ViewException
{
 return null;
}
 
开发者ID:CruxFramework,项目名称:crux-maven-plugin,代码行数:6,代码来源:MojoViewLoader.java



注:本文中的com.google.gwt.dev.resource.Resource类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Map类代码示例发布时间:2022-05-22
下一篇:
Java StatsConfig类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap