|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.roydesign.app.Application
de.sciss.app.AbstractApplication
public abstract class AbstractApplication
A rudimentary implementation of the de.sciss.app.Application
interface, which deals with component registration, quitting,
preference, clipboard and resource bundle generation. It
extends net.roydesign.app.Application
in order
to supply easy access to methods.
Constructor Summary | |
---|---|
protected |
AbstractApplication(java.lang.Class mainClass,
java.lang.String name)
Creates a new instance of this class. |
Method Summary | |
---|---|
void |
addComponent(java.lang.Object key,
java.lang.Object component)
Adds a newly created component (e.g. a specific frame) to the application. |
static Application |
getApplication()
Returns the current runtime's application. |
java.awt.datatransfer.Clipboard |
getClipboard()
Returns the system's clipboard, or a local clipboard if security permits to retrieve the system clipboard. |
java.lang.Object |
getComponent(java.lang.Object key)
Retrieves a specific component (such as a GUI frame) of the application. |
net.roydesign.app.Application |
getMRJApplication()
Returns this . |
java.lang.String |
getResourceString(java.lang.String key)
Returns a localized string for a given key. |
java.lang.String |
getResourceString(java.lang.String key,
java.lang.String defaultValue)
Returns a localized string for a given key. |
java.util.prefs.Preferences |
getSystemPrefs()
Returns the applications system wide preferences. |
java.util.prefs.Preferences |
getUserPrefs()
Returns the applications user specific preferences. |
void |
quit()
Flushes preferences and quits. |
void |
removeComponent(java.lang.Object key)
Unregisters a component, for example when a frame has been disposed. |
Methods inherited from class net.roydesign.app.Application |
---|
addOpenApplicationListener, addOpenDocumentListener, addPrintDocumentListener, addReopenApplicationListener, getAboutJMenuItem, getAboutMenuItem, getFramelessJMenuBar, getFramelessMenuBar, getInstance, getName, getPreferencesJMenuItem, getPreferencesMenuItem, getQuitJMenuItem, getQuitMenuItem, removeOpenApplicationListener, removeOpenDocumentListener, removePrintDocumentListener, removeReopenApplicationListener, setFramelessJMenuBar, setFramelessMenuBar, setName |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface de.sciss.app.Application |
---|
getDocumentHandler, getGraphicsHandler, getMacOSCreator, getName, getVersion, getWindowHandler |
Constructor Detail |
---|
protected AbstractApplication(java.lang.Class mainClass, java.lang.String name)
mainClass
will be used to determine the application's preference root node.
This name
will be used to set the application's name
and to load a ResourceBundle
with localized text strings.
The resource bundle must be stored in a file
"<name>Strings.properties"
,
e.g. if name
equals "FScape"
, the
resources are retrieved from "FScapeStrings.properties"
!
Only one instance of this class can be created, any further attempt
will result in a RuntimeException
. The one and only instance
is available through the class method getApplication
.
mainClass
- the main class of the application whose package
(e.g. de.sciss.fscape
) is used to identify
the preferences files.name
- application name, should not contain white spaces
or special characters.getApplication()
Method Detail |
---|
public final java.util.prefs.Preferences getSystemPrefs()
Application
getSystemPrefs
in interface Application
Preferences.systemNodeForPackage( Class )
public final java.util.prefs.Preferences getUserPrefs()
Application
getUserPrefs
in interface Application
Preferences.userNodeForPackage( Class )
public final java.awt.datatransfer.Clipboard getClipboard()
getClipboard
in interface Application
Toolkit.getSystemClipboard()
public final java.lang.Object getComponent(java.lang.Object key)
Application
getComponent
in interface Application
key
- agreed upon idenfier for the component,
e.g. a string or class
null
if absent or unknownpublic final void addComponent(java.lang.Object key, java.lang.Object component)
Application
getComponent
method.
addComponent
in interface Application
key
- agreed upon idenfier for the component,
e.g. a string or classcomponent
- the component to be registeredpublic final void removeComponent(java.lang.Object key)
Application
removeComponent
in interface Application
key
- agreed upon idenfier for the component to be removed,
e.g. a string or classpublic final net.roydesign.app.Application getMRJApplication()
this
.
getMRJApplication
in interface Application
Application
class providing access to
common menu items and system events registrationpublic final java.lang.String getResourceString(java.lang.String key)
Application
getResourceString
in interface Application
key
- a key into the application's main string recource file
ResourceBundle.getString( String )
public final java.lang.String getResourceString(java.lang.String key, java.lang.String defaultValue)
Application
getResourceString
in interface Application
key
- a key into the application's main string recource filedefaultValue
- the text to return if the key is
not in the dictionary
ResourceBundle.getString( String )
public void quit()
quit
in interface Application
public static final Application getApplication()
Application
or null
if no application has been created.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |