|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | 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.merlotxml.merlot.XMLEditorFrame
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.
XMLEditor
,
XMLEditorActions
, Serialized FormInner Class Summary | |
protected class |
XMLEditorFrame.WindowHideShowListener
ActionListener for when a window is hidden or shown using the window menu item for it. |
Inner classes inherited from class javax.swing.JFrame |
javax.swing.JFrame.AccessibleJFrame |
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
The list of open documents (XMLEditorDoc objects) |
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.lang.String |
_lib_dir
Directory where the last library file was opened from. |
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 |
_pluginMenu
|
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 java.awt.datatransfer.Clipboard |
_treeClipboard
Special clipboard for the tree nodes. |
protected javax.swing.JMenu |
_windowMenu
|
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
|
protected static int |
OFF_Y
|
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 |
Fields inherited from class javax.swing.JFrame |
accessibleContext,
rootPane,
rootPaneCheckingEnabled |
Fields inherited from class java.awt.Frame |
CROSSHAIR_CURSOR,
DEFAULT_CURSOR,
E_RESIZE_CURSOR,
HAND_CURSOR,
ICONIFIED,
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 |
Constructor Summary | |
XMLEditorFrame(XMLEditor master,
java.lang.String title)
Constructor which takes the XMLEditor and the title for the Frame. |
Method Summary | |
javax.swing.JInternalFrame |
add(XMLEditorDoc d)
add a XMLEditorDoc to the frame. |
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 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 |
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.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 |
java.io.File |
getFileToOpen(MerlotFileFilter filter,
java.lang.String selectedFileName)
Present a file chooser dialog for the user to select a file. |
java.lang.String |
getNewRootElementName(DTDCacheEntry dtdEntry)
Get the root element name from the user for a new file |
static XMLEditorFrame |
getSharedInstance()
Returns the singleton instance. |
java.awt.datatransfer.Clipboard |
getTreeClipboard()
returns the DOMTree clipboard |
protected javax.swing.JFileChooser |
getXMLFileChooser(java.lang.String dir,
javax.swing.filechooser.FileFilter filter)
Creates a Swing JFileChooser with the given filter and starting the directory given |
protected java.awt.FileDialog |
getXMLFileDialog(java.lang.String dir,
java.io.FilenameFilter filter)
Creates an AWT native-peered file dialog. |
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)
|
void |
internalFrameIconified(javax.swing.event.InternalFrameEvent e)
|
void |
internalFrameOpened(javax.swing.event.InternalFrameEvent e)
|
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 |
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 |
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 |
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 |
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,
isRootPaneCheckingEnabled,
paramString,
processKeyEvent,
processWindowEvent,
remove,
setContentPane,
setDefaultCloseOperation,
setGlassPane,
setJMenuBar,
setLayeredPane,
setLayout,
setRootPane,
setRootPaneCheckingEnabled,
update |
Methods inherited from class java.awt.Frame |
addNotify,
finalize,
getCursorType,
getFrames,
getIconImage,
getMenuBar,
getState,
getTitle,
isResizable,
remove,
removeNotify,
setCursor,
setIconImage,
setMenuBar,
setResizable,
setState,
setTitle |
Methods inherited from class java.awt.Window |
addWindowListener,
applyResourceBundle,
applyResourceBundle,
dispose,
getFocusOwner,
getInputContext,
getLocale,
getOwnedWindows,
getOwner,
getToolkit,
getWarningString,
hide,
isShowing,
pack,
postEvent,
processEvent,
removeWindowListener,
setCursor,
show,
toBack,
toFront |
Methods inherited from class java.awt.Container |
add,
add,
add,
add,
add,
addContainerListener,
countComponents,
deliverEvent,
doLayout,
findComponentAt,
findComponentAt,
getAlignmentX,
getAlignmentY,
getComponent,
getComponentAt,
getComponentAt,
getComponentCount,
getComponents,
getInsets,
getLayout,
getMaximumSize,
getMinimumSize,
getPreferredSize,
insets,
invalidate,
isAncestorOf,
layout,
list,
list,
locate,
minimumSize,
paint,
paintComponents,
preferredSize,
print,
printComponents,
processContainerEvent,
remove,
removeAll,
removeContainerListener,
setFont,
validate,
validateTree |
Methods inherited from class java.awt.Component |
action,
add,
addComponentListener,
addFocusListener,
addInputMethodListener,
addKeyListener,
addMouseListener,
addMouseMotionListener,
addPropertyChangeListener,
addPropertyChangeListener,
bounds,
checkImage,
checkImage,
coalesceEvents,
contains,
contains,
createImage,
createImage,
disable,
disableEvents,
dispatchEvent,
enable,
enable,
enableEvents,
enableInputMethods,
firePropertyChange,
getBackground,
getBounds,
getBounds,
getColorModel,
getComponentOrientation,
getCursor,
getDropTarget,
getFont,
getFontMetrics,
getForeground,
getGraphics,
getHeight,
getInputMethodRequests,
getLocation,
getLocation,
getLocationOnScreen,
getName,
getParent,
getPeer,
getSize,
getSize,
getTreeLock,
getWidth,
getX,
getY,
gotFocus,
handleEvent,
hasFocus,
imageUpdate,
inside,
isDisplayable,
isDoubleBuffered,
isEnabled,
isFocusTraversable,
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,
processInputMethodEvent,
processMouseEvent,
processMouseMotionEvent,
removeComponentListener,
removeFocusListener,
removeInputMethodListener,
removeKeyListener,
removeMouseListener,
removeMouseMotionListener,
removePropertyChangeListener,
removePropertyChangeListener,
repaint,
repaint,
repaint,
repaint,
requestFocus,
reshape,
resize,
resize,
setBackground,
setBounds,
setBounds,
setComponentOrientation,
setDropTarget,
setEnabled,
setForeground,
setLocale,
setLocation,
setLocation,
setName,
setSize,
setSize,
setVisible,
show,
size,
toString,
transferFocus |
Methods inherited from class java.lang.Object |
clone,
equals,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
Field Detail |
public static XMLEditorFrame _frame
protected XMLEditorActions _actions
protected java.util.Vector _internalFrames
protected java.util.Vector _libraries
protected java.util.Hashtable _fileToFrameMap
protected javax.swing.JMenuBar _menuBar
protected javax.swing.JMenu _fileMenu
protected javax.swing.JMenu _editMenu
protected javax.swing.JMenu _windowMenu
protected javax.swing.JMenu _pluginMenu
protected javax.swing.JMenu _helpMenu
protected java.util.Vector _documents
protected javax.swing.JDesktopPane _desktop
protected XMLEditor _editor
protected javax.swing.JPanel _background
protected DTDChooser _dtdChooser
protected java.awt.datatransfer.Clipboard _clipboard
protected java.awt.datatransfer.Clipboard _treeClipboard
protected java.lang.String _current_dir
protected java.lang.String _lib_dir
protected static final int STAGGER_X
protected static final int STAGGER_Y
protected static final int MAX_STAGGER_X
protected static final int MAX_STAGGER_Y
protected static final int STAGGER_OFFSET
protected int _stagger_x
protected int _stagger_y
protected int _stagger_x_start
protected int _stagger_y_start
protected static final int OFF_X
protected static final int OFF_Y
Constructor Detail |
public XMLEditorFrame(XMLEditor master, java.lang.String title)
master
- the XMLEditor which is creating thistitle
- the frame titleMethod Detail |
public static XMLEditorFrame getSharedInstance()
public javax.swing.JInternalFrame add(XMLEditorDoc d)
d
- the XMLEditorDoc to add to the framepublic void addInternalFrame(javax.swing.JInternalFrame f)
public void addInternalFrame(javax.swing.JInternalFrame f, boolean stagger)
f
- the frame to addstagger
- whether or not to stagger the placement of this internal frame within the
stagger pattern.protected void setupFrame()
protected void setupMenus()
protected javax.swing.JMenu setupFileMenu()
protected javax.swing.JMenu setupEditMenu()
protected javax.swing.JMenu setupWindowMenu()
protected javax.swing.JMenu setupPluginMenu()
protected javax.swing.JMenu setupPluginAboutMenu()
protected javax.swing.JMenu setupHelpMenu()
protected javax.swing.JToolBar setupToolBar()
protected void setupDesktop()
protected void frameResized(java.awt.event.ComponentEvent evt)
public void quit()
protected boolean checkQuit()
public void newFile()
public java.lang.String getNewRootElementName(DTDCacheEntry dtdEntry)
public void openFile()
public java.io.File getFileToOpen(MerlotFileFilter filter, java.lang.String selectedFileName)
filter
- the file filter for which files to show in the chooserselectedFileName
- a file to select in the chooser if using the
native AWT fileDialogprotected javax.swing.JFileChooser getXMLFileChooser(java.lang.String dir, javax.swing.filechooser.FileFilter filter)
dir
- the Directory to start the file chooser infilter
- a file filter for what files to show to the user in the dialogprotected java.awt.FileDialog getXMLFileDialog(java.lang.String dir, java.io.FilenameFilter filter)
dir
- the Directory to start the file dialog infilter
- a file filter for what files to show to the user in the dialogpublic void close()
public void revert()
public void save()
public void saveAs()
public java.lang.String getCurrentDir()
public void cut(java.awt.event.ActionEvent evt)
XMLEditorDoc.cut(java.awt.event.ActionEvent)
public void copy(java.awt.event.ActionEvent evt)
XMLEditorDoc.copy(java.awt.event.ActionEvent)
public void paste(java.awt.event.ActionEvent evt)
XMLEditorDoc.paste(java.awt.event.ActionEvent)
public void undo(java.awt.event.ActionEvent evt)
XMLEditorDoc.undo(java.awt.event.ActionEvent)
protected void resetUndoAction(javax.swing.undo.UndoManager mgr)
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"public java.awt.datatransfer.Clipboard getClipboard()
public java.awt.datatransfer.Clipboard getTreeClipboard()
public void lostOwnership(java.awt.datatransfer.Clipboard c, java.awt.datatransfer.Transferable t)
public javax.swing.JDesktopPane getDesktopPane()
public XMLEditorDoc getCurrentDocument()
public void openLibrary(java.io.File libfile, boolean show)
libfile
- the File to open as a libraryshow
- if true, show the library frame immediatelypublic void openLibrary(java.io.File libfile)
public void openLibrary()
public void newLibrary()
protected void docActivated(XMLEditorDoc doc)
protected void docDeactivated(XMLEditorDoc doc)
public void internalFrameActivated(javax.swing.event.InternalFrameEvent e)
public void internalFrameClosed(javax.swing.event.InternalFrameEvent e)
public void internalFrameClosing(javax.swing.event.InternalFrameEvent e)
public void internalFrameDeactivated(javax.swing.event.InternalFrameEvent e)
public void internalFrameDeiconified(javax.swing.event.InternalFrameEvent e)
public void internalFrameIconified(javax.swing.event.InternalFrameEvent e)
public void internalFrameOpened(javax.swing.event.InternalFrameEvent e)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |