public class CommandParser
extends java.lang.Object
GUICommand
instances from string
representations.Modifier and Type | Field and Description |
---|---|
private JXCSkinCache<AbstractGUIElement> |
definedGUIElements
The defined GUI elements.
|
private Dialogs |
dialogs
The
Dialogs instance to use. |
private FloorView |
floorView
The
FloorView to use. |
Constructor and Description |
---|
CommandParser(Dialogs dialogs,
FloorView floorView,
JXCSkinCache<AbstractGUIElement> definedGUIElements)
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
private static GUICommand |
parseAccountCreate(AbstractGUIElement element,
CommandCallback commandCallback)
Parses and builds an "ACCOUNT_CREATE" command.
|
private static GUICommand |
parseAccountCreateCharacter(AbstractGUIElement element,
CommandCallback commandCallback)
Parses and builds an "ACCOUNT_CREATE_CHARACTER" command.
|
private static GUICommand |
parseAccountLink(AbstractGUIElement element,
CommandCallback commandCallback)
Parses and builds an "ACCOUNT_LINK" command.
|
private static GUICommand |
parseAccountLogin(AbstractGUIElement element,
CommandCallback commandCallback)
Parses and builds an "ACCOUNT_LOGIN" command.
|
private static GUICommand |
parseAccountPassword(AbstractGUIElement element,
CommandCallback commandCallback)
Parses and builds an "ACCOUNT_PASSWORD" command.
|
private static GUICommand |
parseAccountPlay(AbstractGUIElement element,
CommandCallback commandCallback)
Parses and builds an "ACCOUNT_PLAY" command.
|
GUICommand |
parseCommandArgs(Args args,
AbstractGUIElement element,
java.lang.String command,
GuiStateManager guiStateManager,
CommandExecutor commandExecutor,
java.io.LineNumberReader lnr,
CommandQueue commandQueue,
CrossfireServerConnection crossfireServerConnection,
CommandCallback commandCallback,
Macros macros)
Parses and builds command arguments.
|
private static GUICommand |
parseConnect(GUIElement element,
GuiStateManager guiStateManager)
Parses and builds a "CONNECT" command.
|
private GUICommand |
parseDialogClose(Args args,
GUIElement element,
CommandCallback commandCallback)
Parses and builds a "DIALOG_CLOSE" command.
|
private GUICommand |
parseDialogOpen(Args args,
GUIElement element,
CommandCallback commandCallback)
Parses and builds a "DIALOG_OPEN" command.
|
private GUICommand |
parseDialogToggle(Args args,
GUIElement element,
CommandCallback commandCallback)
Parses and builds a "DIALOG_TOGGLE" command.
|
private static GUICommand |
parseDisconnect(GUIElement element,
GuiStateManager guiStateManager)
Parses and builds a "DISCONNECT" command.
|
private GUICommand |
parseExecSelection(Args args,
GUIElement element,
CommandQueue commandQueue,
CrossfireServerConnection crossfireServerConnection)
Parses and builds a "" command.
|
private static GUICommand |
parseGuiExecuteCommand(Args args,
GUIElement element,
CommandExecutor commandExecutor,
java.io.LineNumberReader lnr,
Macros macros)
Parses and builds a "GUI_EXECUTE_COMMAND" command.
|
private static GUICommand |
parseGuiExecuteElement(GUIElement element)
Parses and builds a "GUI_EXECUTE_ELEMENT" command.
|
private static GUICommand |
parseGuiMeta(GUIElement element,
GuiStateManager guiStateManager)
Parses and builds a "GUI_META" command.
|
private static GUICommand |
parseGuiStart(GUIElement element,
GuiStateManager guiStateManager)
Parses and builds a "GUI_START" command.
|
private static GUICommand |
parseHide(java.awt.Component element)
Parses and builds a "HIDE" command.
|
private GUICommand |
parseMoveFocus(Args args,
GUIElement element)
Parses and builds a "MOVE_FOCUS" command.
|
private static GUICommand |
parseMoveSelection(Args args,
GUIElement element)
Parses and builds a "MOVE_SELECTION" command.
|
private static GUICommand |
parsePrint(GUIElement element)
Parses and builds a "PRINT" command.
|
private static GUICommand |
parseQuit(GUIElement element,
CommandCallback commandCallback)
Parses and builds a "QUIT" command.
|
private static GUICommand |
parseScroll(Args args,
GUIElement element,
boolean isScroll)
Parses and builds a "SCROLL" or "SCROLL_NEVER command.
|
private static GUICommand |
parseScrollList(Args args,
GUIElement element)
Parses and builds a "SCROLL_LIST" command.
|
private static GUICommand |
parseScrollReset(GUIElement element)
Parses and builds a "SCROLL_RESET" command.
|
private static GUICommand |
parseSelect(Args args,
GUIElement element)
Parses and builds a "SELECT" command.
|
private static GUICommand |
parseShow(java.awt.Component element)
Parses and builds a "SHOW" command.
|
private static GUICommand |
parseToggle(java.awt.Component element)
Parses and builds a "TOGGLE" command.
|
@NotNull private final JXCSkinCache<AbstractGUIElement> definedGUIElements
public CommandParser(@NotNull Dialogs dialogs, @NotNull FloorView floorView, @NotNull JXCSkinCache<AbstractGUIElement> definedGUIElements)
dialogs
- the dialogs instance to usefloorView
- the floor view to usedefinedGUIElements
- the defined GUI elements@NotNull private static GUICommand parseAccountCreate(@Nullable AbstractGUIElement element, @NotNull CommandCallback commandCallback) throws java.io.IOException
element
- the target elementcommandCallback
- the command callback to usejava.io.IOException
- if a syntax error occurs@NotNull private static GUICommand parseAccountCreateCharacter(@Nullable AbstractGUIElement element, @NotNull CommandCallback commandCallback) throws java.io.IOException
element
- the target elementcommandCallback
- the command callback to usejava.io.IOException
- if a syntax error occurs@NotNull private static GUICommand parseAccountLink(@Nullable AbstractGUIElement element, @NotNull CommandCallback commandCallback) throws java.io.IOException
element
- the target elementcommandCallback
- the command callback to usejava.io.IOException
- if a syntax error occurs@NotNull private static GUICommand parseAccountLogin(@Nullable AbstractGUIElement element, @NotNull CommandCallback commandCallback) throws java.io.IOException
element
- the target elementcommandCallback
- the command callback to usejava.io.IOException
- if a syntax error occurs@NotNull private static GUICommand parseAccountPassword(@Nullable AbstractGUIElement element, @NotNull CommandCallback commandCallback) throws java.io.IOException
element
- the target elementcommandCallback
- the command callback to usejava.io.IOException
- if a syntax error occurs@NotNull private static GUICommand parseAccountPlay(@Nullable AbstractGUIElement element, @NotNull CommandCallback commandCallback) throws java.io.IOException
element
- the target elementcommandCallback
- the command callback to usejava.io.IOException
- if a syntax error occurs@NotNull public GUICommand parseCommandArgs(@NotNull Args args, @Nullable AbstractGUIElement element, @NotNull java.lang.String command, @NotNull GuiStateManager guiStateManager, @NotNull CommandExecutor commandExecutor, @NotNull java.io.LineNumberReader lnr, @NotNull CommandQueue commandQueue, @NotNull CrossfireServerConnection crossfireServerConnection, @NotNull CommandCallback commandCallback, @NotNull Macros macros) throws java.io.IOException, JXCSkinException
args
- the list of argumentselement
- the target elementcommand
- the command to parse the arguments ofguiStateManager
- the gui state manager instancecommandExecutor
- the command executor for executing commandslnr
- the source to read more parameters fromcommandQueue
- the command queue for executing commandscrossfireServerConnection
- the server connection to usecommandCallback
- the command callback to usemacros
- the macros instance to usejava.io.IOException
- if a syntax error occursJXCSkinException
- if an element cannot be found@NotNull private static GUICommand parseConnect(@Nullable GUIElement element, @NotNull GuiStateManager guiStateManager) throws java.io.IOException
element
- the target elementguiStateManager
- the gui state manager instancejava.io.IOException
- if a syntax error occurs@NotNull private GUICommand parseDialogClose(@NotNull Args args, @Nullable GUIElement element, @NotNull CommandCallback commandCallback) throws java.io.IOException
args
- the list of argumentselement
- the target elementcommandCallback
- the command callback to usejava.io.IOException
- if a syntax error occurs@NotNull private GUICommand parseDialogOpen(@NotNull Args args, @Nullable GUIElement element, @NotNull CommandCallback commandCallback) throws java.io.IOException
args
- the list of argumentselement
- the target elementcommandCallback
- the command callback to usejava.io.IOException
- if a syntax error occurs@NotNull private GUICommand parseDialogToggle(@NotNull Args args, @Nullable GUIElement element, @NotNull CommandCallback commandCallback) throws java.io.IOException
args
- the list of argumentselement
- the target elementcommandCallback
- the command callback to usejava.io.IOException
- if a syntax error occurs@NotNull private static GUICommand parseDisconnect(@Nullable GUIElement element, @NotNull GuiStateManager guiStateManager) throws java.io.IOException
element
- the target elementguiStateManager
- the gui state manager instancejava.io.IOException
- if a syntax error occurs@NotNull private GUICommand parseExecSelection(@NotNull Args args, @Nullable GUIElement element, @NotNull CommandQueue commandQueue, @NotNull CrossfireServerConnection crossfireServerConnection) throws java.io.IOException
args
- the list of argumentselement
- the target elementcommandQueue
- the command queue for executing commandscrossfireServerConnection
- the server connection to usejava.io.IOException
- if a syntax error occurs@NotNull private static GUICommand parseGuiExecuteCommand(@NotNull Args args, @Nullable GUIElement element, @NotNull CommandExecutor commandExecutor, @NotNull java.io.LineNumberReader lnr, @NotNull Macros macros) throws java.io.IOException
args
- the list of argumentselement
- the target elementcommandExecutor
- the command executor for executing commandslnr
- the source to read more parameters frommacros
- the macros instance to usejava.io.IOException
- if a syntax error occurs@NotNull private static GUICommand parseGuiExecuteElement(@Nullable GUIElement element) throws java.io.IOException
element
- the target elementjava.io.IOException
- if a syntax error occurs@NotNull private static GUICommand parseGuiMeta(@Nullable GUIElement element, @NotNull GuiStateManager guiStateManager) throws java.io.IOException
element
- the target elementguiStateManager
- the gui state manager instancejava.io.IOException
- if a syntax error occurs@NotNull private static GUICommand parseGuiStart(@Nullable GUIElement element, @NotNull GuiStateManager guiStateManager) throws java.io.IOException
element
- the target elementguiStateManager
- the gui state manager instancejava.io.IOException
- if a syntax error occurs@NotNull private static GUICommand parseHide(@Nullable java.awt.Component element) throws java.io.IOException
element
- the target elementjava.io.IOException
- if a syntax error occurs@NotNull private GUICommand parseMoveFocus(@NotNull Args args, @Nullable GUIElement element) throws java.io.IOException, JXCSkinException
args
- the list of argumentselement
- the target elementjava.io.IOException
- if a syntax error occursJXCSkinException
- if a syntax error occurs@NotNull private static GUICommand parseMoveSelection(@NotNull Args args, @Nullable GUIElement element) throws java.io.IOException
args
- the list of argumentselement
- the target elementjava.io.IOException
- if a syntax error occurs@NotNull private static GUICommand parsePrint(@Nullable GUIElement element) throws java.io.IOException
element
- the target elementjava.io.IOException
- if a syntax error occurs@NotNull private static GUICommand parseQuit(@Nullable GUIElement element, @NotNull CommandCallback commandCallback) throws java.io.IOException
element
- the target elementcommandCallback
- the command callback to usejava.io.IOException
- if a syntax error occurs@NotNull private static GUICommand parseScroll(@NotNull Args args, @Nullable GUIElement element, boolean isScroll) throws java.io.IOException
args
- the list of argumentselement
- the target elementisScroll
- whether to parse a "SCROLL" (true
) or a
"SCROLL_NEVER" (false
) commandjava.io.IOException
- if a syntax error occurs@NotNull private static GUICommand parseScrollList(@NotNull Args args, @Nullable GUIElement element) throws java.io.IOException
args
- the list of argumentselement
- the target elementjava.io.IOException
- if a syntax error occurs@NotNull private static GUICommand parseScrollReset(@Nullable GUIElement element) throws java.io.IOException
element
- the target elementjava.io.IOException
- if a syntax error occurs@NotNull private static GUICommand parseSelect(@NotNull Args args, @Nullable GUIElement element) throws java.io.IOException
args
- the list of argumentselement
- the target elementjava.io.IOException
- if a syntax error occurs@NotNull private static GUICommand parseShow(@Nullable java.awt.Component element) throws java.io.IOException
element
- the target elementjava.io.IOException
- if a syntax error occurs@NotNull private static GUICommand parseToggle(@Nullable java.awt.Component element) throws java.io.IOException
element
- the target elementjava.io.IOException
- if a syntax error occurs