From 4e8f703d9371f461f7342dc53bed28a958a35c57 Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Tue, 3 Apr 2012 13:37:41 +0300 Subject: [PATCH] CRLF -> LF --- .../client/ConnectorHierarchyChangeEvent.java | 192 ++++++------- .../vaadin/terminal/gwt/client/Paintable.java | 38 +-- .../gwt/client/communication/RpcProxy.java | 74 ++--- .../RpcProxyCreatorGenerator.java | 266 +++++++++--------- 4 files changed, 285 insertions(+), 285 deletions(-) diff --git a/src/com/vaadin/terminal/gwt/client/ConnectorHierarchyChangeEvent.java b/src/com/vaadin/terminal/gwt/client/ConnectorHierarchyChangeEvent.java index a9293801c8..aa41caf75d 100644 --- a/src/com/vaadin/terminal/gwt/client/ConnectorHierarchyChangeEvent.java +++ b/src/com/vaadin/terminal/gwt/client/ConnectorHierarchyChangeEvent.java @@ -1,97 +1,97 @@ -/* -@VaadinApache2LicenseForJavaFiles@ - */ -package com.vaadin.terminal.gwt.client; - -import java.io.Serializable; -import java.util.List; - -import com.google.gwt.event.shared.EventHandler; -import com.google.gwt.event.shared.GwtEvent; -import com.vaadin.terminal.gwt.client.ConnectorHierarchyChangeEvent.ConnectorHierarchyChangeHandler; -import com.vaadin.terminal.gwt.client.communication.AbstractServerConnectorEvent; - -/** - * Event for containing data related to a change in the {@link ServerConnector} - * hierarchy. A {@link ConnectorHierarchyChangedEvent} is fired when an update - * from the server has been fully processed and all hierarchy updates have been - * completed. - * - * @author Vaadin Ltd - * @version @VERSION@ - * @since 7.0.0 - * - */ -public class ConnectorHierarchyChangeEvent extends - AbstractServerConnectorEvent { - /** - * Type of this event, used by the event bus. - */ - public static final Type TYPE = new Type(); - - List oldChildren; - private ComponentContainerConnector parent; - - public ConnectorHierarchyChangeEvent() { - } - - /** - * Returns a collection of the old children for the connector. This was the - * state before the update was received from the server. - * - * @return A collection of old child connectors. Never returns null. - */ - public List getOldChildren() { - return oldChildren; - } - - /** - * Sets the collection of the old children for the connector. - * - * @param oldChildren - * The old child connectors. Must not be null. - */ - public void setOldChildren(List oldChildren) { - this.oldChildren = oldChildren; - } - - /** - * Returns the {@link ComponentContainerConnector} for which this event - * occurred. - * - * @return The {@link ComponentContainerConnector} whose child collection - * has changed. Never returns null. - */ - public ComponentContainerConnector getParent() { - return parent; - } - - /** - * Sets the {@link ComponentContainerConnector} for which this event - * occurred. - * - * @param The - * {@link ComponentContainerConnector} whose child collection has - * changed. - */ - public void setParent(ComponentContainerConnector parent) { - this.parent = parent; - } - - public interface ConnectorHierarchyChangeHandler extends Serializable, - EventHandler { - public void onConnectorHierarchyChange( - ConnectorHierarchyChangeEvent connectorHierarchyChangeEvent); - } - - @Override - public void dispatch(ConnectorHierarchyChangeHandler handler) { - handler.onConnectorHierarchyChange(this); - } - - @Override - public GwtEvent.Type getAssociatedType() { - return TYPE; - } - +/* +@VaadinApache2LicenseForJavaFiles@ + */ +package com.vaadin.terminal.gwt.client; + +import java.io.Serializable; +import java.util.List; + +import com.google.gwt.event.shared.EventHandler; +import com.google.gwt.event.shared.GwtEvent; +import com.vaadin.terminal.gwt.client.ConnectorHierarchyChangeEvent.ConnectorHierarchyChangeHandler; +import com.vaadin.terminal.gwt.client.communication.AbstractServerConnectorEvent; + +/** + * Event for containing data related to a change in the {@link ServerConnector} + * hierarchy. A {@link ConnectorHierarchyChangedEvent} is fired when an update + * from the server has been fully processed and all hierarchy updates have been + * completed. + * + * @author Vaadin Ltd + * @version @VERSION@ + * @since 7.0.0 + * + */ +public class ConnectorHierarchyChangeEvent extends + AbstractServerConnectorEvent { + /** + * Type of this event, used by the event bus. + */ + public static final Type TYPE = new Type(); + + List oldChildren; + private ComponentContainerConnector parent; + + public ConnectorHierarchyChangeEvent() { + } + + /** + * Returns a collection of the old children for the connector. This was the + * state before the update was received from the server. + * + * @return A collection of old child connectors. Never returns null. + */ + public List getOldChildren() { + return oldChildren; + } + + /** + * Sets the collection of the old children for the connector. + * + * @param oldChildren + * The old child connectors. Must not be null. + */ + public void setOldChildren(List oldChildren) { + this.oldChildren = oldChildren; + } + + /** + * Returns the {@link ComponentContainerConnector} for which this event + * occurred. + * + * @return The {@link ComponentContainerConnector} whose child collection + * has changed. Never returns null. + */ + public ComponentContainerConnector getParent() { + return parent; + } + + /** + * Sets the {@link ComponentContainerConnector} for which this event + * occurred. + * + * @param The + * {@link ComponentContainerConnector} whose child collection has + * changed. + */ + public void setParent(ComponentContainerConnector parent) { + this.parent = parent; + } + + public interface ConnectorHierarchyChangeHandler extends Serializable, + EventHandler { + public void onConnectorHierarchyChange( + ConnectorHierarchyChangeEvent connectorHierarchyChangeEvent); + } + + @Override + public void dispatch(ConnectorHierarchyChangeHandler handler) { + handler.onConnectorHierarchyChange(this); + } + + @Override + public GwtEvent.Type getAssociatedType() { + return TYPE; + } + } \ No newline at end of file diff --git a/src/com/vaadin/terminal/gwt/client/Paintable.java b/src/com/vaadin/terminal/gwt/client/Paintable.java index d2f66241ba..c9e3ef79cc 100755 --- a/src/com/vaadin/terminal/gwt/client/Paintable.java +++ b/src/com/vaadin/terminal/gwt/client/Paintable.java @@ -1,19 +1,19 @@ -/* -@VaadinApache2LicenseForJavaFiles@ - */ - -package com.vaadin.terminal.gwt.client; - -/** - * An interface used by client-side widgets or paintable parts to receive - * updates from the corresponding server-side components in the form of - * {@link UIDL}. - * - * Updates can be sent back to the server using the - * {@link ApplicationConnection#updateVariable()} methods. - */ -@Deprecated -public interface Paintable { - - public void updateFromUIDL(UIDL uidl, ApplicationConnection client); -} +/* +@VaadinApache2LicenseForJavaFiles@ + */ + +package com.vaadin.terminal.gwt.client; + +/** + * An interface used by client-side widgets or paintable parts to receive + * updates from the corresponding server-side components in the form of + * {@link UIDL}. + * + * Updates can be sent back to the server using the + * {@link ApplicationConnection#updateVariable()} methods. + */ +@Deprecated +public interface Paintable { + + public void updateFromUIDL(UIDL uidl, ApplicationConnection client); +} diff --git a/src/com/vaadin/terminal/gwt/client/communication/RpcProxy.java b/src/com/vaadin/terminal/gwt/client/communication/RpcProxy.java index 01f5e13a8d..113ec1f1b1 100644 --- a/src/com/vaadin/terminal/gwt/client/communication/RpcProxy.java +++ b/src/com/vaadin/terminal/gwt/client/communication/RpcProxy.java @@ -1,37 +1,37 @@ -/* -@VaadinApache2LicenseForJavaFiles@ - */ -package com.vaadin.terminal.gwt.client.communication; - -import com.google.gwt.core.client.GWT; -import com.vaadin.terminal.gwt.client.ServerConnector; - -/** - * Class for creating proxy instances for Client to Server RPC. - * - * @since 7.0 - */ -public class RpcProxy { - - private static RpcProxyCreator impl = GWT.create(RpcProxyCreator.class); - - /** - * Create a proxy class for the given Rpc interface and assign it to the - * given connector. - * - * @param rpcInterface - * The rpc interface to construct a proxy for - * @param connector - * The connector this proxy is connected to - * @return A proxy class used for calling Rpc methods. - */ - public static T create(Class rpcInterface, - ServerConnector connector) { - return impl.create(rpcInterface, connector); - } - - public interface RpcProxyCreator { - T create(Class rpcInterface, - ServerConnector connector); - } -} +/* +@VaadinApache2LicenseForJavaFiles@ + */ +package com.vaadin.terminal.gwt.client.communication; + +import com.google.gwt.core.client.GWT; +import com.vaadin.terminal.gwt.client.ServerConnector; + +/** + * Class for creating proxy instances for Client to Server RPC. + * + * @since 7.0 + */ +public class RpcProxy { + + private static RpcProxyCreator impl = GWT.create(RpcProxyCreator.class); + + /** + * Create a proxy class for the given Rpc interface and assign it to the + * given connector. + * + * @param rpcInterface + * The rpc interface to construct a proxy for + * @param connector + * The connector this proxy is connected to + * @return A proxy class used for calling Rpc methods. + */ + public static T create(Class rpcInterface, + ServerConnector connector) { + return impl.create(rpcInterface, connector); + } + + public interface RpcProxyCreator { + T create(Class rpcInterface, + ServerConnector connector); + } +} diff --git a/src/com/vaadin/terminal/gwt/widgetsetutils/RpcProxyCreatorGenerator.java b/src/com/vaadin/terminal/gwt/widgetsetutils/RpcProxyCreatorGenerator.java index 8a28018bb2..62cdae397c 100644 --- a/src/com/vaadin/terminal/gwt/widgetsetutils/RpcProxyCreatorGenerator.java +++ b/src/com/vaadin/terminal/gwt/widgetsetutils/RpcProxyCreatorGenerator.java @@ -1,133 +1,133 @@ -/* -@VaadinApache2LicenseForJavaFiles@ - */ -package com.vaadin.terminal.gwt.widgetsetutils; - -import java.io.PrintWriter; -import java.util.Date; - -import com.google.gwt.core.client.GWT; -import com.google.gwt.core.ext.Generator; -import com.google.gwt.core.ext.GeneratorContext; -import com.google.gwt.core.ext.TreeLogger; -import com.google.gwt.core.ext.TreeLogger.Type; -import com.google.gwt.core.ext.UnableToCompleteException; -import com.google.gwt.core.ext.typeinfo.JClassType; -import com.google.gwt.core.ext.typeinfo.TypeOracle; -import com.google.gwt.user.rebind.ClassSourceFileComposerFactory; -import com.google.gwt.user.rebind.SourceWriter; -import com.vaadin.terminal.gwt.client.ServerConnector; -import com.vaadin.terminal.gwt.client.communication.RpcProxy.RpcProxyCreator; -import com.vaadin.terminal.gwt.client.communication.ServerRpc; -import com.vaadin.terminal.gwt.client.communication.ServerRpc.InitializableClientToServerRpc; - -public class RpcProxyCreatorGenerator extends Generator { - - @Override - public String generate(TreeLogger logger, GeneratorContext ctx, - String requestedClassName) throws UnableToCompleteException { - logger.log(TreeLogger.DEBUG, "Running RpcProxyCreatorGenerator"); - TypeOracle typeOracle = ctx.getTypeOracle(); - assert (typeOracle != null); - - JClassType requestedType = typeOracle.findType(requestedClassName); - String packageName = requestedType.getPackage().getName(); - String className = requestedType.getSimpleSourceName() + "Impl"; - if (requestedType == null) { - logger.log(TreeLogger.ERROR, "Unable to find metadata for type '" - + requestedClassName + "'", null); - throw new UnableToCompleteException(); - } - - createType(logger, ctx, packageName, className); - return packageName + "." + className; - } - - private void createType(TreeLogger logger, GeneratorContext context, - String packageName, String className) { - ClassSourceFileComposerFactory composer = new ClassSourceFileComposerFactory( - packageName, className); - - PrintWriter printWriter = context.tryCreate(logger, - composer.getCreatedPackage(), - composer.getCreatedClassShortName()); - if (printWriter == null) { - // print writer is null if source code has already been generated - return; - } - Date date = new Date(); - TypeOracle typeOracle = context.getTypeOracle(); - - // init composer, set class properties, create source writer - composer.addImport(GWT.class.getCanonicalName()); - composer.addImport(ServerRpc.class.getCanonicalName()); - composer.addImport(ServerConnector.class.getCanonicalName()); - composer.addImport(InitializableClientToServerRpc.class - .getCanonicalName()); - composer.addImport(IllegalArgumentException.class.getCanonicalName()); - composer.addImplementedInterface(RpcProxyCreator.class - .getCanonicalName()); - - SourceWriter sourceWriter = composer.createSourceWriter(context, - printWriter); - sourceWriter.indent(); - - sourceWriter - .println("public T create(Class rpcInterface, ServerConnector connector) {"); - sourceWriter.indent(); - - sourceWriter - .println("if (rpcInterface == null || connector == null) {"); - sourceWriter.indent(); - sourceWriter - .println("throw new IllegalArgumentException(\"RpcInterface and/or connector cannot be null\");"); - sourceWriter.outdent(); - sourceWriter - .println("} else if (connector.getConnectorId() == null) {"); - sourceWriter.indent(); - sourceWriter - .println("throw new IllegalArgumentException(\"Connector must be initialized before creating Rpc instances.\");"); - sourceWriter.outdent(); - - JClassType initializableInterface = typeOracle.findType(ServerRpc.class - .getCanonicalName()); - - for (JClassType rpcType : initializableInterface.getSubtypes()) { - String rpcClassName = rpcType.getQualifiedSourceName(); - if (InitializableClientToServerRpc.class.getCanonicalName().equals( - rpcClassName)) { - // InitializableClientToServerRpc is a special marker interface - // that should not get a generated class - continue; - } - sourceWriter.println("} else if (rpcInterface == " + rpcClassName - + ".class) {"); - sourceWriter.indent(); - sourceWriter.println(rpcClassName + " rpc = GWT.create(" - + rpcClassName + ".class);"); - sourceWriter - .println("((InitializableClientToServerRpc) rpc).initRpc(connector.getConnectorId(), connector.getConnection());"); - sourceWriter.println("return (T) rpc;"); - sourceWriter.outdent(); - } - - sourceWriter.println("} else {"); - sourceWriter.indent(); - sourceWriter - .println("throw new IllegalArgumentException(\"No RpcInterface of type \"+ rpcInterface.getName() + \" was found.\");"); - sourceWriter.outdent(); - // End of if - sourceWriter.println("}"); - // End of method - sourceWriter.println("}"); - - // close generated class - sourceWriter.outdent(); - sourceWriter.println("}"); - // commit generated class - context.commit(logger, printWriter); - logger.log(Type.INFO, composer.getCreatedClassName() + " created in " - + (new Date().getTime() - date.getTime()) / 1000 + "seconds"); - - } -} +/* +@VaadinApache2LicenseForJavaFiles@ + */ +package com.vaadin.terminal.gwt.widgetsetutils; + +import java.io.PrintWriter; +import java.util.Date; + +import com.google.gwt.core.client.GWT; +import com.google.gwt.core.ext.Generator; +import com.google.gwt.core.ext.GeneratorContext; +import com.google.gwt.core.ext.TreeLogger; +import com.google.gwt.core.ext.TreeLogger.Type; +import com.google.gwt.core.ext.UnableToCompleteException; +import com.google.gwt.core.ext.typeinfo.JClassType; +import com.google.gwt.core.ext.typeinfo.TypeOracle; +import com.google.gwt.user.rebind.ClassSourceFileComposerFactory; +import com.google.gwt.user.rebind.SourceWriter; +import com.vaadin.terminal.gwt.client.ServerConnector; +import com.vaadin.terminal.gwt.client.communication.RpcProxy.RpcProxyCreator; +import com.vaadin.terminal.gwt.client.communication.ServerRpc; +import com.vaadin.terminal.gwt.client.communication.ServerRpc.InitializableClientToServerRpc; + +public class RpcProxyCreatorGenerator extends Generator { + + @Override + public String generate(TreeLogger logger, GeneratorContext ctx, + String requestedClassName) throws UnableToCompleteException { + logger.log(TreeLogger.DEBUG, "Running RpcProxyCreatorGenerator"); + TypeOracle typeOracle = ctx.getTypeOracle(); + assert (typeOracle != null); + + JClassType requestedType = typeOracle.findType(requestedClassName); + String packageName = requestedType.getPackage().getName(); + String className = requestedType.getSimpleSourceName() + "Impl"; + if (requestedType == null) { + logger.log(TreeLogger.ERROR, "Unable to find metadata for type '" + + requestedClassName + "'", null); + throw new UnableToCompleteException(); + } + + createType(logger, ctx, packageName, className); + return packageName + "." + className; + } + + private void createType(TreeLogger logger, GeneratorContext context, + String packageName, String className) { + ClassSourceFileComposerFactory composer = new ClassSourceFileComposerFactory( + packageName, className); + + PrintWriter printWriter = context.tryCreate(logger, + composer.getCreatedPackage(), + composer.getCreatedClassShortName()); + if (printWriter == null) { + // print writer is null if source code has already been generated + return; + } + Date date = new Date(); + TypeOracle typeOracle = context.getTypeOracle(); + + // init composer, set class properties, create source writer + composer.addImport(GWT.class.getCanonicalName()); + composer.addImport(ServerRpc.class.getCanonicalName()); + composer.addImport(ServerConnector.class.getCanonicalName()); + composer.addImport(InitializableClientToServerRpc.class + .getCanonicalName()); + composer.addImport(IllegalArgumentException.class.getCanonicalName()); + composer.addImplementedInterface(RpcProxyCreator.class + .getCanonicalName()); + + SourceWriter sourceWriter = composer.createSourceWriter(context, + printWriter); + sourceWriter.indent(); + + sourceWriter + .println("public T create(Class rpcInterface, ServerConnector connector) {"); + sourceWriter.indent(); + + sourceWriter + .println("if (rpcInterface == null || connector == null) {"); + sourceWriter.indent(); + sourceWriter + .println("throw new IllegalArgumentException(\"RpcInterface and/or connector cannot be null\");"); + sourceWriter.outdent(); + sourceWriter + .println("} else if (connector.getConnectorId() == null) {"); + sourceWriter.indent(); + sourceWriter + .println("throw new IllegalArgumentException(\"Connector must be initialized before creating Rpc instances.\");"); + sourceWriter.outdent(); + + JClassType initializableInterface = typeOracle.findType(ServerRpc.class + .getCanonicalName()); + + for (JClassType rpcType : initializableInterface.getSubtypes()) { + String rpcClassName = rpcType.getQualifiedSourceName(); + if (InitializableClientToServerRpc.class.getCanonicalName().equals( + rpcClassName)) { + // InitializableClientToServerRpc is a special marker interface + // that should not get a generated class + continue; + } + sourceWriter.println("} else if (rpcInterface == " + rpcClassName + + ".class) {"); + sourceWriter.indent(); + sourceWriter.println(rpcClassName + " rpc = GWT.create(" + + rpcClassName + ".class);"); + sourceWriter + .println("((InitializableClientToServerRpc) rpc).initRpc(connector.getConnectorId(), connector.getConnection());"); + sourceWriter.println("return (T) rpc;"); + sourceWriter.outdent(); + } + + sourceWriter.println("} else {"); + sourceWriter.indent(); + sourceWriter + .println("throw new IllegalArgumentException(\"No RpcInterface of type \"+ rpcInterface.getName() + \" was found.\");"); + sourceWriter.outdent(); + // End of if + sourceWriter.println("}"); + // End of method + sourceWriter.println("}"); + + // close generated class + sourceWriter.outdent(); + sourceWriter.println("}"); + // commit generated class + context.commit(logger, printWriter); + logger.log(Type.INFO, composer.getCreatedClassName() + " created in " + + (new Date().getTime() - date.getTime()) / 1000 + "seconds"); + + } +} -- 2.39.5