Package 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
JMenus 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
MenuFactoryfor the application, and that will be created by theMainclass.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classBasicMenuFactory.ActionOpenRecentclassBasicMenuFactory.ActionPreferencesAction to be attached to the Preference item of the Edit menu.classBasicMenuFactory.ActionShowWindow-
Nested classes/interfaces inherited from class de.sciss.gui.MenuItem
MenuItem.Realized
-
Nested classes/interfaces inherited from interface de.sciss.gui.MenuNode
MenuNode.DummyAction
-
-
Field Summary
Fields Modifier and Type Field Description protected BasicMenuFactory.ActionOpenRecentactionOpenRecentstatic intMENU_SHORTCUTKeyStrokemodifier mask representing the platform's default menu accelerator (e.g.protected MenuGroupmgRecentprotected PathListopenRecentPaths-
Fields inherited from class de.sciss.gui.MenuGroup
defaultProxy, proxies
-
Fields inherited from class de.sciss.gui.MenuItem
mapRealized
-
Fields inherited from interface de.sciss.gui.MenuNode
IDENTIFIER
-
-
Constructor Summary
Constructors Constructor Description BasicMenuFactory(BasicApplication app)The constructor is called only once by theMainclass and will create a prototype main menu from which all copies are derived.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected static java.lang.StringabbrName(java.lang.String name)protected abstract voidaddMenuItems()voidaddRecent(java.io.File path)voidaddToWindowMenu(javax.swing.Action a)ProcessingThreadcloseAll(boolean force, Flag confirmed)protected BasicMenuFactory.ActionOpenRecentcreateOpenRecentAction(java.lang.String name, java.io.File path)voiddocumentAdded(DocumentEvent e)Notifies the listener that a document has been created and added to the list of open documents.voiddocumentFocussed(DocumentEvent e)Notifies the listener that a the active document has been switched.voiddocumentRemoved(DocumentEvent e)Notifies the listener that a document has been removed from the list of open documents and was destroyed.BasicApplicationgetApplication()protected abstract javax.swing.ActiongetOpenAction()java.lang.StringgetResourceString(java.lang.String key)voidinit()abstract voidopenDocument(java.io.File f)voidremoveFromWindowMenu(javax.swing.Action a)voidsetSelectedWindow(javax.swing.Action a)abstract voidshowPreferences()-
Methods inherited from class de.sciss.gui.MenuRoot
createBar, createComponent
-
Methods inherited from class de.sciss.gui.MenuGroup
add, add, add, add, addSeparator, addSeparator, create, destroy, get, get, get, getByAction, getByAction, indexOf, indexOf, putMimic, remove, remove, remove, remove, size
-
Methods inherited from class de.sciss.gui.MenuItem
getAction, getAction, getID, getRealized, put, remove, setEnabled
-
-
-
-
Field Detail
-
MENU_SHORTCUT
public static final int MENU_SHORTCUT
KeyStrokemodifier 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
-
-
Constructor Detail
-
BasicMenuFactory
public BasicMenuFactory(BasicApplication app)
The constructor is called only once by theMainclass and will create a prototype main menu from which all copies are derived.
-
-
Method Detail
-
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:DocumentListenerNotifies the listener that a document has been created and added to the list of open documents.- Specified by:
documentAddedin interfaceDocumentListener- Parameters:
e- the event describing the change
-
documentRemoved
public void documentRemoved(DocumentEvent e)
Description copied from interface:DocumentListenerNotifies the listener that a document has been removed from the list of open documents and was destroyed.- Specified by:
documentRemovedin interfaceDocumentListener- Parameters:
e- the event describing the change
-
documentFocussed
public void documentFocussed(DocumentEvent e)
Description copied from interface:DocumentListenerNotifies the listener that a the active document has been switched.e.getDocumentwill return the newly active document (ornull, if no document is active any more).- Specified by:
documentFocussedin interfaceDocumentListener- Parameters:
e- the event describing the change
-
abbrName
protected static java.lang.String abbrName(java.lang.String name)
-
-