|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.awt.Component java.awt.Container java.awt.Window java.awt.Frame javax.swing.JFrame org.opensourcephysics.controls.OSPLog
public class OSPLog
This is a viewable file-based message log for a java package. It displays log records in a text pane and saves them in a temp file.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class javax.swing.JFrame |
---|
javax.swing.JFrame.AccessibleJFrame |
Nested classes/interfaces inherited from class java.awt.Frame |
---|
java.awt.Frame.AccessibleAWTFrame |
Nested classes/interfaces inherited from class java.awt.Window |
---|
java.awt.Window.AccessibleAWTWindow |
Nested classes/interfaces inherited from class java.awt.Container |
---|
java.awt.Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component |
---|
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
Field Summary | |
---|---|
protected static javax.swing.text.Style |
black
|
protected static javax.swing.text.Style |
blue
|
protected static java.awt.Color |
DARK_BLUE
|
protected static java.awt.Color |
DARK_GREEN
|
protected static java.awt.Color |
DARK_RED
|
protected static javax.swing.text.Style |
gray
|
protected static javax.swing.text.Style |
green
|
static java.util.logging.Level[] |
levels
|
protected static javax.swing.text.Style |
magenta
|
protected static javax.swing.text.Style |
red
|
Fields inherited from class javax.swing.JFrame |
---|
accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled |
Fields inherited from class java.awt.Frame |
---|
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR |
Fields inherited from class java.awt.Component |
---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface javax.swing.WindowConstants |
---|
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
OSPLog(java.lang.Class<?> type)
Constructs an OSPLog for a specified class. |
|
OSPLog(java.lang.Class<?> type,
java.lang.String resourceBundleName)
Constructs an OSPLog for a specified class and resource bundle. |
|
OSPLog(java.lang.Package pkg)
Constructs an OSPLog for a specified package. |
|
OSPLog(java.lang.Package pkg,
java.lang.String resourceBundleName)
Constructs an OSPLog for a specified package and resource bundle. |
Method Summary | |
---|---|
void |
clear()
Clears the log. |
static void |
clearLog()
Clears the Log. |
static void |
config(java.lang.String msg)
Logs a configuration message. |
protected void |
createGUI()
Creates the GUI. |
protected java.util.logging.Logger |
createLogger()
Creates and initializes the logger. |
protected void |
createMenus()
Creates the popup menu. |
static void |
fine(java.lang.String msg)
Logs a fine debugging message. |
static void |
finer(java.lang.String msg)
Logs a finer debugging message. |
static void |
finest(java.lang.String msg)
Logs a finest debugging message. |
protected static javax.swing.JFileChooser |
getChooser()
Gets a file chooser. |
protected java.util.logging.Handler |
getFileHandler()
Gets the file handler using lazy instantiation. |
java.lang.String |
getLogDir()
Gets the directory where the log file will be saved if logging is enabled. |
java.util.logging.Logger |
getLogger()
Gets the logger. |
javax.swing.JPanel |
getLogPanel()
Gets the log panel so it can be displayed in a dialog or other container. |
static OSPLog |
getOSPLog()
Gets the OSPLog that can be shared by multiple OSP packages. |
static void |
info(java.lang.String msg)
Logs an information message. |
static boolean |
isLogVisible()
Determines if the shared log is visible. |
boolean |
isVisible()
Determines if the log is visible. |
java.lang.String |
open()
Opens a text file selected with a chooser and writes the contents to the log. |
java.lang.String |
open(java.lang.String fileName)
Opens a text file specified by name and writes the contents to the log. |
static java.util.logging.Level |
parseLevel(java.lang.String level)
Returns the Level with the specified name, or null if none. |
protected java.lang.String |
read(java.lang.String fileName)
Reads a file. |
java.lang.String |
saveLog(java.lang.String fileName)
Saves the log to a text file specified by name. |
java.lang.String |
saveLogAs()
Saves a log to a text file selected with a chooser. |
java.lang.String |
saveXML(java.lang.String fileName)
Saves the xml-formatted log records to a file specified by name. |
java.lang.String |
saveXMLAs()
Saves the xml-formatted log records to a file selected with a chooser. |
static void |
setLevel(java.util.logging.Level level)
Sets the logger level. |
void |
setLogDir(java.lang.String dir)
Sets the directory where the log file will be saved if logging is enabled. |
void |
setLogToFile(boolean enable)
Enables logging to a file. |
void |
setVisible(boolean visible)
Sets the visibility of this log. |
static void |
severe(java.lang.String msg)
Logs a severe error message. |
static javax.swing.JFrame |
showLog()
Shows the log when it is invoked from the event queue. |
static void |
showLogInvokeLater()
Shows the log. |
static void |
warning(java.lang.String msg)
Logs a warning message. |
Methods inherited from class javax.swing.JFrame |
---|
addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update |
Methods inherited from class java.awt.Frame |
---|
addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setResizable, setState, setTitle, setUndecorated |
Methods inherited from class java.awt.Window |
---|
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOwnedWindows, getOwner, getOwnerlessWindows, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isShowing, pack, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, show, toBack, toFront |
Methods inherited from class java.awt.Container |
---|
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusBackward, transferFocusDownCycle, validate, validateTree |
Methods inherited from class java.awt.Component |
---|
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isValid, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, setBackground, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusUpCycle |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.awt.MenuContainer |
---|
getFont, postEvent |
Field Detail |
---|
protected static javax.swing.text.Style black
protected static javax.swing.text.Style red
protected static javax.swing.text.Style blue
protected static javax.swing.text.Style green
protected static javax.swing.text.Style magenta
protected static javax.swing.text.Style gray
protected static final java.awt.Color DARK_GREEN
protected static final java.awt.Color DARK_BLUE
protected static final java.awt.Color DARK_RED
public static final java.util.logging.Level[] levels
Constructor Detail |
---|
public OSPLog(java.lang.Package pkg)
pkg
- the packagepublic OSPLog(java.lang.Package pkg, java.lang.String resourceBundleName)
pkg
- the packageresourceBundleName
- the name of the resource bundlepublic OSPLog(java.lang.Class<?> type)
type
- the classpublic OSPLog(java.lang.Class<?> type, java.lang.String resourceBundleName)
type
- the classresourceBundleName
- the name of the resource bundleMethod Detail |
---|
public static OSPLog getOSPLog()
public void setLogDir(java.lang.String dir)
dir
- Stringpublic java.lang.String getLogDir()
dir
- Stringpublic static boolean isLogVisible()
public void setVisible(boolean visible)
setVisible
in class java.awt.Window
true
- to set visiblepublic boolean isVisible()
isVisible
in class java.awt.Component
public static javax.swing.JFrame showLog()
public static void showLogInvokeLater()
public static void setLevel(java.util.logging.Level level)
level
- the Levelpublic static java.util.logging.Level parseLevel(java.lang.String level)
level
- the Levelpublic static void severe(java.lang.String msg)
msg
- the messagepublic static void warning(java.lang.String msg)
msg
- the messagepublic static void info(java.lang.String msg)
msg
- the messagepublic static void config(java.lang.String msg)
msg
- the messagepublic static void fine(java.lang.String msg)
msg
- the messagepublic static void clearLog()
msg
- the messagepublic static void finer(java.lang.String msg)
msg
- the messagepublic static void finest(java.lang.String msg)
msg
- the messagepublic javax.swing.JPanel getLogPanel()
public void clear()
public java.lang.String saveLog(java.lang.String fileName)
fileName
- the file name
public java.lang.String saveLogAs()
public java.lang.String saveXML(java.lang.String fileName)
fileName
- the file name
public java.lang.String saveXMLAs()
public java.lang.String open()
public java.lang.String open(java.lang.String fileName)
fileName
- the file name
public java.util.logging.Logger getLogger()
public void setLogToFile(boolean enable)
enable
- true to log to a fileprotected void createGUI()
protected java.util.logging.Logger createLogger()
protected java.util.logging.Handler getFileHandler()
protected void createMenus()
protected static javax.swing.JFileChooser getChooser()
protected java.lang.String read(java.lang.String fileName)
fileName
- the name of the file
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |