Crossfire JXClient, Trunk  R20561
com.realtime.crossfire.jxclient.window.GuiManager Class Reference

Maintains the application's main GUI state. More...

+ Collaboration diagram for com.realtime.crossfire.jxclient.window.GuiManager:

Classes

enum  EscAction
 Action after ESC has been pressed. More...
 

Public Member Functions

void activateCommandInput (@Nullable final String newText)
 Activates the command input text field. More...
 
void addDialog (@NotNull final String name, @NotNull final Gui dialog)
 Adds a dialog for name based lookup. More...
 
void closeDialog (@NotNull final String name)
 Closes the given dialog. More...
 
boolean closeDialog (@NotNull final Gui dialog)
 Closes the given dialog. More...
 
void closeKeybindDialog ()
 Closes the keybinding dialog. More...
 
void closeQueryDialog ()
 Closes the "query" dialog. More...
 
boolean createKeyBinding (final boolean perCharacter, @NotNull final CommandList cmdList)
 Adds a key binding. More...
 
EscAction escPressed (final boolean connected)
 The ESC key has been pressed. More...
 
CommandList getCommandList (@NotNull final String args) throws NoSuchCommandException
 Returns a named command list. More...
 
 GuiManager (@NotNull final GuiStateManager guiStateManager, @NotNull final TooltipManagerImpl tooltipManager, @NotNull final Settings settings, @NotNull final CrossfireServerConnection server, @NotNull final JXCWindowRenderer windowRenderer, @NotNull final GuiFactory guiFactory, @NotNull final KeybindingsManager keybindingsManager, @NotNull final JXCConnection connection)
 Creates a new instance. More...
 
void hideAccountWindows ()
 Hides all account-related windows. More...
 
void manageAccount ()
 Displays the main account dialog, to let the player login or create a new account. More...
 
void openDialog (@NotNull final String name)
 Opens a dialog by name. More...
 
void openQueryDialog (@NotNull final String prompt, final int queryType)
 Opens the "query" dialog. More...
 
boolean openQuitDialog ()
 Opens the "quit" dialog. More...
 
void playerReceived ()
 A "player" protocol command has been received. More...
 
boolean removeKeyBinding (final boolean perCharacter)
 Removes a key binding. More...
 
void selectCharacter (@NotNull final String accountName, @NotNull final String characterName)
 Updates the selected character name in an account. More...
 
void setAccountName (@NotNull final String accountName)
 Updates the current account name. More...
 
void setSkin (@NotNull final JXCSkin skin)
 Sets a new skin. More...
 
void showCharacters (final int count)
 Displays the window with the characters for an account. More...
 
void term ()
 Terminates the GUI. More...
 
void toggleDialog (@NotNull final String name)
 Toggles a dialog. More...
 
void unsetSkin ()
 Unsets the current skin. More...
 
void updatePlayerName (@NotNull final String playerName)
 Sets the current player name. More...
 
void updateWindowSize (final int width, final int height)
 Sets a new window size. More...
 

Private Member Functions

GUIText activateCommandInput ()
 Activates the command input text field. More...
 
void activateMetaserverGui ()
 Called when the server selection GUI becomes active. More...
 
void closeDialogByName (@NotNull final String name)
 Closes a dialog by name. More...
 
void closeTransientDialogs ()
 Closes all transient dialogs: disconnect, quit, connect, query, and book dialogs. More...
 
boolean openDialog (@NotNull final Gui dialog, final boolean autoCloseOnDeactivate)
 Opens a dialog. More...
 
boolean openDialogByName (@NotNull final String name)
 Opens a dialog by name. More...
 
void openKeybindDialog ()
 Opens the keybinding dialog. More...
 
void setHideInput (final boolean hideInput)
 Enables or disables hidden text in the first input field of the queryDialog. More...
 
void showGUIMain ()
 Displays the "main" GUI. More...
 
void showGUIMeta ()
 Displays the "server selection" GUI. More...
 
void showGUIStart ()
 Displays the "start" GUI. More...
 
void updateConnectLabel (@NotNull final ClientSocketState clientSocketState, @Nullable final String param)
 Updates the "message" field of the connect dialog. More...
 

Private Attributes

final JXCConnection connection
 The JXCConnection to use. More...
 
final CrossfireDrawextinfoListener crossfireDrawextinfoListener
 The CrossfireDrawextinfoListener attached to server. More...
 
final CrossfireFailureListener crossfireFailureListener
 The CrossfireFailureListener registered to receive failure messages. More...
 
boolean currentQueryDialogIsNamePrompt
 Whether the currently shown query dialog is the character name prompt. More...
 
Gui dialogConnect
 The "connect in progress" dialog. More...
 
AbstractLabel dialogConnectLabel
 The "message" field within dialogConnect. More...
 
Gui dialogDisconnect
 The "really disconnect?" dialog. More...
 
Gui dialogQuit
 The "really quit?" dialog. More...
 
final Map< String, Guidialogs = new HashMap<>()
 Maps dialog name to dialog instance. More...
 
final GuiFactory guiFactory
 The GuiFactory for creating Gui instances. More...
 
final GuiStateListener guiStateListener
 The GuiStateListener for detecting established or dropped connections. More...
 
Gui keybindDialog
 The keybindings dialog. More...
 
final KeybindingsManager keybindingsManager
 The key bindings manager for this window. More...
 
Gui queryDialog
 The query dialog. More...
 
final CrossfireServerConnection server
 The CrossfireServerConnection instance to monitor. More...
 
final Settings settings
 The Settings to use. More...
 
JXCSkin skin
 The currently active skin. More...
 
final TooltipManagerImpl tooltipManager
 The TooltipManager for this window. More...
 
final JXCWindowRenderer windowRenderer
 The JXCWindowRenderer used to paint the gui. More...
 

Detailed Description

Maintains the application's main GUI state.

Author
Andreas Kirschbaum

Definition at line 60 of file GuiManager.java.

Constructor & Destructor Documentation

◆ GuiManager()

com.realtime.crossfire.jxclient.window.GuiManager.GuiManager ( @NotNull final GuiStateManager  guiStateManager,
@NotNull final TooltipManagerImpl  tooltipManager,
@NotNull final Settings  settings,
@NotNull final CrossfireServerConnection  server,
@NotNull final JXCWindowRenderer  windowRenderer,
@NotNull final GuiFactory  guiFactory,
@NotNull final KeybindingsManager  keybindingsManager,
@NotNull final JXCConnection  connection 
)

Creates a new instance.

Parameters
guiStateManagerthe gui state manager to watch
tooltipManagerthe tooltip manager to update
settingsthe settings to use
serverthe crossfire server connection to monitor
windowRendererthe window renderer to use
guiFactorythe gui factory for creating gui instances
keybindingsManagerthe keybindings manager to use
connectionthe connection to use

Definition at line 417 of file GuiManager.java.

References com.realtime.crossfire.jxclient.window.GuiManager.connection, com.realtime.crossfire.jxclient.window.GuiManager.guiFactory, com.realtime.crossfire.jxclient.window.GuiManager.guiStateListener, com.realtime.crossfire.jxclient.window.GuiManager.keybindDialog, com.realtime.crossfire.jxclient.window.GuiManager.keybindingsManager, com.realtime.crossfire.jxclient.window.GuiManager.queryDialog, com.realtime.crossfire.jxclient.window.GuiManager.server, com.realtime.crossfire.jxclient.window.GuiManager.settings, com.realtime.crossfire.jxclient.window.GuiManager.tooltipManager, and com.realtime.crossfire.jxclient.window.GuiManager.windowRenderer.

Member Function Documentation

◆ activateCommandInput() [1/2]

GUIText com.realtime.crossfire.jxclient.window.GuiManager.activateCommandInput ( )
private

Activates the command input text field.

If the skin defined more than one input field, the first matching one is selected.

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.

Returns
the command input text field, or
null
if the skin has no command input text field defined

Definition at line 859 of file GuiManager.java.

References com.realtime.crossfire.jxclient.gui.misc.JXCWindowRenderer.activateCommandInput(), com.realtime.crossfire.jxclient.window.GuiManager.openDialog(), com.realtime.crossfire.jxclient.window.GuiManager.skin, and com.realtime.crossfire.jxclient.window.GuiManager.windowRenderer.

Referenced by com.realtime.crossfire.jxclient.main.GuiManagerCommandCallback.activateCommandInput(), and com.realtime.crossfire.jxclient.window.GuiManager.activateCommandInput().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ activateCommandInput() [2/2]

void com.realtime.crossfire.jxclient.window.GuiManager.activateCommandInput ( @Nullable final String  newText)

Activates the command input text field.

If the skin defines more than one input field, the first matching one is selected.

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.

Parameters
newTextthe new command text if non-
null

Definition at line 887 of file GuiManager.java.

References com.realtime.crossfire.jxclient.window.GuiManager.activateCommandInput(), and com.realtime.crossfire.jxclient.gui.textinput.GUIText.setText().

+ Here is the call graph for this function:

◆ activateMetaserverGui()

void com.realtime.crossfire.jxclient.window.GuiManager.activateMetaserverGui ( )
private

◆ addDialog()

void com.realtime.crossfire.jxclient.window.GuiManager.addDialog ( @NotNull final String  name,
@NotNull final Gui  dialog 
)

Adds a dialog for name based lookup.

Parameters
namethe name of the dialog
dialogthe dialog

Definition at line 436 of file GuiManager.java.

References com.realtime.crossfire.jxclient.window.GuiManager.dialogs.

Referenced by com.realtime.crossfire.jxclient.skin.skin.Dialogs.addDialog().

+ Here is the caller graph for this function:

◆ closeDialog() [1/2]

◆ closeDialog() [2/2]

boolean com.realtime.crossfire.jxclient.window.GuiManager.closeDialog ( @NotNull final Gui  dialog)

Closes the given dialog.

Does nothing if the dialog is not opened.

Parameters
dialogthe dialog to close
Returns
whether the dialog has been closed;
false
if the dialog was not open

Definition at line 832 of file GuiManager.java.

References com.realtime.crossfire.jxclient.gui.misc.JXCWindowRenderer.closeDialog(), and com.realtime.crossfire.jxclient.window.GuiManager.windowRenderer.

+ Here is the call graph for this function:

◆ closeDialogByName()

void com.realtime.crossfire.jxclient.window.GuiManager.closeDialogByName ( @NotNull final String  name)
private

◆ closeKeybindDialog()

void com.realtime.crossfire.jxclient.window.GuiManager.closeKeybindDialog ( )

Closes the keybinding dialog.

Does nothing if the dialog is not opened.

Definition at line 807 of file GuiManager.java.

References com.realtime.crossfire.jxclient.window.GuiManager.closeDialog(), and com.realtime.crossfire.jxclient.window.GuiManager.keybindDialog.

Referenced by com.realtime.crossfire.jxclient.main.DefaultKeyHandler.keyReleased(), and com.realtime.crossfire.jxclient.window.GuiManager.openQuitDialog().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ closeQueryDialog()

void com.realtime.crossfire.jxclient.window.GuiManager.closeQueryDialog ( )

Closes the "query" dialog.

Does nothing if the dialog is not open.

Definition at line 706 of file GuiManager.java.

References com.realtime.crossfire.jxclient.window.GuiManager.closeDialog(), and com.realtime.crossfire.jxclient.window.GuiManager.queryDialog.

+ Here is the call graph for this function:

◆ closeTransientDialogs()

◆ createKeyBinding()

boolean com.realtime.crossfire.jxclient.window.GuiManager.createKeyBinding ( final boolean  perCharacter,
@NotNull final CommandList  cmdList 
)

Adds a key binding.

Parameters
perCharacterwhether a per-character key binding should be added
cmdListthe command list to execute on key press
Returns
whether the key bindings dialog should be opened

Definition at line 1026 of file GuiManager.java.

References com.realtime.crossfire.jxclient.gui.keybindings.KeybindingsManager.createKeyBinding(), com.realtime.crossfire.jxclient.window.GuiManager.keybindingsManager, and com.realtime.crossfire.jxclient.window.GuiManager.openKeybindDialog().

Referenced by com.realtime.crossfire.jxclient.main.GuiManagerCommandCallback.createKeyBinding().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ escPressed()

◆ getCommandList()

CommandList com.realtime.crossfire.jxclient.window.GuiManager.getCommandList ( @NotNull final String  args) throws NoSuchCommandException

Returns a named command list.

Parameters
argsthe name of the command list
Returns
the command list
Exceptions
NoSuchCommandExceptionif the command list does not exist

Definition at line 1073 of file GuiManager.java.

References com.realtime.crossfire.jxclient.skin.skin.JXCSkin.getCommandList(), and com.realtime.crossfire.jxclient.window.GuiManager.skin.

Referenced by com.realtime.crossfire.jxclient.main.GuiManagerCommandCallback.getCommandList().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ hideAccountWindows()

void com.realtime.crossfire.jxclient.window.GuiManager.hideAccountWindows ( )

Hides all account-related windows.

Definition at line 482 of file GuiManager.java.

References com.realtime.crossfire.jxclient.window.GuiManager.closeDialogByName().

Referenced by com.realtime.crossfire.jxclient.window.GuiManager.manageAccount(), and com.realtime.crossfire.jxclient.window.GuiManager.showCharacters().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ manageAccount()

◆ openDialog() [1/2]

◆ openDialog() [2/2]

boolean com.realtime.crossfire.jxclient.window.GuiManager.openDialog ( @NotNull final Gui  dialog,
final boolean  autoCloseOnDeactivate 
)
private

Opens a dialog.

Raises the dialog if it is open.

Parameters
dialogthe dialog to show
autoCloseOnDeactivatewhether the dialog should auto-close when it becomes inactive; ignored if the dialog is already open
Returns
whether the dialog was opened or raised;
false
if the dialog already was opened as the topmost dialog

Definition at line 615 of file GuiManager.java.

References com.realtime.crossfire.jxclient.window.GuiManager.connection, com.realtime.crossfire.jxclient.server.crossfire.CrossfireServerConnection.getAccountName(), com.realtime.crossfire.jxclient.window.JXCConnection.getHostname(), com.realtime.crossfire.jxclient.settings.SettingsEntries.getLoginAccountSettingsEntry(), com.realtime.crossfire.jxclient.settings.Settings.getString(), com.realtime.crossfire.jxclient.util.SwingUtilities2.invokeAndWait(), com.realtime.crossfire.jxclient.gui.misc.JXCWindowRenderer.openDialog(), com.realtime.crossfire.jxclient.window.GuiManager.queryDialog, com.realtime.crossfire.jxclient.window.GuiManager.server, com.realtime.crossfire.jxclient.gui.gui.ActivatableGUIElement.setActive(), com.realtime.crossfire.jxclient.gui.list.GUICharacterList.setCharacter(), com.realtime.crossfire.jxclient.window.GuiManager.setHideInput(), com.realtime.crossfire.jxclient.gui.label.AbstractLabel.setText(), com.realtime.crossfire.jxclient.gui.textinput.GUIText.setText(), com.realtime.crossfire.jxclient.window.GuiManager.settings, and com.realtime.crossfire.jxclient.window.GuiManager.windowRenderer.

+ Here is the call graph for this function:

◆ openDialogByName()

boolean com.realtime.crossfire.jxclient.window.GuiManager.openDialogByName ( @NotNull final String  name)
private

◆ openKeybindDialog()

void com.realtime.crossfire.jxclient.window.GuiManager.openKeybindDialog ( )
private

Opens the keybinding dialog.

Does nothing if the dialog is opened.

Definition at line 796 of file GuiManager.java.

References com.realtime.crossfire.jxclient.window.GuiManager.keybindDialog, and com.realtime.crossfire.jxclient.window.GuiManager.openDialog().

Referenced by com.realtime.crossfire.jxclient.window.GuiManager.createKeyBinding(), and com.realtime.crossfire.jxclient.window.GuiManager.removeKeyBinding().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ openQueryDialog()

◆ openQuitDialog()

◆ playerReceived()

◆ removeKeyBinding()

boolean com.realtime.crossfire.jxclient.window.GuiManager.removeKeyBinding ( final boolean  perCharacter)

Removes a key binding.

Parameters
perCharacterwhether a per-character key binding should be removed
Returns
whether the key bindings dialog should be opened

Definition at line 1040 of file GuiManager.java.

References com.realtime.crossfire.jxclient.window.GuiManager.keybindingsManager, com.realtime.crossfire.jxclient.window.GuiManager.openKeybindDialog(), and com.realtime.crossfire.jxclient.gui.keybindings.KeybindingsManager.removeKeyBinding().

Referenced by com.realtime.crossfire.jxclient.main.GuiManagerCommandCallback.removeKeyBinding().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ selectCharacter()

void com.realtime.crossfire.jxclient.window.GuiManager.selectCharacter ( @NotNull final String  accountName,
@NotNull final String  characterName 
)

◆ setAccountName()

void com.realtime.crossfire.jxclient.window.GuiManager.setAccountName ( @NotNull final String  accountName)

◆ setHideInput()

void com.realtime.crossfire.jxclient.window.GuiManager.setHideInput ( final boolean  hideInput)
private

Enables or disables hidden text in the first input field of the queryDialog.

Parameters
hideInputif set, hide input; else show input

Definition at line 1113 of file GuiManager.java.

References com.realtime.crossfire.jxclient.window.GuiManager.queryDialog, and com.realtime.crossfire.jxclient.gui.textinput.GUIText.setHideInput().

Referenced by com.realtime.crossfire.jxclient.window.GuiManager.openDialog(), com.realtime.crossfire.jxclient.window.GuiManager.openQueryDialog(), and com.realtime.crossfire.jxclient.window.GuiManager.toggleDialog().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setSkin()

◆ showCharacters()

void com.realtime.crossfire.jxclient.window.GuiManager.showCharacters ( final int  count)

◆ showGUIMain()

◆ showGUIMeta()

◆ showGUIStart()

◆ term()

◆ toggleDialog()

void com.realtime.crossfire.jxclient.window.GuiManager.toggleDialog ( @NotNull final String  name)

◆ unsetSkin()

◆ updateConnectLabel()

void com.realtime.crossfire.jxclient.window.GuiManager.updateConnectLabel ( @NotNull final ClientSocketState  clientSocketState,
@Nullable final String  param 
)
private

Updates the "message" field of the connect dialog.

Does nothing if the dialog is not open, does not exist, or if the dialog does not define a "message" field.

Parameters
clientSocketStatethe client socket state
parama parameter to display

Definition at line 978 of file GuiManager.java.

References com.realtime.crossfire.jxclient.window.GuiManager.dialogConnectLabel, and com.realtime.crossfire.jxclient.gui.label.AbstractLabel.setText().

+ Here is the call graph for this function:

◆ updatePlayerName()

void com.realtime.crossfire.jxclient.window.GuiManager.updatePlayerName ( @NotNull final String  playerName)

◆ updateWindowSize()

void com.realtime.crossfire.jxclient.window.GuiManager.updateWindowSize ( final int  width,
final int  height 
)

Member Data Documentation

◆ connection

◆ crossfireDrawextinfoListener

final CrossfireDrawextinfoListener com.realtime.crossfire.jxclient.window.GuiManager.crossfireDrawextinfoListener
private

The CrossfireDrawextinfoListener attached to server.

Definition at line 165 of file GuiManager.java.

◆ crossfireFailureListener

final CrossfireFailureListener com.realtime.crossfire.jxclient.window.GuiManager.crossfireFailureListener
private

The CrossfireFailureListener registered to receive failure messages.

Definition at line 250 of file GuiManager.java.

◆ currentQueryDialogIsNamePrompt

boolean com.realtime.crossfire.jxclient.window.GuiManager.currentQueryDialogIsNamePrompt
private

Whether the currently shown query dialog is the character name prompt.

Definition at line 129 of file GuiManager.java.

Referenced by com.realtime.crossfire.jxclient.window.GuiManager.openQueryDialog(), and com.realtime.crossfire.jxclient.window.GuiManager.updatePlayerName().

◆ dialogConnect

Gui com.realtime.crossfire.jxclient.window.GuiManager.dialogConnect
private

◆ dialogConnectLabel

AbstractLabel com.realtime.crossfire.jxclient.window.GuiManager.dialogConnectLabel
private

The "message" field within dialogConnect.

Set to

null

if the dialog does not define a "message" label.

Definition at line 124 of file GuiManager.java.

Referenced by com.realtime.crossfire.jxclient.window.GuiManager.setSkin(), and com.realtime.crossfire.jxclient.window.GuiManager.updateConnectLabel().

◆ dialogDisconnect

◆ dialogQuit

◆ dialogs

final Map<String, Gui> com.realtime.crossfire.jxclient.window.GuiManager.dialogs = new HashMap<>()
private

◆ guiFactory

◆ guiStateListener

final GuiStateListener com.realtime.crossfire.jxclient.window.GuiManager.guiStateListener
private

The GuiStateListener for detecting established or dropped connections.

Definition at line 341 of file GuiManager.java.

Referenced by com.realtime.crossfire.jxclient.window.GuiManager.GuiManager().

◆ keybindDialog

◆ keybindingsManager

◆ queryDialog

◆ server

final CrossfireServerConnection com.realtime.crossfire.jxclient.window.GuiManager.server
private

◆ settings

◆ skin

◆ tooltipManager

◆ windowRenderer


The documentation for this class was generated from the following file: