de.sciss.common
Class BasicMenuFactory
java.lang.Object
de.sciss.gui.MenuItem
de.sciss.gui.MenuGroup
de.sciss.gui.MenuRoot
de.sciss.common.BasicMenuFactory
- All Implemented Interfaces:
- DocumentListener, MenuNode, java.util.EventListener
public abstract class BasicMenuFactory
- extends MenuRoot
- implements DocumentListener
JMenu
s cannot be added to more than
one frame. Since on MacOS there's one
global menu for all the application windows
we need to 'duplicate' a menu prototype.
Synchronizing all menus is accomplished
by using the same action objects for all
menu copies. However when items are added
or removed, synchronization needs to be
performed manually. That's the point about
this class.
There can be only one instance of MenuFactory
for the application, and that will be created by the
Main
class.
- Version:
- 0.71, 26-Aug-08
- Author:
- Hanns Holger Rutz
Constructor Summary |
BasicMenuFactory(BasicApplication app)
The constructor is called only once by
the Main class and will create a prototype
main menu from which all copies are
derived. |
Methods inherited from class de.sciss.gui.MenuGroup |
add, add, addSeparator, create, destroy, get, getByAction, indexOf, put, putMimic, remove, remove |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
MENU_SHORTCUT
public static final int MENU_SHORTCUT
KeyStroke
modifier mask
representing the platform's default
menu accelerator (e.g. Apple-key on Mac,
Ctrl on Windows).
- See Also:
Toolkit.getMenuShortcutKeyMask()
mgRecent
protected MenuGroup mgRecent
openRecentPaths
protected final PathList openRecentPaths
actionOpenRecent
protected BasicMenuFactory.ActionOpenRecent actionOpenRecent
BasicMenuFactory
public BasicMenuFactory(BasicApplication app)
- The constructor is called only once by
the
Main
class and will create a prototype
main menu from which all copies are
derived.
init
public void init()
getApplication
public BasicApplication getApplication()
closeAll
public ProcessingThread closeAll(boolean force,
Flag confirmed)
createOpenRecentAction
protected BasicMenuFactory.ActionOpenRecent createOpenRecentAction(java.lang.String name,
java.io.File path)
addMenuItems
protected abstract void addMenuItems()
showPreferences
public abstract void showPreferences()
getOpenAction
protected abstract javax.swing.Action getOpenAction()
openDocument
public abstract void openDocument(java.io.File f)
addRecent
public void addRecent(java.io.File path)
getResourceString
public java.lang.String getResourceString(java.lang.String key)
addToWindowMenu
public void addToWindowMenu(javax.swing.Action a)
removeFromWindowMenu
public void removeFromWindowMenu(javax.swing.Action a)
setSelectedWindow
public void setSelectedWindow(javax.swing.Action a)
documentAdded
public void documentAdded(DocumentEvent e)
- Description copied from interface:
DocumentListener
- Notifies the listener that
a document has been created and added
to the list of open documents.
- Specified by:
documentAdded
in interface DocumentListener
- Parameters:
e
- the event describing
the change
documentRemoved
public void documentRemoved(DocumentEvent e)
- Description copied from interface:
DocumentListener
- Notifies the listener that
a document has been removed from
the list of open documents and
was destroyed.
- Specified by:
documentRemoved
in interface DocumentListener
- Parameters:
e
- the event describing
the change
documentFocussed
public void documentFocussed(DocumentEvent e)
- Description copied from interface:
DocumentListener
- Notifies the listener that
a the active document has been switched.
e.getDocument
will return
the newly active document (or null
,
if no document is active any more).
- Specified by:
documentFocussed
in interface DocumentListener
- Parameters:
e
- the event describing
the change
abbrName
protected static java.lang.String abbrName(java.lang.String name)