SD - Display Group Request
- ShowRoutes.displayRequestedMap makes the call to ServiceWrapper.showRoutes(DisplayGroup).
- DisplayGroup is created from the request params.
- ServiceWrapper is a client-side piece.
- ServiceWrapper make an asynchronous call to the GWT Service GetDisplayElements
- The GWT service returns a List<DisplayElement>
- ServiceWrapper then instantiates a RouteRequest from the List<DisplayElement>
- The routeRequest is then added to the routeContainer : MapPanel using the addRoutes(routeRequest) method.
- MapPanel is then the main activation because it can display feedback to the user regarding progress. This is one of the big reasons there are two calls to the server: 1) learn how much work to do, then 2) do the work while reporting progress.
- Call ServiceWrapper.requestElement with the first DisplayElement from the RouteRequest
- ServiceWrapper.requestElement decides which call to make depending on the DisplayElement's Type and ClassName. So far, only thing supported is the BikeTrainDE, but this would be a place to expand. The Display Elements design goes into more detail. Since only the BikeTrainDE is currently supported, the GWT call is getBikeTrain(DisplayElement). I've noticed that the decision made inside ServiceWrapper.requestElement only needs to choose the correct callback. It may be possible for a single interface to be used that accepts a DisplayElement and then creates and returns the appropriate instance of Route.
- The callback returns a BikeTrainDE object which extends DisplayElement and adds a BikeTrain instance and an EncodedTrack instance loaded from the route name specified inside the BikeTrain record.
- The ServiceWrapper takes the EncodedTrack and asks the RouteFactory to instantiate a Route instance of the appropriate type. The ServiceWrapper currently embodies (as part of the BikeTrainAsyncCallback) the knowledge of how to assemble the route from the BikeTrainDE. It may be worth considering having the DisplayElement itself provide the callback since that's where the knowledge should reside.
- The ServiceWrapper then adds the route to the MapPanel and asks it to update its progress.
page revision: 11, last edited: 06 Jan 2011 00:35