Class ScoreCommandCenter

java.lang.Object
com.softsynth.jmsl.score.ScoreCommandCenter

public class ScoreCommandCenter
extends java.lang.Object
Static repository of ScoreCommand classes
Provides clones of ScoreCommands that were added
Maintains hashtable with KeyCode ints hashed to Score Command Classes
Author:
Nick Didkovsky, (c) 2004 All rights reserved, Email: nick@didkovsky.com
  • Field Details

    • VERBOSE

      public static boolean VERBOSE
  • Constructor Details

    • ScoreCommandCenter

      public ScoreCommandCenter()
  • Method Details

    • addScoreCommandAddedListener

      public static void addScoreCommandAddedListener​(ScoreCommandAddedListener listener)
    • removeScoreCommandAddedListener

      public static void removeScoreCommandAddedListener​(ScoreCommandAddedListener listener)
    • addScoreCommand

      public static void addScoreCommand​(ScoreCommand cmd, int keyCode)
      Add a ScoreCommand and associate it with a keyCode hotkey. Prints a warning if a ScoreCommand is added which has a duplicate name to one already registered with the ScoreCommandCenter. Only prints if ScoreCommandCenter.VERBOSE = true;
    • addScoreCommand

      public static void addScoreCommand​(ScoreCommand cmd)
      Add a ScoreCommand with no hot key.
      Same as addScoreCommand(klass, -1)
    • getScoreCommand

      public static ScoreCommand getScoreCommand​(Score score, int keyCode) throws java.lang.CloneNotSupportedException
      Returns:
      a clone of the command that hashes to the keyCode. null if no match
      Throws:
      java.lang.CloneNotSupportedException
    • getScoreCommand

      public static ScoreCommand getScoreCommand​(Score score, java.lang.String commandName) throws java.lang.CloneNotSupportedException
      Returns:
      a clone of the command with matching name. null if no match
      Throws:
      java.lang.CloneNotSupportedException
    • getScoreCommands

      public static java.util.Enumeration getScoreCommands()
      Returns:
      Enumeration of ScoreCommands
    • getHotkey

      public static int getHotkey​(ScoreCommand cmd)
      Returns:
      hotkey assigned to this ScoreCommand, else -1 if ScoreCommand found but unassigned to a hotkey, else -2 if command not found
    • getCommandNames

      public static java.util.Enumeration getCommandNames()
      Returns:
      Enumeration of command names