本文整理汇总了Java中com.google.gwt.core.ext.linker.ArtifactSet.add方法的典型用法代码示例。如果您正苦于以下问题:Java ArtifactSet.add方法的具体用法?Java ArtifactSet.add怎么用?Java ArtifactSet.add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.gwt.core.ext.linker.ArtifactSet
的用法示例。
在下文中一共展示了ArtifactSet.add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: link
import com.google.gwt.core.ext.linker.ArtifactSet; //导入方法依赖的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;
}
示例2: link
import com.google.gwt.core.ext.linker.ArtifactSet; //导入方法依赖的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;
}
示例3: link
import com.google.gwt.core.ext.linker.ArtifactSet; //导入方法依赖的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;
}
示例4: link
import com.google.gwt.core.ext.linker.ArtifactSet; //导入方法依赖的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;
}
示例5: link
import com.google.gwt.core.ext.linker.ArtifactSet; //导入方法依赖的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;
}
示例6: perPermutationLink
import com.google.gwt.core.ext.linker.ArtifactSet; //导入方法依赖的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;
}
示例7: getPermutationArtifacts
import com.google.gwt.core.ext.linker.ArtifactSet; //导入方法依赖的package包/类
@Test
public void getPermutationArtifacts()
{
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 ] ) );
artifacts1.add( artifact2 );
final ArrayList<PermutationArtifact> permutationArtifacts = linker.getPermutationArtifacts( artifacts1 );
assertEquals( permutationArtifacts.size(), 2 );
assertTrue( permutationArtifacts.contains( artifact1 ) );
assertTrue( permutationArtifacts.contains( artifact2 ) );
}
示例8: getArtifactsForCompilation
import com.google.gwt.core.ext.linker.ArtifactSet; //导入方法依赖的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" ) );
}
示例9: link
import com.google.gwt.core.ext.linker.ArtifactSet; //导入方法依赖的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;
}
示例10: link
import com.google.gwt.core.ext.linker.ArtifactSet; //导入方法依赖的package包/类
@Override
public ArtifactSet link(TreeLogger logger, LinkerContext context, ArtifactSet artifacts) throws UnableToCompleteException {
ArtifactSet artifactset = new ArtifactSet(artifacts);
StringBuilder builder = new StringBuilder("CACHE MANIFEST\n");
builder.append("# Cache Version 10\n");
builder.append("CACHE:\n");
builder.append("../css/main.css\n");
builder.append("../Yaph.html\n");
for (EmittedArtifact emitted : artifacts.find(EmittedArtifact.class)) {
if (emitted.getVisibility().equals(Visibility.Private)) {
continue;
}
if (emitted.getPartialPath().endsWith(".symbolMap"))
continue;
if (emitted.getPartialPath().endsWith(".txt"))
continue;
builder.append("" + emitted.getPartialPath()).append("\n");
}
builder.append("yaph.nocache.js\n");
builder.append("NETWORK:\n");
builder.append("*\n");
EmittedArtifact manifest = emitString(logger, builder.toString(), "offline.appcache");
artifactset.add(manifest);
return artifactset;
}
示例11: testEmptyManifestDevMode
import com.google.gwt.core.ext.linker.ArtifactSet; //导入方法依赖的package包/类
public void testEmptyManifestDevMode() throws UnableToCompleteException {
// No SelectionInformation artifact
artifacts = new ArtifactSet();
SimpleAppCacheLinker linker = new SimpleAppCacheLinker();
// Some cacheable artifact
artifacts.add(new SyntheticArtifact(SimpleAppCacheLinker.class, "foo.bar", new byte[0]));
ArtifactSet result = linker.link(logger, new MockLinkerContext(), artifacts, false);
assertHasOneManifest(result);
assertFalse(getManifestContents(result).contains("foo.bar"));
}
示例12: link
import com.google.gwt.core.ext.linker.ArtifactSet; //导入方法依赖的package包/类
@Override
public ArtifactSet link( TreeLogger logger, LinkerContext context,
ArtifactSet artifacts ) throws UnableToCompleteException {
ArtifactSet toReturn = new ArtifactSet( artifacts );
out = new DefaultTextOutput( true );
long compilationTime = System.currentTimeMillis();
out.print( "(function(){" );
out.newline();
// get compilation result
Set<CompilationResult> results = artifacts
.find( CompilationResult.class );
if( results.size() == 0 ) {
logger.log( TreeLogger.WARN, "Requested 0 permutations" );
return toReturn;
}
CompilationResult result = results.iterator().next();
// get the generated javascript
String[] javaScript = result.getJavaScript();
out.print( "var $wnd;var $doc;" );
out.print( "var $moduleName, $moduleBase;" );
out.newline();
out.print( "if(typeof(window)!='undefined'){$wnd=window;$doc=$wnd.document;}" );
out.newline();
out.print( "if(typeof(navigator)=='undefined'){navigator={};navigator.userAgent='timobile';$doc={};$doc.documentMode=''; }" );
out.newline();
out.print( "var $gwt_version = \"" + About.getGwtVersionNum() + "\";" );
out.newlineOpt();
out.print( context.optimizeJavaScript( logger, javaScript[0] ) );
out.newline();
out.print( "var $stats = function(){};" );
out.newline();
out.print( "var $sessionId = function(){};" );
out.newline();
out.print( "$strongName = '" + result.getStrongName() + "';" );
out.newline();
out.print( "$ti4jCompilationDate = " + compilationTime + ";" );
out.newline();
out.print( "gwtOnLoad(null,'" + context.getModuleName() + "',null);" );
out.newline();
out.print( "})();" );
out.newline();
toReturn.add( emitString( logger, out.toString(), generateJavaScriptPath( context ) ) );
// toReturn.add(emitString(logger, Long.toString(compilationTime),
// APP_COMPILATION_FILE_NAME));
return toReturn;
}
示例13: setUp
import com.google.gwt.core.ext.linker.ArtifactSet; //导入方法依赖的package包/类
@Override
public void setUp() {
artifacts = new ArtifactSet();
artifacts.add(new SelectionInformation("foo", 0, new TreeMap<String, String>()));
logger = TreeLogger.NULL;
}
示例14: perCompileLink
import com.google.gwt.core.ext.linker.ArtifactSet; //导入方法依赖的package包/类
private ArtifactSet perCompileLink( final TreeLogger logger,
final LinkerContext context,
final ArtifactSet artifacts )
throws UnableToCompleteException
{
final ArrayList<PermutationArtifact> permutationArtifacts = getPermutationArtifacts( artifacts );
if ( 0 == permutationArtifacts.size() )
{
// hosted mode
return new ArtifactSet( artifacts );
}
final Set<String> allPermutationFiles = getAllPermutationFiles( permutationArtifacts );
// get all artifacts
final Set<String> allArtifacts = getArtifactsForCompilation( context, artifacts );
final ArtifactSet results = new ArtifactSet( artifacts );
for ( final PermutationArtifact permutation : permutationArtifacts )
{
// make a copy of all artifacts
final HashSet<String> filesForCurrentPermutation = new HashSet<String>( allArtifacts );
// remove all permutations
filesForCurrentPermutation.removeAll( allPermutationFiles );
// add files of the one permutation we are interested in
// leaving the common stuff for all permutations in...
for ( final String file : permutation.getPermutation().getPermutationFiles() )
{
if ( allArtifacts.contains( file ) )
{
filesForCurrentPermutation.add( file );
}
}
// build manifest
final Set<String> externalFiles = getConfigurationValues( context, STATIC_FILES_CONFIGURATION_PROPERTY_NAME );
final Map<String, String> fallbackFiles =
parseFallbackResources( logger, getConfigurationValues( context, FALLBACK_FILES_CONFIGURATION_PROPERTY_NAME ) );
final String maniFest = writeManifest( logger, externalFiles, fallbackFiles, filesForCurrentPermutation );
final String filename =
permutation.getPermutation().getPermutationName() + Permutation.PERMUTATION_MANIFEST_FILE_ENDING;
results.add( emitString( logger, maniFest, filename ) );
}
results.add( createPermutationMap( logger, permutationArtifacts ) );
return results;
}
示例15: calculatePermutation
import com.google.gwt.core.ext.linker.ArtifactSet; //导入方法依赖的package包/类
@Test
public void calculatePermutation()
throws UnableToCompleteException
{
final AppcacheLinker linker = new AppcacheLinker();
final ArtifactSet artifacts1 = new ArtifactSet();
artifacts1.add( new PermutationArtifact( AppcacheLinker.class, new Permutation( "1" ) ) );
artifacts1.add( new StandardGeneratedResource( "myapp.devmode.js", new byte[ 0 ] ) );
artifacts1.add( new StandardGeneratedResource( "file1.txt", new byte[ 0 ] ) );
final TreeMap<String, String> configs2 = new TreeMap<String, String>();
configs2.put( "user.agent", "ie9" );
configs2.put( "screen.size", "large" );
configs2.put( "geolocationSupport", "maybe" );
artifacts1.add( new SelectionInformation( "S2", 0, configs2 ) );
final TreeMap<String, String> configs3 = new TreeMap<String, String>();
configs3.put( "user.agent", "ie9" );
configs3.put( "screen.size", "small" );
configs3.put( "geolocationSupport", "maybe" );
artifacts1.add( new SelectionInformation( "S2", 1, configs3 ) );
final LinkerContext linkerContext = mock( LinkerContext.class );
when( linkerContext.getModuleName() ).thenReturn( "myapp" );
final TreeSet<SelectionProperty> properties = new TreeSet<SelectionProperty>();
properties.add( new TestSelectionProperty( "user.agent", false ) );
properties.add( new TestSelectionProperty( "screen.size", false ) );
properties.add( new TestSelectionProperty( "geolocationSupport", true ) );
when( linkerContext.getProperties() ).thenReturn( properties );
final Permutation permutation = linker.calculatePermutation( TreeLogger.NULL, linkerContext, artifacts1 );
assertEquals( permutation.getPermutationName(), "S2" );
final Set<String> files = permutation.getPermutationFiles();
assertEquals( files.size(), 1 );
assertTrue( files.contains( "myapp/file1.txt" ) );
final List<SelectionDescriptor> softPermutations = permutation.getSelectors();
assertEquals( softPermutations.size(), 2 );
final SelectionDescriptor s0 = softPermutations.get( 0 );
final List<BindingProperty> bp0 = s0.getBindingProperties();
final BindingProperty property01 = findProperty( "user.agent", bp0 );
assertNotNull( property01 );
assertEquals( property01.getValue(), "ie9" );
final BindingProperty property02 = findProperty( "screen.size", bp0 );
assertNotNull( property02 );
assertEquals( property02.getValue(), "large" );
final SelectionDescriptor s1 = softPermutations.get( 1 );
final List<BindingProperty> bp1 = s1.getBindingProperties();
final BindingProperty property11 = findProperty( "user.agent", bp1 );
assertNotNull( property11 );
assertEquals( property11.getValue(), "ie9" );
final BindingProperty property12 = findProperty( "screen.size", bp1 );
assertNotNull( property12 );
assertEquals( property12.getValue(), "small" );
}