com.realtime.crossfire.jxclient.main
Class JXCWindow

java.lang.Object
  extended by com.realtime.crossfire.jxclient.main.JXCWindow

public class JXCWindow
extends java.lang.Object

The main window.


Field Summary
private  CrossfireAccountListener accountListener
           
private  CharacterModel characterModel
           
private  CommandQueue commandQueue
          The command queue instance for this window.
private  CrossfireQueryListener crossfireQueryListener
          The CrossfireQueryListener attached to server.
private  CrossfireUpdateItemListener crossfireUpdateItemListener
          The CrossfireUpdateItemListener to receive item updates.
static boolean DISABLE_START_GUI
          TODO: Remove when more options are implemented in the start screen gui.
private  Exiter exiter
          The Exiter to use.
private  java.awt.Frame frame
          The main window.
private  GuiManager guiManager
          The GuiManager for controlling the main GUI state.
private  GuiStateListener guiStateListener
          The GuiStateListener for detecting established or dropped connections.
private  KeyHandler keyHandler
          The KeyHandler for processing keyboard input.
private  java.awt.event.KeyListener keyListener
          The KeyListener attached to the main window.
private  OptionManager optionManager
          The option manager for this window.
private  java.lang.Object semaphoreDrawing
          The semaphore for drawing the window contents.
private  SentReplyListener sentReplyListener
          The SentReplyListener for detecting "reply" commands sent to the server.
private  CrossfireServerConnection server
          The CrossfireServerConnection to use.
private  java.awt.event.WindowFocusListener windowFocusListener
          The WindowFocusListener registered for this window.
private  java.awt.event.WindowListener windowListener
          The window listener attached to this frame.
private  JXCWindowRenderer windowRenderer
          The JXCWindowRenderer for this window.
 
Constructor Summary
JXCWindow(Exiter exiter, CrossfireServerConnection server, OptionManager optionManager, GuiStateManager guiStateManager, JXCWindowRenderer windowRenderer, CommandQueue commandQueue, GuiManager guiManager, KeyHandler keyHandler, CharacterModel characterModel, javax.swing.JFrame frame)
          Creates a new instance.
 
Method Summary
 void init(Resolution resolution, MouseTracker mouseTracker, java.lang.String skinName, boolean fullScreen, SkinLoader skinLoader)
          Initializes the instance: loads and displays the skin.
 void term()
          Frees all resources.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

accountListener

@NotNull
private final CrossfireAccountListener accountListener

characterModel

@NotNull
private final CharacterModel characterModel

commandQueue

@NotNull
private final CommandQueue commandQueue
The command queue instance for this window.


crossfireQueryListener

@NotNull
private final CrossfireQueryListener crossfireQueryListener
The CrossfireQueryListener attached to server. It parses query messages to open/close dialogs.


crossfireUpdateItemListener

@NotNull
private final CrossfireUpdateItemListener crossfireUpdateItemListener
The CrossfireUpdateItemListener to receive item updates.


DISABLE_START_GUI

public static final boolean DISABLE_START_GUI
TODO: Remove when more options are implemented in the start screen gui.

See Also:
Constant Field Values

exiter

@NotNull
private final Exiter exiter
The Exiter to use.


frame

@NotNull
private final java.awt.Frame frame
The main window.


guiManager

@NotNull
private final GuiManager guiManager
The GuiManager for controlling the main GUI state.


guiStateListener

@NotNull
private final GuiStateListener guiStateListener
The GuiStateListener for detecting established or dropped connections.


keyHandler

@NotNull
private final KeyHandler keyHandler
The KeyHandler for processing keyboard input.


keyListener

@NotNull
private final java.awt.event.KeyListener keyListener
The KeyListener attached to the main window.


optionManager

@NotNull
private final OptionManager optionManager
The option manager for this window.


semaphoreDrawing

@NotNull
private final java.lang.Object semaphoreDrawing
The semaphore for drawing the window contents.


sentReplyListener

@NotNull
private final SentReplyListener sentReplyListener
The SentReplyListener for detecting "reply" commands sent to the server.


server

@NotNull
private final CrossfireServerConnection server
The CrossfireServerConnection to use.


windowFocusListener

@NotNull
private final java.awt.event.WindowFocusListener windowFocusListener
The WindowFocusListener registered for this window. It resets the keyboard modifier state when the window loses the focus. The idea is to prevent the following: user switches from JXClient to another window with CTRL+ALT+direction key. This makes JXClient enter RUN mode since CTRL was pressed. The following key release event is not received by JXClient because it does not own the focus. Therefore JXClient's CTRL state is still active when the user switches back to JXClient. A following direction key then causes the character to run which is not what the player wants.


windowListener

@NotNull
private final java.awt.event.WindowListener windowListener
The window listener attached to this frame.


windowRenderer

@NotNull
private final JXCWindowRenderer windowRenderer
The JXCWindowRenderer for this window.

Constructor Detail

JXCWindow

public JXCWindow(@NotNull
                 Exiter exiter,
                 @NotNull
                 CrossfireServerConnection server,
                 @NotNull
                 OptionManager optionManager,
                 @NotNull
                 GuiStateManager guiStateManager,
                 @NotNull
                 JXCWindowRenderer windowRenderer,
                 @NotNull
                 CommandQueue commandQueue,
                 @NotNull
                 GuiManager guiManager,
                 @NotNull
                 KeyHandler keyHandler,
                 @NotNull
                 CharacterModel characterModel,
                 @NotNull
                 javax.swing.JFrame frame)
Creates a new instance.

Parameters:
exiter - the exiter to use
server - the crossfire server connection to use
optionManager - the option manager instance to use
guiStateManager - the gui state manager to use
windowRenderer - the window renderer to use
commandQueue - the command queue instance
guiManager - the gui manager instance
keyHandler - the key handler for keyboard input
frame - the frame to use
Method Detail

init

public void init(@Nullable
                 Resolution resolution,
                 @NotNull
                 MouseTracker mouseTracker,
                 @NotNull
                 java.lang.String skinName,
                 boolean fullScreen,
                 @NotNull
                 SkinLoader skinLoader)
Initializes the instance: loads and displays the skin.

Parameters:
resolution - the size of the client area, null for default
mouseTracker - the mouse tracker to use
skinName - the skin to load
fullScreen - whether full-screen mode should be enabled
skinLoader - the skin loader instance

term

public void term()
Frees all resources. Should be called before the application terminates.