Crossfire JXClient, Trunk
com.realtime.crossfire.jxclient.main.JXCWindow Class Reference

The main window. More...

+ Collaboration diagram for com.realtime.crossfire.jxclient.main.JXCWindow:

Public Member Functions

 JXCWindow (@NotNull final Exiter exiter, @NotNull final CrossfireServerConnection server, @NotNull final OptionManager optionManager, @NotNull final GuiStateManager guiStateManager, @NotNull final JXCWindowRenderer windowRenderer, @NotNull final CommandQueue commandQueue, @NotNull final GuiManager guiManager, @NotNull final KeyHandler keyHandler, @NotNull final CharacterModel characterModel, @NotNull final JXCConnection connection, @Nullable final Resolution resolution, final boolean fullScreen, @NotNull final JXCSkin skin)
 Creates a new instance. More...
 
void term ()
 Frees all resources. More...
 

Static Public Attributes

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

Private Attributes

final CrossfireAccountListener accountListener
 The CrossfireAccountListener attached to server. More...
 
final CharacterModel characterModel
 The CharacterModel to update. More...
 
final CommandQueue commandQueue
 The command queue instance for this window. More...
 
final CrossfireQueryListener crossfireQueryListener
 The CrossfireQueryListener attached to server. More...
 
final CrossfireUpdateItemListener crossfireUpdateItemListener
 The CrossfireUpdateItemListener to receive item updates. More...
 
final Exiter exiter
 The Exiter to use. More...
 
final JFrame frame = new JFrame("")
 The main window. More...
 
final GuiManager guiManager
 The GuiManager for controlling the main GUI state. More...
 
final GuiStateListener guiStateListener
 The GuiStateListener for detecting established or dropped connections. More...
 
final KeyHandler keyHandler
 The KeyHandler for processing keyboard input. More...
 
final KeyListener keyListener
 The KeyListener attached to the main window. More...
 
final OptionManager optionManager
 The option manager for this window. More...
 
final SentPacketListener sentPacketListener
 The SentPacketListener for detecting commands sent to the server. More...
 
final CrossfireServerConnection server
 The CrossfireServerConnection to use. More...
 
final WindowFocusListener windowFocusListener
 The WindowFocusListener registered for this window. More...
 
final WindowListener windowListener
 The window listener attached to this frame. More...
 

Detailed Description

The main window.

Author
Lauwenmark
Andreas Kirschbaum

Definition at line 67 of file JXCWindow.java.

Constructor & Destructor Documentation

◆ JXCWindow()

com.realtime.crossfire.jxclient.main.JXCWindow.JXCWindow ( @NotNull final Exiter  exiter,
@NotNull final CrossfireServerConnection  server,
@NotNull final OptionManager  optionManager,
@NotNull final GuiStateManager  guiStateManager,
@NotNull final JXCWindowRenderer  windowRenderer,
@NotNull final CommandQueue  commandQueue,
@NotNull final GuiManager  guiManager,
@NotNull final KeyHandler  keyHandler,
@NotNull final CharacterModel  characterModel,
@NotNull final JXCConnection  connection,
@Nullable final Resolution  resolution,
final boolean  fullScreen,
@NotNull final JXCSkin  skin 
)

Creates a new instance.

Parameters
exiterthe exiter to use
serverthe crossfire server connection to use
optionManagerthe option manager instance to use
guiStateManagerthe gui state manager to use
windowRendererthe window renderer to use
commandQueuethe command queue instance
guiManagerthe gui manager instance
keyHandlerthe key handler for keyboard input
characterModelthe character model to update
connectionthe connection to update
resolutionthe size of the client area,
null
for default
fullScreenwhether full-screen mode should be enabled
skinthe skin to show

Definition at line 375 of file JXCWindow.java.

References com.realtime.crossfire.jxclient.main.JXCWindow.accountListener, com.realtime.crossfire.jxclient.server.crossfire.CrossfireServerConnection.addCrossfireAccountListener(), com.realtime.crossfire.jxclient.server.crossfire.CrossfireServerConnection.addSentPacketListener(), com.realtime.crossfire.jxclient.util.ResourceUtils.APPLICATION_ICON, com.realtime.crossfire.jxclient.util.Resolution.asDimension(), com.realtime.crossfire.jxclient.main.JXCWindow.characterModel, com.realtime.crossfire.jxclient.main.JXCWindow.commandQueue, com.realtime.crossfire.jxclient.util.Resolution.equals(), com.realtime.crossfire.jxclient.main.JXCWindow.exiter, com.realtime.crossfire.jxclient.main.JXCWindow.frame, com.realtime.crossfire.jxclient.main.JXCWindow.guiManager, com.realtime.crossfire.jxclient.main.JXCWindow.guiStateListener, com.realtime.crossfire.jxclient.main.JXCWindow.keyHandler, com.realtime.crossfire.jxclient.main.JXCWindow.keyListener, com.realtime.crossfire.jxclient.window.DialogStateParser.load(), com.realtime.crossfire.jxclient.util.ResourceUtils.loadImage(), com.realtime.crossfire.jxclient.settings.options.OptionManager.loadOptions(), com.realtime.crossfire.jxclient.main.JXCWindow.optionManager, com.realtime.crossfire.jxclient.main.JXCWindow.sentPacketListener, com.realtime.crossfire.jxclient.main.JXCWindow.server, com.realtime.crossfire.jxclient.window.KeyHandler.setDefaultKeyBindings(), com.realtime.crossfire.jxclient.window.GuiManager.setSkin(), com.realtime.crossfire.jxclient.window.GuiManager.unsetSkin(), com.realtime.crossfire.jxclient.window.GuiManager.updateWindowSize(), com.realtime.crossfire.jxclient.main.JXCWindow.windowFocusListener, and com.realtime.crossfire.jxclient.main.JXCWindow.windowListener.

+ Here is the call graph for this function:

Member Function Documentation

◆ term()

void com.realtime.crossfire.jxclient.main.JXCWindow.term ( )

Member Data Documentation

◆ accountListener

final CrossfireAccountListener com.realtime.crossfire.jxclient.main.JXCWindow.accountListener
private

◆ characterModel

final CharacterModel com.realtime.crossfire.jxclient.main.JXCWindow.characterModel
private

The CharacterModel to update.

Definition at line 114 of file JXCWindow.java.

Referenced by com.realtime.crossfire.jxclient.main.JXCWindow.JXCWindow().

◆ commandQueue

final CommandQueue com.realtime.crossfire.jxclient.main.JXCWindow.commandQueue
private

The command queue instance for this window.

Definition at line 96 of file JXCWindow.java.

Referenced by com.realtime.crossfire.jxclient.main.JXCWindow.JXCWindow().

◆ crossfireQueryListener

final CrossfireQueryListener com.realtime.crossfire.jxclient.main.JXCWindow.crossfireQueryListener
private
Initial value:
= new CrossfireQueryListener() {
@Override
public void commandQueryReceived(@NotNull final String prompt, final int queryType) {
SwingUtilities.invokeLater(() -> guiManager.openQueryDialog(prompt, queryType));
}
}

The CrossfireQueryListener attached to server.

It parses query messages to open/close dialogs.

Definition at line 234 of file JXCWindow.java.

◆ crossfireUpdateItemListener

final CrossfireUpdateItemListener com.realtime.crossfire.jxclient.main.JXCWindow.crossfireUpdateItemListener
private
Initial value:
= new CrossfireUpdateItemListener() {
@Override
public void delinvReceived(final int tag) {
}
@Override
public void delitemReceived(final int @NotNull [] tags) {
}
@Override
public void addItemReceived(final int location, final int tag, final int flags, final int weight, final int faceNum, @NotNull final String name, @NotNull final String namePl, final int anim, final int animSpeed, final int nrof, final int type) {
}
@Override
public void playerReceived(final int tag, final int weight, final int faceNum, @NotNull final String name) {
SwingUtilities.invokeLater(guiManager::playerReceived);
}
@Override
public void upditemReceived(final int flags, final int tag, final int valLocation, final int valFlags, final int valWeight, final int valFaceNum, @NotNull final String valName, @NotNull final String valNamePl, final int valAnim, final int valAnimSpeed, final int valNrof) {
}
}

The CrossfireUpdateItemListener to receive item updates.

Definition at line 151 of file JXCWindow.java.

◆ DISABLE_START_GUI

final boolean com.realtime.crossfire.jxclient.main.JXCWindow.DISABLE_START_GUI = true
static

TODO: Remove when more options are implemented in the start screen gui.

Definition at line 72 of file JXCWindow.java.

Referenced by com.realtime.crossfire.jxclient.main.JXClient.JXClient().

◆ exiter

final Exiter com.realtime.crossfire.jxclient.main.JXCWindow.exiter
private

The Exiter to use.

Definition at line 78 of file JXCWindow.java.

Referenced by com.realtime.crossfire.jxclient.main.JXCWindow.JXCWindow().

◆ frame

final JFrame com.realtime.crossfire.jxclient.main.JXCWindow.frame = new JFrame("")
private

The main window.

Definition at line 120 of file JXCWindow.java.

Referenced by com.realtime.crossfire.jxclient.main.JXCWindow.JXCWindow().

◆ guiManager

final GuiManager com.realtime.crossfire.jxclient.main.JXCWindow.guiManager
private

The GuiManager for controlling the main GUI state.

Definition at line 84 of file JXCWindow.java.

Referenced by com.realtime.crossfire.jxclient.main.JXCWindow.JXCWindow(), and com.realtime.crossfire.jxclient.main.JXCWindow.term().

◆ guiStateListener

final GuiStateListener com.realtime.crossfire.jxclient.main.JXCWindow.guiStateListener
private

The GuiStateListener for detecting established or dropped connections.

Definition at line 249 of file JXCWindow.java.

Referenced by com.realtime.crossfire.jxclient.main.JXCWindow.JXCWindow().

◆ keyHandler

final KeyHandler com.realtime.crossfire.jxclient.main.JXCWindow.keyHandler
private

The KeyHandler for processing keyboard input.

Definition at line 102 of file JXCWindow.java.

Referenced by com.realtime.crossfire.jxclient.main.JXCWindow.JXCWindow().

◆ keyListener

final KeyListener com.realtime.crossfire.jxclient.main.JXCWindow.keyListener
private
Initial value:
= new KeyListener() {
@Override
public void keyTyped(@NotNull final KeyEvent e) {
}
@Override
public void keyPressed(@NotNull final KeyEvent e) {
}
@Override
public void keyReleased(@NotNull final KeyEvent e) {
}
}

The KeyListener attached to the main window.

Definition at line 210 of file JXCWindow.java.

Referenced by com.realtime.crossfire.jxclient.main.JXCWindow.JXCWindow().

◆ optionManager

final OptionManager com.realtime.crossfire.jxclient.main.JXCWindow.optionManager
private

The option manager for this window.

Definition at line 108 of file JXCWindow.java.

Referenced by com.realtime.crossfire.jxclient.main.JXCWindow.JXCWindow(), and com.realtime.crossfire.jxclient.main.JXCWindow.term().

◆ sentPacketListener

final SentPacketListener com.realtime.crossfire.jxclient.main.JXCWindow.sentPacketListener
private
Initial value:
= new SentPacketListener() {
@Override
public void markSent(final int tag) {
}
@Override
public void replySent() {
}
}

The SentPacketListener for detecting commands sent to the server.

Definition at line 300 of file JXCWindow.java.

Referenced by com.realtime.crossfire.jxclient.main.JXCWindow.JXCWindow().

◆ server

final CrossfireServerConnection com.realtime.crossfire.jxclient.main.JXCWindow.server
private

◆ windowFocusListener

final WindowFocusListener com.realtime.crossfire.jxclient.main.JXCWindow.windowFocusListener
private
Initial value:
= new WindowAdapter() {
@Override
@SuppressWarnings("MethodDoesntCallSuperMethod")
public void windowLostFocus(final WindowEvent e) {
}
}
}

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.

Definition at line 135 of file JXCWindow.java.

Referenced by com.realtime.crossfire.jxclient.main.JXCWindow.JXCWindow().

◆ windowListener

final WindowListener com.realtime.crossfire.jxclient.main.JXCWindow.windowListener
private
Initial value:
= new WindowAdapter() {
@Override
@SuppressWarnings("MethodDoesntCallSuperMethod")
public void windowClosing(@NotNull final WindowEvent e) {
}
}
@Override
@SuppressWarnings("MethodDoesntCallSuperMethod")
public void windowClosed(@NotNull final WindowEvent e) {
if (!frame.isVisible()) {
}
}
}

The window listener attached to this frame.

Definition at line 185 of file JXCWindow.java.

Referenced by com.realtime.crossfire.jxclient.main.JXCWindow.JXCWindow().


The documentation for this class was generated from the following file:
com.realtime.crossfire.jxclient.main.JXCWindow.keyHandler
final KeyHandler keyHandler
The KeyHandler for processing keyboard input.
Definition: JXCWindow.java:102
com.realtime.crossfire.jxclient.main.JXCWindow.exiter
final Exiter exiter
The Exiter to use.
Definition: JXCWindow.java:78
com.realtime.crossfire.jxclient.main.JXCWindow.commandQueue
final CommandQueue commandQueue
The command queue instance for this window.
Definition: JXCWindow.java:96
com.realtime.crossfire.jxclient.window.GuiManager.openQueryDialog
void openQueryDialog(@NotNull final String prompt, final int queryType)
Opens the "query" dialog.
Definition: GuiManager.java:559
com.realtime.crossfire.jxclient.main.Exiter.terminate
void terminate()
Terminates the application.
Definition: Exiter.java:42
com.realtime.crossfire.jxclient.window.GuiManager.openQuitDialog
boolean openQuitDialog()
Opens the "quit" dialog.
Definition: GuiManager.java:494
com.realtime.crossfire.jxclient.window.KeyHandler.isRunningUsingCtrl
boolean isRunningUsingCtrl
Whether the player is running because she is using the Ctrl key or not.
Definition: KeyHandler.java:87
com.realtime.crossfire.jxclient.queue.CommandQueue.stopRunning
boolean stopRunning()
Tells the server to stop running.
Definition: CommandQueue.java:269
com.realtime.crossfire.jxclient.main.JXCWindow.guiManager
final GuiManager guiManager
The GuiManager for controlling the main GUI state.
Definition: JXCWindow.java:84
com.realtime.crossfire.jxclient.window.GuiManager.closeQueryDialog
void closeQueryDialog()
Closes the "query" dialog.
Definition: GuiManager.java:706
com.realtime.crossfire.jxclient.window.KeyHandler.keyReleased
void keyReleased(@NotNull final KeyEvent e)
Handles a "key released" event.
Definition: KeyHandler.java:274
com.realtime.crossfire.jxclient.window.KeyHandler.keyPressed
void keyPressed(@NotNull final KeyEvent e)
Handles a "key pressed" event.
Definition: KeyHandler.java:260
com.realtime.crossfire.jxclient.main.JXCWindow.frame
final JFrame frame
The main window.
Definition: JXCWindow.java:120