Changed TableManager to TableDirector. Will I ever learn?
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@534 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// $Id: TableItem.java,v 1.1 2001/10/23 20:24:10 mdb Exp $
|
// $Id: TableItem.java,v 1.2 2001/10/23 23:52:01 mdb Exp $
|
||||||
|
|
||||||
package com.threerings.micasa.lobby.table;
|
package com.threerings.micasa.lobby.table;
|
||||||
|
|
||||||
@@ -20,7 +20,7 @@ import com.samskivert.util.StringUtil;
|
|||||||
|
|
||||||
import com.threerings.crowd.data.BodyObject;
|
import com.threerings.crowd.data.BodyObject;
|
||||||
|
|
||||||
import com.threerings.parlor.client.TableManager;
|
import com.threerings.parlor.client.TableDirector;
|
||||||
import com.threerings.parlor.client.SeatednessObserver;
|
import com.threerings.parlor.client.SeatednessObserver;
|
||||||
import com.threerings.parlor.data.Table;
|
import com.threerings.parlor.data.Table;
|
||||||
import com.threerings.parlor.data.TableConfig;
|
import com.threerings.parlor.data.TableConfig;
|
||||||
@@ -43,13 +43,13 @@ public class TableItem
|
|||||||
* Creates a new table item to display and interact with the supplied
|
* Creates a new table item to display and interact with the supplied
|
||||||
* table.
|
* table.
|
||||||
*/
|
*/
|
||||||
public TableItem (MiCasaContext ctx, TableManager tmgr, Table table)
|
public TableItem (MiCasaContext ctx, TableDirector tdtr, Table table)
|
||||||
{
|
{
|
||||||
// keep track of these
|
// keep track of these
|
||||||
_tmgr = tmgr;
|
_tdtr = tdtr;
|
||||||
|
|
||||||
// add ourselves as a seatedness observer
|
// add ourselves as a seatedness observer
|
||||||
_tmgr.addSeatednessObserver(this);
|
_tdtr.addSeatednessObserver(this);
|
||||||
|
|
||||||
// figure out who we are
|
// figure out who we are
|
||||||
_self = ((BodyObject)ctx.getClient().getClientObject()).username;
|
_self = ((BodyObject)ctx.getClient().getClientObject()).username;
|
||||||
@@ -122,7 +122,7 @@ public class TableItem
|
|||||||
this.table = table;
|
this.table = table;
|
||||||
|
|
||||||
// first look to see if we're already sitting at a table
|
// first look to see if we're already sitting at a table
|
||||||
boolean isSeated = _tmgr.isSeated();
|
boolean isSeated = _tdtr.isSeated();
|
||||||
|
|
||||||
// now enable and label the buttons accordingly
|
// now enable and label the buttons accordingly
|
||||||
int slength = _seats.length;
|
int slength = _seats.length;
|
||||||
@@ -152,7 +152,7 @@ public class TableItem
|
|||||||
public void tableRemoved ()
|
public void tableRemoved ()
|
||||||
{
|
{
|
||||||
// no more observy
|
// no more observy
|
||||||
_tmgr.removeSeatednessObserver(this);
|
_tdtr.removeSeatednessObserver(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
// documentation inherited
|
// documentation inherited
|
||||||
@@ -174,12 +174,12 @@ public class TableItem
|
|||||||
"click came from [event=" + event + "].");
|
"click came from [event=" + event + "].");
|
||||||
} else {
|
} else {
|
||||||
// otherwise, request to join the table at this position
|
// otherwise, request to join the table at this position
|
||||||
_tmgr.joinTable(table.getTableId(), position);
|
_tdtr.joinTable(table.getTableId(), position);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// if we're not joining, we're leaving
|
// if we're not joining, we're leaving
|
||||||
_tmgr.leaveTable(table.getTableId());
|
_tdtr.leaveTable(table.getTableId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -193,8 +193,8 @@ public class TableItem
|
|||||||
/** Our username. */
|
/** Our username. */
|
||||||
protected String _self;
|
protected String _self;
|
||||||
|
|
||||||
/** A reference to our table manager. */
|
/** A reference to our table director. */
|
||||||
protected TableManager _tmgr;
|
protected TableDirector _tdtr;
|
||||||
|
|
||||||
/** A casted reference to our table config object. */
|
/** A casted reference to our table config object. */
|
||||||
protected TableConfig _tconfig;
|
protected TableConfig _tconfig;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// $Id: TableListView.java,v 1.1 2001/10/23 20:24:10 mdb Exp $
|
// $Id: TableListView.java,v 1.2 2001/10/23 23:52:01 mdb Exp $
|
||||||
|
|
||||||
package com.threerings.micasa.lobby.table;
|
package com.threerings.micasa.lobby.table;
|
||||||
|
|
||||||
@@ -25,7 +25,7 @@ import com.samskivert.swing.VGroupLayout;
|
|||||||
import com.threerings.crowd.client.PlaceView;
|
import com.threerings.crowd.client.PlaceView;
|
||||||
import com.threerings.crowd.data.PlaceObject;
|
import com.threerings.crowd.data.PlaceObject;
|
||||||
|
|
||||||
import com.threerings.parlor.client.TableManager;
|
import com.threerings.parlor.client.TableDirector;
|
||||||
import com.threerings.parlor.client.TableObserver;
|
import com.threerings.parlor.client.TableObserver;
|
||||||
import com.threerings.parlor.client.SeatednessObserver;
|
import com.threerings.parlor.client.SeatednessObserver;
|
||||||
import com.threerings.parlor.data.Table;
|
import com.threerings.parlor.data.Table;
|
||||||
@@ -58,11 +58,11 @@ public class TableListView
|
|||||||
_config = config;
|
_config = config;
|
||||||
_ctx = ctx;
|
_ctx = ctx;
|
||||||
|
|
||||||
// create our table manager
|
// create our table director
|
||||||
_tmgr = new TableManager(ctx, TableLobbyObject.TABLES, this);
|
_tdtr = new TableDirector(ctx, TableLobbyObject.TABLES, this);
|
||||||
|
|
||||||
// add ourselves as a seatedness observer
|
// add ourselves as a seatedness observer
|
||||||
_tmgr.addSeatednessObserver(this);
|
_tdtr.addSeatednessObserver(this);
|
||||||
|
|
||||||
// set up a layout manager
|
// set up a layout manager
|
||||||
HGroupLayout gl = new HGroupLayout(HGroupLayout.STRETCH);
|
HGroupLayout gl = new HGroupLayout(HGroupLayout.STRETCH);
|
||||||
@@ -126,8 +126,8 @@ public class TableListView
|
|||||||
// documentation inherited
|
// documentation inherited
|
||||||
public void willEnterPlace (PlaceObject place)
|
public void willEnterPlace (PlaceObject place)
|
||||||
{
|
{
|
||||||
// pass the good word on to our table manager
|
// pass the good word on to our table director
|
||||||
_tmgr.willEnterPlace(place);
|
_tdtr.willEnterPlace(place);
|
||||||
|
|
||||||
// iterate over the tables already active in this lobby and put
|
// iterate over the tables already active in this lobby and put
|
||||||
// them in their respective lists
|
// them in their respective lists
|
||||||
@@ -141,8 +141,8 @@ public class TableListView
|
|||||||
// documentation inherited
|
// documentation inherited
|
||||||
public void didLeavePlace (PlaceObject place)
|
public void didLeavePlace (PlaceObject place)
|
||||||
{
|
{
|
||||||
// pass the good word on to our table manager
|
// pass the good word on to our table director
|
||||||
_tmgr.didLeavePlace(place);
|
_tdtr.didLeavePlace(place);
|
||||||
|
|
||||||
// clear out our table lists
|
// clear out our table lists
|
||||||
_matchList.removeAll();
|
_matchList.removeAll();
|
||||||
@@ -157,7 +157,7 @@ public class TableListView
|
|||||||
// create a table item for this table and insert it into the
|
// create a table item for this table and insert it into the
|
||||||
// appropriate list
|
// appropriate list
|
||||||
JPanel panel = table.inPlay() ? _playList : _matchList;
|
JPanel panel = table.inPlay() ? _playList : _matchList;
|
||||||
panel.add(new TableItem(_ctx, _tmgr, table));
|
panel.add(new TableItem(_ctx, _tdtr, table));
|
||||||
panel.revalidate();
|
panel.revalidate();
|
||||||
panel.repaint();
|
panel.repaint();
|
||||||
}
|
}
|
||||||
@@ -217,7 +217,7 @@ public class TableListView
|
|||||||
public void actionPerformed (ActionEvent event)
|
public void actionPerformed (ActionEvent event)
|
||||||
{
|
{
|
||||||
// the create table button was clicked. pass the word on to the
|
// the create table button was clicked. pass the word on to the
|
||||||
// table manager
|
// table director
|
||||||
GameConfig config = null;
|
GameConfig config = null;
|
||||||
try {
|
try {
|
||||||
config = _config.getGameConfig();
|
config = _config.getGameConfig();
|
||||||
@@ -233,7 +233,7 @@ public class TableListView
|
|||||||
}
|
}
|
||||||
|
|
||||||
// and create a table with these values
|
// and create a table with these values
|
||||||
_tmgr.createTable(config);
|
_tdtr.createTable(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
// documentation inherited
|
// documentation inherited
|
||||||
@@ -287,8 +287,8 @@ public class TableListView
|
|||||||
* doing table-style matchmaking. */
|
* doing table-style matchmaking. */
|
||||||
protected LobbyConfig _config;
|
protected LobbyConfig _config;
|
||||||
|
|
||||||
/** A reference to our table manager. */
|
/** A reference to our table director. */
|
||||||
protected TableManager _tmgr;
|
protected TableDirector _tdtr;
|
||||||
|
|
||||||
/** The list of tables currently being matchmade. */
|
/** The list of tables currently being matchmade. */
|
||||||
protected JPanel _matchList;
|
protected JPanel _matchList;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// $Id: TableDirector.java,v 1.4 2001/10/23 23:47:02 mdb Exp $
|
// $Id: TableDirector.java,v 1.5 2001/10/23 23:52:01 mdb Exp $
|
||||||
|
|
||||||
package com.threerings.parlor.client;
|
package com.threerings.parlor.client;
|
||||||
|
|
||||||
@@ -25,23 +25,23 @@ import com.threerings.parlor.util.ParlorContext;
|
|||||||
* standard hierarchy of place controllers that deal with place-related
|
* standard hierarchy of place controllers that deal with place-related
|
||||||
* functionality on the client. Thus, instead of forcing places that
|
* functionality on the client. Thus, instead of forcing places that
|
||||||
* expect to have tables to extend a <code>TableLobbyController</code> or
|
* expect to have tables to extend a <code>TableLobbyController</code> or
|
||||||
* something similar, we instead provide the table manager which can be
|
* something similar, we instead provide the table director which can be
|
||||||
* instantiated by the place controller (or specific table related views)
|
* instantiated by the place controller (or specific table related views)
|
||||||
* to handle the table matchmaking services.
|
* to handle the table matchmaking services.
|
||||||
*
|
*
|
||||||
* <p> Entites that do so, will need to implement the {@link
|
* <p> Entites that do so, will need to implement the {@link
|
||||||
* TableObserver} interface so that the table manager can notify them when
|
* TableObserver} interface so that the table director can notify them
|
||||||
* table related things happen.
|
* when table related things happen.
|
||||||
*
|
*
|
||||||
* <p> The table services expect that the place object being used as a
|
* <p> The table services expect that the place object being used as a
|
||||||
* lobby in which the table matchmaking takes place implements the {@link
|
* lobby in which the table matchmaking takes place implements the {@link
|
||||||
* TableLobbyObject} interface.
|
* TableLobbyObject} interface.
|
||||||
*/
|
*/
|
||||||
public class TableManager
|
public class TableDirector
|
||||||
implements SetListener
|
implements SetListener
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Creates a new table manager to manage tables with the specified
|
* Creates a new table director to manage tables with the specified
|
||||||
* observer which will receive callbacks when interesting table
|
* observer which will receive callbacks when interesting table
|
||||||
* related things happen.
|
* related things happen.
|
||||||
*
|
*
|
||||||
@@ -51,7 +51,7 @@ public class TableManager
|
|||||||
* @param observer the entity that will receive callbacks when things
|
* @param observer the entity that will receive callbacks when things
|
||||||
* happen to the tables.
|
* happen to the tables.
|
||||||
*/
|
*/
|
||||||
public TableManager (
|
public TableDirector (
|
||||||
ParlorContext ctx, String tableField, TableObserver observer)
|
ParlorContext ctx, String tableField, TableObserver observer)
|
||||||
{
|
{
|
||||||
// keep track of this stuff
|
// keep track of this stuff
|
||||||
@@ -61,7 +61,7 @@ public class TableManager
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This must be called by the entity that uses the table manager when
|
* This must be called by the entity that uses the table director when
|
||||||
* the using entity prepares to enter and display a place. It is
|
* the using entity prepares to enter and display a place. It is
|
||||||
* assumed that the client is already subscribed to the provided place
|
* assumed that the client is already subscribed to the provided place
|
||||||
* object.
|
* object.
|
||||||
@@ -76,7 +76,7 @@ public class TableManager
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This must be called by the entity that uses the table manager when
|
* This must be called by the entity that uses the table director when
|
||||||
* the using entity has left and is done displaying a place.
|
* the using entity has left and is done displaying a place.
|
||||||
*/
|
*/
|
||||||
public void didLeavePlace (PlaceObject place)
|
public void didLeavePlace (PlaceObject place)
|
||||||
|
|||||||
Reference in New Issue
Block a user