java.lang.Objectcom.realtime.crossfire.jxclient.window.GuiManager
public class GuiManager
Maintains the application's main GUI state.
| Field Summary | |
|---|---|
private JXCConnection |
connection
The JXCConnection to use. |
private CrossfireDrawextinfoListener |
crossfireDrawextinfoListener
The CrossfireDrawextinfoListener attached to server. |
private boolean |
currentQueryDialogIsNamePrompt
Whether the currently shown query dialog is the character name prompt. |
private Gui |
dialogConnect
The "connect in progress" dialog. |
private AbstractLabel |
dialogConnectLabel
The "message" field within dialogConnect. |
private Gui |
dialogDisconnect
The "really disconnect?" dialog. |
private Gui |
dialogQuit
The "really quit?" dialog. |
private GuiFactory |
guiFactory
The GuiFactory for creating Gui instances. |
private GuiStateListener |
guiStateListener
The GuiStateListener for detecting established or dropped
connections. |
private Gui |
keybindDialog
The keybindings dialog. |
private KeybindingsManager |
keybindingsManager
The key bindings manager for this window. |
private Gui |
queryDialog
The query dialog. |
private CrossfireServerConnection |
server
The CrossfireServerConnection instance to monitor. |
private Settings |
settings
The Settings to use. |
private JXCSkin |
skin
The currently active skin. |
private TooltipManager |
tooltipManager
The TooltipManager for this window. |
private JXCWindowRenderer |
windowRenderer
The JXCWindowRenderer used to paint the gui. |
| Constructor Summary | |
|---|---|
GuiManager(GuiStateManager guiStateManager,
TooltipManager tooltipManager,
Settings settings,
CrossfireServerConnection server,
JXCWindowRenderer windowRenderer,
GuiFactory guiFactory,
KeybindingsManager keybindingsManager,
JXCConnection connection)
Creates a new instance. |
|
| Method Summary | |
|---|---|
private GUIText |
activateCommandInput()
Activates the command input text field. |
void |
activateCommandInput(java.lang.String newText)
Activates the command input text field. |
private void |
activateMetaserverGui()
Called when the server selection GUI becomes active. |
void |
closeDialog(Gui dialog)
Closes the given dialog. |
private void |
closeDialogByName(java.lang.String name)
Closes a dialog by name. |
void |
closeKeybindDialog()
Closes the keybinding dialog. |
void |
closeQueryDialog()
Closes the "query" dialog. |
private void |
closeTransientDialogs()
Closes all transient dialogs: disconnect, quit, connect, query, and book dialogs. |
boolean |
createKeyBinding(boolean perCharacter,
CommandList cmdList)
Adds a key binding. |
int |
escPressed(boolean connected)
The ESC key has been pressed. |
CommandList |
getCommandList(java.lang.String args)
Returns a named command list. |
void |
hideAccountWindows()
Hides all account-related windows. |
void |
manageAccount()
Displays the main account dialog, to let the player login or create a new account. |
boolean |
openDialog(Gui dialog,
boolean autoCloseOnDeactivate)
Opens a dialog. |
private boolean |
openDialogByName(java.lang.String name)
Opens a dialog by name. |
private void |
openKeybindDialog()
Opens the keybinding dialog. |
void |
openQueryDialog(java.lang.String prompt,
int queryType)
Opens the "query" dialog. |
boolean |
openQuitDialog()
Opens the "quit" dialog. |
void |
playerReceived()
A "player" protocol command has been received. |
boolean |
removeKeyBinding(boolean perCharacter)
Removes a key binding. |
void |
selectCharacter(java.lang.String accountName,
java.lang.String characterName)
Updates the selected character name in an account. |
void |
setAccountName(java.lang.String accountName)
Updates the current account name. |
void |
setSkin(JXCSkin skin)
Sets a new skin. |
void |
showCharacters()
Displays the window with the characters for an account. |
private void |
showGUIMain()
Displays the "main" GUI. |
private void |
showGUIMeta()
Displays the "server selection" GUI. |
private void |
showGUIStart()
Displays the "start" GUI. |
void |
term()
|
void |
toggleDialog(Gui dialog)
Toggles a dialog. |
void |
unsetSkin()
Unsets the current skin. |
private void |
updateConnectLabel(ClientSocketState clientSocketState,
java.lang.String param)
Updates the "message" field of the connect dialog. |
void |
updatePlayerName(java.lang.String playerName)
Sets the current player name. |
private void |
updateServerSettings()
Updates server based settings to current screen size. |
void |
updateWindowSize(java.awt.Dimension size)
Sets a new window size. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
@NotNull private final JXCConnection connection
JXCConnection to use.
@NotNull private final CrossfireDrawextinfoListener crossfireDrawextinfoListener
CrossfireDrawextinfoListener attached to server.
private boolean currentQueryDialogIsNamePrompt
@Nullable private Gui dialogConnect
null if the skin
does not define this dialog.
@Nullable private AbstractLabel dialogConnectLabel
dialogConnect. Set to
null if the dialog does not define a "message" label.
@Nullable private Gui dialogDisconnect
null if the skin
does not define this dialog.
@Nullable private Gui dialogQuit
null if the skin does not
define this dialog.
@NotNull private final GuiFactory guiFactory
GuiFactory for creating Gui instances.
@NotNull private final GuiStateListener guiStateListener
GuiStateListener for detecting established or dropped
connections.
@Nullable private Gui keybindDialog
@NotNull private final KeybindingsManager keybindingsManager
@Nullable private Gui queryDialog
@NotNull private final CrossfireServerConnection server
CrossfireServerConnection instance to monitor.
@NotNull private final Settings settings
Settings to use.
@Nullable private JXCSkin skin
null if no skin is set.
@NotNull private final TooltipManager tooltipManager
TooltipManager for this window.
@NotNull private final JXCWindowRenderer windowRenderer
JXCWindowRenderer used to paint the gui.
| Constructor Detail |
|---|
public GuiManager(@NotNull
GuiStateManager guiStateManager,
@NotNull
TooltipManager tooltipManager,
@NotNull
Settings settings,
@NotNull
CrossfireServerConnection server,
@NotNull
JXCWindowRenderer windowRenderer,
@NotNull
GuiFactory guiFactory,
@NotNull
KeybindingsManager keybindingsManager,
@NotNull
JXCConnection connection)
guiStateManager - the gui state manager to watchtooltipManager - the tooltip manager to updatesettings - the settings to useserver - the crossfire server connection to monitorwindowRenderer - the window renderer to useguiFactory - the gui factory for creating gui instanceskeybindingsManager - the keybindings manager to useconnection - the connection to use| Method Detail |
|---|
@Nullable private GUIText activateCommandInput()
If neither the main gui nor any visible dialog has an input text field, invisible GUIs are checked as well. If one is found, it is made visible.
null if the skin
has no command input text field defined
public void activateCommandInput(@Nullable
java.lang.String newText)
newText - the new command text if non-nullprivate void activateMetaserverGui()
public void closeDialog(@NotNull
Gui dialog)
dialog - the dialog to close
private void closeDialogByName(@NotNull
java.lang.String name)
name - the dialog namepublic void closeKeybindDialog()
public void closeQueryDialog()
private void closeTransientDialogs()
public boolean createKeyBinding(boolean perCharacter,
@NotNull
CommandList cmdList)
perCharacter - whether a per-character key binding should be addedcmdList - the command list to execute on key press
public int escPressed(boolean connected)
connected - whether a connection to the server is active
@NotNull
public CommandList getCommandList(@NotNull
java.lang.String args)
throws NoSuchCommandException
args - the name of the command list
NoSuchCommandException - if the command list does not existpublic void hideAccountWindows()
public void manageAccount()
public boolean openDialog(@NotNull
Gui dialog,
boolean autoCloseOnDeactivate)
dialog - the dialog to showautoCloseOnDeactivate - whether the dialog should auto-close when it
becomes inactive; ignored if the dialog is already open
false if
the dialog already was opened as the topmost dialog
private boolean openDialogByName(@NotNull
java.lang.String name)
name - the dialog name
private void openKeybindDialog()
public void openQueryDialog(@NotNull
java.lang.String prompt,
int queryType)
prompt - the query promptqueryType - the query typepublic boolean openQuitDialog()
public void playerReceived()
public boolean removeKeyBinding(boolean perCharacter)
perCharacter - whether a per-character key binding should be
removed
public void selectCharacter(@NotNull
java.lang.String accountName,
@NotNull
java.lang.String characterName)
accountName - the account namecharacterName - the character name
public void setAccountName(@NotNull
java.lang.String accountName)
accountName - the current account name
public void setSkin(@NotNull
JXCSkin skin)
skin - the new skinpublic void showCharacters()
private void showGUIMain()
private void showGUIMeta()
private void showGUIStart()
public void term()
public void toggleDialog(@NotNull
Gui dialog)
dialog - the dialog to togglepublic void unsetSkin()
private void updateConnectLabel(@NotNull
ClientSocketState clientSocketState,
@Nullable
java.lang.String param)
clientSocketState - the client socket stateparam - a parameter to display
public void updatePlayerName(@NotNull
java.lang.String playerName)
playerName - the player nameprivate void updateServerSettings()
public void updateWindowSize(@NotNull
java.awt.Dimension size)
size - the new window size