de.adom.jade.ui.ascii
Class AsciiUserInterface

java.lang.Object
  extended by de.adom.jade.ui.UserInterface
      extended by de.adom.jade.ui.DefaultUserInterface
          extended by de.adom.jade.ui.ascii.AsciiUserInterface
All Implemented Interfaces:
KeyboardCommandTarget, StartupConstants

public class AsciiUserInterface
extends DefaultUserInterface
implements KeyboardCommandTarget, StartupConstants

Implements an ascii based user interface.


Field Summary
 
Fields inherited from interface de.adom.jade.startup.StartupConstants
PL_BASIC_MAP_FINISHED, PL_DESERTS_FINISHED, PL_DUNGEONS_FINISHED, PL_GENESIS_DATA_CLEANED_UP, PL_GENESIS_DATA_CREATED, PL_MAXIMUM, PL_PRE_UI_INITIALIZATION, PL_RIVERS_FINISHED, PL_SEISMIC_ACTIVITY_FINISHED, PL_SETTLEMENTS_FINISHED, PL_SWAMPS_FINISHED, PL_WORD_FORMS_FINISHED, PL_WORLD_MAP_FINISHED
 
Constructor Summary
AsciiUserInterface()
           
 
Method Summary
 void centerMap()
          Centers the map on the centrail being.
 void clearMessages()
          Clears the message display area provided by the UI implementation.
 void commandActivated(Command command)
          Is called when a command has been activated.
 boolean displayErrorDialog(java.lang.String message, java.lang.Throwable error)
          Displays a runtime error together with a message.
 java.lang.String getDescription()
          Returns the extended description for this user interface.
 java.lang.String getName()
          Returns the short name of this specific user interface.
 int getProgressAddition()
          Returns the numerical amount added to the startup progress maximum by the initialize method of this class.
 TileRepresentation getTileRepresentation(int id)
          Returns a specific tile representation for a tile ID.
 void hideGameWindow()
          Hides the game window.
 void initialize(SplashScreen splashScreen)
          Initializes this particular user interface by executing all CPU intensive initializaton routines.
 void message(java.lang.String message)
          Displays a message to the user.
 void setMap(Map currentMap)
          Sets the map to use.
 void setNonKeyCommandInput(boolean active)
          Enables / disables non-keyboard input methods.
 void setPointOfView(Being being)
          Sets the point of view for the map.
 void showGameWindow()
          Displays the game window.
 void update()
          Requires the UI implementation to update the screen right away.
 void updateStatistics()
          Updates the statistics.
 
Methods inherited from class de.adom.jade.ui.DefaultUserInterface
addCommand, getCommand, requestCommand
 
Methods inherited from class de.adom.jade.ui.UserInterface
observe, observe
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AsciiUserInterface

public AsciiUserInterface()
Method Detail

getName

public java.lang.String getName()
Returns the short name of this specific user interface.

Specified by:
getName in class UserInterface
Returns:
the short name of this user interface

getDescription

public java.lang.String getDescription()
Returns the extended description for this user interface.

Specified by:
getDescription in class UserInterface
Returns:
the extended description for this user interface

getProgressAddition

public int getProgressAddition()
Returns the numerical amount added to the startup progress maximum by the initialize method of this class.

Specified by:
getProgressAddition in class UserInterface
Returns:
the numerical amount added to the startup progress by this class

initialize

public void initialize(SplashScreen splashScreen)
Initializes this particular user interface by executing all CPU intensive initializaton routines.

Specified by:
initialize in class UserInterface
Parameters:
splashScreen - the splash screen to use during initialization
See Also:
UserInterface.getProgressAddition(), SplashScreen, SplashScreen.setMessage(java.lang.String), SplashScreen.setProgress(int), SplashScreen.setStatus(java.lang.String, int), StartupConstants

update

public void update()
Requires the UI implementation to update the screen right away. This command always should be called from the game thread. The method will return after requesting a screen update and waiting for it to be done.

Specified by:
update in class UserInterface

setMap

public void setMap(Map currentMap)
Sets the map to use.

Specified by:
setMap in class UserInterface
Parameters:
currentMap - the map to use for now

setPointOfView

public void setPointOfView(Being being)
Sets the point of view for the map.

Specified by:
setPointOfView in class UserInterface
Parameters:
being - the being to use as the reference being for the next map view

showGameWindow

public void showGameWindow()
Displays the game window.

Specified by:
showGameWindow in class UserInterface

hideGameWindow

public void hideGameWindow()
Hides the game window.

Specified by:
hideGameWindow in class UserInterface

commandActivated

public void commandActivated(Command command)
Is called when a command has been activated.

Specified by:
commandActivated in interface KeyboardCommandTarget
Parameters:
command - the command that has been activated

message

public void message(java.lang.String message)
Displays a message to the user.

Specified by:
message in class UserInterface
Parameters:
message - the message to display

clearMessages

public void clearMessages()
Clears the message display area provided by the UI implementation.

Specified by:
clearMessages in class UserInterface

updateStatistics

public void updateStatistics()
Updates the statistics.

Specified by:
updateStatistics in class UserInterface

displayErrorDialog

public boolean displayErrorDialog(java.lang.String message,
                                  java.lang.Throwable error)
Description copied from class: UserInterface
Displays a runtime error together with a message. The information needs to be displayed in a modal dialog. The user should get a choice to view the detailed crash information, continue with the program or abort.

Specified by:
displayErrorDialog in class UserInterface
Parameters:
message - the message to display
error - the runtime error that occurred
Returns:
a boolean value to indicate whether the program should continue
See Also:
UserInterface.displayErrorDialog(java.lang.String, java.lang.Throwable)

setNonKeyCommandInput

public void setNonKeyCommandInput(boolean active)
Description copied from class: UserInterface
Enables / disables non-keyboard input methods.

Specified by:
setNonKeyCommandInput in class UserInterface
Parameters:
active - a boolean value indicating whether other command input methods are enabled or not
See Also:
UserInterface.setNonKeyCommandInput(boolean)

centerMap

public void centerMap()
Description copied from class: UserInterface
Centers the map on the centrail being.

Specified by:
centerMap in class UserInterface
See Also:
UserInterface.centerMap()

getTileRepresentation

public TileRepresentation getTileRepresentation(int id)
Description copied from class: UserInterface
Returns a specific tile representation for a tile ID.

Specified by:
getTileRepresentation in class UserInterface
Parameters:
id - the tile ID
Returns:
the tile representation for the tile ID
See Also:
UserInterface.getTileRepresentation(int)