Crossfire JXClient, Trunk
Public Member Functions | Private Member Functions | Private Attributes | List of all members
com.realtime.crossfire.jxclient.window.GuiManager Class Reference
Collaboration diagram for com.realtime.crossfire.jxclient.window.GuiManager:
Collaboration graph

Public Member Functions

void activateCommandInput (@Nullable final String newText)
 
void addDialog (@NotNull final String name, @NotNull final Gui dialog)
 
void closeDialog (@NotNull final String name)
 
void closeKeybindDialog ()
 
void closeQueryDialog ()
 
boolean createKeyBinding (final boolean perCharacter, @NotNull final CommandList cmdList)
 
EscAction escPressed (final boolean connected)
 
CommandList getCommandList (@NotNull final String args) throws NoSuchCommandException
 
Collection< String > getCommandListNames ()
 
 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)
 
void hideAccountWindows ()
 
void manageAccount ()
 
void openDialog (@NotNull final String name)
 
void openQueryDialog (@NotNull final String prompt, final int queryType)
 
boolean openQuitDialog ()
 
void playerReceived ()
 
boolean removeKeyBinding (final boolean perCharacter)
 
void selectCharacter (@NotNull final String accountName, @NotNull final String characterName)
 
void setAccountName (@NotNull final String accountName)
 
void setOpaqueDialogBackground (final boolean opaque)
 
void setShowSentCommands (final boolean showSentCommands)
 
void setShowTimestamps (final boolean showTimestamps)
 
void setSkin (@NotNull final JXCSkin skin)
 
void showCharacters (final int count)
 
void term ()
 
void toggleDialog (@NotNull final String name)
 
void unsetSkin ()
 
void updatePlayerName (@NotNull final String playerName)
 
void updateWindowSize (final int width, final int height)
 

Private Member Functions

GUIText activateCommandInput ()
 
void activateMetaserverGui ()
 
boolean closeDialog (@NotNull final Gui dialog)
 
void closeDialogByName (@NotNull final String name)
 
void closeTransientDialogs (final boolean ignoreQueryDialog)
 
boolean openDialog (@NotNull final Gui dialog, final boolean autoCloseOnDeactivate)
 
boolean openDialogByName (@NotNull final String name)
 
void openKeybindDialog ()
 
void setHideInput (final boolean hideInput)
 
void showGUIMain ()
 
void showGUIMeta ()
 
void showGUIStart ()
 
void updateConnectLabel (@NotNull final ClientSocketState clientSocketState, @Nullable final String param)
 

Private Attributes

final JXCConnection connection
 
final CrossfireDrawextinfoListener crossfireDrawextinfoListener
 
final CrossfireFailureListener crossfireFailureListener
 
boolean currentQueryDialogIsNamePrompt
 
Gui dialogConnect
 
AbstractLabel dialogConnectLabel
 
Gui dialogDisconnect
 
Gui dialogQuit
 
final Map< String, Guidialogs = new HashMap<>()
 
final GuiStateListener guiStateListener
 
Gui keybindDialog
 
final KeybindingsManager keybindingsManager
 
Gui queryDialog
 
final CrossfireServerConnection server
 
final Settings settings
 
JXCSkin skin
 
final TooltipManagerImpl tooltipManager
 
final JXCWindowRenderer windowRenderer
 

Detailed Description

Maintains the application's main GUI state.

Author
Andreas Kirschbaum

Definition at line 63 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.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.gui.misc.JXCWindowRenderer.setCurrentGui(), com.realtime.crossfire.jxclient.window.GuiManager.settings, com.realtime.crossfire.jxclient.window.GuiManager.tooltipManager, and com.realtime.crossfire.jxclient.window.GuiManager.windowRenderer.

Here is the call graph for this function:

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 862 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 890 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 435 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]

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

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 835 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:

◆ closeDialog() [2/2]

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

◆ 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 810 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()

void com.realtime.crossfire.jxclient.window.GuiManager.closeTransientDialogs ( final boolean  ignoreQueryDialog)
private

◆ 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 1024 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()

EscAction com.realtime.crossfire.jxclient.window.GuiManager.escPressed ( final boolean  connected)

◆ 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 1071 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:

◆ getCommandListNames()

Collection<String> com.realtime.crossfire.jxclient.window.GuiManager.getCommandListNames ( )

Returns all names of command lists.

Returns
the names in alphabetical order

Definition at line 1088 of file GuiManager.java.

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

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

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 481 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()

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

◆ openDialog() [1/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:

◆ openDialog() [2/2]

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

◆ 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 799 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()

void com.realtime.crossfire.jxclient.window.GuiManager.openQueryDialog ( @NotNull final String  prompt,
final int  queryType 
)

◆ openQuitDialog()

boolean com.realtime.crossfire.jxclient.window.GuiManager.openQuitDialog ( )

◆ playerReceived()

void com.realtime.crossfire.jxclient.window.GuiManager.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 1038 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 1124 of file GuiManager.java.

References com.realtime.crossfire.jxclient.gui.gui.Gui.getFirstElement(), 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:

◆ setOpaqueDialogBackground()

void com.realtime.crossfire.jxclient.window.GuiManager.setOpaqueDialogBackground ( final boolean  opaque)

Sets whether the dialog's background is opaque.

Parameters
opaquewhether the background is opaque

Definition at line 1136 of file GuiManager.java.

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

Referenced by com.realtime.crossfire.jxclient.gui.gui.TranslucentDialogsCheckBoxOption.execute().

Here is the caller graph for this function:

◆ setShowSentCommands()

void com.realtime.crossfire.jxclient.window.GuiManager.setShowSentCommands ( final boolean  showSentCommands)

Sets whether the commands sent to the server should be shown in the messages dialog.

Parameters
showSentCommandswhether to show the commands

Definition at line 1147 of file GuiManager.java.

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

Referenced by com.realtime.crossfire.jxclient.gui.log.ShowSentCommandsCheckBoxOption.execute().

Here is the caller graph for this function:

◆ setShowTimestamps()

void com.realtime.crossfire.jxclient.window.GuiManager.setShowTimestamps ( final boolean  showTimestamps)

Sets whether timestamps shown in the messages dialog.

Parameters
showTimestampswhether to show timestamps

Definition at line 1157 of file GuiManager.java.

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

Referenced by com.realtime.crossfire.jxclient.gui.log.ShowTimestampMessagesCheckBoxOption.execute().

Here is the caller graph for this function:

◆ setSkin()

void com.realtime.crossfire.jxclient.window.GuiManager.setSkin ( @NotNull final JXCSkin  skin)

◆ showCharacters()

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

◆ showGUIMain()

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

◆ showGUIMeta()

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

◆ showGUIStart()

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

◆ term()

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

◆ toggleDialog()

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

◆ unsetSkin()

void com.realtime.crossfire.jxclient.window.GuiManager.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 976 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

final JXCConnection com.realtime.crossfire.jxclient.window.GuiManager.connection
private

◆ crossfireDrawextinfoListener

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

The CrossfireDrawextinfoListener attached to server.

Definition at line 164 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 126 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 121 of file GuiManager.java.

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

◆ dialogDisconnect

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

◆ dialogQuit

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

◆ dialogs

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

◆ 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

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

◆ keybindingsManager

final KeybindingsManager com.realtime.crossfire.jxclient.window.GuiManager.keybindingsManager
private

◆ queryDialog

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

◆ server

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

◆ settings

final Settings com.realtime.crossfire.jxclient.window.GuiManager.settings
private

◆ skin

JXCSkin com.realtime.crossfire.jxclient.window.GuiManager.skin
private

◆ tooltipManager

final TooltipManagerImpl com.realtime.crossfire.jxclient.window.GuiManager.tooltipManager
private

◆ windowRenderer

final JXCWindowRenderer com.realtime.crossfire.jxclient.window.GuiManager.windowRenderer
private

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