示例#1
0
  public void saveTo(File file, String renameTo) {
    boolean absoluteFile = renameTo.endsWith(".gwt.xml");
    if (absoluteFile) {
      renameTo = renameTo.substring(0, renameTo.length() - 8);
    }
    boolean rename = !renameTo.replace('/', '.').equals(module.getInheritName());

    final String inheritName;
    if (rename) {
      final String pkg, name;
      int ind = renameTo.lastIndexOf('.');
      boolean moveToPackage = ind > -1;
      if (moveToPackage) {
        pkg = renameTo.substring(0, ind).replace('.', '/');
        name = renameTo.substring(ind + 1);
      } else {
        pkg = "";
        name = renameTo;
      }
      if (pkg.length() == 0) {
        inheritName = name;
      } else {
        if (file.isDirectory()) {
          File f = new File(file, pkg);
          f.mkdirs();
          f.deleteOnExit();
          file = f;
        }
        inheritName = pkg + (pkg.length() == 0 ? "" : ".") + name;
      }
    } else {
      inheritName = renameTo;
    }
  }
示例#2
0
 public GwtcContext(GwtcService gwtcService, ClassLoader resourceLoader) {
   this.gwtcService = gwtcService;
   // Start scanning the classpath, but don't block until we need to.
   final Callable<ClasspathResourceMap> scanner = X_Scanner.scanClassloaderAsync(resourceLoader);
   classpath =
       new SingletonProvider<ClasspathResourceMap>() {
         @Override
         protected ClasspathResourceMap initialValue() {
           try {
             return scanner.call();
           } catch (Exception e) {
             throw X_Debug.rethrow(e);
           }
         }
       };
   String genName = "Gwtc" + Math.abs(hashCode() - System.nanoTime());
   module = new GwtcXmlBuilder("", genName, false);
   module.addConfigurationProperty("xsiframe.failIfScriptTag", "FALSE");
   module.setPublic("public");
 }
示例#3
0
 public void setRenameTo(String renameTo) {
   module.setRenameTo(renameTo);
 }
示例#4
0
 public XmlBuffer getGwtXml() {
   return module.getBuffer();
 }
示例#5
0
 public void addGwtXmlInherit(String value) {
   module.addInherit(value);
 }
示例#6
0
 public void addGwtXmlSource(String genPrefix) {
   module.addSource(genPrefix);
 }
示例#7
0
 public void setEntryPoint(String qualifiedName) {
   module.setEntryPoint(qualifiedName);
 }
示例#8
0
 public String getGenName() {
   return module.getInheritName();
 }
示例#9
0
 public void inheritGwtXml(String inherit) {
   module.inherit(inherit);
 }
示例#10
0
 public void saveTo(File file) {
   saveTo(file, module.getInheritName());
 }
示例#11
0
 public String generateGwtXml(Gwtc gwtc, String pkg, String name) {
   xml = GwtcXmlBuilder.generateGwtXml(gwtc, pkg, name);
   return xml.getInheritName();
 }