public class OSPLog
extends javax.swing.JFrame
javax.swing.JFrame.AccessibleJFrame
java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
Modifier and Type | Field and Description |
---|---|
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 |
accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
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
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
Constructor and Description |
---|
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.
|
Modifier and Type | Method and Description |
---|---|
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 void |
showLog()
Shows the log.
|
static void |
warning(java.lang.String msg)
Logs a warning message.
|
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
addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, show, toBack, toFront
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, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
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, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, 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, 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, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
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
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 bundlepublic 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 void showLog()
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 namepublic java.lang.String saveLogAs()
public java.lang.String saveXML(java.lang.String fileName)
fileName
- the file namepublic java.lang.String saveXMLAs()
public java.lang.String open()
public java.lang.String open(java.lang.String fileName)
fileName
- the file namepublic 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