|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.awt.Component java.awt.Container java.awt.Window java.awt.Frame javax.swing.JFrame org.jogre.client.awt.JogreTableFrame
The important JogreTableFrame which is where each game is played. Each time a new table is created one of these frames appear. This class creates the buttons at the top of the screen, the player list at the bottom left and the message chat box on the bottom right. The main game area is set in the sub classes e.g. ChessTableFrame using the setGamePanel (JPanel) method.
To use this class a class must extend it e.g. ChesTableFrame. Its fields must include a data model (JogreModel e.g. ChessModel), a view of the data (JogreComponent e.g. ChessBoardComponent) and a controller (JogreController e.g. ChessController) for understanding mouse movements etc on the view.
The constructor in the sub class should initialise these MVC fields and MUST call the setMVC (model, view, controller) method as this class makes use of these.
Nested Class Summary |
Nested classes inherited from class javax.swing.JFrame |
JFrame.AccessibleJFrame |
Nested classes inherited from class java.awt.Frame |
Frame.AccessibleAWTFrame |
Nested classes inherited from class java.awt.Window |
Window.AccessibleAWTWindow |
Nested classes inherited from class java.awt.Container |
Container.AccessibleAWTContainer |
Nested classes inherited from class java.awt.Component |
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy |
Field Summary | |
protected TableConnectionThread |
conn
|
protected JogreController |
gameController
|
protected JogreComponent |
gameMainView
|
protected JogreModel |
gameModel
|
protected JButton |
offerDrawButton
|
protected JButton |
resignButton
|
protected JButton |
sitButton
|
protected JButton |
standButton
|
protected JButton |
startButton
|
protected int |
tableNum
|
protected boolean |
tableUpdateRefreshesModel
Boolean to indicate that a table update will refresh the model in that particular table. |
protected String |
username
|
Fields inherited from class javax.swing.JFrame |
accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled |
Fields inherited from class java.awt.Frame |
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR |
Fields inherited from class java.awt.Component |
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface javax.swing.WindowConstants |
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE |
Fields inherited from interface java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, PROPERTIES, SOMEBITS |
Constructor Summary | |
JogreTableFrame(TableConnectionThread conn)
Constructor to a standard JogreGameFrame. |
Method Summary | |
void |
addToTopPanel(Component component)
Method to add additional components (such as buttons etc) to the top right hand side of the screen. |
void |
gameOver(CommGameOver commGameOver)
Create game over. |
JogreController |
getController()
Accessor for the game controller. |
ChatGameComponent |
getMessageComponent()
Accessor for the small message box with each table. |
JogreModel |
getModel()
Accessor for the game controller. |
void |
leaveTable()
Player leaves the table. |
void |
receiveChatTableMessage(String usernameFrom,
int tableNum,
String messageText)
Receive a message for a specificied table. |
protected void |
receiveMessage(XMLElement message)
Adapter method for receiving a custom message. |
void |
receiveObject(CommControllerObject commObject)
Retrieve controller and object. |
void |
receiveOfferDraw(CommOfferDraw offerDraw)
|
void |
receiveProperty(CommControllerProperty commProperty)
Recieve a property. |
void |
receiveTableMessage(XMLElement message)
Implementation of the ITable interface. |
void |
setGamePanel(JPanel gamePanel)
Set the empty panel in the screen equal to the game panel. |
void |
setTableUpdateRefreshesModel(boolean value)
This method sets a boolean, which if set to true will result in the JogreModel refreshing its componets which are observing it everytime the table object in ClientConnectionThread updates itself. |
void |
setupMVC(JogreModel model,
JogreComponent mainView,
JogreController controller)
Sets up the MVC for this table. |
void |
startGame()
Start the game. |
void |
updateTable()
The table object has been updated. |
Methods inherited from class java.awt.Frame |
addNotify, finalize, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setCursor, setExtendedState, setIconImage, setMaximizedBounds, setMenuBar, setResizable, setState, setTitle, setUndecorated |
Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.awt.MenuContainer |
getFont, postEvent |
Field Detail |
protected boolean tableUpdateRefreshesModel
protected String username
protected TableConnectionThread conn
protected int tableNum
protected JogreModel gameModel
protected JogreController gameController
protected JogreComponent gameMainView
protected JButton sitButton
protected JButton standButton
protected JButton startButton
protected JButton offerDrawButton
protected JButton resignButton
Constructor Detail |
public JogreTableFrame(TableConnectionThread conn)
conn
- Client connection thread which holds the link to the
server, user and table lists.Method Detail |
public void setTableUpdateRefreshesModel(boolean value)
This method sets a boolean, which if set to true will result in the JogreModel refreshing its componets which are observing it everytime the table object in ClientConnectionThread updates itself.
This only needs to be set if a visual component uses data from the Table object (from TableList) in the ClientConnectionThread to show the current player or the players name for example. The method updateTable() makes use of this boolean.
value
- public void updateTable()
public void leaveTable()
public void setGamePanel(JPanel gamePanel)
gamePanel
- public void addToTopPanel(Component component)
component
- public JogreController getController()
public JogreModel getModel()
public void startGame()
public ChatGameComponent getMessageComponent()
public void receiveTableMessage(XMLElement message)
receiveTableMessage
in interface ITable
message
- Message from server.ITable.receiveTableMessage(nanoxml.XMLElement)
protected void receiveMessage(XMLElement message)
ITable.receiveTableMessage(nanoxml.XMLElement)
public void setupMVC(JogreModel model, JogreComponent mainView, JogreController controller)
model
- mainView
- controller
- public void receiveOfferDraw(CommOfferDraw offerDraw)
offerDraw
- public void gameOver(CommGameOver commGameOver)
commGameOver
- public void receiveProperty(CommControllerProperty commProperty)
commProperty
- public void receiveChatTableMessage(String usernameFrom, int tableNum, String messageText)
usernameFrom
- tableNum
- messageText
- public void receiveObject(CommControllerObject commObject)
commObject
-
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |