org.merlotxml.merlot
Class XMLEditorFrame

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjava.awt.Window
              extended byjava.awt.Frame
                  extended byjavax.swing.JFrame
                      extended byorg.merlotxml.merlot.XMLEditorFrame
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.datatransfer.ClipboardOwner, java.util.EventListener, java.awt.image.ImageObserver, javax.swing.event.InternalFrameListener, java.awt.MenuContainer, MerlotConstants, javax.swing.RootPaneContainer, java.io.Serializable, javax.swing.WindowConstants
Direct Known Subclasses:
XMLEditorMACFrame

public class XMLEditorFrame
extends javax.swing.JFrame
implements java.awt.datatransfer.ClipboardOwner, MerlotConstants, javax.swing.event.InternalFrameListener

The main frame for the application. This sets up the menus and toolbars. This also manages the internal frames via the JDesktopPane. It is a singleton instance class similar to XMLEditor. You get the singleton instance with the getSharedInstance() method.

Methods of interest in this class are the addInternalFrame() methods for displaying a JInternalFrame within this main frame. This class also includes some of the main operation methods which are called by their cooresponding Action in XMLEditorActions. These include quit(), newFile(), openFile(), revert(), save(), saveAs(), cut(), copy(), paste() and undo(). Library handling methods are also located here.

The XMLEditorFrame is an InternalFrameListener which helps it manage the Windows menu, and handles saving open files before quitting, saving a file when it's close box is clicked, managing the undo stack based on which document is active, and activating/deactivating available menu items based on which docuement is active.

Author:
Kelly A. Campbell
See Also:
XMLEditor, XMLEditorActions, Serialized Form

Nested Class Summary
protected  class XMLEditorFrame.WindowHideShowListener
          ActionListener for when a window is hidden or shown using the window menu item for it.
 
Nested classes inherited from class javax.swing.JFrame
javax.swing.JFrame.AccessibleJFrame
 
Nested classes inherited from class java.awt.Frame
java.awt.Frame.AccessibleAWTFrame
 
Nested classes inherited from class java.awt.Window
java.awt.Window.AccessibleAWTWindow
 
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
protected  XMLEditorActions _actions
          the actions toplevel object
protected  javax.swing.JPanel _background
          The background of this frame
protected  java.awt.datatransfer.Clipboard _clipboard
          the clipboard for this application.
protected  java.lang.String _current_dir
          Directory to go to when opening a file.
protected  javax.swing.JDesktopPane _desktop
           
protected  java.util.Vector _documents
           
protected  DTDChooser _dtdChooser
          A DTD chooser instance which can be reused throughout the application
protected  javax.swing.JMenu _editMenu
           
protected  XMLEditor _editor
          The editor that created this class instance
protected  javax.swing.JMenu _fileMenu
           
protected  java.util.Hashtable _fileToFrameMap
          Hashtable mapping Files to JInternalFrames.
static XMLEditorFrame _frame
          the singleton instance of this class
protected  javax.swing.JMenu _helpMenu
           
protected  java.util.Vector _internalFrames
          The list of internal frames that are being managed by this toplevel Frame.
protected  java.util.Vector _libraries
          The list of library objects which are open.
protected  javax.swing.JMenuBar _menuBar
          The main menu bar for the application
protected  javax.swing.JMenu _nodeMenu
           
protected  javax.swing.JMenu _pluginMenu
           
protected  javax.swing.JDialog _preferenceDialog
          Description of the Field
protected  int _stagger_x
          current values of staggering
protected  int _stagger_x_start
          Where to start the stagger
protected  int _stagger_y
          current values of staggering
protected  int _stagger_y_start
          Where to start the stagger
protected  javax.swing.JToolBar _toolBar
           
protected  java.awt.datatransfer.Clipboard _treeClipboard
          Special clipboard for the tree nodes.
protected  javax.swing.JMenu _windowMenu
           
static java.awt.Cursor DEFAULT
          Default Cursor
protected static int MAX_STAGGER_X
          maximum amount of total horizontal staggering before cycling back to the start
protected static int MAX_STAGGER_Y
          maximum amount of total vertical staggering before cycling back to the start
protected static int OFF_X
          Description of the Field
protected static int OFF_Y
          Description of the Field
protected static int STAGGER_OFFSET
          amount to offset staggers when recycling
protected static int STAGGER_X
          Amount to stagger new windows horizontally
protected static int STAGGER_Y
          Amount to stagger new windows vertically
static java.awt.Cursor WAIT
          Wait Cursor
 
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 org.merlotxml.merlot.MerlotConstants
ACTION_MENU_ACCELERATOR, ACTION_MENU_ICON, ACTION_NAME, ACTION_SHORT_DESCRIPTION, ACTION_SMALL_ICON, AFTER, BEFORE, ERR, INTO, UI, XML
 
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
XMLEditorFrame(XMLEditor master, java.lang.String title)
          Constructor which takes the XMLEditor and the title for the Frame.
 
Method Summary
protected  void activateDocumentAfterClose()
          Sets the most recent document active - needed after a document is closed to activate menu items
 javax.swing.JInternalFrame add(XMLEditorDoc d)
          add a XMLEditorDoc to the frame.
 void addActionToMenu(java.lang.String name, javax.swing.Action a, javax.swing.JMenu menu)
          Adds an action to a menu - a tag is used to ensure the same action name is not added twice
 void addActionToMenu(java.lang.String name, javax.swing.Action a, javax.swing.JMenu menu, int position)
          Adds an action to a menu at a given position
 void addActionToToolBar(java.lang.String name, javax.swing.Action a)
          Adds an action to the toolbar
 void addActionToToolBar(java.lang.String name, javax.swing.Action a, int position)
          Adds an action to the toolbar at a specified location
 void addInternalFrame(javax.swing.JInternalFrame f)
          Adds an internal frame in a staggered manner
 void addInternalFrame(javax.swing.JInternalFrame f, boolean stagger)
          Adds an internal frame to the desktop.
protected  void addRecentlyUsedFiles()
           
protected  boolean checkQuit()
          prepares the application to quit, asking the user if they want to save each of the open files.
 void close()
          This closes the foreground XMLEditorDoc document
 void copy(java.awt.event.ActionEvent evt)
          Delegates to copy method in the current foreground XMLEditorDoc
protected static java.io.File createNewFile(java.lang.String rootElementName, java.lang.String publicid, java.lang.String systemid)
          Description of the Method
 void cut(java.awt.event.ActionEvent evt)
          Delegates to cut method in the current foreground XMLEditorDoc
protected  void docActivated(XMLEditorDoc doc)
          Called when an XMLEditorDoc is activated.
protected  void docDeactivated(XMLEditorDoc doc)
          Called when an XMLEditorDoc is deactivated.
protected  void frameResized(java.awt.event.ComponentEvent evt)
          The frame got resized...
 java.lang.Object getAction(java.lang.String name)
          Get a custom action by name
 java.awt.datatransfer.Clipboard getClipboard()
          returnts the text clipboard
 java.lang.String getCurrentDir()
          Retrieve the current user working directory.
 XMLEditorDoc getCurrentDocument()
          returns the current foreground document or null if none are selected
 javax.swing.JDesktopPane getDesktopPane()
          returns the JDesktopPane which this Frame uses
 javax.swing.JMenu getEditMenu()
          Gets the editMenu attribute of the XMLEditorFrame object
 XerlinFileDialogs getFileDialogs()
          Gets the fileDialogs attribute of the XMLEditorFrame object
 javax.swing.JMenu getFileMenu()
          Gets the fileMenu attribute of the XMLEditorFrame object
 java.io.File getFileToOpen(MerlotFileFilter filter, java.lang.String selectedFileName)
          Present a file chooser dialog for the user to select a file.
 java.io.File getFileToOpen(MerlotFileFilter filter, java.lang.String selectedFileName, boolean readWrite)
           
 java.lang.String getLibDir()
           
 java.lang.String getNewRootElementName(DTDCacheEntry dtdEntry)
          Get the root element name from the user for a new file
 javax.swing.JMenu getNodeMenu()
          Gets the nodeMenu attribute of the XMLEditorFrame object
static XMLEditorFrame getSharedInstance()
          Returns the singleton instance.
 java.awt.datatransfer.Clipboard getTreeClipboard()
          returns the DOMTree clipboard
 void internalFrameActivated(javax.swing.event.InternalFrameEvent e)
          Implementation of InternalFrameListener.
 void internalFrameClosed(javax.swing.event.InternalFrameEvent e)
          Called when an internal frame has been closed.
 void internalFrameClosing(javax.swing.event.InternalFrameEvent e)
          Called when a frame is about to close.
 void internalFrameDeactivated(javax.swing.event.InternalFrameEvent e)
          A frame has been deactivated.
 void internalFrameDeiconified(javax.swing.event.InternalFrameEvent e)
          Description of the Method
 void internalFrameIconified(javax.swing.event.InternalFrameEvent e)
          Description of the Method
 void internalFrameOpened(javax.swing.event.InternalFrameEvent e)
          Description of the Method
 void lostOwnership(java.awt.datatransfer.Clipboard c, java.awt.datatransfer.Transferable t)
          Notification that we lost ownership of a clipboard item
 void newFile()
          Create a new file.
 void newLibrary()
          Create a new library file
 void openFile()
          Allow the user to select a file to open, and then check to see if it's already open or not.
 void openFile(java.io.File f)
           
 void openLibrary()
          Open a library by giving the user a file chooser and then opening the selected library file if there is one
 void openLibrary(java.io.File libfile)
          Open the specified library file and show the fram
 void openLibrary(java.io.File libfile, boolean show)
          Open a library file.
 void paste(java.awt.event.ActionEvent evt)
          Delegates to paste method in the current foreground XMLEditorDoc
 void quit()
          Checks if the application can be shutdown.
protected  void resetUndoAction(javax.swing.undo.UndoManager mgr)
          Updates the undo action with information about what it is going to undo using the mgr getUndoPresentationName() call.
 void revert()
          Revert a document to its previously saved version
 void save()
          Save the current foreground document
 void saveAs()
          Save the current foreground document with a different filename
 void setCurrentDir(java.lang.String current)
          Sets the currentDir attribute of the XMLEditorFrame object
static void setDefaultCursor()
          Sets the defaultCursor attribute of the XMLEditorFrame class
protected  void setFileDialogs(XerlinFileDialogs fileDialogs)
           
protected  void setupDesktop()
          Sets up the desktop for the application.
protected  javax.swing.JMenu setupEditMenu()
          Creates the edit menu from actions in XMLEditorActions
protected  javax.swing.JMenu setupFileMenu()
          Sets up the file menu from the actions in XMLEditorActions
protected  void setupFrame()
          Sets up the desktop and menus.
protected  javax.swing.JMenu setupHelpMenu()
          Sets up the Help menu which contains the about item and plugin about menu
protected  void setupMenus()
          Sets up all the toplevel menus for the application.
protected  javax.swing.JMenu setupNodeMenu()
          Creates the Node menu which is maintained by individual documents
protected  javax.swing.JMenu setupPluginAboutMenu()
          Creates the About menu for plugins, getting the action from the PluginConfigs in PluginManager
protected  javax.swing.JMenu setupPluginMenu()
          Creates the plugin menu from actions in XMLEditorActions
protected  javax.swing.JToolBar setupToolBar()
          This creates the toolbar for the application and adds the actions to it
protected  javax.swing.JMenu setupWindowMenu()
          Creates the windows menu from actions in XMLEditorActions
static void setWaitCursor()
          Sets the waitCursor attribute of the XMLEditorFrame class
 void undo(java.awt.event.ActionEvent evt)
          Delegates to undo method in the current foreground XMLEditorDoc
 
Methods inherited from class javax.swing.JFrame
addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getJMenuBar, getLayeredPane, getRootPane, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, update
 
Methods inherited from class java.awt.Frame
addNotify, finalize, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setCursor, setExtendedState, setIconImage, 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, getInputContext, getListeners, getLocale, getMostRecentFocusOwner, getOwnedWindows, getOwner, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindowStateListeners, hide, isActive, isFocusableWindow, isFocusCycleRoot, isFocused, isShowing, pack, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, setCursor, setFocusableWindowState, setFocusCycleRoot, setLocationRelativeTo, 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, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setFocusTraversalKeys, setFocusTraversalPolicy, 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, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, 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, isOpaque, isValid, isVisible, 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, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.awt.MenuContainer
getFont, postEvent
 

Field Detail

_frame

public static XMLEditorFrame _frame
the singleton instance of this class


_actions

protected XMLEditorActions _actions
the actions toplevel object


_internalFrames

protected java.util.Vector _internalFrames
The list of internal frames that are being managed by this toplevel Frame. Objects are of type JInternalFrame.


_libraries

protected java.util.Vector _libraries
The list of library objects which are open. Objects are of type MerlotLibrary


_fileToFrameMap

protected java.util.Hashtable _fileToFrameMap
Hashtable mapping Files to JInternalFrames. This allows us to bring a frame to the front if someone tries to open a file that is already open, instead of giving a new XMLDoc for it


_menuBar

protected javax.swing.JMenuBar _menuBar
The main menu bar for the application


_fileMenu

protected javax.swing.JMenu _fileMenu

_editMenu

protected javax.swing.JMenu _editMenu

_nodeMenu

protected javax.swing.JMenu _nodeMenu

_windowMenu

protected javax.swing.JMenu _windowMenu

_pluginMenu

protected javax.swing.JMenu _pluginMenu

_helpMenu

protected javax.swing.JMenu _helpMenu

_toolBar

protected javax.swing.JToolBar _toolBar

_documents

protected java.util.Vector _documents

_desktop

protected javax.swing.JDesktopPane _desktop

_editor

protected XMLEditor _editor
The editor that created this class instance


_background

protected javax.swing.JPanel _background
The background of this frame


_dtdChooser

protected DTDChooser _dtdChooser
A DTD chooser instance which can be reused throughout the application


_preferenceDialog

protected javax.swing.JDialog _preferenceDialog
Description of the Field


_clipboard

protected java.awt.datatransfer.Clipboard _clipboard
the clipboard for this application. This one holds just about anything except tree nodes. It mainly holds text.


_treeClipboard

protected java.awt.datatransfer.Clipboard _treeClipboard
Special clipboard for the tree nodes. We keep this separate because a paste in the tree is different from a paste in a text box.


_current_dir

protected java.lang.String _current_dir
Directory to go to when opening a file. This is set to the last directory that the user opened a file from.


STAGGER_X

protected static final int STAGGER_X
Amount to stagger new windows horizontally

See Also:
Constant Field Values

STAGGER_Y

protected static final int STAGGER_Y
Amount to stagger new windows vertically

See Also:
Constant Field Values

MAX_STAGGER_X

protected static final int MAX_STAGGER_X
maximum amount of total horizontal staggering before cycling back to the start

See Also:
Constant Field Values

MAX_STAGGER_Y

protected static final int MAX_STAGGER_Y
maximum amount of total vertical staggering before cycling back to the start

See Also:
Constant Field Values

STAGGER_OFFSET

protected static final int STAGGER_OFFSET
amount to offset staggers when recycling

See Also:
Constant Field Values

DEFAULT

public static java.awt.Cursor DEFAULT
Default Cursor


WAIT

public static java.awt.Cursor WAIT
Wait Cursor


_stagger_x

protected int _stagger_x
current values of staggering


_stagger_y

protected int _stagger_y
current values of staggering


_stagger_x_start

protected int _stagger_x_start
Where to start the stagger


_stagger_y_start

protected int _stagger_y_start
Where to start the stagger


OFF_X

protected static final int OFF_X
Description of the Field

See Also:
Constant Field Values

OFF_Y

protected static final int OFF_Y
Description of the Field

See Also:
Constant Field Values
Constructor Detail

XMLEditorFrame

public XMLEditorFrame(XMLEditor master,
                      java.lang.String title)
Constructor which takes the XMLEditor and the title for the Frame. This sets up the clipboards, the frame and document maps, and the actions. Then it shows the main splash screen, and sets up the frame, its menus, and its background.

Parameters:
master - the XMLEditor which is creating this
title - the frame title
Method Detail

getSharedInstance

public static XMLEditorFrame getSharedInstance()
Returns the singleton instance. Does not create a new instance if one doesn't exist.

Returns:
The sharedInstance value

add

public javax.swing.JInternalFrame add(XMLEditorDoc d)
add a XMLEditorDoc to the frame. This gets the internalframe from the Doc and adds it to the maps and the desktop.

Parameters:
d - the XMLEditorDoc to add to the frame
Returns:
Description of the Return Value

addInternalFrame

public void addInternalFrame(javax.swing.JInternalFrame f)
Adds an internal frame in a staggered manner

Parameters:
f - The feature to be added to the InternalFrame attribute

addInternalFrame

public void addInternalFrame(javax.swing.JInternalFrame f,
                             boolean stagger)
Adds an internal frame to the desktop. This decides on the placement of the window bassed on the stagger parameter. If this is false, the InternalFrame is placed wherever its location is set. This also places it in the window menu list of windows.

Parameters:
f - the frame to add
stagger - whether or not to stagger the placement of this internal frame within the stagger pattern.

setupFrame

protected void setupFrame()
Sets up the desktop and menus. Sets the look and feel, and sets up the application icon


setupMenus

protected void setupMenus()
Sets up all the toplevel menus for the application. Menu resources are retrieved from ResourceBundles via MerlotResource.


getFileMenu

public javax.swing.JMenu getFileMenu()
Gets the fileMenu attribute of the XMLEditorFrame object

Returns:
The fileMenu value

getEditMenu

public javax.swing.JMenu getEditMenu()
Gets the editMenu attribute of the XMLEditorFrame object

Returns:
The editMenu value

getNodeMenu

public javax.swing.JMenu getNodeMenu()
Gets the nodeMenu attribute of the XMLEditorFrame object

Returns:
The nodeMenu value

addActionToMenu

public void addActionToMenu(java.lang.String name,
                            javax.swing.Action a,
                            javax.swing.JMenu menu)
Adds an action to a menu - a tag is used to ensure the same action name is not added twice

Parameters:
name - The feature to be added to the ActionToMenu attribute
a - The feature to be added to the ActionToMenu attribute
menu - The feature to be added to the ActionToMenu attribute

addActionToMenu

public void addActionToMenu(java.lang.String name,
                            javax.swing.Action a,
                            javax.swing.JMenu menu,
                            int position)
Adds an action to a menu at a given position

Parameters:
name - The feature to be added to the ActionToMenu attribute
a - The feature to be added to the ActionToMenu attribute
menu - The feature to be added to the ActionToMenu attribute
position - The feature to be added to the ActionToMenu attribute

addActionToToolBar

public void addActionToToolBar(java.lang.String name,
                               javax.swing.Action a)
Adds an action to the toolbar

Parameters:
name - The feature to be added to the ActionToToolBar attribute
a - The feature to be added to the ActionToToolBar attribute

addActionToToolBar

public void addActionToToolBar(java.lang.String name,
                               javax.swing.Action a,
                               int position)
Adds an action to the toolbar at a specified location

Parameters:
name - The feature to be added to the ActionToToolBar attribute
a - The feature to be added to the ActionToToolBar attribute
position - The feature to be added to the ActionToToolBar attribute

getAction

public java.lang.Object getAction(java.lang.String name)
Get a custom action by name

Parameters:
name - Description of the Parameter
Returns:
The action value

setupFileMenu

protected javax.swing.JMenu setupFileMenu()
Sets up the file menu from the actions in XMLEditorActions

Returns:
Description of the Return Value

addRecentlyUsedFiles

protected void addRecentlyUsedFiles()

setupEditMenu

protected javax.swing.JMenu setupEditMenu()
Creates the edit menu from actions in XMLEditorActions

Returns:
Description of the Return Value

setupNodeMenu

protected javax.swing.JMenu setupNodeMenu()
Creates the Node menu which is maintained by individual documents

Returns:
Description of the Return Value

setupWindowMenu

protected javax.swing.JMenu setupWindowMenu()
Creates the windows menu from actions in XMLEditorActions

Returns:
Description of the Return Value

setupPluginMenu

protected javax.swing.JMenu setupPluginMenu()
Creates the plugin menu from actions in XMLEditorActions

Returns:
Description of the Return Value

setupPluginAboutMenu

protected javax.swing.JMenu setupPluginAboutMenu()
Creates the About menu for plugins, getting the action from the PluginConfigs in PluginManager

Returns:
Description of the Return Value

setupHelpMenu

protected javax.swing.JMenu setupHelpMenu()
Sets up the Help menu which contains the about item and plugin about menu

Returns:
Description of the Return Value

setupToolBar

protected javax.swing.JToolBar setupToolBar()
This creates the toolbar for the application and adds the actions to it

Returns:
Description of the Return Value

setupDesktop

protected void setupDesktop()
Sets up the desktop for the application. This includes the JDesktopPane and the background


frameResized

protected void frameResized(java.awt.event.ComponentEvent evt)
The frame got resized... check to make sure all the windows are still in the frame, and reset the background

Parameters:
evt - Description of the Parameter

quit

public void quit()
Checks if the application can be shutdown. If it can, it calls System.exit()


checkQuit

protected boolean checkQuit()
prepares the application to quit, asking the user if they want to save each of the open files. If the user selects "cancel" on any of the open file save questions, this returns false.

Returns:
true if the application can quit, false otherwise

newFile

public void newFile()
Create a new file. Show the DTDChooser, create a file which uses the DTD, and then create an XMLEditorDoc for that new file


createNewFile

protected static java.io.File createNewFile(java.lang.String rootElementName,
                                            java.lang.String publicid,
                                            java.lang.String systemid)
                                     throws java.io.IOException
Description of the Method

Parameters:
rootElementName - Description of the Parameter
publicid - Description of the Parameter
systemid - Description of the Parameter
Returns:
Description of the Return Value
Throws:
java.io.IOException - Description of the Exception

getNewRootElementName

public java.lang.String getNewRootElementName(DTDCacheEntry dtdEntry)
Get the root element name from the user for a new file

Parameters:
dtdEntry - Description of the Parameter
Returns:
The newRootElementName value

openFile

public void openFile()
Allow the user to select a file to open, and then check to see if it's already open or not. If its not open, open it and create the XMLEditorDoc for it.


openFile

public void openFile(java.io.File f)

getFileToOpen

public java.io.File getFileToOpen(MerlotFileFilter filter,
                                  java.lang.String selectedFileName)
Present a file chooser dialog for the user to select a file.

Parameters:
filter - the file filter for which files to show in the chooser
selectedFileName - a file to select in the chooser if using the native AWT fileDialog
Returns:
the File the user selected or null if they didn't select one

getFileToOpen

public java.io.File getFileToOpen(MerlotFileFilter filter,
                                  java.lang.String selectedFileName,
                                  boolean readWrite)

close

public void close()
This closes the foreground XMLEditorDoc document


revert

public void revert()
Revert a document to its previously saved version


activateDocumentAfterClose

protected void activateDocumentAfterClose()
Sets the most recent document active - needed after a document is closed to activate menu items


save

public void save()
Save the current foreground document


saveAs

public void saveAs()
Save the current foreground document with a different filename


getCurrentDir

public java.lang.String getCurrentDir()
Retrieve the current user working directory. This could be the directory the previous file was located in or if that is null, it would be the user.dir from the System properties

Returns:
The currentDir value

getLibDir

public java.lang.String getLibDir()

cut

public void cut(java.awt.event.ActionEvent evt)
Delegates to cut method in the current foreground XMLEditorDoc

Parameters:
evt - Description of the Parameter
See Also:
XMLEditorDoc.cut(java.awt.event.ActionEvent)

copy

public void copy(java.awt.event.ActionEvent evt)
Delegates to copy method in the current foreground XMLEditorDoc

Parameters:
evt - Description of the Parameter
See Also:
XMLEditorDoc.copy(java.awt.event.ActionEvent)

paste

public void paste(java.awt.event.ActionEvent evt)
Delegates to paste method in the current foreground XMLEditorDoc

Parameters:
evt - Description of the Parameter
See Also:
XMLEditorDoc.paste(java.awt.event.ActionEvent)

undo

public void undo(java.awt.event.ActionEvent evt)
Delegates to undo method in the current foreground XMLEditorDoc

Parameters:
evt - Description of the Parameter
See Also:
XMLEditorDoc.undo(java.awt.event.ActionEvent)

resetUndoAction

protected void resetUndoAction(javax.swing.undo.UndoManager mgr)
Updates the undo action with information about what it is going to undo using the mgr getUndoPresentationName() call.

Parameters:
mgr - the UndoManager to consult about whether an undo is available, and what it's presentation name is. If this is passed as null, the undo action is disabled and set to the defaults from the UI resource bundle keys "edit.undo"

getClipboard

public java.awt.datatransfer.Clipboard getClipboard()
returnts the text clipboard

Returns:
The clipboard value

getTreeClipboard

public java.awt.datatransfer.Clipboard getTreeClipboard()
returns the DOMTree clipboard

Returns:
The treeClipboard value

lostOwnership

public void lostOwnership(java.awt.datatransfer.Clipboard c,
                          java.awt.datatransfer.Transferable t)
Notification that we lost ownership of a clipboard item

Specified by:
lostOwnership in interface java.awt.datatransfer.ClipboardOwner
Parameters:
c - Description of the Parameter
t - Description of the Parameter

getDesktopPane

public javax.swing.JDesktopPane getDesktopPane()
returns the JDesktopPane which this Frame uses

Returns:
The desktopPane value

getCurrentDocument

public XMLEditorDoc getCurrentDocument()
returns the current foreground document or null if none are selected

Returns:
The currentDocument value

openLibrary

public void openLibrary(java.io.File libfile,
                        boolean show)
Open a library file.

Parameters:
libfile - the File to open as a library
show - if true, show the library frame immediately

openLibrary

public void openLibrary(java.io.File libfile)
Open the specified library file and show the fram

Parameters:
libfile - Description of the Parameter

openLibrary

public void openLibrary()
Open a library by giving the user a file chooser and then opening the selected library file if there is one


newLibrary

public void newLibrary()
Create a new library file


docActivated

protected void docActivated(XMLEditorDoc doc)
Called when an XMLEditorDoc is activated. Changes action enabled state for actions that can change depending on which document is in the foreground

Parameters:
doc - Description of the Parameter

docDeactivated

protected void docDeactivated(XMLEditorDoc doc)
Called when an XMLEditorDoc is deactivated. Changes action enabled state for actions that can change depending on which document is in the foreground

Parameters:
doc - Description of the Parameter

internalFrameActivated

public void internalFrameActivated(javax.swing.event.InternalFrameEvent e)
Implementation of InternalFrameListener. Calls into docActivated to turn on menu items

Specified by:
internalFrameActivated in interface javax.swing.event.InternalFrameListener
Parameters:
e - Description of the Parameter

internalFrameClosed

public void internalFrameClosed(javax.swing.event.InternalFrameEvent e)
Called when an internal frame has been closed. This cleans up items in the document maps and the window menu item

Specified by:
internalFrameClosed in interface javax.swing.event.InternalFrameListener
Parameters:
e - Description of the Parameter

internalFrameClosing

public void internalFrameClosing(javax.swing.event.InternalFrameEvent e)
Called when a frame is about to close. We don't do anything here. Saves of dirty documents are handled in the close action itself

Specified by:
internalFrameClosing in interface javax.swing.event.InternalFrameListener
Parameters:
e - Description of the Parameter

internalFrameDeactivated

public void internalFrameDeactivated(javax.swing.event.InternalFrameEvent e)
A frame has been deactivated. This called the docDeactivated method to change enabled state of affected menu items

Specified by:
internalFrameDeactivated in interface javax.swing.event.InternalFrameListener
Parameters:
e - Description of the Parameter

internalFrameDeiconified

public void internalFrameDeiconified(javax.swing.event.InternalFrameEvent e)
Description of the Method

Specified by:
internalFrameDeiconified in interface javax.swing.event.InternalFrameListener
Parameters:
e - Description of the Parameter

setCurrentDir

public void setCurrentDir(java.lang.String current)
Sets the currentDir attribute of the XMLEditorFrame object

Parameters:
current - The new currentDir value

internalFrameIconified

public void internalFrameIconified(javax.swing.event.InternalFrameEvent e)
Description of the Method

Specified by:
internalFrameIconified in interface javax.swing.event.InternalFrameListener
Parameters:
e - Description of the Parameter

setDefaultCursor

public static void setDefaultCursor()
Sets the defaultCursor attribute of the XMLEditorFrame class


setWaitCursor

public static void setWaitCursor()
Sets the waitCursor attribute of the XMLEditorFrame class


getFileDialogs

public XerlinFileDialogs getFileDialogs()
Gets the fileDialogs attribute of the XMLEditorFrame object

Returns:
The fileDialogs value

setFileDialogs

protected void setFileDialogs(XerlinFileDialogs fileDialogs)

internalFrameOpened

public void internalFrameOpened(javax.swing.event.InternalFrameEvent e)
Description of the Method

Specified by:
internalFrameOpened in interface javax.swing.event.InternalFrameListener
Parameters:
e - Description of the Parameter