Friday, September 21, 2012

Re: Serializing different objects in one class that implements IsSerializable

ok so for my createpolygon method i just make that private? You cant make a private constructor of an object in another class, or can you?  And for the polygon class being shown, i am just importing import com.google.gwt.maps.client.overlay.Polygon this. 

On Fri, Sep 21, 2012 at 7:58 AM, Paul Robinson <ukcueman@gmail.com> wrote:
You don't show the Polygon class, but from the error it looks like you haven't provided a zero-argument constructor. It must have one, even if it's private and you never call it. GWT-RPC needs it for anything that it serializes.

Paul


On 21/09/12 15:40, coffeMan wrote:
I created a class that implements IsSerializable.  I am using Polygon and LatLng within this class called BoundingBox.  I am getting issues with no being able to instantiate Polygon without a constructor.  Do you create a separate Polygon class?

[ERROR] com.google.gwt.maps.client.overlay.Polygon has no available instantiable subtypes.
                                                                                   &
  [ERROR] subtype com.google.gwt.maps.client.overlay.Polygon is not default instantiable (it must have a zero-argument constructor or no constructors at all) and has no custom serializer. 

Can anyone point me in the right direction???

Thanks!

public class BoundingBox implements IsSerializable {

    private LatLng Coordinate_One;
    private LatLng Coordinate_Two;
    private LatLng Coordinate_Three;
    private LatLng Coordinate_Four;
    private Polygon poly;

    public BoundingBox() {        
    }        
    
    public Polygon getPoly() {
        return poly;
    }

    public void setPoly(Polygon poly) {
        this.poly = poly;
    }   

    public Polygon CreatePolygon(BoundingBox bbox) // param = file type object
    {
        LatLng[] polyOverlay = new LatLng[5];
        polyOverlay[0] = LatLng.newInstance(bbox.getCoordinate_One()
                .getLatitude(), bbox.getCoordinate_One().getLongitude());
        polyOverlay[1] = LatLng.newInstance(bbox.getCoordinate_Two()
                .getLatitude(), bbox.getCoordinate_Two().getLongitude());
        polyOverlay[2] = LatLng.newInstance(bbox.getCoordinate_Three()
                .getLatitude(), bbox.getCoordinate_Three().getLongitude());
        polyOverlay[3] = LatLng.newInstance(bbox.getCoordinate_Four()
                .getLatitude(), bbox.getCoordinate_Four().getLongitude());
        polyOverlay[4] = LatLng.newInstance(bbox.getCoordinate_One()
                .getLatitude(), bbox.getCoordinate_One().getLongitude());

        this.poly = new Polygon(polyOverlay);

        return poly;
    }
 public LatLng getCoordinate_One() {
        return Coordinate_One;
    }

    public void setCoordinate_One(LatLng coordinate_One) {
        Coordinate_One = coordinate_One;
    }...etc for the rest of the sets/gets
--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/FZ8xY8K6SA0J.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment