com.realtime.crossfire.jxclient.main
Class GuiManagerCommandCallback

java.lang.Object
  extended by com.realtime.crossfire.jxclient.main.GuiManagerCommandCallback
All Implemented Interfaces:
CommandCallback

public class GuiManagerCommandCallback
extends java.lang.Object
implements CommandCallback

A CommandCallback that delegates to a GuiManager.


Field Summary
private  Exiter exiter
          The Exiter instance.
private  GuiManager guiManager
          The GuiManager to forward to.
private  java.lang.String lastAccountPassword
          The last sent account or character password.
private  CrossfireServerConnection server
          The CrossfireServerConnection for sending commands.
 
Constructor Summary
GuiManagerCommandCallback(Exiter exiter)
          Creates a new instance.
 
Method Summary
 void accountCreate(java.lang.String login, java.lang.String password)
          Creates an account.
 void accountCreateCharacter(java.lang.String login)
          Creates a character.
 void accountLink(int force, java.lang.String login, java.lang.String password)
          Links a character to the current account.
 void accountLogin(java.lang.String login, java.lang.String password)
          Login to an account.
 void accountPlayCharacter(java.lang.String name)
          Plays a character from the current account.
 void activateCommandInput(java.lang.String newText)
          Activates the command input text field.
 void closeDialog(Gui dialog)
          Closes a dialog.
 boolean createKeyBinding(boolean perCharacter, CommandList commandList)
          Adds a key binding.
 CommandList getCommandList(java.lang.String args)
          Returns a command list.
 void init(GuiManager guiManager, CrossfireServerConnection server)
          Deprecated. 
 void openDialog(Gui dialog)
          Opens a dialog.
 void quitApplication()
          Terminates the application.
 boolean removeKeyBinding(boolean perCharacter)
          Removes a key binding.
 void toggleDialog(Gui dialog)
          Toggles a dialog.
 void updatePlayerName(java.lang.String playerName)
          Sets the current player name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

exiter

@NotNull
private final Exiter exiter
The Exiter instance.


guiManager

@NotNull
private GuiManager guiManager
The GuiManager to forward to.


lastAccountPassword

@Nullable
private java.lang.String lastAccountPassword
The last sent account or character password. Set to null if no password has been sent yet.


server

@NotNull
private CrossfireServerConnection server
The CrossfireServerConnection for sending commands.

Constructor Detail

GuiManagerCommandCallback

public GuiManagerCommandCallback(@NotNull
                                 Exiter exiter)
Creates a new instance.

Parameters:
exiter - the exiter instance
Method Detail

accountCreate

public void accountCreate(@NotNull
                          java.lang.String login,
                          @NotNull
                          java.lang.String password)
Creates an account.

Specified by:
accountCreate in interface CommandCallback
Parameters:
login - the account's name
password - the account's password

accountCreateCharacter

public void accountCreateCharacter(@NotNull
                                   java.lang.String login)
Creates a character. The password should be the last from CommandCallback.accountLogin(java.lang.String, java.lang.String) or CommandCallback.accountCreate(java.lang.String, java.lang.String).

Specified by:
accountCreateCharacter in interface CommandCallback
Parameters:
login - the character's name

accountLink

public void accountLink(int force,
                        @NotNull
                        java.lang.String login,
                        @NotNull
                        java.lang.String password)
Links a character to the current account.

Specified by:
accountLink in interface CommandCallback
Parameters:
force - 0 to allow failure, 1 to force in certain situations
login - the character's name
password - the character's password

accountLogin

public void accountLogin(@NotNull
                         java.lang.String login,
                         @NotNull
                         java.lang.String password)
Login to an account.

Specified by:
accountLogin in interface CommandCallback
Parameters:
login - login
password - password

accountPlayCharacter

public void accountPlayCharacter(@NotNull
                                 java.lang.String name)
Plays a character from the current account.

Specified by:
accountPlayCharacter in interface CommandCallback
Parameters:
name - the character's name

activateCommandInput

public void activateCommandInput(@NotNull
                                 java.lang.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.

Specified by:
activateCommandInput in interface CommandCallback
Parameters:
newText - the new command text if non-null

closeDialog

public void closeDialog(@NotNull
                        Gui dialog)
Closes a dialog. Does nothing if the dialog is not open.

Specified by:
closeDialog in interface CommandCallback
Parameters:
dialog - the dialog to close

createKeyBinding

public boolean createKeyBinding(boolean perCharacter,
                                @NotNull
                                CommandList commandList)
Adds a key binding.

Specified by:
createKeyBinding in interface CommandCallback
Parameters:
perCharacter - whether a per-character key binding should be added
commandList - the command list to execute on key press
Returns:
whether the key bindings dialog should be opened

getCommandList

@NotNull
public CommandList getCommandList(@NotNull
                                          java.lang.String args)
                           throws NoSuchCommandException
Returns a command list.

Specified by:
getCommandList in interface CommandCallback
Parameters:
args - the command list arguments
Returns:
the command list
Throws:
NoSuchCommandException - if the command list does not exist

init

@Deprecated
public void init(@NotNull
                            GuiManager guiManager,
                            @NotNull
                            CrossfireServerConnection server)
Deprecated. 

Creates a new instance.

Parameters:
guiManager - the gui manager to forward to
server - the crossfire server connection for sending commands

openDialog

public void openDialog(@NotNull
                       Gui dialog)
Opens a dialog. Does nothing if the dialog is open.

Specified by:
openDialog in interface CommandCallback
Parameters:
dialog - the dialog to open

quitApplication

public void quitApplication()
Terminates the application.

Specified by:
quitApplication in interface CommandCallback

removeKeyBinding

public boolean removeKeyBinding(boolean perCharacter)
Removes a key binding.

Specified by:
removeKeyBinding in interface CommandCallback
Parameters:
perCharacter - whether a per-character key binding should be removed
Returns:
whether the key bindings dialog should be opened

toggleDialog

public void toggleDialog(@NotNull
                         Gui dialog)
Toggles a dialog.

Specified by:
toggleDialog in interface CommandCallback
Parameters:
dialog - the dialog to toggle

updatePlayerName

public void updatePlayerName(@NotNull
                             java.lang.String playerName)
Sets the current player name. Does nothing if not currently in the character name prompt.

Specified by:
updatePlayerName in interface CommandCallback
Parameters:
playerName - the player name