java.lang.Object
it.polimi.ingsw.am13.client.view.tui.menu.MenuItem
- Direct Known Subclasses:
MenuItemChangeField
,MenuItemChooseObj
,MenuItemCreateRoom
,MenuItemDisableLegend
,MenuItemEnableLegend
,MenuItemEnterChat
,MenuItemJoinRoom
,MenuItemLeaveChat
,MenuItemLeaveRoom
,MenuItemPickCard
,MenuItemPlayCard
,MenuItemPlayStarter
,MenuItemReconnect
,MenuItemSendChatMessage
,MenuItemUpdateRoomList
Item belonging to a menu. It stores the command key with which it is possible to invoke the command, and its description.
The focal point of this abstraction if the method which actually executes the command it represents.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract void
executeCommand
(String argsStr, NetworkHandler networkHandler) Executes the action this menu item representstoString()
-
Field Details
-
commandKey
Command key with which it is possible to invoke the command via the command line -
description
Description of the command. It should contain the list of arguments for the command to work, too
-
-
Constructor Details
-
MenuItem
Build a new menu item- Parameters:
commandKey
- Command key with which it is possible to invoke the commanddescription
- Description of the command
-
-
Method Details
-
executeCommand
public abstract void executeCommand(String argsStr, NetworkHandler networkHandler) throws InvalidTUICommandException Executes the action this menu item represents- Parameters:
argsStr
- String of parameters for the commandnetworkHandler
- Handler of the network thanks to which the item sends the command to the server- Throws:
InvalidTUICommandException
- If the arguments passed via command line are wrong, or anyway different from what expected
-
getCommandKey
- Returns:
- Command key with which it is possible to invoke the command via the command line
-
getDescription
- Returns:
- Description of the command. It should contain the list of arguments for the command to work, too
-
toString
-