Finally broke down and changed createPlaceView() to eliminate the annoying
potential fuckola of being called before the controller gets around to initializing the casted context it almost certainly needs to create its place view. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3440 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -57,7 +57,7 @@ public abstract class PlaceController extends Controller
|
|||||||
_config = config;
|
_config = config;
|
||||||
|
|
||||||
// create our user interface
|
// create our user interface
|
||||||
_view = createPlaceView();
|
_view = createPlaceView(_ctx);
|
||||||
|
|
||||||
// initialize our delegates
|
// initialize our delegates
|
||||||
applyToDelegates(new DelegateOp() {
|
applyToDelegates(new DelegateOp() {
|
||||||
@@ -101,8 +101,25 @@ public abstract class PlaceController extends Controller
|
|||||||
* Creates the user interface that will be used to display this place.
|
* Creates the user interface that will be used to display this place.
|
||||||
* The view instance returned will later be configured with the place
|
* The view instance returned will later be configured with the place
|
||||||
* object, once it becomes available.
|
* object, once it becomes available.
|
||||||
|
*
|
||||||
|
* @param ctx a reference to the {@link CrowdContext} associated with
|
||||||
|
* this controller.
|
||||||
*/
|
*/
|
||||||
protected abstract PlaceView createPlaceView ();
|
protected PlaceView createPlaceView (CrowdContext ctx)
|
||||||
|
{
|
||||||
|
return createPlaceView();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Obsolete but retained for runtime compatibility with the old and
|
||||||
|
* busted.
|
||||||
|
*
|
||||||
|
* @deprecated Use {@link #createPlaceView(CrowdContext)}.
|
||||||
|
*/
|
||||||
|
protected PlaceView createPlaceView ()
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is called by the location director once the place object has
|
* This is called by the location director once the place object has
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ public class LobbyController extends PlaceController
|
|||||||
_ctx.getParlorDirector().setInvitationHandler(this);
|
_ctx.getParlorDirector().setInvitationHandler(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected PlaceView createPlaceView ()
|
protected PlaceView createPlaceView (CrowdContext ctx)
|
||||||
{
|
{
|
||||||
return new LobbyPanel(_ctx, _config);
|
return new LobbyPanel(_ctx, _config);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
package com.threerings.stage.client;
|
package com.threerings.stage.client;
|
||||||
|
|
||||||
import com.threerings.crowd.client.PlaceView;
|
import com.threerings.crowd.client.PlaceView;
|
||||||
|
import com.threerings.crowd.util.CrowdContext;
|
||||||
|
|
||||||
import com.threerings.whirled.data.SceneUpdate;
|
import com.threerings.whirled.data.SceneUpdate;
|
||||||
import com.threerings.whirled.spot.client.SpotSceneController;
|
import com.threerings.whirled.spot.client.SpotSceneController;
|
||||||
@@ -17,9 +18,9 @@ import com.threerings.stage.util.StageContext;
|
|||||||
public class StageSceneController extends SpotSceneController
|
public class StageSceneController extends SpotSceneController
|
||||||
{
|
{
|
||||||
// documentation inherited
|
// documentation inherited
|
||||||
protected PlaceView createPlaceView ()
|
protected PlaceView createPlaceView (CrowdContext ctx)
|
||||||
{
|
{
|
||||||
return new StageScenePanel((StageContext)_ctx, this);
|
return new StageScenePanel((StageContext)ctx, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
// documentation inherited
|
// documentation inherited
|
||||||
|
|||||||
@@ -22,11 +22,12 @@
|
|||||||
package com.threerings.parlor;
|
package com.threerings.parlor;
|
||||||
|
|
||||||
import com.threerings.crowd.client.PlaceView;
|
import com.threerings.crowd.client.PlaceView;
|
||||||
|
import com.threerings.crowd.util.CrowdContext;
|
||||||
import com.threerings.parlor.game.client.GameController;
|
import com.threerings.parlor.game.client.GameController;
|
||||||
|
|
||||||
public class TestController extends GameController
|
public class TestController extends GameController
|
||||||
{
|
{
|
||||||
public PlaceView createPlaceView ()
|
public PlaceView createPlaceView (CrowdContext ctx)
|
||||||
{
|
{
|
||||||
// nothing doing
|
// nothing doing
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// $Id: TestController.java,v 1.4 2004/08/27 02:21:05 mdb Exp $
|
// $Id$
|
||||||
//
|
//
|
||||||
// Narya library - tools for developing networked games
|
// Narya library - tools for developing networked games
|
||||||
// Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved
|
// Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved
|
||||||
@@ -22,10 +22,11 @@
|
|||||||
package com.threerings.whirled;
|
package com.threerings.whirled;
|
||||||
|
|
||||||
import com.threerings.crowd.client.*;
|
import com.threerings.crowd.client.*;
|
||||||
|
import com.threerings.crowd.util.CrowdContext;
|
||||||
|
|
||||||
public class TestController extends PlaceController
|
public class TestController extends PlaceController
|
||||||
{
|
{
|
||||||
protected PlaceView createPlaceView ()
|
protected PlaceView createPlaceView (CrowdContext ctx)
|
||||||
{
|
{
|
||||||
// nothing doing
|
// nothing doing
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
Reference in New Issue
Block a user