本文整理汇总了Java中com.google.gwt.core.ext.linker.ArtifactSet.find方法的典型用法代码示例。如果您正苦于以下问题:Java ArtifactSet.find方法的具体用法?Java ArtifactSet.find怎么用?Java ArtifactSet.find使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.gwt.core.ext.linker.ArtifactSet
的用法示例。
在下文中一共展示了ArtifactSet.find方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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) 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);
}
示例5: 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;
}
示例6: assertHasOneManifest
import com.google.gwt.core.ext.linker.ArtifactSet; //导入方法依赖的package包/类
private void assertHasOneManifest(ArtifactSet artifacts) {
int manifestCount = 0;
for (SyntheticArtifact artifact : artifacts.find(SyntheticArtifact.class)) {
if ("appcache.nocache.manifest".equals(artifact.getPartialPath())) {
assertEquals("appcache.nocache.manifest", artifact.getPartialPath());
manifestCount++;
}
}
assertEquals(1, manifestCount);
}
示例7: getManifest
import com.google.gwt.core.ext.linker.ArtifactSet; //导入方法依赖的package包/类
private SyntheticArtifact getManifest(ArtifactSet artifacts) {
for (SyntheticArtifact artifact : artifacts.find(SyntheticArtifact.class)) {
if ("appcache.nocache.manifest".equals(artifact.getPartialPath())) {
assertEquals("appcache.nocache.manifest", artifact.getPartialPath());
return artifact;
}
}
fail("Manifest not found");
return null;
}
示例8: getPermutationArtifacts
import com.google.gwt.core.ext.linker.ArtifactSet; //导入方法依赖的package包/类
final ArrayList<PermutationArtifact> getPermutationArtifacts( final ArtifactSet artifacts )
{
final ArrayList<PermutationArtifact> results = new ArrayList<PermutationArtifact>();
for ( final PermutationArtifact permutationArtifact : artifacts.find( PermutationArtifact.class ) )
{
results.add( permutationArtifact );
}
return results;
}
示例9: getArtifactsForCompilation
import com.google.gwt.core.ext.linker.ArtifactSet; //导入方法依赖的package包/类
final Set<String> getArtifactsForCompilation( final LinkerContext context, final ArtifactSet artifacts )
{
final Set<String> artifactNames = new HashSet<String>();
for ( final EmittedArtifact artifact : artifacts.find( EmittedArtifact.class ) )
{
if ( Visibility.Public == artifact.getVisibility() && shouldAddToManifest( artifact.getPartialPath() ) )
{
artifactNames.add( context.getModuleName() + "/" + artifact.getPartialPath() );
}
}
return artifactNames;
}
示例10: emitSelectionScript
import com.google.gwt.core.ext.linker.ArtifactSet; //导入方法依赖的package包/类
@Override
protected EmittedArtifact emitSelectionScript(TreeLogger logger,
LinkerContext context, ArtifactSet artifacts)
throws UnableToCompleteException {
// Find the single Script result
Set<Script> results = artifacts.find(Script.class);
ensureSinglePermutation(logger, context, results);
Script result = results.iterator().next();
DefaultTextOutput out = new DefaultTextOutput(true);
// Emit the selection script.
String bootstrap = generateSelectionScript(logger, context, artifacts);
bootstrap = context.optimizeJavaScript(logger, bootstrap);
out.print(bootstrap);
out.newlineOpt();
// Emit the module's JS a closure.
out.print("(function () {");
out.newlineOpt();
out.print("var $gwt_version = \"" + About.getGwtVersionNum() + "\";");
out.newlineOpt();
defineJsWndAndDoc(out);
out.print("var $moduleName, $moduleBase;");
out.newlineOpt();
out.print("var $stats = $wnd.__gwtStatsEvent ? function(a) {$wnd.__gwtStatsEvent(a)} : null;");
out.newlineOpt();
out.print("var $strongName = '" + result.getStrongName() + "';");
out.newlineOpt();
out.print(result.getJavaScript());
// Generate the call to tell the bootstrap code that we're ready to go.
out.newlineOpt();
out.print("if (" + context.getModuleFunctionName() + ") "
+ context.getModuleFunctionName() + ".onScriptLoad(gwtOnLoad);");
out.newlineOpt();
out.print("})();");
out.newlineOpt();
return emitString(logger, out.toString(), context.getModuleName()
+ getCompilationExtension(logger, context));
}
示例11: 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;
}
示例12: calculatePermutation
import com.google.gwt.core.ext.linker.ArtifactSet; //导入方法依赖的package包/类
/**
* Return the permutation for a single link step.
*/
final Permutation calculatePermutation( final TreeLogger logger,
final LinkerContext context,
final ArtifactSet artifacts )
throws UnableToCompleteException
{
Permutation permutation = null;
for ( final SelectionInformation result : artifacts.find( SelectionInformation.class ) )
{
final String strongName = result.getStrongName();
if ( null != permutation && !permutation.getPermutationName().equals( strongName ) )
{
throw new UnableToCompleteException();
}
if ( null == permutation )
{
permutation = new Permutation( strongName );
final Set<String> artifactsForCompilation = getArtifactsForCompilation( context, artifacts );
permutation.getPermutationFiles().addAll( artifactsForCompilation );
}
final List<BindingProperty> list = new ArrayList<BindingProperty>();
for ( final SelectionProperty property : context.getProperties() )
{
if ( !property.isDerived() )
{
final String name = property.getName();
final String value = result.getPropMap().get( name );
if ( null != value )
{
list.add( new BindingProperty( name, value ) );
}
}
}
final SelectionDescriptor selection = new SelectionDescriptor( strongName, list );
final List<SelectionDescriptor> selectors = permutation.getSelectors();
if ( !selectors.contains( selection ) )
{
selectors.add( selection );
}
}
if ( null != permutation )
{
logger.log( Type.DEBUG, "Calculated Permutation: " + permutation.getPermutationName() +
" Selectors: " + permutation.getSelectors() );
}
return permutation;
}