ucar.unidata.util
Class Debug

java.lang.Object
  extended by ucar.unidata.util.Debug

public class Debug
extends Object

This is a simple way to add runtime-settable debugging. Debug flags are just strings; the Debug class dynamically adds them to the debug menu. Example: putting a runtime flag in your code. A convention I use is to put the name of the debug flag in the message, so I know "where it comes from".

   if (Debug.isSet("Map.draw")) {
     System.out.println("Map.draw: makeShapes with "+displayProject);
   }
   
Example: adding the debug menu to a "System" menu
   private JMenu debugMenu;

   JMenu sysMenu = new JMenu("System");
   debugMenu = (JMenu) sysMenu.add(new JMenu("Debug"));
   debugMenu.addMenuListener( new MenuListener() {
     public void menuSelected(MenuEvent e) { ucar.unidata.util.Debug.constructMenu(debugMenu); }
     public void menuDeselected(MenuEvent e) {}
     public void menuCanceled(MenuEvent e) {}
   });
   


Constructor Summary
Debug()
           
 
Method Summary
static void clear()
          _more_
static void constructMenu(JMenu topMenu)
          _more_
static void fetchPersistentData(PersistentStore store)
          call this when you want to fetch the persistent data
static boolean isSet(String flagName)
          _more_
static void set(String flagName, boolean value)
          _more_
static void storePersistentData(PersistentStore store)
          call this when you want to store the persistent data
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Debug

public Debug()
Method Detail

fetchPersistentData

public static void fetchPersistentData(PersistentStore store)
call this when you want to fetch the persistent data

Parameters:
store -

storePersistentData

public static void storePersistentData(PersistentStore store)
call this when you want to store the persistent data

Parameters:
store -

isSet

public static boolean isSet(String flagName)
_more_

Parameters:
flagName -
Returns:
_more_

set

public static void set(String flagName,
                       boolean value)
_more_

Parameters:
flagName -
value -

clear

public static void clear()
_more_


constructMenu

public static void constructMenu(JMenu topMenu)
_more_

Parameters:
topMenu -