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

Java LinkerContext类代码示例

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

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



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

示例1: getPageRelativeModulePath

import com.google.gwt.core.ext.LinkerContext; //导入依赖的package包/类
private static String getPageRelativeModulePath(LinkerContext context) {
    String moduleName = context.getModuleName();

    List<String> pathBindings = null;
    for (ConfigurationProperty property : context.getConfigurationProperties()) {
        if (PAGE_RELATIVE_MODULE_PATH.equals(property.getName())) {
            pathBindings = property.getValues();
        }
    }
    if (pathBindings == null) return moduleName;

    for (String binding : pathBindings) {
        String[] parts = binding.split("=");
        if (parts.length == 2 && moduleName.equals(parts[0])) {
            System.out.println("      Setting page-relative module path for module '" + moduleName + "' using gwt.xml config");
            return parts[1];
        }
    }

    return moduleName;
}
 
开发者ID:iSergio,项目名称:gwt-cs,代码行数:22,代码来源:CesiumScriptInjector.java


示例2: link

import com.google.gwt.core.ext.LinkerContext; //导入依赖的package包/类
@Override
public ArtifactSet link(TreeLogger logger, LinkerContext context, ArtifactSet artifacts) throws UnableToCompleteException {
    ArtifactSet toReturn = new ArtifactSet(artifacts);

    Set<EmittedArtifact> emittedArtifacts = artifacts.find(EmittedArtifact.class);
    for (EmittedArtifact emittedArtifact : emittedArtifacts) {
        String partialPath = emittedArtifact.getPartialPath();
        // Add to Cesium.js file, path, where Cesium/Cesium.js stored.
        // It need for inject css files for example - Viewer
        if (partialPath.endsWith("/Cesium.js")) {
            String contents = CesiumLinkerUtils.getContents(emittedArtifact, logger);
            StringBuffer sb = new StringBuffer(contents);
            sb.insert(0, "window.CesiumPath = '" + context.getModuleName() + "/js/';\n");
            toReturn.remove(emittedArtifact);
            toReturn.add(emitString(logger, sb.toString(), partialPath));
        }
    }
    return toReturn;
}
 
开发者ID:iSergio,项目名称:gwt-cs,代码行数:20,代码来源:CesiumLinker.java


示例3: link

import com.google.gwt.core.ext.LinkerContext; //导入依赖的package包/类
@Override
public ArtifactSet link(TreeLogger logger, LinkerContext context, ArtifactSet artifacts) throws UnableToCompleteException {
    ArtifactSet toReturn = new ArtifactSet(artifacts);

    Set<EmittedArtifact> emittedArtifacts = artifacts.find(EmittedArtifact.class);
    for (EmittedArtifact emittedArtifact : emittedArtifacts) {
        String partialPath = emittedArtifact.getPartialPath();
        // Add to Cesium.js file, path, where Cesium/Cesium.js stored.
        // It need for inject css files for example - Viewer
        if (partialPath.endsWith("/olcesium.js")) {
            String contents = OLCesiumLinkerUtils.getContents(emittedArtifact, logger);
            StringBuffer sb = new StringBuffer(contents);
            sb.insert(0, "window.OpenLayersPath = '" + context.getModuleName() + "/js/';\n");
            toReturn.remove(emittedArtifact);
            toReturn.add(emitString(logger, sb.toString(), partialPath));
        }
    }
    return toReturn;
}
 
开发者ID:iSergio,项目名称:gwt-olcs,代码行数:20,代码来源:OLCesiumLinker.java


示例4: doEmitCompilation

import com.google.gwt.core.ext.LinkerContext; //导入依赖的package包/类
@Override
protected Collection<Artifact<?>> doEmitCompilation(TreeLogger logger,
    LinkerContext context, CompilationResult result, ArtifactSet artifacts)
    throws UnableToCompleteException {

  String[] js = result.getJavaScript();
  if (js.length != 1) {
    logger.branch(TreeLogger.ERROR, getMultiFragmentWarningMessage(), null);
    throw new UnableToCompleteException();
  }

  Collection<Artifact<?>> toReturn = new ArrayList<Artifact<?>>();
  toReturn.add(new Script(result.getStrongName(), js[0]));
  toReturn.addAll(emitSelectionInformation(result.getStrongName(), result));
  return toReturn;
}
 
开发者ID:metteo,项目名称:gwt-worker,代码行数:17,代码来源:SingleScriptLinker.java


示例5: link

import com.google.gwt.core.ext.LinkerContext; //导入依赖的package包/类
@Override
public ArtifactSet link(
    TreeLogger logger, LinkerContext context, ArtifactSet artifacts, boolean onePermutation)
    throws UnableToCompleteException {
  ArtifactSet toReturn = new ArtifactSet(artifacts);
  ArtifactSet writableArtifacts = new ArtifactSet(artifacts);
  boolean export = getExportProperty(context);

  for (CompilationResult result : toReturn.find(CompilationResult.class)) {
    String[] js = result.getJavaScript();
    checkArgument(js.length == 1, "MinimalLinker doesn't support GWT.runAsync");

    String output = formatOutput(js[0], export);
    toReturn.add(emitString(logger, output, context.getModuleName() + ".js"));
  }

  for (SymbolMapsLinker.ScriptFragmentEditsArtifact ea :
      writableArtifacts.find(SymbolMapsLinker.ScriptFragmentEditsArtifact.class)) {
    toReturn.add(ea);
  }
  return toReturn;
}
 
开发者ID:google,项目名称:closure-compiler,代码行数:23,代码来源:MinimalLinker.java


示例6: link

import com.google.gwt.core.ext.LinkerContext; //导入依赖的package包/类
@Override
public ArtifactSet link( TreeLogger logger, LinkerContext context, ArtifactSet artifacts, boolean onePermutation ) throws UnableToCompleteException
{
	MANIFEST = context.getModuleName() + ".appcache";

	ArtifactSet toReturn = new ArtifactSet( artifacts );

	if( onePermutation )
	{
		return toReturn;
	}

	if( toReturn.find( SelectionInformation.class ).isEmpty() )
	{
		logger.log( TreeLogger.INFO, "DevMode warning: Clobbering " + MANIFEST + " to allow debugging. Recompile before deploying your app!" + artifacts );
		// artifacts = null;
		return toReturn;
	}

	// Create the general cache-manifest resource for the landing page:
	toReturn.add( emitLandingPageCacheManifest( context, logger, artifacts ) );
	return toReturn;
}
 
开发者ID:ltearno,项目名称:hexa.tools,代码行数:24,代码来源:AppCacheLinker.java


示例7: emitSelectionScript

import com.google.gwt.core.ext.LinkerContext; //导入依赖的package包/类
@Override
protected EmittedArtifact emitSelectionScript(TreeLogger logger, LinkerContext context, ArtifactSet artifacts) throws UnableToCompleteException {
    Set<WorkerScript> scripts = artifacts.find(WorkerScript.class);
    if (scripts.size() != 1) {
        logger.branch(TreeLogger.ERROR, "Too many scripts");
        throw new UnableToCompleteException();
    }
    WorkerScript script = scripts.iterator().next();

    DefaultTextOutput output = new DefaultTextOutput(true);

    output.print(context.optimizeJavaScript(logger, generateSelectionScript(logger, context, artifacts)));
    output.newlineOpt();
    output.print(script.javascript);
    output.newlineOpt();
    output.print("gwtOnLoad(null, \"__MODULE_NAME__\", null);");

    return emitString(logger, output.toString(), context.getModuleName() + ".worker.js");
}
 
开发者ID:Thinkofname,项目名称:ThinkMap,代码行数:20,代码来源:WorkerLinker.java


示例8: link

import com.google.gwt.core.ext.LinkerContext; //导入依赖的package包/类
@Override
public ArtifactSet link(TreeLogger logger, LinkerContext context, ArtifactSet artifacts,
    boolean onePermutation)
    throws UnableToCompleteException {
  
  ArtifactSet toReturn = new ArtifactSet(artifacts);
  
  if (onePermutation) {
    return toReturn;
  }

  if (toReturn.find(SelectionInformation.class).isEmpty()) {
    logger.log(TreeLogger.INFO, "DevMode warning: Clobbering " + MANIFEST + " to allow debugging. "
        + "Recompile before deploying your app!");
    artifacts = null;
  }
  
  // Create the general cache-manifest resource for the landing page:
  toReturn.add(emitLandingPageCacheManifest(context, logger, artifacts));
  return toReturn;
}
 
开发者ID:Peergos,项目名称:Peergos,代码行数:22,代码来源:SimpleAppCacheLinker.java


示例9: link

import com.google.gwt.core.ext.LinkerContext; //导入依赖的package包/类
@Override
public ArtifactSet link( final TreeLogger logger,
                         final LinkerContext context,
                         final ArtifactSet artifacts,
                         final boolean onePermutation )
  throws UnableToCompleteException
{
  if ( onePermutation )
  {
    return perPermutationLink( logger, context, artifacts );
  }
  else
  {
    return perCompileLink( logger, context, artifacts );
  }
}
 
开发者ID:realityforge,项目名称:gwt-appcache,代码行数:17,代码来源:AppcacheLinker.java


示例10: perPermutationLink

import com.google.gwt.core.ext.LinkerContext; //导入依赖的package包/类
final ArtifactSet perPermutationLink( final TreeLogger logger,
                                      final LinkerContext context,
                                      final ArtifactSet artifacts )
  throws UnableToCompleteException
{
  final Permutation permutation = calculatePermutation( logger, context, artifacts );
  if ( null == permutation )
  {
    logger.log( Type.ERROR, "Unable to calculate permutation " );
    throw new UnableToCompleteException();
  }

  final ArtifactSet results = new ArtifactSet( artifacts );
  results.add( new PermutationArtifact( AppcacheLinker.class, permutation ) );
  return results;
}
 
开发者ID:realityforge,项目名称:gwt-appcache,代码行数:17,代码来源:AppcacheLinker.java


示例11: getConfigurationValues

import com.google.gwt.core.ext.LinkerContext; //导入依赖的package包/类
@Nonnull
final Set<String> getConfigurationValues( @Nonnull final LinkerContext context, @Nonnull final String propertyName )
{
  final HashSet<String> set = new HashSet<String>();
  final SortedSet<ConfigurationProperty> properties = context.getConfigurationProperties();
  for ( final ConfigurationProperty configurationProperty : properties )
  {
    if ( propertyName.equals( configurationProperty.getName() ) )
    {
      for ( final String value : configurationProperty.getValues() )
      {
        set.add( value );
      }
    }
  }

  return set;
}
 
开发者ID:realityforge,项目名称:gwt-appcache,代码行数:19,代码来源:AppcacheLinker.java


示例12: getArtifactsForCompilation

import com.google.gwt.core.ext.LinkerContext; //导入依赖的package包/类
@Test
public void getArtifactsForCompilation()
{
  final AppcacheLinker linker = new AppcacheLinker();
  final ArtifactSet artifacts1 = new ArtifactSet();
  final PermutationArtifact artifact1 = new PermutationArtifact( AppcacheLinker.class, new Permutation( "1" ) );
  final PermutationArtifact artifact2 = new PermutationArtifact( AppcacheLinker.class, new Permutation( "2" ) );
  artifacts1.add( artifact1 );
  artifacts1.add( new StandardGeneratedResource( "path1", new byte[ 0 ] ) );
  artifacts1.add( new StandardGeneratedResource( "path2", new byte[ 0 ] ) );
  final StandardGeneratedResource resource =
    new StandardGeneratedResource( "path3", new byte[ 0 ] );
  resource.setVisibility( Visibility.Private );
  artifacts1.add( resource );
  artifacts1.add( new StandardGeneratedResource( "compilation-mappings.txt", new byte[ 0 ] ) );
  artifacts1.add( new StandardGeneratedResource( "myapp.devmode.js", new byte[ 0 ] ) );
  artifacts1.add( artifact2 );
  final LinkerContext linkerContext = mock( LinkerContext.class );
  when( linkerContext.getModuleName() ).thenReturn( "myapp" );
  final Set<String> files =
    linker.getArtifactsForCompilation( linkerContext, artifacts1 );
  assertEquals( files.size(), 2 );
  assertTrue( files.contains( "myapp/path1" ) );
  assertTrue( files.contains( "myapp/path2" ) );
}
 
开发者ID:realityforge,项目名称:gwt-appcache,代码行数:26,代码来源:AppcacheLinkerTest.java


示例13: loadTouchKitWidgetSetResources

import com.google.gwt.core.ext.LinkerContext; //导入依赖的package包/类
/**
 * Traverses directories specified in gwt modules to be added to cache
 * manifests. E.g. themes.
 * 
 * @param context
 */
private void loadTouchKitWidgetSetResources(LinkerContext context) {
    synchronized (cachedArtifacts) {
        SortedSet<ConfigurationProperty> configurationProperties = context
                .getConfigurationProperties();
        for (ConfigurationProperty configurationProperty : configurationProperties) {
            if (configurationProperty.getName().equals(
                    "touchkit.manifestlinker.additionalCacheRoot")) {
                List<String> values = configurationProperty.getValues();
                for (String root : values) {
                    addResourcesRecursively(root);
                }
                break;
            }
        }
    }
}
 
开发者ID:vaadin,项目名称:touchkit,代码行数:23,代码来源:CacheManifestLinker.java


示例14: createCacheManifest

import com.google.gwt.core.ext.LinkerContext; //导入依赖的package包/类
private Artifact<?> createCacheManifest(LinkerContext context,
        TreeLogger logger, Set<String> artifacts, String userAgent)
        throws UnableToCompleteException {

    StringBuilder cm = new StringBuilder();
    cm.append("CACHE MANIFEST\n");
    cm.append("# Build time" + new Date());
    cm.append("\n\nCACHE:\n");

    for (String fn : artifacts) {
        cm.append(fn);
        cm.append("\n");
    }
    cm.append("\nNETWORK:\n");
    cm.append("*\n\n");

    String manifest = cm.toString();
    String manifestName = userAgent + ".manifest";

    return emitString(logger, manifest, manifestName);
}
 
开发者ID:vaadin,项目名称:touchkit,代码行数:22,代码来源:CacheManifestLinker.java


示例15: getSelectionScriptTemplate

import com.google.gwt.core.ext.LinkerContext; //导入依赖的package包/类
@Override
protected String getSelectionScriptTemplate( TreeLogger logger, LinkerContext context )
    throws UnableToCompleteException
{
    String pname = getClass().getPackage().getName().replace( '.', '/' );
    return pname + "/DedicatedWorkerTemplate.js";
}
 
开发者ID:jandsu,项目名称:gwt-webworker,代码行数:8,代码来源:DedicatedWorkerLinker.java


示例16: link

import com.google.gwt.core.ext.LinkerContext; //导入依赖的package包/类
@Override
public ArtifactSet link(TreeLogger logger, LinkerContext context, ArtifactSet artifacts)
    throws UnableToCompleteException {
  ArtifactSet toReturn = super.link(logger, context, artifacts);

  // Create the general cache-manifest resource for the landing page:
  toReturn.add(emitLandingPageCacheManifest(context, logger, toReturn, staticCachedFiles()));

  return toReturn;
}
 
开发者ID:playn,项目名称:playn,代码行数:11,代码来源:AppCacheLinker.java


示例17: link

import com.google.gwt.core.ext.LinkerContext; //导入依赖的package包/类
@Override
public ArtifactSet link(TreeLogger logger, LinkerContext context,
    ArtifactSet artifacts) throws UnableToCompleteException {
    ArtifactSet toLink = new ArtifactSet(artifacts);

    // Mask the stub manifest created by the generator
    for (EmittedArtifact res : toLink.find(EmittedArtifact.class)) {
        if (res.getPartialPath().endsWith(".gadget.xml")) {
            manifestArtifact = res;
            toLink.remove(res);

            break;
        }
    }

    if (manifestArtifact == null) {
        if (artifacts.find(CompilationResult.class).isEmpty()) {
            // Maybe hosted mode or junit, defer to XSLinker.
            return new XSLinker().link(logger, context, toLink);
        } else {
            // When compiling for web mode, enforce that the manifest is present.
            logger.log(TreeLogger.ERROR,
                "No gadget manifest found in ArtifactSet.");
            throw new UnableToCompleteException();
        }
    }

    return super.link(logger, context, toLink);
}
 
开发者ID:kebernet,项目名称:shortyz,代码行数:30,代码来源:GadgetLinker.java


示例18: emitSelectionScript

import com.google.gwt.core.ext.LinkerContext; //导入依赖的package包/类
@Override
protected EmittedArtifact emitSelectionScript(TreeLogger logger,
    LinkerContext context, ArtifactSet artifacts)
    throws UnableToCompleteException {
    logger = logger.branch(TreeLogger.DEBUG, "Building gadget manifest",
            null);

    String bootstrap = "<script>" +
        context.optimizeJavaScript(logger,
            generateSelectionScript(logger, context, artifacts)) +
        "</script>\n" + "<div id=\"__gwt_gadget_content_div\"></div>";

    // Read the content
    StringBuffer manifest = new StringBuffer();

    try {
        BufferedReader in = new BufferedReader(new InputStreamReader(
                    manifestArtifact.getContents(logger)));

        for (String line = in.readLine(); line != null;
                line = in.readLine()) {
            manifest.append(line).append("\n");
        }

        in.close();
    } catch (IOException e) {
        logger.log(TreeLogger.ERROR, "Unable to read manifest stub", e);
        throw new UnableToCompleteException();
    }

    replaceAll(manifest, "__BOOTSTRAP__", bootstrap);

    return emitString(logger, manifest.toString(),
        manifestArtifact.getPartialPath());
}
 
开发者ID:kebernet,项目名称:shortyz,代码行数:36,代码来源:GadgetLinker.java


示例19: generateSelectionScript

import com.google.gwt.core.ext.LinkerContext; //导入依赖的package包/类
@Override
protected String generateSelectionScript(TreeLogger logger,
    LinkerContext context, ArtifactSet artifacts)
    throws UnableToCompleteException {
    StringBuffer scriptContents = new StringBuffer(super.generateSelectionScript(
                logger, context, artifacts));

    // Add a substitution for the GWT major release number. e.g. "1.6"
    int[] gwtVersions = getVersionArray();
    replaceAll(scriptContents, "__GWT_MAJOR_VERSION__",
        gwtVersions[0] + "." + gwtVersions[1]);

    return scriptContents.toString();
}
 
开发者ID:kebernet,项目名称:shortyz,代码行数:15,代码来源:GadgetLinker.java


示例20: getModulePrefix

import com.google.gwt.core.ext.LinkerContext; //导入依赖的package包/类
@Override
protected String getModulePrefix(TreeLogger logger, LinkerContext context,
		String strongName) throws UnableToCompleteException {
	String prefix =  super.getModulePrefix(logger, context, strongName);
	
	TextOutput out = new DefaultTextOutput(context.isOutputCompact());
	
	out.print("var isWorker = typeof importScripts === 'function';");
	out.newlineOpt();
	
	out.print("var $self = isWorker ? self : window;");
	out.newlineOpt();
	
	out.print("if(isWorker) {");
	{
		//simple document emulation in worker context
		out.print("$self.document = {");
		out.print("documentMode: 10,");
		out.print("compatMode: 'CSS1Compat',");
		out.print("location: $self.location,");
		out.print("createElement: function(){throw 'worker!'}");
		out.print("};");
	}
	out.print("}");
	out.newlineOpt();

	// support running of worker code in renderer context
	out.print("var $wnd = $self;");
	out.newlineOpt();
	
	//replace the first line with our code
	prefix.replace("var $wnd = $wnd || window.parent;", out.toString());
	
	return prefix;
}
 
开发者ID:metteo,项目名称:gwt-worker,代码行数:36,代码来源:CrossSiteWorkerLinker.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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