org.jhotdraw.contrib
Class MDI_DrawApplication

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.jhotdraw.application.DrawApplication
                          extended byorg.jhotdraw.contrib.MDI_DrawApplication
All Implemented Interfaces:
javax.accessibility.Accessible, DrawingEditor, FigureSelectionListener, java.awt.image.ImageObserver, java.awt.MenuContainer, PaletteListener, javax.swing.RootPaneContainer, java.io.Serializable, VersionRequester, javax.swing.WindowConstants
Direct Known Subclasses:
JavaDrawApp

public class MDI_DrawApplication
extends DrawApplication

Many applications have the ability to deal with multiple internal windows. MDI_DrawApplications provides the basic facilities to make use of MDI in JHotDraw. Its main tasks are to create a content for DrawApplications, which is embedded in internal frames, to maintain a list with all internal frames and to manage the switching between them.

Version:
<$CURRENT_VERSION$>
See Also:
Serialized Form

Nested Class Summary
 
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
 
Fields inherited from class org.jhotdraw.application.DrawApplication
ALIGNMENT_MENU, ATTRIBUTES_MENU, EDIT_MENU, fgUntitled, FILE_MENU, IMAGES, winCount
 
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
MDI_DrawApplication()
          Constructs a drawing window with a default title.
MDI_DrawApplication(java.lang.String title)
          Constructs a drawing window with the given title.
 
Method Summary
protected  DrawApplication createApplication()
          Factory method which can be overriden by subclasses to create an instance of their type.
protected  Desktop createDesktop()
          Factory method to create a specialized desktop (manager) for MDI applications
protected  DrawingView createInitialDrawingView()
          Create the DrawingView that is active when the application is started.
protected  void createTools(javax.swing.JToolBar palette)
          Creates the tools.
 java.lang.String getDefaultDrawingTitle()
           
 void newView()
          Open a new view for this application containing a view of the drawing of the currently activated window.
 void newWindow(Drawing newDrawing)
          Method to create a new internal frame.
 void promptNew()
          Opens a new internal frame containing a new drawing.
protected  void setDrawingTitle(java.lang.String drawingTitle)
          Set the title of the currently selected drawing
 DrawingView[] views()
          Returns all the views in the application
 
Methods inherited from class org.jhotdraw.application.DrawApplication
addListeners, addMenuIfPossible, addViewChangeListener, checkCommandMenu, checkCommandMenus, closeQuery, createAlignmentMenu, createArrowMenu, createAttributesMenu, createColorMenu, createDebugMenu, createDefaultTool, createDesktopListener, createDrawing, createDrawingView, createDrawingView, createEditMenu, createFileMenu, createFontMenu, createFontSizeMenu, createFontStyleMenu, createIconkit, createLookAndFeelMenu, createMenus, createOpenFileChooser, createSaveFileChooser, createSelectionTool, createStatusLine, createStorageFormatManager, createToolButton, createToolPalette, defaultSize, destroy, endApp, exit, figureSelectionChanged, fireViewCreatedEvent, fireViewDestroyingEvent, fireViewSelectionChangedEvent, getApplicationName, getDefaultTool, getDesktop, getDesktopListener, getDrawingTitle, getDrawingViewSize, getIconkit, getRequiredVersions, getStatusLine, getStorageFormatManager, getUndoManager, getVersionControlStrategy, loadDrawing, newWindow, open, open, paletteUserOver, paletteUserSelected, print, promptOpen, promptSaveAs, removeViewChangeListener, saveDrawing, setApplicationName, setDefaultTool, setDesktop, setDesktopListener, setIconkit, setStorageFormatManager, setTool, setUndoManager, setView, showStatus, tool, toolDone, view
 
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
 

Constructor Detail

MDI_DrawApplication

public MDI_DrawApplication()
Constructs a drawing window with a default title.


MDI_DrawApplication

public MDI_DrawApplication(java.lang.String title)
Constructs a drawing window with the given title.

Method Detail

createApplication

protected DrawApplication createApplication()
Factory method which can be overriden by subclasses to create an instance of their type.

Overrides:
createApplication in class DrawApplication
Returns:
newly created application

createTools

protected void createTools(javax.swing.JToolBar palette)
Creates the tools. By default only the selection tool is added. Override this method to add additional tools. Call the inherited method to include the selection tool.

Overrides:
createTools in class DrawApplication
Parameters:
palette - the palette where the tools are added.

promptNew

public void promptNew()
Opens a new internal frame containing a new drawing.

Overrides:
promptNew in class DrawApplication

newWindow

public void newWindow(Drawing newDrawing)
Method to create a new internal frame. Applications that want to create a new internal drawing view should call this method.

Overrides:
newWindow in class DrawApplication

createInitialDrawingView

protected DrawingView createInitialDrawingView()
Create the DrawingView that is active when the application is started. This initial DrawingView might be different from DrawingView created by the application, so subclasses can override this method to provide a special drawing view for application startup time, e.g. a NullDrawingView which does not display an internal frame in a multiple document interface (MDI) application.

Overrides:
createInitialDrawingView in class DrawApplication
Returns:
drawing view that is active at application startup time

newView

public void newView()
Open a new view for this application containing a view of the drawing of the currently activated window.

Overrides:
newView in class DrawApplication

createDesktop

protected Desktop createDesktop()
Factory method to create a specialized desktop (manager) for MDI applications

Overrides:
createDesktop in class DrawApplication

views

public DrawingView[] views()
Returns all the views in the application

Specified by:
views in interface DrawingEditor
Overrides:
views in class DrawApplication

getDefaultDrawingTitle

public java.lang.String getDefaultDrawingTitle()
Overrides:
getDefaultDrawingTitle in class DrawApplication

setDrawingTitle

protected void setDrawingTitle(java.lang.String drawingTitle)
Set the title of the currently selected drawing

Overrides:
setDrawingTitle in class DrawApplication