Package com.google.gwt.user.rebind

Examples of com.google.gwt.user.rebind.ClassSourceFileComposerFactory


        if (printWriter == null) {
            return null;
        }

        ClassSourceFileComposerFactory composerFactory = new ClassSourceFileComposerFactory(packageName, multicasterClassName);

        composerFactory.addImport(List.class.getName());
        composerFactory.addImport(LinkedList.class.getName());
        composerFactory.addImport(Command.class.getName());
        composerFactory.addImport(ApplicationEvent.class.getName());
        composerFactory.addImport(ApplicationEventListener.class.getName());

        composerFactory.setSuperclass(parentType.getQualifiedSourceName());

        return composerFactory.createSourceWriter(context, printWriter);
    }
View Full Code Here


        if (printWriter == null) {
            return null;
        }

        ClassSourceFileComposerFactory composerFactory = new ClassSourceFileComposerFactory(packageName, beanClassName);

        composerFactory.addImport(Map.class.getName());
        composerFactory.addImport(HashMap.class.getName());
        composerFactory.addImport(ArrayList.class.getName());
        composerFactory.addImport(List.class.getName());
        composerFactory.addImport(Set.class.getName());
        composerFactory.addImport(HashSet.class.getName());
        composerFactory.addImport(Stack.class.getName());
        composerFactory.addImport(Iterator.class.getName());
        composerFactory.addImport(TextConverterManager.class.getName());
        composerFactory.addImport(GlobalTextConverter.class.getName());
        composerFactory.addImport(Factory.class.getName());
        composerFactory.addImport(ComponentProcessor.class.getName());
        composerFactory.addImport(Disposable.class.getName());
        composerFactory.addImport(Initializable.class.getName());
        composerFactory.addImport(ApplicationEventMulticaster.class.getName());
        composerFactory.addImport(DefaultApplicationEventMulticaster.class.getName());
        composerFactory.addImport(ApplicationEventMulticasterAware.class.getName());
        composerFactory.addImport(RootPanel.class.getName());
        composerFactory.addImport(RootLayoutPanel.class.getName());
        composerFactory.addImport(Widget.class.getName());
        composerFactory.addImport(GWT.class.getName());
        composerFactory.addImport(Element.class.getName());
        composerFactory.addImport(Document.class.getName());
        composerFactory.addImport(NodeList.class.getName());

        if (superType.isInterface() != null) {
            composerFactory.addImplementedInterface(superType.getQualifiedSourceName());
        } else {
            composerFactory.setSuperclass(superType.getQualifiedSourceName());
        }

        return composerFactory.createSourceWriter(context, printWriter);
    }
View Full Code Here

        if (printWriter == null) {
            return null;
        }

        ClassSourceFileComposerFactory composerFactory = new ClassSourceFileComposerFactory(packageName, listenerClassName);

        composerFactory.addImport(ApplicationEvent.class.getName());
        composerFactory.addImport(ApplicationEventListener.class.getName());

        composerFactory.addImplementedInterface(ApplicationEventListener.class.getName());

        return composerFactory.createSourceWriter(context, printWriter);
    }
View Full Code Here

    String packageName = classType.getPackage().getName();
    String className = classType.getSimpleSourceName()+"_";
    if(!locale.equalsIgnoreCase("default"))
      className += locale;
   
    ClassSourceFileComposerFactory composer = new ClassSourceFileComposerFactory(packageName, className);
    composer.addImplementedInterface(typeName);
    PrintWriter printWriter = context.tryCreate(logger, composer.getCreatedPackage(), composer.getCreatedClassShortName());
    if(printWriter != null) {
      writer = composer.createSourceWriter(context, printWriter);
     
      for(JMethod method : classType.getMethods()) {
        generateMethod(logger, method);
        methods.add(method);
      }
     
      generateGetByKeyMethod();
     
      writer.commit(logger);
    }
    return composer.getCreatedClassName();
  }
View Full Code Here

        GeneratorContext context, BeanResolver type) {
        logger.log(Type.INFO, "Creating JSON Serializer for " + type.getType());

        String classTypeName = type.getType().getSimpleSourceName() +
            "_JSONCodec";
        ClassSourceFileComposerFactory mcf = new ClassSourceFileComposerFactory(type.getType()
                                                                                    .getPackage()
                                                                                    .getName(),
                classTypeName);
        mcf.addImport(JSONParser.class.getCanonicalName());
        mcf.addImport(JSONObject.class.getCanonicalName());
        mcf.addImport(JSONArray.class.getCanonicalName());
        mcf.addImport(JSONBoolean.class.getCanonicalName());
        mcf.addImport(JSONNumber.class.getCanonicalName());
        mcf.addImport(JSONString.class.getCanonicalName());
        mcf.addImport(JSONNull.class.getCanonicalName());
        mcf.addImport(GWT.class.getCanonicalName());
        mcf.addImport(SerializationException.class.getCanonicalName());
        mcf.addImplementedInterface(JSONCodec.class.getCanonicalName() + "<" +
            type.getType().getQualifiedSourceName() + ">");

        PrintWriter printWriter = context.tryCreate(logger,
                type.getType().getPackage().getName(), classTypeName);

        if (printWriter == null) {
            logger.log(Type.INFO, "Already genned " + classTypeName);

            return;
        }

        SourceWriter writer = mcf.createSourceWriter(context, printWriter);

        writeDeserializer(writer, type);
        writeSerializer(writer, type);

        HashSet<BeanResolver> childrenCopy = new HashSet<BeanResolver>(this.children);
View Full Code Here

        writer.println("}");
    }

    private void writeTopSerializer(TreeLogger logger,
        GeneratorContext context, JClassType typeFor, JClassType subType) {
        ClassSourceFileComposerFactory mcf = new ClassSourceFileComposerFactory(typeFor.getPackage()
                                                                                       .getName(),
                typeFor.getSimpleSourceName() + "_Impl");
        mcf.addImplementedInterface(typeFor.getParameterizedQualifiedSourceName());
        mcf.setSuperclass(subType.getParameterizedQualifiedSourceName() +
            "_JSONCodec");

        PrintWriter printWriter = context.tryCreate(logger,
                typeFor.getPackage().getName(),
                typeFor.getSimpleSourceName() + "_Impl");

        if (printWriter == null) {
            logger.log(Type.INFO,
                "Already genned " + typeFor.getSimpleSourceName() + "_Impl");

            return;
        }

        SourceWriter writer = mcf.createSourceWriter(context, printWriter);
        writer.println(" public String getMimeType() { return MIME_TYPE; }");
        writer.println("}");
        context.commit(logger, printWriter);
    }
View Full Code Here

        } catch (NotFoundException ex) {
            logger.log( TreeLogger.Type.ERROR, "Unable to find async type for "+type, ex);
            throw new UnableToCompleteException();
        }

        ClassSourceFileComposerFactory mcf = new ClassSourceFileComposerFactory(packageName,
                className);
        mcf.setSuperclass(StreamingServiceStub.class.getCanonicalName());
        mcf.addImplementedInterface(type.getQualifiedSourceName() + "Async");
        mcf.addImport( SerializationStreamFactory.class.getCanonicalName() );
        mcf.addImport( GWT.class.getCanonicalName() );
        mcf.addImport( StreamServiceCallback.class.getCanonicalName() );
        mcf.addImport( ClientSerializationStreamWriter.class.getCanonicalName() );
        mcf.addImport( SerializationException.class.getCanonicalName() );
        PrintWriter pw = context.tryCreate(logger, packageName, className);
        if(pw == null){
             return packageName +"."+className;
        }
        SourceWriter sw = mcf.createSourceWriter(context, pw);

        String generatedRemoteService = type.getQualifiedSourceName() + "_impls"
                + "." +type.getSimpleSourceName() + "_RemoteService";
        sw.print( "private static final SerializationStreamFactory SERIALIZER =");
        sw.print( "(SerializationStreamFactory) GWT.create(");
View Full Code Here

    protected void generateRemoteService(TreeLogger logger,
        GeneratorContext context, JClassType type)
        throws UnableToCompleteException {
        String packageName = type.getQualifiedSourceName() + "_impls";
        String className = type.getSimpleSourceName() + "_RemoteService";
        ClassSourceFileComposerFactory mcf = new ClassSourceFileComposerFactory(packageName,
                className);
        mcf.makeInterface();
        mcf.addImplementedInterface(
            "com.google.gwt.user.client.rpc.RemoteService");

        PrintWriter pw = context.tryCreate(logger, packageName, className);
        if( pw == null ){
           return;
        }
        SourceWriter sw = mcf.createSourceWriter(context, pw);

        for (JMethod method : type.getMethods()) {
            if (!(method.getReturnType() instanceof JClassType)) {
                logger.log(TreeLogger.Type.ERROR,
                    method.getReturnType().getQualifiedSourceName() +
View Full Code Here

    protected void generateRemoteServiceAsync(TreeLogger logger,
        GeneratorContext context, JClassType type)
        throws UnableToCompleteException {
        String packageName = type.getQualifiedSourceName() + "_impls";
        String className = type.getSimpleSourceName() + "_RemoteServiceAsync";
        ClassSourceFileComposerFactory mcf = new ClassSourceFileComposerFactory(packageName,
                className);
        mcf.makeInterface();
        PrintWriter pw = context.tryCreate(logger, packageName, className);
        if(pw == null){
            return;
        }
        SourceWriter sw = mcf.createSourceWriter(context, pw);

        for (JMethod method : type.getMethods()) {
            if (!(method.getReturnType() instanceof JClassType)) {
                logger.log(TreeLogger.Type.ERROR,
                    method.getReturnType().getQualifiedSourceName() +
View Full Code Here

        List<BeanResolver> introspectables = this.getIntrospectableTypes(logger, context.getTypeOracle());

        MethodWrapper[] methods = this.findMethods(logger, introspectables);

        ClassSourceFileComposerFactory mcf = new ClassSourceFileComposerFactory(this.packageName,
                this.methodsImplementationName);
        mcf.addImport(com.totsp.gwittir.client.beans.Method.class.getCanonicalName());

        PrintWriter methodsPrintWriter = context.tryCreate(logger, this.packageName, this.methodsImplementationName);

        if (methodsPrintWriter != null) {
            SourceWriter methodsWriter = mcf.createSourceWriter(context, methodsPrintWriter);
            this.writeMethods(logger, methods, methodsWriter);
            methodsWriter.println("}");
            context.commit(logger, methodsPrintWriter);
        }

        ClassSourceFileComposerFactory cfcf = new ClassSourceFileComposerFactory(this.packageName,
                this.implementationName);
        cfcf.addImplementedInterface(typeName);
        cfcf.addImport("java.util.HashMap");
        cfcf.addImport(com.totsp.gwittir.client.beans.Method.class.getCanonicalName());
        cfcf.addImport(com.totsp.gwittir.client.beans.Property.class.getCanonicalName());
        cfcf.addImport(com.totsp.gwittir.client.beans.BeanDescriptor.class.getCanonicalName());

        PrintWriter printWriter = context.tryCreate(logger, packageName, implementationName);

        if (printWriter == null) {
            //.println( "Introspector Generate skipped.");
            return packageName + "." + implementationName;
        }

        SourceWriter writer = cfcf.createSourceWriter(context, printWriter);
        this.writeIntrospectables(logger, introspectables, methods, writer);
        this.writeResolver(introspectables, writer);

        writer.println(
            "private HashMap<Class,BeanDescriptor> beanDescriptorLookup = new HashMap<Class,BeanDescriptor>();");
View Full Code Here

TOP

Related Classes of com.google.gwt.user.rebind.ClassSourceFileComposerFactory

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.