qat.components
Class Notepad

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byjavax.swing.JPanel
                  extended byqat.components.Notepad
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public class Notepad
extends javax.swing.JPanel

Modified to fit needs of the QAT tool by webhiker. Added syntax highlighting, etc....

Version:
1.13 08/28/98
Author:
Timothy Prinzing
See Also:
Serialized Form

Nested Class Summary
protected static class Notepad.AppCloser
          To shutdown when run as an application.
 
Nested classes inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Nested classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
static java.lang.String actionSuffix
          Suffix applied to the key used in resource file lookups for an action.
static java.lang.String exitAction
           
 java.io.File file
           
protected  java.awt.FileDialog fileDialog
           
static java.lang.String imageSuffix
          Suffix applied to the key used in resource file lookups for an image.
static java.lang.String labelSuffix
          Suffix applied to the key used in resource file lookups for a label.
static java.lang.String newAction
           
static java.lang.String openAction
           
static java.lang.String saveAction
           
static java.lang.String saveAsAction
           
static java.lang.String tipSuffix
          Suffix applied to the key used in resource file lookups for tooltip text.
protected  javax.swing.undo.UndoManager undo
          UndoManager that we add edits to.
protected  javax.swing.event.UndoableEditListener undoHandler
          Listener for the edits on the current document.
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
Notepad(ParserInterface parser, boolean syntaxHighlighting)
           
Notepad(java.lang.String fileName, ParserInterface parser, boolean syntaxHighlighting)
           
 
Method Summary
 void closeWindow()
           
protected  java.beans.PropertyChangeListener createActionChangeListener(javax.swing.JMenuItem b)
           
protected  javax.swing.JTextPane createEditor()
          Create an editor to represent the given document.
protected  javax.swing.JMenu createMenu(java.lang.String key)
          Create a menu for the app.
protected  javax.swing.JMenuBar createMenubar()
          Create the menubar for the app.
protected  javax.swing.JMenuItem createMenuItem(java.lang.String cmd)
          This is the hook through which all menu items are created.
protected  qat.components.Notepad.StatusBar createStatusbar()
          Create a status bar
protected  java.awt.Component createTool(java.lang.String key)
          Hook through which every toolbar item is created.
protected  javax.swing.JButton createToolbarButton(java.lang.String key)
          Create a button to go inside of the toolbar.
protected  javax.swing.Action getAction(java.lang.String cmd)
           
 javax.swing.Action[] getActions()
          Fetch the list of actions supported by this editor.
protected  javax.swing.JTextPane getEditor()
          Fetch the editor contained in this panel
protected  java.awt.Frame getFrame()
          Find the hosting frame, for the file-chooser dialog.
protected  javax.swing.JMenuBar getMenubar()
           
protected  javax.swing.JMenuItem getMenuItem(java.lang.String cmd)
          Fetch the menu item that was created for the given command.
protected  java.net.URL getResource(java.lang.String resourceStr)
           
protected  java.lang.String getResourceString(java.lang.String nm)
           
protected  java.awt.Container getToolbar()
           
protected  java.lang.String[] tokenize(java.lang.String input)
          Take the given string and chop it up into a series of strings on whitespace boundries.
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, 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, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

file

public java.io.File file

fileDialog

protected java.awt.FileDialog fileDialog

undoHandler

protected javax.swing.event.UndoableEditListener undoHandler
Listener for the edits on the current document.


undo

protected javax.swing.undo.UndoManager undo
UndoManager that we add edits to.


imageSuffix

public static final java.lang.String imageSuffix
Suffix applied to the key used in resource file lookups for an image.

See Also:
Constant Field Values

labelSuffix

public static final java.lang.String labelSuffix
Suffix applied to the key used in resource file lookups for a label.

See Also:
Constant Field Values

actionSuffix

public static final java.lang.String actionSuffix
Suffix applied to the key used in resource file lookups for an action.

See Also:
Constant Field Values

tipSuffix

public static final java.lang.String tipSuffix
Suffix applied to the key used in resource file lookups for tooltip text.

See Also:
Constant Field Values

openAction

public static final java.lang.String openAction
See Also:
Constant Field Values

newAction

public static final java.lang.String newAction
See Also:
Constant Field Values

saveAction

public static final java.lang.String saveAction
See Also:
Constant Field Values

saveAsAction

public static final java.lang.String saveAsAction
See Also:
Constant Field Values

exitAction

public static final java.lang.String exitAction
See Also:
Constant Field Values
Constructor Detail

Notepad

public Notepad(java.lang.String fileName,
               ParserInterface parser,
               boolean syntaxHighlighting)

Notepad

public Notepad(ParserInterface parser,
               boolean syntaxHighlighting)
Method Detail

getActions

public javax.swing.Action[] getActions()
Fetch the list of actions supported by this editor. It is implemented to return the list of actions supported by the embedded JTextPane augmented with the actions defined locally.


createEditor

protected javax.swing.JTextPane createEditor()
Create an editor to represent the given document.


getEditor

protected javax.swing.JTextPane getEditor()
Fetch the editor contained in this panel


getFrame

protected java.awt.Frame getFrame()
Find the hosting frame, for the file-chooser dialog.


createMenuItem

protected javax.swing.JMenuItem createMenuItem(java.lang.String cmd)
This is the hook through which all menu items are created. It registers the result with the menuitem hashtable so that it can be fetched with getMenuItem().

See Also:
getMenuItem(java.lang.String)

getMenuItem

protected javax.swing.JMenuItem getMenuItem(java.lang.String cmd)
Fetch the menu item that was created for the given command.

Parameters:
cmd - Name of the action.

getAction

protected javax.swing.Action getAction(java.lang.String cmd)

getResourceString

protected java.lang.String getResourceString(java.lang.String nm)

getResource

protected java.net.URL getResource(java.lang.String resourceStr)

getToolbar

protected java.awt.Container getToolbar()

getMenubar

protected javax.swing.JMenuBar getMenubar()

createStatusbar

protected qat.components.Notepad.StatusBar createStatusbar()
Create a status bar


createTool

protected java.awt.Component createTool(java.lang.String key)
Hook through which every toolbar item is created.


createToolbarButton

protected javax.swing.JButton createToolbarButton(java.lang.String key)
Create a button to go inside of the toolbar. By default this will load an image resource. The image filename is relative to the classpath (including the '.' directory if its a part of the classpath), and may either be in a JAR file or a separate file.

Parameters:
key - The key in the resource file to serve as the basis of lookups.

tokenize

protected java.lang.String[] tokenize(java.lang.String input)
Take the given string and chop it up into a series of strings on whitespace boundries. This is useful for trying to get an array of strings out of the resource file.


createMenubar

protected javax.swing.JMenuBar createMenubar()
Create the menubar for the app. By default this pulls the definition of the menu from the associated resource file.


createMenu

protected javax.swing.JMenu createMenu(java.lang.String key)
Create a menu for the app. By default this pulls the definition of the menu from the associated resource file.


createActionChangeListener

protected java.beans.PropertyChangeListener createActionChangeListener(javax.swing.JMenuItem b)

closeWindow

public void closeWindow()


See QAT project for licensing details