com.virtuosotechnologies.asaph.maingui
Interface CommandManager


public interface CommandManager

The command manager API exported by the maingui plugin.

This API is not thread-safe, and should only be called from the AWT/Swing thread.


Nested Class Summary
static class CommandManager.CommandCategory
          A category for commands, specifying where in the menus the command will appear, as well as additional behaviors involving appearance and enabling.
 
Field Summary
static CommandManager.CommandCategory ADD_SONG_COMMANDS
          Denotes commands for song adding.
static CommandManager.CommandCategory CREATE_DATABASE_COMMANDS
          Denotes commands for database creating.
static CommandManager.CommandCategory MODIFY_SONG_COMMANDS
          Denotes commands for song manipulation.
static CommandManager.CommandCategory OPEN_DATABASE_COMMANDS
          Denotes commands for database opening.
static CommandManager.CommandCategory SAVE_DATABASE_COMMANDS
          Denotes commands for database saving.
static CommandManager.CommandCategory TOOL_COMMANDS
          Denotes commands for publishing, report generation, and other features provided by the plugin.
 
Method Summary
 CommandNode createCommandGroup(CommandManager.CommandCategory category)
          Returns a group-flavored CommandNode that can be filled with commands which a plugin wants to submit to the menu system.
 boolean installDefaultSongCommand(CommandNode node, StringID priority)
          Sets the default song command.
 boolean removeCommandGroup(CommandNode node)
          Removes a command node previously created by createCommandGroup.
 boolean removeDefaultSongCommand(CommandNode node)
          Removes a default song command.
 

Field Detail

OPEN_DATABASE_COMMANDS

public static final CommandManager.CommandCategory OPEN_DATABASE_COMMANDS
Denotes commands for database opening. Commands registered in this category will show up in a group near the top of the File menu. The plugin has complete control over the enable/disable state of these commands, and it may change the state at any time.


CREATE_DATABASE_COMMANDS

public static final CommandManager.CommandCategory CREATE_DATABASE_COMMANDS
Denotes commands for database creating. Commands registered in this category will show up in a group at the very top of the File menu. The plugin has complete control over the enable/disable state of these commands, and it may change the state at any time.


SAVE_DATABASE_COMMANDS

public static final CommandManager.CommandCategory SAVE_DATABASE_COMMANDS
Denotes commands for database saving. Commands registered in this category will show up towards the middle and bottom of the File menu, and will be located in a group that is enabled only when a database is selected. Additionally, the plugin may further disable this node or its subnodes if it chooses, in response to the type of database selected.


ADD_SONG_COMMANDS

public static final CommandManager.CommandCategory ADD_SONG_COMMANDS
Denotes commands for song adding. Commands registered in this category will show up in the Song menu, and will be located in a group that is enabled only when a writable database is selected. Additionally, the plugin may further disable this node or its subnodes if it chooses, in response to selection changes or other state changes.


MODIFY_SONG_COMMANDS

public static final CommandManager.CommandCategory MODIFY_SONG_COMMANDS
Denotes commands for song manipulation. Commands registered in this category will show up in the Song menu, and will be located in a group that is enabled only when at least one song is selected. Additionally, the plugin may further disable this node or its subnodes if it chooses, in response to selection changes or other state changes.


TOOL_COMMANDS

public static final CommandManager.CommandCategory TOOL_COMMANDS
Denotes commands for publishing, report generation, and other features provided by the plugin. Commands registered under this node will show up in the Tools menu. The plugin has complete control over the enable/disable state of these commands, and it may change the state in response to selection changes or other state changes.

Method Detail

createCommandGroup

public CommandNode createCommandGroup(CommandManager.CommandCategory category)
Returns a group-flavored CommandNode that can be filled with commands which a plugin wants to submit to the menu system. Commands are separated into categories, identified by the constants OPEN_COMMANDS, SAVE_COMMANDS, SONG_COMMANDS and TOOL_COMMANDS. See the comments for the various key constants for more information about command categories.

Parameters:
category - a category for the command
Returns:
a group-flavored CommandNode, or null if category not recognized

removeCommandGroup

public boolean removeCommandGroup(CommandNode node)
Removes a command node previously created by createCommandGroup.

Parameters:
node - the node to remove
Returns:
true if the node was removed, or false if it was not created by createCommandGroup.

installDefaultSongCommand

public boolean installDefaultSongCommand(CommandNode node,
                                         StringID priority)
Sets the default song command. If a command is already present, the one with the higher priority will be taken. Returns true if the command was chosen as the new default, or false if not.

Parameters:
node - a CommandNode for the default song command
priority - priority of this command
Returns:
true if the command was chosen as the new default

removeDefaultSongCommand

public boolean removeDefaultSongCommand(CommandNode node)
Removes a default song command. Returns true if the command was the current command.

Parameters:
node - a CommandNode for the default song command
Returns:
true if it was the current command