Add support for clearing a place view when it goes away so that we can

better manage multiple outstanding place views.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1929 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2002-11-08 09:31:59 +00:00
parent 800a3e8a80
commit c53a6f59b1
4 changed files with 30 additions and 9 deletions
@@ -1,5 +1,5 @@
//
// $Id: PlaceController.java,v 1.9 2002/05/13 23:03:24 mdb Exp $
// $Id: PlaceController.java,v 1.10 2002/11/08 09:31:59 mdb Exp $
package com.threerings.crowd.client;
@@ -114,17 +114,21 @@ public abstract class PlaceController extends Controller
*/
public void didLeavePlace (final PlaceObject plobj)
{
// let the UI hierarchy know that we're outta here
if (_view != null ) {
PlaceViewUtil.dispatchDidLeavePlace(_view, plobj);
}
// let our delegates know what's up
applyToDelegates(new DelegateOp() {
public void apply (PlaceControllerDelegate delegate) {
delegate.didLeavePlace(plobj);
}
});
// let the UI hierarchy know that we're outta here
if (_view != null ) {
PlaceViewUtil.dispatchDidLeavePlace(_view, plobj);
_ctx.clearPlaceView(_view);
_view = null;
}
_plobj = null;
}
/**
@@ -1,5 +1,5 @@
//
// $Id: CrowdContext.java,v 1.7 2002/04/15 14:38:45 shaper Exp $
// $Id: CrowdContext.java,v 1.8 2002/11/08 09:31:59 mdb Exp $
package com.threerings.crowd.util;
@@ -40,4 +40,11 @@ public interface CrowdContext extends PresentsContext
* fully entered the place and are ready for user interaction.
*/
public void setPlaceView (PlaceView view);
/**
* When the client leaves a place, the place controller will remove
* any place view it set previously via {@link #setPlaceView} with a
* call to this method.
*/
public void clearPlaceView (PlaceView view);
}
@@ -1,5 +1,5 @@
//
// $Id: MiCasaClient.java,v 1.15 2002/08/14 19:07:49 mdb Exp $
// $Id: MiCasaClient.java,v 1.16 2002/11/08 09:31:59 mdb Exp $
package com.threerings.micasa.client;
@@ -161,6 +161,11 @@ public class MiCasaClient
_frame.setPanel((JPanel)view);
}
public void clearPlaceView (PlaceView view)
{
// we'll just let the next place view replace our old one
}
public MiCasaFrame getFrame ()
{
return _frame;
@@ -1,5 +1,5 @@
//
// $Id: SimpleClient.java,v 1.7 2002/08/14 19:07:50 mdb Exp $
// $Id: SimpleClient.java,v 1.8 2002/11/08 09:31:59 mdb Exp $
package com.threerings.micasa.simulator.client;
@@ -113,6 +113,11 @@ public class SimpleClient
_frame.setPanel((JPanel)view);
}
public void clearPlaceView (PlaceView view)
{
// we'll just let the next view replace the old one
}
public MiCasaFrame getFrame ()
{
return (MiCasaFrame)_frame;