Have to call mayLeavePlace() in a couple of other places. Fixed

documentation for it in PlaceController.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2105 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2003-01-09 02:46:58 +00:00
parent 4abcc6a87c
commit 0c246fcef7
2 changed files with 30 additions and 17 deletions
@@ -1,5 +1,5 @@
//
// $Id: LocationDirector.java,v 1.28 2003/01/09 00:26:56 mdb Exp $
// $Id: LocationDirector.java,v 1.29 2003/01/09 02:46:58 mdb Exp $
package com.threerings.crowd.client;
@@ -185,15 +185,7 @@ public class LocationDirector extends BasicDirector
// if we're actually going somewhere, let the controller know that
// we might be leaving
if (_controller != null) {
try {
_controller.mayLeavePlace(_plobj);
} catch (Exception e) {
Log.warning("Place controller choked in " +
"didLeavePlace [plobj=" + _plobj + "].");
Log.logStackTrace(e);
}
}
mayLeavePlace();
// if we have a result listener, let it know if we failed
// or keep it for later if we're still going
@@ -208,6 +200,23 @@ public class LocationDirector extends BasicDirector
return !vetoed[0];
}
/**
* Called to inform our controller that we may be leaving the current
* place.
*/
protected void mayLeavePlace ()
{
if (_controller != null) {
try {
_controller.mayLeavePlace(_plobj);
} catch (Exception e) {
Log.warning("Place controller choked in " +
"mayLeavePlace [plobj=" + _plobj + "].");
Log.logStackTrace(e);
}
}
}
/**
* This can be called by cooperating directors that need to coopt the
* moving process to extend it in some way or other. In such
@@ -353,6 +362,7 @@ public class LocationDirector extends BasicDirector
super.clientDidLogoff(client);
// clear ourselves out and inform observers of our departure
mayLeavePlace();
didLeavePlace();
// let our observers know that we're no longer in a location
@@ -410,6 +420,7 @@ public class LocationDirector extends BasicDirector
Log.info("Moving at request of server [placeId=" + placeId + "].");
// clear out our old place information
mayLeavePlace();
didLeavePlace();
// move to the new place
@@ -1,5 +1,5 @@
//
// $Id: PlaceController.java,v 1.11 2003/01/09 00:26:56 mdb Exp $
// $Id: PlaceController.java,v 1.12 2003/01/09 02:46:58 mdb Exp $
package com.threerings.crowd.client;
@@ -107,12 +107,14 @@ public abstract class PlaceController extends Controller
/**
* Called before a request is submitted to the server to leave the
* current place. The request to leave may be rejected, but if a place
* controller needs to make a final communication to the place manager
* before it leaves, it should so do here. This is the only place in
* which the controller is guaranteed to be able to communicate to the
* place manager, as by the time {@link #didLeavePlace} is called, the
* place manager may have already been destroyed.
* current place. As such, this method may be called multiple times
* before {@link #didLeavePlace} is finally called. The request to
* leave may be rejected, but if a place controller needs to flush any
* information to the place manager before it leaves, it should so do
* here. This is the only place in which the controller is guaranteed
* to be able to communicate to the place manager, as by the time
* {@link #didLeavePlace} is called, the place manager may have
* already been destroyed.
*/
public void mayLeavePlace (final PlaceObject plobj)
{