From c9dfd6ef4511f4200cd79cc3d36ca401a52fa0a7 Mon Sep 17 00:00:00 2001 From: Michael Bayne Date: Tue, 9 Oct 2001 17:20:03 +0000 Subject: [PATCH] Added code to handle displaying the user interface for a place once we have actually entered the place. It's not tied to a particular UI toolkit and this requires coordination between the client implementation and the place implementation, but that seems better than the alternative of tying the Parlor code to Swing or similar. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@408 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- .../crowd/client/PlaceController.java | 6 ++++-- .../threerings/crowd/util/CrowdContext.java | 20 ++++++++++++++++++- .../threerings/crowd/client/TestClient.java | 7 ++++++- 3 files changed, 29 insertions(+), 4 deletions(-) diff --git a/src/java/com/threerings/crowd/client/PlaceController.java b/src/java/com/threerings/crowd/client/PlaceController.java index 674211301..605de0bfe 100644 --- a/src/java/com/threerings/crowd/client/PlaceController.java +++ b/src/java/com/threerings/crowd/client/PlaceController.java @@ -1,5 +1,5 @@ // -// $Id: PlaceController.java,v 1.2 2001/10/06 00:24:46 mdb Exp $ +// $Id: PlaceController.java,v 1.3 2001/10/09 17:20:03 mdb Exp $ package com.threerings.cocktail.party.client; @@ -58,9 +58,11 @@ public abstract class PlaceController */ public void willEnterPlace (PlaceObject plobj) { - // let the UI hierarchy know that we've got our place if (_view != null ) { + // let the UI hierarchy know that we've got our place PlaceViewUtil.dispatchWillEnterPlace(_view, plobj); + // and display the user interface + _ctx.setPlaceView(_view); } } diff --git a/src/java/com/threerings/crowd/util/CrowdContext.java b/src/java/com/threerings/crowd/util/CrowdContext.java index 6c8a73d30..bfb7a1f5d 100644 --- a/src/java/com/threerings/crowd/util/CrowdContext.java +++ b/src/java/com/threerings/crowd/util/CrowdContext.java @@ -1,11 +1,12 @@ // -// $Id: CrowdContext.java,v 1.4 2001/10/01 22:14:55 mdb Exp $ +// $Id: CrowdContext.java,v 1.5 2001/10/09 17:20:03 mdb Exp $ package com.threerings.cocktail.party.util; import com.threerings.cocktail.cher.util.CherContext; import com.threerings.cocktail.party.client.LocationDirector; import com.threerings.cocktail.party.client.OccupantManager; +import com.threerings.cocktail.party.client.PlaceView; /** * The party context provides access to the various managers, etc. that @@ -22,4 +23,21 @@ public interface PartyContext extends CherContext * Returns a reference to the occupant manager. */ public OccupantManager getOccupantManager (); + + /** + * When the client enters a new place, the location director creates a + * place controller which then creates a place view to visualize the + * place for the user. The place view created by the place controller + * will be passed to this function to actually display it in whatever + * user interface is provided for the user. We don't require any + * particular user interface toolkit, so it is expected that the place + * view implementation will coordinate with the client implementation + * so that the client can display the view provided by the place + * controller. + * + *

Though the place view is created before we enter the place, it + * won't be displayed (via a call to this function) until we have + * fully entered the place and are ready for user interaction. + */ + public void setPlaceView (PlaceView view); } diff --git a/tests/src/java/com/threerings/crowd/client/TestClient.java b/tests/src/java/com/threerings/crowd/client/TestClient.java index 2560bc7f2..098f79dda 100644 --- a/tests/src/java/com/threerings/crowd/client/TestClient.java +++ b/tests/src/java/com/threerings/crowd/client/TestClient.java @@ -1,5 +1,5 @@ // -// $Id: TestClient.java,v 1.4 2001/10/01 22:14:55 mdb Exp $ +// $Id: TestClient.java,v 1.5 2001/10/09 17:20:03 mdb Exp $ package com.threerings.cocktail.party.client.test; @@ -121,6 +121,11 @@ public class TestClient { return _occmgr; } + + public void setPlaceView (PlaceView view) + { + // nothing to do because we don't create views + } } protected Config _config;