|
||||||||||
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.Panel soc.client.SOCPlayerClient.GameAwtDisplay
public static class SOCPlayerClient.GameAwtDisplay
A SOCPlayerClient.GameDisplay
implementation for AWT.
Before v2.0.00, most of these fields and methods were part of the main SOCPlayerClient
class.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.awt.Panel |
---|
java.awt.Panel.AccessibleAWTPanel |
Nested classes/interfaces inherited from class java.awt.Container |
---|
java.awt.Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component |
---|
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
Field Summary | |
---|---|
protected java.awt.CardLayout |
cardLayout
This class displays one of several panels to the user: MAIN_PANEL , MESSAGE_PANEL or
(if launched from jar, or with no command-line arguments)
CONNECT_OR_PRACTICE_PANEL . |
protected java.awt.TextField |
channel
Chat channel name to create or join with jc button. |
protected java.util.Hashtable<java.lang.String,ChannelFrame> |
channels
the channels we've joined |
protected java.awt.List |
chlist
List of chat channels that can be joined with jc button or by double-click. |
private SOCPlayerClient |
client
|
private static java.lang.String |
CONNECT_OR_PRACTICE_PANEL
Connect-or-practice panel (if jar launch), in cardlayout. |
protected SOCConnectOrPracticePanel |
connectOrPracticePane
If applicable, is set up in initVisualElements() . |
protected java.util.Timer |
eventTimer
Utility for time-driven events in the display. |
protected SOCPlayerClient.GameOptionDefaultsTimeoutTask |
gameOptsDefsTask
Task for timeout when asking remote server for game options defaults . |
protected SOCPlayerClient.GameOptionsTimeoutTask |
gameOptsTask
Task for timeout when asking remote server for game options info . |
protected java.awt.Button |
gi
"Game Info" button, shows a game's SOCGameOption s. |
protected java.awt.List |
gmlist
List of games that can be joined with jg button or by double-click,
or detail info displayed with gi button. |
protected boolean |
hasConnectOrPractice
If true, we'll give the user a choice to connect to a server, start a local server, or a local practice game. |
protected boolean |
hasJoinedServer
Once true, disable "nick" textfield, etc. |
protected java.awt.Button |
jc
"Join Channel" button, for channel currently highlighted in chlist ,
or create new channel named in channel . |
protected java.awt.Button |
jg
"Join Game" button |
private java.awt.Label |
localTCPServerLabel
Local Server indicator in main panel: blank, or 'server is running' if localTCPServer has been started. |
private static java.lang.String |
MAIN_PANEL
main panel, in cardlayout |
private java.awt.GridBagConstraints |
mainGBC
Constraints for mainGBL |
private java.awt.GridBagLayout |
mainGBL
Layout for mainPane |
private java.awt.Panel |
mainPane
MainPanel GUI, initialized in initVisualElements()
and initMainPanelLayout(boolean, SOCServerFeatures) . |
private boolean |
mainPaneLayoutIsDone
Flags for tracking mainPane layout status, in case
initMainPanelLayout(boolean, SOCServerFeatures) is
called again after losing connection and then connecting to
another server or starting a hosted tcp server. |
private boolean |
mainPaneLayoutIsDone_hasChannels
Flags for tracking mainPane layout status, in case
initMainPanelLayout(boolean, SOCServerFeatures) is
called again after losing connection and then connecting to
another server or starting a hosted tcp server. |
private static java.lang.String |
MESSAGE_PANEL
message panel, in cardlayout |
protected java.awt.Label |
messageLabel
|
protected java.awt.Label |
messageLabel_top
|
java.lang.String |
NEED_NICKNAME_BEFORE_JOIN
Hint message if they try to join a game or channel without entering a nickname. |
java.lang.String |
NEED_NICKNAME_BEFORE_JOIN_2
Stronger hint message if they still try to join a game or channel without entering a nickname. |
java.lang.String |
NEED_NICKNAME_BEFORE_JOIN_G
Hint message if they try to join a game without entering a nickname, on a server which doesn't support chat channels. |
java.lang.String |
NEED_NICKNAME_BEFORE_JOIN_G2
Stronger hint message if they still try to join a game without entering a nickname, on a server which doesn't support chat channels. |
java.lang.String |
NET_UNAVAIL_CAN_PRACTICE_MSG
For practice games, reminder message for network problems. |
NewGameOptionsFrame |
newGameOptsFrame
The currently showing new-game options frame, or null |
protected java.awt.Button |
ng
"New Game..." button, brings up NewGameOptionsFrame window |
protected java.awt.TextField |
nick
Nickname (username) to connect to server and use in games |
protected java.awt.TextField |
pass
Password for nick while connecting to server, or blank |
protected java.awt.Button |
pg
Practice Game button: Create game to play against practiceServer ,
not localTCPServer . |
protected java.awt.Button |
pgm
|
private java.util.Map<java.lang.String,SOCPlayerInterface> |
playerInterfaces
the player interfaces for the games |
protected static java.lang.String |
STATSPREFEX
Game statistics prefix |
protected java.awt.TextField |
status
Status from server, or progress/error message updated by client |
java.lang.String |
STATUS_CANNOT_JOIN_THIS_GAME
Status text to indicate client cannot join a game. |
private java.awt.Label |
versionOrlocalTCPPortLabel
When connected to a remote server, shows its version number. |
Fields inherited from class java.awt.Component |
---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
SOCPlayerClient.GameAwtDisplay(boolean hasConnectOrPractice,
SOCPlayerClient client)
Create a new GameAwtDisplay for this client. |
Method Summary | |
---|---|
void |
addToGameList(boolean cannotJoin,
java.lang.String gameName,
java.lang.String gameOptsStr,
boolean addToSrvList)
Add a new game to the initial window's list of games. |
void |
addToList(java.lang.String thing,
java.awt.List lst)
add a new channel or game, put it in the list in alphabetical order |
void |
askStartGameWithOptions(java.lang.String gmName,
boolean forPracticeServer,
java.util.Map<java.lang.String,SOCGameOption> opts)
Ask server to start a game with options. |
void |
channelCreated(java.lang.String channelName)
|
void |
channelDeleted(java.lang.String channelName)
|
void |
channelJoined(java.lang.String channelName)
|
void |
channelJoined(java.lang.String channelName,
java.lang.String nickname)
|
void |
channelLeft(java.lang.String channelName)
|
void |
channelLeft(java.lang.String channelName,
java.lang.String nickname)
|
void |
channelList(java.util.Collection<java.lang.String> channelNames,
boolean isPractice)
|
void |
channelMemberList(java.lang.String channel,
java.util.Collection<java.lang.String> members)
|
void |
channelsClosed(java.lang.String message)
|
void |
chSend(java.lang.String ch,
java.lang.String mes)
send a text message to a channel |
void |
clickPracticeButton()
Act as if the "practice game" button has been clicked. |
void |
connect(java.lang.String cpass,
java.lang.String cuser)
Prepare to connect, give feedback by showing MESSAGE_PANEL . |
java.awt.event.WindowAdapter |
createWindowAdapter()
|
boolean |
deleteFromGameList(java.lang.String gameName,
boolean isPractice)
Delete a game from the list. |
void |
deleteFromList(java.lang.String thing,
java.awt.List lst)
delete a group |
boolean |
doLocalCommand(java.lang.String ch,
java.lang.String cmd)
Handle local client commands for channels. |
void |
enableOptions()
|
protected SOCPlayerInterface |
findAnyActiveGame(boolean fromPracticeServer)
Look for active games that we're playing |
void |
focusPassword()
If the password field is currently visible, focus the cursor there for the user to type something. |
PlayerClientListener |
gameJoined(SOCGame game)
|
private void |
gameOptionsCancelTimeoutTask()
Cancel the game-options info timeout. |
private void |
gameOptionsSetTimeoutTask()
Start the game-options info timeout ( SOCPlayerClient.GameOptionsTimeoutTask ) at 5 seconds. |
void |
gameWithOptionsBeginSetup(boolean forPracticeServer,
boolean didAuth)
Want to start a new game, on a server which supports options. |
SOCPlayerClient |
getClient()
|
java.util.Timer |
getEventTimer()
Utility for time-driven events in the client. |
SOCPlayerClient.GameManager |
getGameManager()
|
java.lang.String |
getNickname()
|
protected java.lang.String |
getPassword()
Validate and return the password textfield contents; may be 0-length. |
protected java.lang.String |
getValidNickname(boolean precheckOnly)
Validate and return the nickname textfield, or null if blank or not ready. |
private boolean |
guardedActionPerform_channels(java.lang.Object target)
GuardedActionPerform when a channels-related button or field is clicked |
private boolean |
guardedActionPerform_games(java.lang.Object target)
GuardedActionPerform when a games-related button or field is clicked |
private void |
guardedActionPerform(java.lang.Object target)
Wrapped version of actionPerformed() for easier encapsulation. |
private void |
initMainPanelLayout(boolean isStatusRow,
SOCServerFeatures feats)
Lay out the Main Panel: status text, name, password, game/channel names and lists, buttons. |
void |
initVisualElements()
Init the visual elements. |
void |
leaveGame(SOCGame game)
|
void |
messageBroadcast(java.lang.String message)
|
void |
messageReceived(java.lang.String channelName,
java.lang.String nickname,
java.lang.String message)
|
void |
optionsReceived(ServerGametypeInfo opts,
boolean isPractice)
Server has sent its game option default values for new games. |
void |
optionsReceived(ServerGametypeInfo opts,
boolean isPractice,
boolean isDash,
boolean hasAllNow)
Server has sent info about a single game option. |
void |
optionsRequested()
|
void |
practiceGameStarting()
When a practice game is starting, it may take a while to start server & game. |
protected void |
printIgnoreList(ChannelFrame fr)
Print the current chat ignorelist in a channel. |
protected void |
printIgnoreList(SOCPlayerInterface pi)
Print the current chat ignorelist in a playerinterface. |
boolean |
readValidNicknameAndPassword()
Read and validate username and password GUI fields into client's data fields. |
void |
setMessage(java.lang.String message)
|
void |
setPassword(java.lang.String pw)
Set the contents of the password field. |
void |
showErrorDialog(java.lang.String errMessage,
java.lang.String buttonText)
Show an error dialog which has one button. |
void |
showErrorPanel(java.lang.String err,
boolean canPractice)
After network trouble, show the error panel ( MESSAGE_PANEL )
instead of the main user/password/games/channels panel (MAIN_PANEL ). |
void |
showStatus(java.lang.String statusText,
boolean debugWarn)
Show server welcome banner or status text. |
void |
showVersion(int vers,
java.lang.String versionString,
java.lang.String buildString,
SOCServerFeatures feats)
After connecting, display the remote server's version on main panel, and update display based on its active SOCServerFeatures . |
void |
startLocalTCPServer(int tport)
Setup for locally hosting a TCP server. |
void |
updateGameStats(java.lang.String gameName,
int[] scores,
boolean[] robots)
Update this game's stats in the game list display. |
Methods inherited from class java.awt.Panel |
---|
addNotify, getAccessibleContext |
Methods inherited from class java.awt.Container |
---|
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, paramString, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, setLayout, transferFocusBackward, transferFocusDownCycle, update, validate, validateTree |
Methods inherited from class java.awt.Component |
---|
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusUpCycle |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private static final java.lang.String MAIN_PANEL
private static final java.lang.String MESSAGE_PANEL
private static final java.lang.String CONNECT_OR_PRACTICE_PANEL
connectOrPracticePane
.
Available if hasConnectOrPractice
.
protected static final java.lang.String STATSPREFEX
public final java.lang.String NET_UNAVAIL_CAN_PRACTICE_MSG
public final java.lang.String NEED_NICKNAME_BEFORE_JOIN
NEED_NICKNAME_BEFORE_JOIN_2
,
NEED_NICKNAME_BEFORE_JOIN_G
public final java.lang.String NEED_NICKNAME_BEFORE_JOIN_2
NEED_NICKNAME_BEFORE_JOIN
,
NEED_NICKNAME_BEFORE_JOIN_G2
public final java.lang.String NEED_NICKNAME_BEFORE_JOIN_G
NEED_NICKNAME_BEFORE_JOIN_G2
,
NEED_NICKNAME_BEFORE_JOIN
public final java.lang.String NEED_NICKNAME_BEFORE_JOIN_G2
NEED_NICKNAME_BEFORE_JOIN_G
,
NEED_NICKNAME_BEFORE_JOIN_2
public final java.lang.String STATUS_CANNOT_JOIN_THIS_GAME
private SOCPlayerClient client
private final java.util.Map<java.lang.String,SOCPlayerInterface> playerInterfaces
protected SOCPlayerClient.GameOptionsTimeoutTask gameOptsTask
game options info
.
Set up when sending GAMEOPTIONGETINFOS
.
In case of slow connection or server bug.
gameOptionsSetTimeoutTask()
protected SOCPlayerClient.GameOptionDefaultsTimeoutTask gameOptsDefsTask
game options defaults
.
Set up when sending GAMEOPTIONGETDEFAULTS
.
In case of slow connection or server bug.
gameWithOptionsBeginSetup(boolean, boolean)
protected boolean hasJoinedServer
protected final boolean hasConnectOrPractice
SOCConnectOrPracticePanel
.
cardLayout
protected SOCConnectOrPracticePanel connectOrPracticePane
initVisualElements()
.
Key for cardLayout
is CONNECT_OR_PRACTICE_PANEL
.
hasConnectOrPractice
public NewGameOptionsFrame newGameOptsFrame
private java.awt.Panel mainPane
initVisualElements()
and initMainPanelLayout(boolean, SOCServerFeatures)
.
mainPane
, mainGBL
, and mainGBC
are fields not locals so that
the layout can be changed after initialization if needed. Most of the Main Panel
elements are initialized in initVisualElements()
but not laid out or made visible
until a later call to initMainPanelLayout(boolean, SOCServerFeatures)
(from
(showVersion(....)
)
when the version and features are known.
private java.awt.GridBagLayout mainGBL
mainPane
private java.awt.GridBagConstraints mainGBC
mainGBL
private boolean mainPaneLayoutIsDone
mainPane
layout status, in case
initMainPanelLayout(boolean, SOCServerFeatures)
is
called again after losing connection and then connecting to
another server or starting a hosted tcp server.
private boolean mainPaneLayoutIsDone_hasChannels
mainPane
layout status, in case
initMainPanelLayout(boolean, SOCServerFeatures)
is
called again after losing connection and then connecting to
another server or starting a hosted tcp server.
protected java.awt.TextField nick
protected java.awt.TextField pass
nick
while connecting to server, or blank
protected java.awt.TextField status
protected java.awt.TextField channel
jc
button.
Hidden in v1.1.19+ if server is missing SOCServerFeatures.FEAT_CHANNELS
.
protected java.awt.List chlist
jc
button or by double-click.
Hidden in v1.1.19+ if server is missing SOCServerFeatures.FEAT_CHANNELS
.
protected java.awt.List gmlist
jg
button or by double-click,
or detail info displayed with gi
button.
Contains all games on server if connected, and any Practice Games
created with pg
button.
protected java.awt.Button ng
NewGameOptionsFrame
window
protected java.awt.Button jc
chlist
,
or create new channel named in channel
. Hidden in v1.1.19+ if server
is missing SOCServerFeatures.FEAT_CHANNELS
.
protected java.awt.Button jg
protected java.awt.Button pg
practiceServer
,
not localTCPServer
.
protected java.awt.Button gi
SOCGameOption
s.
Renamed in 2.0.00 to 'gi'; previously 'so' Show Options.
private java.awt.Label localTCPServerLabel
localTCPServer
has been started.
If so, localTCPServer's port number is shown in versionOrlocalTCPPortLabel
.
private java.awt.Label versionOrlocalTCPPortLabel
localTCPServer
,
shows that server's port number (see also localTCPServerLabel
).
In either mode, has a tooltip with more info.
protected java.awt.Label messageLabel
protected java.awt.Label messageLabel_top
protected java.awt.Button pgm
protected java.awt.CardLayout cardLayout
MAIN_PANEL
, MESSAGE_PANEL
or
(if launched from jar, or with no command-line arguments)
CONNECT_OR_PRACTICE_PANEL
.
hasConnectOrPractice
protected java.util.Hashtable<java.lang.String,ChannelFrame> channels
protected java.util.Timer eventTimer
getEventTimer()
.
Constructor Detail |
---|
public SOCPlayerClient.GameAwtDisplay(boolean hasConnectOrPractice, SOCPlayerClient client) throws java.lang.IllegalArgumentException
initVisualElements()
after this constructor.
hasConnectOrPractice
- True if should initially display SOCConnectOrPracticePanel
and ask for a server to connect to, false if the server is known
and should display the main panel (game list, channel list, etc).client
- Client using this display; client.strings
must not be null
java.lang.IllegalArgumentException
- if client
is nullMethod Detail |
---|
public SOCPlayerClient getClient()
public SOCPlayerClient.GameManager getGameManager()
public java.awt.event.WindowAdapter createWindowAdapter()
public void setMessage(java.lang.String message)
setMessage
in interface SOCPlayerClient.GameDisplay
public void showErrorDialog(java.lang.String errMessage, java.lang.String buttonText)
Uses NotifyDialog#createAndShow(GameAwtDisplay, Frame, String, String, boolean)
which calls EventQueue.invokeLater(Runnable)
to ensure it displays from the proper thread.
showErrorDialog
in interface SOCPlayerClient.GameDisplay
errMessage
- Error message to showbuttonText
- Button text, or null for "OK"public void initVisualElements()
SOCPlayerClient.GameDisplay
SOCServerFeatures
.
So, most of the Main Panel elements are initialized here but not
laid out or made visible until a later call to
SOCPlayerClient.GameDisplay.showVersion(int, String, String, SOCServerFeatures)
when the version and features are known.
initVisualElements
in interface SOCPlayerClient.GameDisplay
private void initMainPanelLayout(boolean isStatusRow, SOCServerFeatures feats) throws java.lang.IllegalArgumentException
Because mainPane
is part of a larger layout, this method does not call validate()
.
Be sure to call validate()
afterwards once the entire layout is ready.
This was part of initVisualElements()
before v1.1.19.
isStatusRow
- If true, this is an initial call and only the status row should be laid out.
If false, assumes status was already done and adds the rest of the rows.feats
- Active optional server features, for second call with isStatusRow == false
.
Null when isStatusRow == true
. See showVersion(int, String, String, SOCServerFeatures)
javadoc for expected contents when an older server does not report features.
java.lang.IllegalArgumentException
- if feats
is null but isStatusRow
is falsepublic void connect(java.lang.String cpass, java.lang.String cuser)
MESSAGE_PANEL
.
Prepare to connect and give feedback by showing a message panel.
Stores the given username and password in the user interface.
Does not make a network connection.
Call SOCPlayerClient.ClientNetwork.connect(String, int)
when ready to make the connection.
User login and authentication don't occur until a game or channel join is requested; at that time, the user interface will read the name and password stored here.
connect
in interface SOCPlayerClient.GameDisplay
cpass
- Password text to put into that TextField (obscured)cuser
- User nickname text to put into that TextFieldpublic java.lang.String getNickname()
public void clickPracticeButton()
SOCPlayerClient.GameDisplay
clickPracticeButton
in interface SOCPlayerClient.GameDisplay
private void guardedActionPerform(java.lang.Object target)
target
- Action source, from ActionEvent.getSource()private boolean guardedActionPerform_channels(java.lang.Object target)
target
- Target as in actionPerformed
public boolean readValidNicknameAndPassword()
NEED_NICKNAME_BEFORE_JOIN
.
getValidNickname(boolean)
private boolean guardedActionPerform_games(java.lang.Object target)
target
- Target as in actionPerformed
protected java.lang.String getValidNickname(boolean precheckOnly)
SOCPlayerClient.nickname
field.
precheckOnly
- If true, only validate the name, don't set SOCPlayerClient.nickname
.readValidNicknameAndPassword()
protected java.lang.String getPassword()
SOCPlayerClient.password
field.
If SOCPlayerClient.gotPassword
already, return current password without checking textfield.
public java.util.Timer getEventTimer()
SOCPlayerInterface.getEventTimer()
.
public void gameWithOptionsBeginSetup(boolean forPracticeServer, boolean didAuth)
NewGameOptionsFrame
is already
showing, give it focus instead of creating a new one.
For a summary of the flags and variables involved with game options,
and the client/server interaction about their values, see
ServerGametypeInfo
.
Updates tcpServGameOpts, practiceServGameOpts, newGameOptsFrame.
gameWithOptionsBeginSetup
in interface SOCPlayerClient.GameDisplay
forPracticeServer
- Ask SOCPlayerClient.ClientNetwork.practiceServer
, instead of TCP server?didAuth
- If true, the server has authenticated our username and password;
set those input fields read-only.public void askStartGameWithOptions(java.lang.String gmName, boolean forPracticeServer, java.util.Map<java.lang.String,SOCGameOption> opts)
SOCPlayerClient.startPracticeGame(String, Map, boolean)
.
Otherwise, ask tcp server, and also set WAIT_CURSOR and status line ("Talking to server...").
Assumes getValidNickname(true)
, getPassword()
, SOCPlayerClient.ClientNetwork.host
,
and SOCPlayerClient.gotPassword
are already called and valid.
gmName
- Game name; for practice, null is allowedforPracticeServer
- Is this for a new game on the practice (not tcp) server?opts
- Set of game options
to use, or nullreadValidNicknameAndPassword()
protected SOCPlayerInterface findAnyActiveGame(boolean fromPracticeServer)
fromPracticeServer
- Enumerate games from SOCPlayerClient.ClientNetwork.practiceServer
,
instead of playerInterfaces
?
SOCPlayerClient.ClientNetwork.anyHostedActiveGames()
public void showErrorPanel(java.lang.String err, boolean canPractice)
MESSAGE_PANEL
)
instead of the main user/password/games/channels panel (MAIN_PANEL
).
If we have the startup panel
(started as JAR client
app, not applet) with buttons to connect to a server or practice, we'll show that
instead of the simpler practice-only message panel.
showErrorPanel
in interface SOCPlayerClient.GameDisplay
err
- Error message to showcanPractice
- In current state of client, can we start a practice game?public void enableOptions()
enableOptions
in interface SOCPlayerClient.GameDisplay
public void showVersion(int vers, java.lang.String versionString, java.lang.String buildString, SOCServerFeatures feats)
SOCServerFeatures
.
Not called for practice server.
If we're running a server, display its listening port # instead.
showVersion
calls
initMainPanelLayout(false, feats)
to complete layout of the Main Panel with the server's version and active features.
showVersion
in interface SOCPlayerClient.GameDisplay
vers
- Version number, like 1119, from server's Version.versionNumber()
versionString
- Version string, like "1.1.19", from server's Version.version()
buildString
- Build number, from server's Version.buildnum()
feats
- Active optional server features; never null. If server is older than v1.1.19, use the
SOCServerFeatures(true)
constructor.public void showStatus(java.lang.String statusText, boolean debugWarn)
SOCPlayerClient.GameDisplay
showStatus
in interface SOCPlayerClient.GameDisplay
statusText
- Status message text from serverdebugWarn
- True if server has Debug Mode activepublic void focusPassword()
SOCPlayerClient.GameDisplay
focusPassword
in interface SOCPlayerClient.GameDisplay
public void setPassword(java.lang.String pw)
SOCPlayerClient.GameDisplay
setPassword
in interface SOCPlayerClient.GameDisplay
public void channelJoined(java.lang.String channelName)
channelJoined
in interface SOCPlayerClient.GameDisplay
public void channelJoined(java.lang.String channelName, java.lang.String nickname)
channelJoined
in interface SOCPlayerClient.GameDisplay
public void channelLeft(java.lang.String channelName)
channelLeft
in interface SOCPlayerClient.GameDisplay
public void channelLeft(java.lang.String channelName, java.lang.String nickname)
channelLeft
in interface SOCPlayerClient.GameDisplay
public void channelMemberList(java.lang.String channel, java.util.Collection<java.lang.String> members)
channelMemberList
in interface SOCPlayerClient.GameDisplay
public void channelDeleted(java.lang.String channelName)
channelDeleted
in interface SOCPlayerClient.GameDisplay
public void channelsClosed(java.lang.String message)
channelsClosed
in interface SOCPlayerClient.GameDisplay
public void addToList(java.lang.String thing, java.awt.List lst)
thing
- the thing to add to the listlst
- the listpublic void deleteFromList(java.lang.String thing, java.awt.List lst)
thing
- the thing to removelst
- the listpublic void channelCreated(java.lang.String channelName)
channelCreated
in interface SOCPlayerClient.GameDisplay
public void channelList(java.util.Collection<java.lang.String> channelNames, boolean isPractice)
channelList
in interface SOCPlayerClient.GameDisplay
public void messageBroadcast(java.lang.String message)
messageBroadcast
in interface SOCPlayerClient.GameDisplay
public void messageReceived(java.lang.String channelName, java.lang.String nickname, java.lang.String message)
messageReceived
in interface SOCPlayerClient.GameDisplay
public void leaveGame(SOCGame game)
public PlayerClientListener gameJoined(SOCGame game)
gameJoined
in interface SOCPlayerClient.GameDisplay
private void gameOptionsSetTimeoutTask()
SOCPlayerClient.GameOptionsTimeoutTask
) at 5 seconds.
gameOptionsCancelTimeoutTask()
private void gameOptionsCancelTimeoutTask()
gameOptionsSetTimeoutTask()
public void optionsRequested()
optionsRequested
in interface SOCPlayerClient.GameDisplay
public void optionsReceived(ServerGametypeInfo opts, boolean isPractice)
SOCPlayerClient.GameDisplay
ServerGametypeInfo.newGameWaitingForOpts
flag was set and
has just been cleared. Client should show dialog to create a new game which
will have game options.
optionsReceived
in interface SOCPlayerClient.GameDisplay
opts
- Client's game option info, tracking the TCP or local practice serverisPractice
- True if received from SOCPlayerClient.ClientNetwork.practiceServer
, instead of TCP serverpublic void optionsReceived(ServerGametypeInfo opts, boolean isPractice, boolean isDash, boolean hasAllNow)
SOCPlayerClient.GameDisplay
hasAllNow
,
client should check ServerGametypeInfo.newGameWaitingForOpts
and
ServerGametypeInfo.gameInfoWaitingForOpts
, and if either of these
were waiting, show a game info/options dialog for a new game or existing game.
optionsReceived
in interface SOCPlayerClient.GameDisplay
opts
- Client's game option info, tracking the TCP or local practice serverisPractice
- True if received from SOCPlayerClient.ClientNetwork.practiceServer
, instead of TCP serverisDash
- True if the game option was "-"
, indicating the end of the list.
If so, no further options will be sent and any running timeout task related to the
game options can be cancelled.hasAllNow
- If true, all game option info has now been received by the clientpublic void addToGameList(boolean cannotJoin, java.lang.String gameName, java.lang.String gameOptsStr, boolean addToSrvList)
SOCPlayerClient.GameDisplay
SOCPlayerClient.serverGames
list.
addToGameList
in interface SOCPlayerClient.GameDisplay
cannotJoin
- Can we not join this game?gameName
- the game name to add to the list;
must not have the prefix SOCGames.MARKER_THIS_GAME_UNJOINABLE
.gameOptsStr
- String of packed game options
, or nulladdToSrvList
- Should this game be added to the list of remote-server games?
Practice games should not be added.public void updateGameStats(java.lang.String gameName, int[] scores, boolean[] robots)
SOCPlayerClient.GameDisplay
updateGameStats
in interface SOCPlayerClient.GameDisplay
gameName
- Name of game to updatescores
- Each player position's scorerobots
- Is this position a robot?SOCGameStats
public boolean deleteFromGameList(java.lang.String gameName, boolean isPractice)
SOCPlayerClient.GameDisplay
SOCPlayerClient.serverGames
.
deleteFromGameList
in interface SOCPlayerClient.GameDisplay
gameName
- the game to removeisPractice
- Game is practice, not at tcp server?
public void chSend(java.lang.String ch, java.lang.String mes)
ch
- the name of the channelmes
- the messagepublic boolean doLocalCommand(java.lang.String ch, java.lang.String cmd)
cmd
- Local client command string, such as \ignore or \unignore
SOCPlayerInterface.doLocalCommand(String)
protected void printIgnoreList(ChannelFrame fr)
protected void printIgnoreList(SOCPlayerInterface pi)
public void practiceGameStarting()
Cursor.WAIT_CURSOR
.
The new-game window will clear this cursor back to default.
practiceGameStarting
in interface SOCPlayerClient.GameDisplay
public void startLocalTCPServer(int tport) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException
local server
and robots are started, and client connects to it.
If parent is a Frame, set titlebar to show "server" and port#.
Show port number in versionOrlocalTCPPortLabel
.
If the SOCPlayerClient.ClientNetwork.localTCPServer
is already created, does nothing.
If connected
already, does nothing.
tport
- Port number to host on; must be greater than zero.
java.lang.IllegalArgumentException
- If port is 0 or negative
java.lang.IllegalStateException
- if already connected to a server
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |