Package net.sf.colossus.webclient
Class WebClient
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- java.awt.Window
-
- java.awt.Frame
-
- javax.swing.JFrame
-
- net.sf.colossus.guiutil.KFrame
-
- net.sf.colossus.webclient.WebClient
-
- All Implemented Interfaces:
java.awt.image.ImageObserver,java.awt.MenuContainer,java.io.Serializable,javax.accessibility.Accessible,javax.swing.RootPaneContainer,javax.swing.WindowConstants,IWebClient
public class WebClient extends KFrame implements IWebClient
This is the main class for one user client for the web server. One such client can register and/or login to the web server, propose a game, browse proposed games and enroll to such a game. When a game has enough players, it can be started, and this brings up the MasterBoard like the network client would do.- Author:
- Clemens Katzer
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) classWebClient.TriggerTimeIsUp-
Nested classes/interfaces inherited from class javax.swing.JFrame
javax.swing.JFrame.AccessibleJFrame
-
Nested classes/interfaces inherited from class java.awt.Window
java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
-
-
Field Summary
Fields Modifier and Type Field Description private javax.swing.BoxadminTabprivate javax.swing.JTextFieldatDateFieldprivate javax.swing.JTextFieldatTimeFieldprivate javax.swing.JCheckBoxautoGamePaneCBprivate static java.lang.StringAutoGamePaneCBTextprivate static java.lang.StringAutoGameStartActionCloseprivate static java.lang.StringAutoGameStartActionHideprivate static java.lang.StringAutoGameStartActionNothingprivate javax.swing.JRadioButtonautoGSCloseRBprivate javax.swing.JRadioButtonautoGSHideRBprivate javax.swing.JRadioButtonautoGSNothingRBprivate javax.swing.JCheckBoxautologinCBprivate static java.lang.StringAutoLoginCBTextprivate javax.swing.JCheckBoxbalancedTowersCBprivate javax.swing.JTextFieldbeepCountFieldprivate javax.swing.JTextFieldbeepIntervalFieldprivate javax.swing.JButtoncancelButtonprivate static java.lang.StringCancelButtonTextprivate static java.lang.StringCancelLoginButtonTextprivate static java.lang.StringCantHideText(package private) static java.lang.StringCARD_PROPOSEDprivate static java.lang.StringchgPasswordButtonTextprivate static java.lang.StringchgPasswordLabelTextprivate booleanclientIsUpprivate booleanclientStartFailedprivate java.lang.ObjectcomingUpMutexprivate javax.swing.JTextFieldcommandFieldprivate static java.lang.StringcreateAccountButtonTextprivate static java.lang.StringcreateAccountLabelTextprivate javax.swing.BoxcreateGamesTabprivate javax.swing.JButtondebugSubmitButtonprivate java.awt.PointdefaultLocationprivate static java.lang.StringdefaultSummaryTextprivate java.util.HashSet<java.lang.String>deletedGamesprivate static java.lang.StringdialogMessageprivate static java.lang.StringdialogTitleprivate javax.swing.JButtondumpInfoButtonprivate javax.swing.JTextFielddurationFieldprivate javax.swing.JButtonenrollButtonprivate static java.lang.StringEnrollButtonTextprivate static intEnrolledInstantGameprivate java.lang.StringenrolledInstantGameId(package private) static java.lang.StringenrolledText(package private) static java.lang.StringenrollTextprivate javax.swing.JComboBoxeventExpiringBoxprivate booleanfailedDueToDuplicateLoginprivate booleanfailedDueToOwnCancelprivate ClientgameClientprivate java.util.HashMap<java.lang.String,GameInfo>gameHashNOTE: shared with SocketThread, because WCST needs it to restore game tokens to an GameInfo objectprivate javax.swing.JTextFieldgameNrFieldprivate RunGameInSameJVMgameRunnerprivate javax.swing.JPanelgamesCardsprivate javax.swing.JPanelgamesTablesPanelprivate java.util.ArrayList<GameInfo>gamesUpdatesprivate ChatHandlergeneralChatprivate javax.swing.JButtonhideButtonprivate javax.swing.JLabelhideButtonTextprivate static java.lang.StringHideButtonTextprivate java.lang.Stringhostnameprivate static java.lang.StringHowtoUnhideTextprivate javax.swing.JLabelinfoTextLabelprivate booleanisAdminprivate ServerlocalServerprivate static intLoggedInprivate static java.util.logging.LoggerLOGGERprivate java.lang.Stringloginprivate static java.lang.StringLoginButtonTextprivate javax.swing.JTextFieldloginFieldprivate javax.swing.JButtonloginLogoutButtonprivate static java.lang.StringLogoutButtonTextprivate javax.swing.JLabelmaxLabelprivate static intmaxPortprivate static intminPortprivate java.text.DateFormatmyDateFormat(package private) static java.util.LocalemyLocaleprivate java.text.DateFormatmyTimeFormat(package private) static java.lang.StringneedLoginTextprivate javax.swing.JTextFieldnotifyMessageFieldprivate javax.swing.JTextFieldnotifyUserFieldprivate static intNotLoggedInprivate javax.swing.JLabelnowDateAndTimeLabelprivate static java.lang.StringoptAutoGameStartActionprivate Optionsoptionsprivate java.lang.Stringpasswordprivate javax.swing.JPasswordFieldpasswordFieldprivate static intPlaying(package private) static java.lang.StringplayingTextprivate intportprivate javax.swing.JPanelpreferencesPaneprivate javax.swing.JPanelpropGamesCardprivate javax.swing.JButtonproposeButtonprivate static java.lang.StringProposeButtonTextprivate GameTableModelproposedGameDataModelprivate javax.swing.JTableproposedGameTableprivate javax.swing.JButtonquitButtonprivate static java.lang.StringquitButtonTextprivate javax.swing.JLabelreceivedFieldprivate javax.swing.JButtonregisterOrPasswordButtonprivate javax.swing.JLabelregisterOrPasswordLabelprivate RegisterPasswordPanelregisterPanelprivate javax.swing.JButtonrereadLoginMsgButtonprivate GameTableModelrunGameDataModelprivate javax.swing.JTablerunGameTableprivate javax.swing.BoxrunningGamesTabprivate booleanscheduledGamesModeprivate static java.lang.Stringsepprivate IWebServerserverprivate javax.swing.BoxserverTabprivate javax.swing.JButtonshutdownButtonprivate javax.swing.JSpinnerspinner1private javax.swing.JSpinnerspinner2private javax.swing.JSpinnerspinner3private javax.swing.JButtonstartButtonprivate static java.lang.StringStartButtonText(package private) static java.lang.StringstartClickedTextprivate java.lang.StringstartedAtHostprivate intstartedAtPortprivate java.lang.StringstartedGameIdprivate GameInfostartingGameprivate javax.swing.JButtonstartLocallyButtonprivate static java.lang.StringStartLocallyButtonTextprivate intstateprivate javax.swing.JLabelstatusFieldprivate javax.swing.JLabelstatusLabelprivate java.lang.StringstatusTextprivate javax.swing.JTextFieldsummaryTextprivate javax.swing.JTabbedPanetabbedPaneprivate booleantimeIsUp(package private) static java.lang.StringTYPE_INSTANTLY(package private) static java.lang.StringTYPE_SCHEDULEDprivate javax.swing.JButtonunenrollButtonprivate static java.lang.StringUnenrollButtonTextprivate javax.swing.JCheckBoxunlimitedMulligansCBprivate javax.swing.JLabeluserinfoLabelprivate java.lang.Stringusernameprivate intusersDeadprivate intusersEnrolledprivate intusersLoggedInprivate longusersLogoffAgoprivate intusersPlayingprivate java.lang.StringusersTextprivate javax.swing.JComboBoxvariantBoxprivate javax.swing.JComboBoxviewmodeBox(package private) static java.lang.StringwaitingTextprivate javax.swing.JButtonwatchButtonprivate static java.lang.StringWatchButtonTextprivate static intWatchingprivate java.lang.StringwatchingInstantGameId(package private) static java.lang.StringwatchingTextstatic intWC_VERSION_DINO_OKstatic intWC_VERSION_GENERAL_MESSAGEstatic intWC_VERSION_SUPPORTS_PINGprivate WebClientSocketThreadwcst(package private) static intWEB_CLIENT_VERSIONprivate javax.swing.JTextFieldwebserverHostFieldprivate javax.swing.JTextFieldwebserverPortFieldprivate WhatNextManagerwhatNextManagerprivate static java.lang.StringwindowTitle-
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 java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
-
Fields inherited from interface net.sf.colossus.webcommon.IWebClient
alreadyLoggedIn, chatDeliver, connectionClosed, didEnroll, didUnenroll, forcedLogout, gameCancelled, gameInfo, gameStarted, gameStartsNow, gameStartsSoon, generalMessage, grantAdmin, pingRequest, requestAttention, systemMessage, tooManyUsers, userInfo, watchGameInfo
-
-
Constructor Summary
Constructors Constructor Description WebClient(WhatNextManager whatNextManager, java.lang.String hostname, int port, java.lang.String login, java.lang.String password)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidaddAdminTab()private voidaddRadioButton(java.awt.Container cont, javax.swing.ButtonGroup group, java.lang.String text, java.lang.String current, java.awt.event.ItemListener listener)private voidadjustToPossibleMax(javax.swing.JSpinner spinner, int max)private voidautoActions()voidbeepButtonAction()private voidcancelButtonAction()private voidcancelOwnInstantGameOnLogout()voidchatDeliver(java.lang.String chatId, long when, java.lang.String sender, java.lang.String message, boolean resent)private booleancheckIfCouldCancel()private booleancheckIfCouldEnroll()private booleancheckIfCouldPropose()private booleancheckIfCouldStartOnServer(int state)private booleancheckIfCouldUnenroll()private booleancheckIfCouldWatch(int state)voidclearWatching()voidconnectionReset(boolean forced)private voidcreateAdminTab()private voidcreateCreateGamesTab()java.lang.StringcreateLoginWebClientSocketThread(boolean force)private voidcreatePreferencesPane()java.lang.StringcreateRegisterWebClientSocketThread(java.lang.String username, java.lang.String password, java.lang.String email, java.lang.String confCode)private voidcreateRunningGamesTab()private voidcreateServerTab()private voiddebugSubmitButtonAction()voiddeliverGeneralMessage(long when, boolean error, java.lang.String title, java.lang.String message)voiddidEnroll(java.lang.String gameId, java.lang.String user)voiddidUnenroll(java.lang.String gameId, java.lang.String user)private voiddisplayOnlyOneInstantGameMessage(java.lang.String action, java.lang.String message)voiddispose()private voiddo_proposeGame(java.lang.String variant, java.lang.String viewmode, long startAt, int duration, java.lang.String summary, java.lang.String expire, boolean unlimMulli, boolean balTowers, int min, int target, int max)private voiddoAutoGSAction()private voiddoCancel(java.lang.String gameId)voiddoCancelConnect()private booleandoEnroll(java.lang.String gameId)voiddoLogin()voiddoLogout()private voiddoQuit()private voiddoRegisterOrPasswordDialog(boolean register)voiddoScheduleDummy()(package private) booleandoStart(java.lang.String gameId)private booleandoStartLocally(java.lang.String gameId)private booleandoUnenroll(java.lang.String gameId)voiddoUpdateGUI()private voiddumpInfoButtonAction()private voidenrollButtonAction()private voidexecuteLoginLogoutButtonAction(java.lang.String command)private GameInfofindGameById(java.lang.String gameId)private GameInfofindGameByIdNoComplaint(java.lang.String gameId)private java.util.List<GameInfo>findMyInstantGames()Find all "relevant" instant games owned by this player (relevant means except those who are running, ending or deleted).voidgameCancelled(java.lang.String gameId, java.lang.String byUser)voidgameInfo(GameInfo gi)voidgameStartsNow(java.lang.String gameId, int port, java.lang.String hostingHost)voidgameStartsSoon(java.lang.String gameId, java.lang.String startUser)intgetClientVersion()private intgetDuration()java.util.HashMap<java.lang.String,GameInfo>getGameHash()IGameRunnergetGameRunner()java.lang.StringgetHost()private intgetMaxForVariant(java.lang.String variant)private java.util.CalendargetNowPlusOffset(java.util.Calendar now, int days, int hours)Determine a point in time given amount of days and hours from now.java.lang.StringgetPort()booleangetScheduledGamesMode()java.lang.StringgetSelectedGameFromRunTableId()java.lang.StringgetSelectedGameId()private longgetStartTime()private java.lang.StringgetSummaryText()private java.lang.StringgetUserinfoText()INotifyWebServergetWhomToNotify()voidgrantAdminStatus()private voidhandleGameInfoUpdates(GameInfo gi)private voidhideButtonAction()voidinformGameStartedLocally()voidinformLocallyGameOver()voidinformStartingOnPlayerHost(java.lang.String hostingPlayer, java.lang.String hostingHost, int hostingPort)private voidinitFormats()private voidinitValues(java.lang.String hostname, int port, java.lang.String login, java.lang.String password)booleanisAdmin()private booleanisEligibleToStart(GameInfo gi)Returns true if this user would be allowed to start this game (given that all other conditions are fulfilled).private booleanisOwner(java.lang.String gameId)private booleanisScheduledGameAndStartable(java.lang.String id)private voidloadGameButtonAction()(package private) voidloginLogoutButtonAction(java.lang.String command)private voidlogout()private java.lang.StringmakeDateTimeInfoString(java.util.Calendar now)private java.lang.StringmakeInfoTextForState(int state)private java.lang.StringmakeStatusTextForState(int state)private javax.swing.BoxmakeTextBox(java.awt.Component c)private javax.swing.BoxmakeTextBox2(java.awt.Component c, java.awt.Component c2)private java.lang.StringmakeWindowTitleForState(int state)private javax.swing.JLabelnonBoldLabel(java.lang.String text)voidnotifyComingUp(boolean success)voidonGameStartAutoAction()private GameInfoownInstantGameIfAny()If there is at least one instant game by this player, return it (one of it if many), otherwise null.private voidproposeButtonAction()private voidquitButtonAction()voidreactOnScheduleRadioButtonChange(java.awt.event.ItemEvent e)private voidregisterOrPasswordButtonAction(java.lang.String command)private voidremoveAdminTab()private voidreplaceInTable(javax.swing.JTable table, GameInfo gi)voidrequestAttention(long when, java.lang.String byUser, boolean byAdmin, java.lang.String message, int beepCount, long beepInterval, boolean windows)private voidrereadLoginMsgButtonAction()private voidsetAdmin(boolean isAdmin)voidsetGameClient(Client c)voidsetLocalServer(Server server)private voidsetScheduledGamesMode(boolean scheduled)private voidsetupGUI()private java.util.TimersetupTimer()voidsetWatching(java.lang.String gameId)voidshowAnswer(java.lang.String s)private voidshowRequestAttentionMessage()private voidshutdownButtonAction()private voidstartButtonAction()private voidstartLocallyButtonAction()voidstartOwnClient(java.lang.String gameId, int port, java.lang.String hostingHost)voidstartSpectatorClient(java.lang.String gameId, int port, java.lang.String hostingHost)voidsystemMessage(long when, java.lang.String message)voidtellGameEnds()java.lang.StringtryChangePassword(java.lang.String name, java.lang.String oldPW, java.lang.String newPW1)private voidunenrollButtonAction()private voidupdateDateTimeInfoString()voidupdateGUI()private voidupdateMaxSpinner(java.lang.String variant)voidupdateStatus(java.lang.String text, java.awt.Color color)voiduserInfo(int loggedin, int enrolled, int playing, int dead, long ago, java.lang.String text)booleanvalidateField(java.awt.Component parent, java.lang.String content, java.lang.String fieldName)(package private) booleanvalidatePort(java.awt.Component parent, java.lang.String portText)booleanvalidateServerAndPort()private voidwatchButtonAction()voidwatchGameInfo(java.lang.String gameId, java.lang.String host, int port)-
Methods inherited from class net.sf.colossus.guiutil.KFrame
centerOnScreen, setVisible, useSaveWindow
-
Methods inherited from class javax.swing.JFrame
addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
-
Methods inherited from class java.awt.Frame
addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
-
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, show, toBack, toFront
-
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, 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, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setMixingCutoutShape, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
-
-
-
Field Detail
-
LOGGER
private static final java.util.logging.Logger LOGGER
-
WC_VERSION_GENERAL_MESSAGE
public static final int WC_VERSION_GENERAL_MESSAGE
- See Also:
- Constant Field Values
-
WC_VERSION_SUPPORTS_PING
public static final int WC_VERSION_SUPPORTS_PING
- See Also:
- Constant Field Values
-
WC_VERSION_DINO_OK
public static final int WC_VERSION_DINO_OK
- See Also:
- Constant Field Values
-
WEB_CLIENT_VERSION
static final int WEB_CLIENT_VERSION
- See Also:
- Constant Field Values
-
myLocale
static final java.util.Locale myLocale
-
CARD_PROPOSED
static final java.lang.String CARD_PROPOSED
- See Also:
- Constant Field Values
-
TYPE_SCHEDULED
static final java.lang.String TYPE_SCHEDULED
- See Also:
- Constant Field Values
-
TYPE_INSTANTLY
static final java.lang.String TYPE_INSTANTLY
- See Also:
- Constant Field Values
-
whatNextManager
private final WhatNextManager whatNextManager
-
hostname
private java.lang.String hostname
-
port
private int port
-
login
private java.lang.String login
-
username
private java.lang.String username
-
password
private java.lang.String password
-
isAdmin
private boolean isAdmin
-
options
private final Options options
-
gameClient
private Client gameClient
-
gameRunner
private RunGameInSameJVM gameRunner
-
localServer
private Server localServer
-
startedGameId
private java.lang.String startedGameId
-
startedAtPort
private int startedAtPort
-
startedAtHost
private java.lang.String startedAtHost
-
registerPanel
private RegisterPasswordPanel registerPanel
-
comingUpMutex
private final java.lang.Object comingUpMutex
-
timeIsUp
private boolean timeIsUp
-
clientIsUp
private boolean clientIsUp
-
clientStartFailed
private boolean clientStartFailed
-
NotLoggedIn
private static final int NotLoggedIn
- See Also:
- Constant Field Values
-
LoggedIn
private static final int LoggedIn
- See Also:
- Constant Field Values
-
EnrolledInstantGame
private static final int EnrolledInstantGame
- See Also:
- Constant Field Values
-
Playing
private static final int Playing
- See Also:
- Constant Field Values
-
Watching
private static final int Watching
- See Also:
- Constant Field Values
-
startingGame
private GameInfo startingGame
-
minPort
private static final int minPort
- See Also:
- Constant Field Values
-
maxPort
private static final int maxPort
- See Also:
- Constant Field Values
-
sep
private static final java.lang.String sep
- See Also:
- Constant Field Values
-
failedDueToDuplicateLogin
private boolean failedDueToDuplicateLogin
-
failedDueToOwnCancel
private boolean failedDueToOwnCancel
-
state
private int state
-
enrolledInstantGameId
private java.lang.String enrolledInstantGameId
-
watchingInstantGameId
private java.lang.String watchingInstantGameId
-
scheduledGamesMode
private boolean scheduledGamesMode
-
usersLoggedIn
private int usersLoggedIn
-
usersEnrolled
private int usersEnrolled
-
usersPlaying
private int usersPlaying
-
usersDead
private int usersDead
-
usersLogoffAgo
private long usersLogoffAgo
-
usersText
private java.lang.String usersText
-
server
private IWebServer server
-
wcst
private WebClientSocketThread wcst
-
tabbedPane
private javax.swing.JTabbedPane tabbedPane
-
serverTab
private javax.swing.Box serverTab
-
preferencesPane
private javax.swing.JPanel preferencesPane
-
createGamesTab
private javax.swing.Box createGamesTab
-
runningGamesTab
private javax.swing.Box runningGamesTab
-
adminTab
private javax.swing.Box adminTab
-
defaultLocation
private final java.awt.Point defaultLocation
-
statusLabel
private javax.swing.JLabel statusLabel
-
userinfoLabel
private javax.swing.JLabel userinfoLabel
-
webserverHostField
private javax.swing.JTextField webserverHostField
-
webserverPortField
private javax.swing.JTextField webserverPortField
-
loginField
private javax.swing.JTextField loginField
-
passwordField
private javax.swing.JPasswordField passwordField
-
commandField
private javax.swing.JTextField commandField
-
receivedField
private javax.swing.JLabel receivedField
-
loginLogoutButton
private javax.swing.JButton loginLogoutButton
-
quitButton
private javax.swing.JButton quitButton
-
autologinCB
private javax.swing.JCheckBox autologinCB
-
autoGamePaneCB
private javax.swing.JCheckBox autoGamePaneCB
-
registerOrPasswordLabel
private javax.swing.JLabel registerOrPasswordLabel
-
registerOrPasswordButton
private javax.swing.JButton registerOrPasswordButton
-
debugSubmitButton
private javax.swing.JButton debugSubmitButton
-
rereadLoginMsgButton
private javax.swing.JButton rereadLoginMsgButton
-
shutdownButton
private javax.swing.JButton shutdownButton
-
dumpInfoButton
private javax.swing.JButton dumpInfoButton
-
notifyMessageField
private javax.swing.JTextField notifyMessageField
-
notifyUserField
private javax.swing.JTextField notifyUserField
-
beepCountField
private javax.swing.JTextField beepCountField
-
beepIntervalField
private javax.swing.JTextField beepIntervalField
-
statusField
private javax.swing.JLabel statusField
-
statusText
private java.lang.String statusText
-
variantBox
private javax.swing.JComboBox variantBox
-
viewmodeBox
private javax.swing.JComboBox viewmodeBox
-
eventExpiringBox
private javax.swing.JComboBox eventExpiringBox
-
spinner1
private javax.swing.JSpinner spinner1
-
spinner2
private javax.swing.JSpinner spinner2
-
spinner3
private javax.swing.JSpinner spinner3
-
maxLabel
private javax.swing.JLabel maxLabel
-
unlimitedMulligansCB
private javax.swing.JCheckBox unlimitedMulligansCB
-
balancedTowersCB
private javax.swing.JCheckBox balancedTowersCB
-
nowDateAndTimeLabel
private javax.swing.JLabel nowDateAndTimeLabel
-
atDateField
private javax.swing.JTextField atDateField
-
atTimeField
private javax.swing.JTextField atTimeField
-
durationField
private javax.swing.JTextField durationField
-
summaryText
private javax.swing.JTextField summaryText
-
myDateFormat
private java.text.DateFormat myDateFormat
-
myTimeFormat
private java.text.DateFormat myTimeFormat
-
proposeButton
private javax.swing.JButton proposeButton
-
cancelButton
private javax.swing.JButton cancelButton
-
enrollButton
private javax.swing.JButton enrollButton
-
unenrollButton
private javax.swing.JButton unenrollButton
-
startButton
private javax.swing.JButton startButton
-
startLocallyButton
private javax.swing.JButton startLocallyButton
-
watchButton
private javax.swing.JButton watchButton
-
hideButton
private javax.swing.JButton hideButton
-
hideButtonText
private javax.swing.JLabel hideButtonText
-
gameNrField
private javax.swing.JTextField gameNrField
-
autoGSNothingRB
private javax.swing.JRadioButton autoGSNothingRB
-
autoGSHideRB
private javax.swing.JRadioButton autoGSHideRB
-
autoGSCloseRB
private javax.swing.JRadioButton autoGSCloseRB
-
infoTextLabel
private javax.swing.JLabel infoTextLabel
-
needLoginText
static final java.lang.String needLoginText
- See Also:
- Constant Field Values
-
enrollText
static final java.lang.String enrollText
- See Also:
- Constant Field Values
-
startClickedText
static final java.lang.String startClickedText
- See Also:
- Constant Field Values
-
waitingText
static final java.lang.String waitingText
- See Also:
- Constant Field Values
-
enrolledText
static final java.lang.String enrolledText
- See Also:
- Constant Field Values
-
playingText
static final java.lang.String playingText
- See Also:
- Constant Field Values
-
watchingText
static final java.lang.String watchingText
- See Also:
- Constant Field Values
-
generalChat
private ChatHandler generalChat
-
gamesUpdates
private final java.util.ArrayList<GameInfo> gamesUpdates
-
gameHash
private final java.util.HashMap<java.lang.String,GameInfo> gameHash
NOTE: shared with SocketThread, because WCST needs it to restore game tokens to an GameInfo object
-
deletedGames
private final java.util.HashSet<java.lang.String> deletedGames
-
gamesTablesPanel
private javax.swing.JPanel gamesTablesPanel
-
gamesCards
private javax.swing.JPanel gamesCards
-
propGamesCard
private javax.swing.JPanel propGamesCard
-
proposedGameTable
private javax.swing.JTable proposedGameTable
-
proposedGameDataModel
private GameTableModel proposedGameDataModel
-
runGameTable
private javax.swing.JTable runGameTable
-
runGameDataModel
private GameTableModel runGameDataModel
-
windowTitle
private static java.lang.String windowTitle
-
LoginButtonText
private static final java.lang.String LoginButtonText
- See Also:
- Constant Field Values
-
LogoutButtonText
private static final java.lang.String LogoutButtonText
- See Also:
- Constant Field Values
-
CancelLoginButtonText
private static final java.lang.String CancelLoginButtonText
- See Also:
- Constant Field Values
-
quitButtonText
private static final java.lang.String quitButtonText
- See Also:
- Constant Field Values
-
HideButtonText
private static final java.lang.String HideButtonText
- See Also:
- Constant Field Values
-
WatchButtonText
private static final java.lang.String WatchButtonText
- See Also:
- Constant Field Values
-
CantHideText
private static final java.lang.String CantHideText
- See Also:
- Constant Field Values
-
HowtoUnhideText
private static final java.lang.String HowtoUnhideText
- See Also:
- Constant Field Values
-
createAccountButtonText
private static final java.lang.String createAccountButtonText
- See Also:
- Constant Field Values
-
chgPasswordButtonText
private static final java.lang.String chgPasswordButtonText
- See Also:
- Constant Field Values
-
ProposeButtonText
private static final java.lang.String ProposeButtonText
- See Also:
- Constant Field Values
-
EnrollButtonText
private static final java.lang.String EnrollButtonText
- See Also:
- Constant Field Values
-
UnenrollButtonText
private static final java.lang.String UnenrollButtonText
- See Also:
- Constant Field Values
-
CancelButtonText
private static final java.lang.String CancelButtonText
- See Also:
- Constant Field Values
-
StartButtonText
private static final java.lang.String StartButtonText
- See Also:
- Constant Field Values
-
StartLocallyButtonText
private static final java.lang.String StartLocallyButtonText
- See Also:
- Constant Field Values
-
AutoLoginCBText
private static final java.lang.String AutoLoginCBText
- See Also:
- Constant Field Values
-
AutoGamePaneCBText
private static final java.lang.String AutoGamePaneCBText
- See Also:
- Constant Field Values
-
createAccountLabelText
private static final java.lang.String createAccountLabelText
- See Also:
- Constant Field Values
-
chgPasswordLabelText
private static final java.lang.String chgPasswordLabelText
- See Also:
- Constant Field Values
-
AutoGameStartActionNothing
private static final java.lang.String AutoGameStartActionNothing
- See Also:
- Constant Field Values
-
AutoGameStartActionHide
private static final java.lang.String AutoGameStartActionHide
- See Also:
- Constant Field Values
-
AutoGameStartActionClose
private static final java.lang.String AutoGameStartActionClose
- See Also:
- Constant Field Values
-
optAutoGameStartAction
private static final java.lang.String optAutoGameStartAction
- See Also:
- Constant Field Values
-
defaultSummaryText
private static final java.lang.String defaultSummaryText
- See Also:
- Constant Field Values
-
dialogTitle
private static java.lang.String dialogTitle
-
dialogMessage
private static java.lang.String dialogMessage
-
-
Constructor Detail
-
WebClient
public WebClient(WhatNextManager whatNextManager, java.lang.String hostname, int port, java.lang.String login, java.lang.String password)
-
-
Method Detail
-
getClientVersion
public int getClientVersion()
- Specified by:
getClientVersionin interfaceIWebClient
-
initValues
private void initValues(java.lang.String hostname, int port, java.lang.String login, java.lang.String password)
-
setGameClient
public void setGameClient(Client c)
-
setScheduledGamesMode
private void setScheduledGamesMode(boolean scheduled)
-
getScheduledGamesMode
public boolean getScheduledGamesMode()
-
onGameStartAutoAction
public void onGameStartAutoAction()
-
setupGUI
private void setupGUI()
-
autoActions
private void autoActions()
-
doAutoGSAction
private void doAutoGSAction()
-
updateStatus
public void updateStatus(java.lang.String text, java.awt.Color color)
-
addAdminTab
private void addAdminTab()
-
removeAdminTab
private void removeAdminTab()
-
setAdmin
private void setAdmin(boolean isAdmin)
-
isAdmin
public boolean isAdmin()
-
showAnswer
public void showAnswer(java.lang.String s)
-
getHost
public java.lang.String getHost()
-
getPort
public java.lang.String getPort()
-
getGameRunner
public IGameRunner getGameRunner()
-
getWhomToNotify
public INotifyWebServer getWhomToNotify()
-
createServerTab
private void createServerTab()
-
addRadioButton
private void addRadioButton(java.awt.Container cont, javax.swing.ButtonGroup group, java.lang.String text, java.lang.String current, java.awt.event.ItemListener listener)
-
nonBoldLabel
private javax.swing.JLabel nonBoldLabel(java.lang.String text)
-
makeTextBox
private javax.swing.Box makeTextBox(java.awt.Component c)
-
makeTextBox2
private javax.swing.Box makeTextBox2(java.awt.Component c, java.awt.Component c2)
-
initFormats
private void initFormats()
-
makeDateTimeInfoString
private java.lang.String makeDateTimeInfoString(java.util.Calendar now)
-
updateDateTimeInfoString
private void updateDateTimeInfoString()
-
createCreateGamesTab
private void createCreateGamesTab()
-
getNowPlusOffset
private java.util.Calendar getNowPlusOffset(java.util.Calendar now, int days, int hours)Determine a point in time given amount of days and hours from now. Round it to a full hour (down if min <= 10, next hour otherwise).- Parameters:
days-hours-- Returns:
-
reactOnScheduleRadioButtonChange
public void reactOnScheduleRadioButtonChange(java.awt.event.ItemEvent e)
-
createPreferencesPane
private void createPreferencesPane()
-
updateMaxSpinner
private void updateMaxSpinner(java.lang.String variant)
-
adjustToPossibleMax
private void adjustToPossibleMax(javax.swing.JSpinner spinner, int max)
-
getMaxForVariant
private int getMaxForVariant(java.lang.String variant)
-
createRunningGamesTab
private void createRunningGamesTab()
-
createAdminTab
private void createAdminTab()
-
beepButtonAction
public void beepButtonAction()
-
createLoginWebClientSocketThread
public java.lang.String createLoginWebClientSocketThread(boolean force)
-
createRegisterWebClientSocketThread
public java.lang.String createRegisterWebClientSocketThread(java.lang.String username, java.lang.String password, java.lang.String email, java.lang.String confCode)
-
logout
private void logout()
-
doQuit
private void doQuit()
-
getUserinfoText
private java.lang.String getUserinfoText()
-
updateGUI
public void updateGUI()
-
getSelectedGameId
public java.lang.String getSelectedGameId()
-
getSelectedGameFromRunTableId
public java.lang.String getSelectedGameFromRunTableId()
-
makeWindowTitleForState
private java.lang.String makeWindowTitleForState(int state)
-
makeInfoTextForState
private java.lang.String makeInfoTextForState(int state)
-
makeStatusTextForState
private java.lang.String makeStatusTextForState(int state)
-
isEligibleToStart
private boolean isEligibleToStart(GameInfo gi)
Returns true if this user would be allowed to start this game (given that all other conditions are fulfilled). Usually the allowed player is the one who created it, but if that one is not enrolled, the first of the enrolled ones is allowed then to do it.- Parameters:
gi-- Returns:
- Whether this player would be allowed to start this game
-
checkIfCouldWatch
private boolean checkIfCouldWatch(int state)
-
checkIfCouldStartOnServer
private boolean checkIfCouldStartOnServer(int state)
-
isScheduledGameAndStartable
private boolean isScheduledGameAndStartable(java.lang.String id)
-
checkIfCouldPropose
private boolean checkIfCouldPropose()
-
checkIfCouldCancel
private boolean checkIfCouldCancel()
-
checkIfCouldEnroll
private boolean checkIfCouldEnroll()
-
checkIfCouldUnenroll
private boolean checkIfCouldUnenroll()
-
doUpdateGUI
public void doUpdateGUI()
-
getGameHash
public java.util.HashMap<java.lang.String,GameInfo> getGameHash()
-
findGameByIdNoComplaint
private GameInfo findGameByIdNoComplaint(java.lang.String gameId)
-
findGameById
private GameInfo findGameById(java.lang.String gameId)
-
isOwner
private boolean isOwner(java.lang.String gameId)
-
validateField
public boolean validateField(java.awt.Component parent, java.lang.String content, java.lang.String fieldName)
-
validatePort
boolean validatePort(java.awt.Component parent, java.lang.String portText)
-
doLogin
public void doLogin()
-
doCancelConnect
public void doCancelConnect()
-
validateServerAndPort
public boolean validateServerAndPort()
-
doLogout
public void doLogout()
-
cancelOwnInstantGameOnLogout
private void cancelOwnInstantGameOnLogout()
-
doRegisterOrPasswordDialog
private void doRegisterOrPasswordDialog(boolean register)
-
tryChangePassword
public java.lang.String tryChangePassword(java.lang.String name, java.lang.String oldPW, java.lang.String newPW1)
-
doCancel
private void doCancel(java.lang.String gameId)
-
doScheduleDummy
public void doScheduleDummy()
-
do_proposeGame
private void do_proposeGame(java.lang.String variant, java.lang.String viewmode, long startAt, int duration, java.lang.String summary, java.lang.String expire, boolean unlimMulli, boolean balTowers, int min, int target, int max)
-
getStartTime
private long getStartTime()
-
getDuration
private int getDuration()
-
getSummaryText
private java.lang.String getSummaryText()
-
doEnroll
private boolean doEnroll(java.lang.String gameId)
-
doUnenroll
private boolean doUnenroll(java.lang.String gameId)
-
doStart
boolean doStart(java.lang.String gameId)
-
doStartLocally
private boolean doStartLocally(java.lang.String gameId)
-
informStartingOnPlayerHost
public void informStartingOnPlayerHost(java.lang.String hostingPlayer, java.lang.String hostingHost, int hostingPort)
-
informGameStartedLocally
public void informGameStartedLocally()
-
informLocallyGameOver
public void informLocallyGameOver()
-
setLocalServer
public void setLocalServer(Server server)
-
grantAdminStatus
public void grantAdminStatus()
- Specified by:
grantAdminStatusin interfaceIWebClient
-
didEnroll
public void didEnroll(java.lang.String gameId, java.lang.String user)- Specified by:
didEnrollin interfaceIWebClient
-
didUnenroll
public void didUnenroll(java.lang.String gameId, java.lang.String user)- Specified by:
didUnenrollin interfaceIWebClient
-
setWatching
public void setWatching(java.lang.String gameId)
-
clearWatching
public void clearWatching()
-
gameStartsSoon
public void gameStartsSoon(java.lang.String gameId, java.lang.String startUser)- Specified by:
gameStartsSoonin interfaceIWebClient
-
notifyComingUp
public void notifyComingUp(boolean success)
-
setupTimer
private java.util.Timer setupTimer()
-
gameStartsNow
public void gameStartsNow(java.lang.String gameId, int port, java.lang.String hostingHost)- Specified by:
gameStartsNowin interfaceIWebClient
-
startOwnClient
public void startOwnClient(java.lang.String gameId, int port, java.lang.String hostingHost)
-
startSpectatorClient
public void startSpectatorClient(java.lang.String gameId, int port, java.lang.String hostingHost)
-
gameCancelled
public void gameCancelled(java.lang.String gameId, java.lang.String byUser)- Specified by:
gameCancelledin interfaceIWebClient
-
chatDeliver
public void chatDeliver(java.lang.String chatId, long when, java.lang.String sender, java.lang.String message, boolean resent)- Specified by:
chatDeliverin interfaceIWebClient
-
watchGameInfo
public void watchGameInfo(java.lang.String gameId, java.lang.String host, int port)- Specified by:
watchGameInfoin interfaceIWebClient
-
requestAttention
public void requestAttention(long when, java.lang.String byUser, boolean byAdmin, java.lang.String message, int beepCount, long beepInterval, boolean windows)- Specified by:
requestAttentionin interfaceIWebClient
-
showRequestAttentionMessage
private void showRequestAttentionMessage()
-
deliverGeneralMessage
public void deliverGeneralMessage(long when, boolean error, java.lang.String title, java.lang.String message)- Specified by:
deliverGeneralMessagein interfaceIWebClient
-
systemMessage
public void systemMessage(long when, java.lang.String message)- Specified by:
systemMessagein interfaceIWebClient
-
tellGameEnds
public void tellGameEnds()
-
userInfo
public void userInfo(int loggedin, int enrolled, int playing, int dead, long ago, java.lang.String text)- Specified by:
userInfoin interfaceIWebClient
-
gameInfo
public void gameInfo(GameInfo gi)
- Specified by:
gameInfoin interfaceIWebClient
-
handleGameInfoUpdates
private void handleGameInfoUpdates(GameInfo gi)
-
replaceInTable
private void replaceInTable(javax.swing.JTable table, GameInfo gi)
-
connectionReset
public void connectionReset(boolean forced)
- Specified by:
connectionResetin interfaceIWebClient
-
hideButtonAction
private void hideButtonAction()
-
watchButtonAction
private void watchButtonAction()
-
loadGameButtonAction
private void loadGameButtonAction()
-
quitButtonAction
private void quitButtonAction()
-
loginLogoutButtonAction
void loginLogoutButtonAction(java.lang.String command)
-
executeLoginLogoutButtonAction
private void executeLoginLogoutButtonAction(java.lang.String command)
-
rereadLoginMsgButtonAction
private void rereadLoginMsgButtonAction()
-
shutdownButtonAction
private void shutdownButtonAction()
-
dumpInfoButtonAction
private void dumpInfoButtonAction()
-
debugSubmitButtonAction
private void debugSubmitButtonAction()
-
registerOrPasswordButtonAction
private void registerOrPasswordButtonAction(java.lang.String command)
-
startLocallyButtonAction
private void startLocallyButtonAction()
-
startButtonAction
private void startButtonAction()
-
cancelButtonAction
private void cancelButtonAction()
-
unenrollButtonAction
private void unenrollButtonAction()
-
findMyInstantGames
private java.util.List<GameInfo> findMyInstantGames()
Find all "relevant" instant games owned by this player (relevant means except those who are running, ending or deleted). Normally there should ever be only one, but in strange cases... (like, game start failed or something...)
-
ownInstantGameIfAny
private GameInfo ownInstantGameIfAny()
If there is at least one instant game by this player, return it (one of it if many), otherwise null. Normally there should ever be only one, but in strange cases... (like, game start failed or something...)- Returns:
- The (or: any) instant game or null
-
displayOnlyOneInstantGameMessage
private void displayOnlyOneInstantGameMessage(java.lang.String action, java.lang.String message)
-
enrollButtonAction
private void enrollButtonAction()
-
proposeButtonAction
private void proposeButtonAction()
-
-