Package ucar.unidata.util
Class Debug
java.lang.Object
ucar.unidata.util.Debug
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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidclear()_more_static voidconstructMenu(JMenu topMenu) _more_static voidcall this when you want to fetch the persistent datastatic boolean_more_static void_more_static voidcall this when you want to store the persistent data
-
Constructor Details
-
Debug
public Debug()
-
-
Method Details
-
fetchPersistentData
call this when you want to fetch the persistent data- Parameters:
store-
-
storePersistentData
call this when you want to store the persistent data- Parameters:
store-
-
isSet
_more_- Parameters:
flagName-- Returns:
- _more_
-
set
_more_- Parameters:
flagName-value-
-
clear
public static void clear()_more_ -
constructMenu
_more_- Parameters:
topMenu-
-