 |
Crossfire JXClient, Trunk
|
Go to the documentation of this file.
23 package com.realtime.crossfire.jxclient.skin.io;
83 import java.awt.Component;
84 import java.io.IOException;
85 import java.io.LineNumberReader;
86 import org.jetbrains.annotations.NotNull;
87 import org.jetbrains.annotations.Nullable;
171 public GUICommand parseCommandArgs(@NotNull
final Args args, @Nullable
final AbstractGUIElement element, @NotNull
final String command, @NotNull
final GuiStateManager guiStateManager, @NotNull
final CommandExecutor commandExecutor, @NotNull
final LineNumberReader lnr, @NotNull
final CommandQueue commandQueue, @NotNull
final CrossfireServerConnection crossfireServerConnection, @NotNull
final CommandCallback commandCallback, @NotNull
final Macros macros)
throws IOException,
JXCSkinException {
172 if (command.equals(
"SHOW")) {
175 if (command.equals(
"HIDE")) {
178 if (command.equals(
"TOGGLE")) {
181 if (command.equals(
"PRINT")) {
184 if (command.equals(
"QUIT")) {
185 return parseQuit(element, commandCallback);
187 if (command.equals(
"CONNECT")) {
190 if (command.equals(
"DISCONNECT")) {
193 if (command.equals(
"GUI_META")) {
196 if (command.equals(
"GUI_START")) {
199 if (command.equals(
"GUI_EXECUTE_ELEMENT")) {
202 if (command.equals(
"DIALOG_OPEN")) {
205 if (command.equals(
"DIALOG_TOGGLE")) {
208 if (command.equals(
"DIALOG_CLOSE")) {
211 if (command.equals(
"GUI_EXECUTE_COMMAND")) {
214 if (command.equals(
"EXEC_SELECTION")) {
217 if (command.equals(
"MOVE_SELECTION")) {
220 if (command.equals(
"SCROLL_LIST")) {
223 if (command.equals(
"SCROLL") || command.equals(
"SCROLL_NEVER")) {
224 return parseScroll(args, element, command.equals(
"SCROLL"));
226 if (command.equals(
"SCROLL_RESET")) {
229 if (command.equals(
"MOVE_FOCUS")) {
232 if (command.equals(
"ACCOUNT_LOGIN")) {
235 if (command.equals(
"ACCOUNT_CREATE")) {
238 if (command.equals(
"ACCOUNT_PLAY")) {
241 if (command.equals(
"ACCOUNT_LINK")) {
244 if (command.equals(
"ACCOUNT_CREATE_CHARACTER")) {
247 if (command.equals(
"ACCOUNT_PASSWORD")) {
250 if (command.equals(
"SELECT")) {
253 if (command.equals(
"INVENTORY_OPTION")) {
256 if (command.equals(
"QUESTS_FILTER")) {
270 if (element ==
null) {
271 throw new IOException(
"<element> is required");
285 if (element ==
null) {
286 throw new IOException(
"<element> is required");
300 if (element ==
null) {
301 throw new IOException(
"<element> is required");
316 if (element !=
null) {
317 throw new IOException(
"<element> is not allowed");
333 if (element !=
null) {
334 throw new IOException(
"<element> is not allowed");
349 if (element ==
null) {
350 throw new IOException(
"<element> is required");
353 if (!(element instanceof
GUIText)) {
354 throw new IOException(
"'"+element+
"' must be an input field");
370 if (element !=
null) {
371 throw new IOException(
"<element> is not allowed");
387 if (element !=
null) {
388 throw new IOException(
"<element> is not allowed");
404 if (element !=
null) {
405 throw new IOException(
"<element> is not allowed");
419 if (element ==
null) {
420 throw new IOException(
"<element> is required");
423 if (!(element instanceof
GUIItem)) {
424 throw new IOException(
"'"+element+
"' must be an item element");
441 if (element !=
null) {
442 throw new IOException(
"<element> is not allowed");
445 final String name = args.get();
461 if (element !=
null) {
462 throw new IOException(
"<element> is not allowed");
465 final String name = args.get();
481 if (element !=
null) {
482 throw new IOException(
"<element> is not allowed");
485 final String name = args.get();
503 if (element !=
null) {
504 throw new IOException(
"<element> is not allowed");
524 if (element ==
null) {
525 throw new IOException(
"<element> is required");
529 throw new IOException(
"'"+element+
"' must be an item list");
546 if (diffLines == 0 && diffElements == 0) {
547 throw new IOException(
"Invalid zero scroll distance");
550 if (element ==
null) {
551 throw new IOException(
"<element> is required");
554 if (!(element instanceof
GUIList)) {
555 throw new IOException(
"'"+element+
"' must be a list");
572 throw new IOException(
"Invalid zero scroll distance");
575 if (element ==
null) {
576 throw new IOException(
"<element> is required");
580 throw new IOException(
"'"+element+
"' must be a scrollable");
599 throw new IOException(
"Invalid zero scroll distance");
602 if (element ==
null) {
603 throw new IOException(
"<element> is required");
607 throw new IOException(
"'"+element+
"' must be a scrollable element");
621 if (element ==
null) {
622 throw new IOException(
"<element> is required");
626 throw new IOException(
"'"+element+
"' must be a scrollable element");
644 throw new IOException(
"'"+args.getPrev()+
"' cannot become active");
648 if (apply != 0 && apply != 1) {
649 throw new IOException(
"<apply> must be 0 or 1");
652 if (element ==
null) {
653 throw new IOException(
"<element> is required");
657 throw new IOException(
"'"+element+
"' cannot become active");
672 if (element ==
null) {
673 throw new IOException(
"<element> is required");
688 if (element ==
null) {
689 throw new IOException(
"<element> is required");
704 if (element ==
null) {
705 throw new IOException(
"<element> is required");
720 if (element ==
null) {
721 throw new IOException(
"<element> is required");
736 if (element ==
null) {
737 throw new IOException(
"<element> is required");
752 if (element ==
null) {
753 throw new IOException(
"<element> is required");
770 if (element ==
null) {
771 throw new IOException(
"<element> is required");
775 throw new IOException(
"'"+element+
"' must be a selectable element");
793 if (element !=
null) {
794 throw new IOException(
"<element> is not allowed");
805 if (element !=
null) {
806 throw new IOException(
"<element> is not allowed");
Abstract base class for text input fields.
A GUICommand which disconnects from the Crossfire server.
A GUICommand sending an account creation request.
static String parseText(@NotNull final Args args, @NotNull final LineNumberReader lnr)
Concatenates trailing arguments into a string.
static GUICommand parseScroll(@NotNull final Args args, @Nullable final GUIElement element, final boolean isScroll)
Parses and builds a "SCROLL" or "SCROLL_NEVER" command.
static GUICommand parseQuit(@Nullable final GUIElement element, @NotNull final CommandCallback commandCallback)
Parses and builds a "QUIT" command.
A GUICommand for setting the inventory filter.
static GUICommand parseScrollList(@NotNull final Args args, @Nullable final GUIElement element)
Parses and builds a "SCROLL_LIST" command.
Adds encoding/decoding of crossfire protocol packets to a ServerConnection.
A GUIElement that displays a list of entries.
A GUICommand which connects to a Crossfire server.
GUICommand parseAccountLogin(@Nullable final AbstractGUIElement element, @NotNull final CommandCallback commandCallback)
Parses and builds an "ACCOUNT_LOGIN" command.
static int parseInt(@NotNull final String str)
Parses an integer constant.
A GUICommand sending an account password change request.
GUICommand parseAccountPassword(@Nullable final AbstractGUIElement element, @NotNull final CommandCallback commandCallback)
Parses and builds an "ACCOUNT_PASSWORD" command.
Abstract base class for GUI elements to be shown in Guis.
static GUICommand parseConnect(@Nullable final GUIElement element, @NotNull final GuiStateManager guiStateManager)
Parses and builds a "CONNECT" command.
A GUICommand for selecting or deselecting a GUIElement.
A GUICommand which toggles the visibility of a target GUIElement.
final Dialogs dialogs
The Dialogs instance to use.
A GUICommand which executes a Crossfire command.
A GUIElement that can be set to active or inactive.
A GUIElement representing an in-game object.
CommandParser(@NotNull final Dialogs dialogs, @NotNull final FloorView floorView, @NotNull final InventoryView inventoryView, @NotNull final QuestsView questsView, @NotNull final JXCSkinCache< AbstractGUIElement > definedGUIElements, @NotNull final GuiFactory guiFactory, @NotNull final NewCharModel newCharModel)
Creates a new instance.
Implements a cache for elements identified by name.
static GUICommand parseSelect(@NotNull final Args args, @Nullable final GUIElement element)
Parses and builds a "SELECT" command.
GUICommand parseQuestsFilter(@NotNull final Args args, @Nullable final GUIElement element)
Utility class for parsing strings into numbers.
void addDialog(@NotNull final String name)
Creates a new dialog instance.
Exception thrown if a skin related problem occurs.
A filter option for the inventory view.
GUICommand parseAccountLink(@Nullable final AbstractGUIElement element, @NotNull final CommandCallback commandCallback)
Parses and builds an "ACCOUNT_LINK" command.
static GUICommand parseToggle(@Nullable final Component element)
Parses and builds a "TOGGLE" command.
static GUICommand parseMoveSelection(@NotNull final Args args, @Nullable final GUIElement element)
Parses and builds a "MOVE_SELECTION" command.
static GUICommand parseDisconnect(@Nullable final GUIElement element, @NotNull final GuiStateManager guiStateManager)
Parses and builds a "DISCONNECT" command.
Parser for integer expressions.
Interface defining an abstract GUI element.
A GUICommand sending a request to link a character to an account.
Parser for creating GUICommand instances from string representations.
GUICommand parseInventoryOption(@NotNull final Args args, @Nullable final GUIElement element)
Parses and builds an "INVENTORY_OPTION" command.
Provides a view of all items in the current player's inventory.
Manages macro expansion in command strings.
Maintains the current GuiState.
static GUICommand parseGuiExecuteElement(@Nullable final GUIElement element)
Parses and builds a "GUI_EXECUTE_ELEMENT" command.
GUICommand parseExecSelection(@NotNull final Args args, @Nullable final GUIElement element, @NotNull final CommandQueue commandQueue, @NotNull final CrossfireServerConnection crossfireServerConnection)
Parses and builds a "" command.
static GUICommand parseGuiExecuteCommand(@NotNull final Args args, @Nullable final GUIElement element, @NotNull final CommandExecutor commandExecutor, @NotNull final LineNumberReader lnr, @NotNull final Macros macros)
Parses and builds a "GUI_EXECUTE_COMMAND" command.
static GUICommand parseShow(@Nullable final Component element)
Parses and builds a "SHOW" command.
GUICommand parseCommandArgs(@NotNull final Args args, @Nullable final AbstractGUIElement element, @NotNull final String command, @NotNull final GuiStateManager guiStateManager, @NotNull final CommandExecutor commandExecutor, @NotNull final LineNumberReader lnr, @NotNull final CommandQueue commandQueue, @NotNull final CrossfireServerConnection crossfireServerConnection, @NotNull final CommandCallback commandCallback, @NotNull final Macros macros)
Parses and builds command arguments.
A GUICommand sending a play character request to the server.
A GUICommand which hides a target GUIElement.
GUICommand parseDialogClose(@NotNull final Args args, @Nullable final GUIElement element, @NotNull final CommandCallback commandCallback)
Parses and builds a "DIALOG_CLOSE" command.
Utility class for parsing string parameters into values.
final FloorView floorView
The FloorView to use.
static GUICommand parseGuiMeta(@Nullable final GUIElement element, @NotNull final GuiStateManager guiStateManager)
Parses and builds a "GUI_META" command.
static GUICommand parseHide(@Nullable final Component element)
Parses and builds a "HIDE" command.
General information for creating new characters.
A GUIList instance that displays GUIItemItem instances.
A filter option for the quests view.
GUICommand parseMoveFocus(@NotNull final Args args, @Nullable final GUIElement element)
Parses and builds a "MOVE_FOCUS" command.
static< T extends Enum< T > T parseEnum(@NotNull final Class< T > class_, @NotNull final String name, @NotNull final String ident)
Parses an enum constant.
GUICommand parseDialogToggle(@NotNull final Args args, @Nullable final GUIElement element, @NotNull final CommandCallback commandCallback)
Parses and builds a "DIALOG_TOGGLE" command.
A GUICommand that executes a command on the selected item of a GUIItemList.
final InventoryView inventoryView
The InventoryView to use.
A GUICommand which does nothing.
Factory for creating Gui instances.
Provides a view of all quests a character is doing.
final QuestsView questsView
final GuiFactory guiFactory
The global GuiFactory instance.
GUICommand parseAccountCreate(@Nullable final AbstractGUIElement element, @NotNull final CommandCallback commandCallback)
Parses and builds an "ACCOUNT_CREATE" command.
Maintains a set of Gui instances representing dialog windows.
Interface that defines callback functions needed by commands.
final JXCSkinCache< AbstractGUIElement > definedGUIElements
The defined GUI elements.
static GUICommand parseGuiStart(@Nullable final GUIElement element, @NotNull final GuiStateManager guiStateManager)
Parses and builds a "GUI_START" command.
static GUICommand parseScrollReset(@Nullable final GUIElement element)
Parses and builds a "SCROLL_RESET" command.
static boolean parseBoolean(@NotNull final String str)
Parses a boolean constant.
A GUICommand sending a character creation request.
A GUICommand which shows the start screen.
GUICommand parseDialogOpen(@NotNull final Args args, @Nullable final GUIElement element, @NotNull final CommandCallback commandCallback)
Parses and builds a "DIALOG_OPEN" command.
A GUICommand which shows a target GUIElement.
Provides a view to all items comprising the current floor view.
A GUICommand which quite the client.
A GUICommand which opens a Gui dialog.
final NewCharModel newCharModel
The global NewCharModel instance.
A GUICommand which toggles the visibility of a dialog.
GUICommand parseAccountCreateCharacter(@Nullable final AbstractGUIElement element, @NotNull final CommandCallback commandCallback)
Parses and builds an "ACCOUNT_CREATE_CHARACTER" command.
GUICommand parseAccountPlay(@Nullable final AbstractGUIElement element, @NotNull final CommandCallback commandCallback)
Parses and builds an "ACCOUNT_PLAY" command.
Maintains the pending (ncom) commands sent to the server.
A GUICommand which moves the selection in a GUIList element.
A GUICommand which executes (i.e., simulates a left-button mouse click on) an GUIItem.
A GUICommand sending an account login request to the server.
A GUICommand which closes a Gui.
static GUICommand parsePrint(@Nullable final GUIElement element)
Parses and builds a "PRINT" command.
A GUICommand for setting a quest filter.