本文整理汇总了Java中com.google.gwt.core.ext.LinkerContext类的典型用法代码示例。如果您正苦于以下问题:Java LinkerContext类的具体用法?Java LinkerContext怎么用?Java LinkerContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LinkerContext类属于com.google.gwt.core.ext包,在下文中一共展示了LinkerContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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");
}
示例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;
}
示例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 );
}
}
示例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;
}
示例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;
}
示例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" ) );
}
示例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;
}
}
}
}
示例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);
}
示例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";
}