|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.tensegrity.application.ApplicationFrame
Class ApplicationFrame represents an abstract implementation
representing a GUI of an Application.
Although its entire responsibility cannot be summed up by standard interfaces
alone, we can show how its methods fall into six distinct categories.
Application implementation
which is the preferred way. It is still possible to create them without an own
Application implementation in which case a default is created
completely transparent for the user.
An ApplicationFrame is responsible for returning information
about the runtime environment. Because an instance can be used in either an
Application or Applet context, client code needs to be able to determine its
environment at runtime and call the correct methods.
Applet getApplet()Frame getFrame()Frame getRootFrame()boolean isApplet()All the main GUI components are managed by the application frame. The following methods are used to retrieve them or update their status:
MenuBar getMenuBar()StatusBar getStatusBar()ToolBar[] getToolBars()MDIComponent getMDIComponent()void updateStatus(Object, Object)
All of the important Container objects of a graph application are
managed by the ApplicationFrame and returned to objects that
request them.
Instances of open documents are handled by implementations
of the central MDIComponent container.
The methods which deal with this gui responsibility are shown below:
int getLayoutConstraint(Container)AttributeEditorContainer getAttributeEditorContainer()Container[] getCustomContainers()LayoutToolsContainer getLayoutToolsContainer()LayoutToolsContainer getNavigatorContainer()LayoutToolsContainer getOutlinerContainer()LayoutToolsContainer getRepositoryContainer()
The ApplicationFrame class also provides a set of methods that
deal directly and indirectly with creating and configuring documents, which
are shown here:
Document newDocument()void configureDocumentView(Document, int)void configureEmptyDocument(Document)void configureNewDocument(Document)JPopupMenuSourceWithUpdateUI
getGraphPanelPopupMenuSource()void
setGraphPanelPopupMenuSource(JPopupMenuSourceWithUpdateUI)RuleRegistry getRuleRegistry()void setRuleRegistry(RuleRegistry)
Finally, an ApplicationFrame exposes a set of methods that
allow client code to load and save graph and generic documents, as shown
here.
void saveDocument(Document, File)void saveDocument(Document, OutputStream)Document openDocument(File)Document openDocument(InputStream, String)GraphDocumentReader getGraphDocumentReader()GraphDocumentWriter getGraphDocumentWriter()
AttributeEditors are using translators to display localized
texts for the names of attributes and values of EnumConstraints.
All Translators are created using a pool, so translators can share resources.
The following methods are used to get a reference to the pool of translators
or one of the default translators used for the main attribute editor, the
preference table or the layout attributes editor. Any of these methods may
return null in which case no translator is used for the corresponding editor
or no translator at all in case getAttributeEditorTranslatorPool()
returns null.
AttributeEditorTranslatorPool getAttributeEditorTranslatorPool()AttributeEditorTranslator getAttributeEditorContainer()AttributeEditorTranslator getLayoutEditorTranslator()AttributeEditorTranslator getPreferenceAttributeEditorTranslator()
| Field Summary | |
protected Application |
application
|
static int |
EAST
|
static int |
NORTH
|
static int |
NORTHEAST
|
static int |
NORTHWEST
|
static int |
SOUTH
|
static int |
SOUTHEAST
|
static int |
SOUTHWEST
|
static int |
TYPE_CLONED_DOCUMENT
A constant identifying a cloned document. |
static int |
TYPE_LOADED_DOCUMENT
A constant identifying a loaded document. |
static int |
TYPE_NEW_DOCUMENT
A constant identifying a new document. |
static int |
UNDEFINED
|
static int |
WEST
|
| Constructor Summary | |
ApplicationFrame(Application application)
Constructs a new ApplicationFrame instance. |
|
| Method Summary | |
protected void |
addKeyCommand(VisualGraphView visualgraphview,
java.lang.String commandId)
This method retrieves the KeyStroke
corresponding to the passed commandId using the
class and adds it to the passed
. |
void |
addPostLaunchTask(java.lang.Runnable postLaunchTask)
Adds a Runnable that is processed when calling
runPostLaunchTasks() which should be done after the
application is on screen. |
abstract void |
configureDocumentView(Document document,
int documenttype)
Configures the view of a document. |
abstract void |
configureEmptyDocument(Document document)
Configures a newly created document. |
abstract void |
configureNewDocument(Document document)
This method should be overridden in order to perform a post-creation configuration of the passed document. |
void |
documentAdded(DocumentEvent documentevent)
Invoked after a document was added to the mdicomponent. |
void |
documentModelChanged(DocumentEvent documentevent)
Invoked after a document's model has changed. |
void |
documentPreAdd(DocumentEvent documentevent)
Invoked when a document is about to be added to a mdicomponent. |
void |
documentPreRemove(DocumentEvent documentevent)
Invoked when a document is about to be removed from a mdicomponent. |
void |
documentRemoved(DocumentEvent documentevent)
Invoked after a document was removed from the mdicomponent. |
void |
documentSelected(DocumentEvent documentevent)
Invoked after a document was selected in the mdicomponent. |
void |
documentUnselected(DocumentEvent documentevent)
Invoked after a document was unselected in the mdicomponent. |
boolean |
exit()
Cleanup method that is called when the application will be closed to free all resources from the application frame and store all contained documents, etc. |
Applet |
getApplet()
Deprecated. use Application.getApplet() |
Application |
getApplication()
Returns the application this application frame belongs to. |
abstract AttributeEditorContainer |
getAttributeEditorContainer()
Returns either the AttributeEditorContainer or null
if no such Container is used by this Application. |
AttributeEditorTranslator |
getAttributeEditorTranslator()
Returns the AttributeEditorTranslator this application
is using for editing attributes in the main attribute editor. |
AttributeEditorTranslatorPool |
getAttributeEditorTranslatorPool()
Returns the AttributeEditorTranslatorPool this application
is using. |
java.lang.String |
getAutomaticLayoutContextName()
Deprecated. This method is no longer used by the framework |
CommandRegistry |
getCommandRegistry()
Deprecated. use Application.getCommandRegistry() instead! |
protected com.tensegrity.application.ApplicationFrame.CompositeViewListener |
getCompositeViewListener()
|
abstract Container |
getCustomContainer()
Deprecated. use getCustomContainers() instead! |
Container[] |
getCustomContainers()
Returns an array of custom not yet specified types of Containers. |
LayoutController |
getDefaultLayoutController()
Deprecated. use GraphApplication.getDefaultLayoutController() |
DocumentDropContext |
getDocumentDropContext()
Returns the Document drop context to be used when files are dropped into the frame. |
DragContext |
getDragContext()
Deprecated. use GraphApplication.getDragContext() |
abstract Frame |
getFrame()
Returns either the awt.Frame of this ApplicationFrame or null if this ApplicationFrame is running as Applet. |
abstract GraphDocumentReader |
getGraphDocumentReader()
Returns the GraphDocumentReader to use for reading documents. |
abstract GraphDocumentWriter |
getGraphDocumentWriter()
Returns the GraphDocumentWriter to use for writing documents. |
abstract JPopupMenuSourceWithUpdateUI |
getGraphPanelPopupMenuSource()
Returns a popup menu instance for this application's graph panels. |
KeyStrokeProvider |
getKeyStrokeProvider()
Deprecated. use Application.getKeyStrokeProvider() instead! |
abstract int |
getLayoutConstraint(Container container)
This method returns a layout constraint for a specific container. |
AttributeEditorTranslator |
getLayoutEditorTranslator()
Returns the AttributeEditorTranslator this application
is using for editing attributes in the layout attributes editor. |
abstract LayoutToolsContainer |
getLayoutToolsContainer()
Returns the LayoutToolsContainer of this Application
or null if no such Container is used. |
java.util.Locale |
getLocale()
Deprecated. use Application.getLocale() |
abstract MDIComponent |
getMDIComponent()
Returns the MDIComponent of the this
ApplicationFrame. |
abstract MenuBar |
getMenuBar()
Returns the MenuBar of this ApplicationFrame. |
abstract NavigatorContainer |
getNavigatorContainer()
Returns the NavigatorContainer of this Application
or null if no such Container is used. |
abstract OutlinerContainer |
getOutlinerContainer()
Returns the OutlinerContainer of this Application
or null if no such Container is used. |
AttributeEditorTranslator |
getPreferenceAttributeEditorTranslator()
Returns the AttributeEditorTranslator this application
is using for editing preferences. |
Preferences |
getPreferences()
Deprecated. use Application.getPreferences() instead! |
abstract RepositoryContainer |
getRepositoryContainer()
Returns the RepositoryContainer of this Application
or null if no such Container is used. |
java.lang.String |
getResourceName()
Deprecated. Use getResourceNames() instead! |
java.util.List |
getResourceNames()
Returns a list of paths to resource files using the syntax of resource bundles. |
Frame |
getRootFrame()
Returns the root frame of this application. |
RuleRegistry |
getRuleRegistry()
Deprecated. use GraphApplication.getRuleRegistry() |
abstract StatusBar |
getStatusBar()
Returns The StatusBar of the ApplicationFrame. |
java.lang.String |
getTitle()
Returns the title for this application frame that is used for the frame title. |
abstract ToolBar[] |
getToolBars()
Returns the ToolBar instances used within this ApplicationFrame,
the default one being at index 0 of the returned array. |
UIManager |
getUIManager()
Deprecated. use Application.getUIManager() instead! |
java.util.HashMap |
getUiMap()
Returns the HashMap to collect all the language-switch affected controls. |
abstract void |
init()
Initializes the ApplicationFrame. |
protected void |
installClipboard(VisualGraphView vgv)
Configures the VisualGraphView to use the clipboard mode
that has been set in the preferences. |
protected void |
installInteractionSettings(VisualGraphView vgv)
Configures the VisualGraphView to use the interaction
settings that have been set in the preferences. |
protected void |
installKeyboardCommands(VisualGraphView vgv)
This protected method is used in order to add to the passed VisualGraphView mappings between
KeyStrokes and BaseCommandes. |
protected void |
installLayoutController(GraphApplication gapp,
VisualGraphView vgv)
Configures the given VisualGraphView instance in case no
LayoutController is associated to use a copy of the
LayoutController assigned to the given
GraphApplication and marked as default
LayoutController. |
protected void |
installListeners()
Should be called by the implementation after the GUI has been initialized to install some default listeners. |
boolean |
isApplet()
Returns true if this ApplicationFrame is used in an
AppletContext. |
abstract Document |
newDocument()
Creates a new Document. |
abstract Document |
openDocument(java.io.File file)
This method is responsible to load a document from a specified file location. |
abstract Document |
openDocument(java.io.InputStream is,
java.lang.String name)
This method is responsible to load a document from a specified input stream. |
boolean |
registerDragRepresentation(VisualGraphView vgv)
Override this method to register the drag representation for fixing Interactable instances. |
boolean |
registerHighlightRepresentation(VisualGraphView vgv)
Override this method to register the highlight representation for fixing Interactable instances. |
boolean |
removePostLaunchTask(java.lang.Runnable postLaunchTask)
Removed a Runnable from the list that is processed when
calling runPostLaunchTasks() which should be done after the
application is on screen. |
void |
runPostLaunchTasks()
Processes all added PostLaunchTasks |
abstract void |
saveDocument(Document document,
java.io.File file)
This method is responsible to save a given document to a specified file location. |
abstract void |
saveDocument(Document document,
java.io.OutputStream os)
This method is responsible to save a given document to a specified output stream. |
abstract void |
savePreferences()
Stores the current settings of the application frame to the preferences |
void |
setAutomaticLayoutContextName(java.lang.String layoutContextName)
Deprecated. This method is no longer used by the framework |
abstract void |
setGraphPanelPopupMenuSource(JPopupMenuSourceWithUpdateUI graphPanelPopupMenuSource)
Sets the popup menu instance for this application's graph panels. |
void |
setLocale(java.util.Locale locale)
Sets the application locale, loads the text resources for the given locale and updates the gui. |
void |
setPreferences(Preferences preferences)
Deprecated. use Application.setPreferences(Preferences) instead! |
void |
setRuleRegistry(RuleRegistry registry)
Deprecated. use {@link GraphApplication#setRuleRegistry(RuleRegistry) |
protected void |
updateResources(java.util.Locale locale)
Updates the text resources of the application for the given locale by (re)loading the resource bundles. |
void |
updateStatus(java.lang.Object caller,
java.lang.Object obj)
This method can be seen as the ultimate drain for update signals. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface com.tensegrity.gui.Evaluable |
applyEvList, installEvList |
| Field Detail |
public static final int UNDEFINED
public static final int NORTH
public static final int NORTHEAST
public static final int EAST
public static final int SOUTHEAST
public static final int SOUTH
public static final int SOUTHWEST
public static final int WEST
public static final int NORTHWEST
public static final int TYPE_NEW_DOCUMENT
configureDocumentView(Document, int)
public static final int TYPE_LOADED_DOCUMENT
configureDocumentView(Document, int)
public static final int TYPE_CLONED_DOCUMENT
configureDocumentView(Document, int)
protected Application application
| Constructor Detail |
public ApplicationFrame(Application application)
ApplicationFrame instance.
| Method Detail |
protected final void installListeners()
public abstract void init()
public abstract MenuBar getMenuBar()
public abstract void configureEmptyDocument(Document document)
document - The document to configure
public abstract void configureDocumentView(Document document,
int documenttype)
document - The document to configuredocumenttype - A constant describing the source of this document,
one of these constants:
TYPE_NEW_DOCUMENT
TYPE_CLONED_DOCUMENT
TYPE_LOADED_DOCUMENTpublic abstract void configureNewDocument(Document document)
document - newly created document to be configured.public abstract JPopupMenuSourceWithUpdateUI getGraphPanelPopupMenuSource()
public abstract void setGraphPanelPopupMenuSource(JPopupMenuSourceWithUpdateUI graphPanelPopupMenuSource)
graphPanelPopupMenuSource - public abstract ToolBar[] getToolBars()
ToolBar instances used within this ApplicationFrame,
the default one being at index 0 of the returned array.
ToolBar instances used within this
ApplicationFrame.public abstract MDIComponent getMDIComponent()
MDIComponent of the this
ApplicationFrame.
MDIComponent of the this
ApplicationFrame.public abstract StatusBar getStatusBar()
public abstract Container getCustomContainer()
getCustomContainers() instead!
public Container[] getCustomContainers()
public abstract Frame getFrame()
null if this ApplicationFrame is running as Applet.
null.public abstract int getLayoutConstraint(Container container)
container - A container to retrieve the layout constraint for.
NORTH,
NORTHEAST,
NORTHWEST,
EAST,
WEST,
SOUTH,
SOUTHEAST,
SOUTHWESTpublic abstract Document newDocument()
public abstract Document openDocument(java.io.File file)
openDocument(InputStream, String).
file - the location to load the document from.
public abstract Document openDocument(java.io.InputStream is,
java.lang.String name)
is - the input stream to load the document from.name - the name for the loaded document
public abstract void saveDocument(Document document,
java.io.File file)
saveDocument(Document, OutputStream).
document - the document to save.file - the location to save the document to.
public abstract void saveDocument(Document document,
java.io.OutputStream os)
document - the document to save.os - the OutputStream to save the document to.public boolean isApplet()
true if this ApplicationFrame is used in an
AppletContext.
public java.util.HashMap getUiMap()
public void updateStatus(java.lang.Object caller,
java.lang.Object obj)
caller - The caller of this method.obj - an optional parameter to pass an object along. This could be
the updated item for example.public abstract GraphDocumentReader getGraphDocumentReader()
public abstract GraphDocumentWriter getGraphDocumentWriter()
public Frame getRootFrame()
public void setAutomaticLayoutContextName(java.lang.String layoutContextName)
All public string-constants defined in
GraphLayoutController are
possible. Also other values if appropriate layout-contexts were defined
previously. Legal values are:
GraphLayoutController.HierarchicalToLeft GraphLayoutController.HierarchicalToRight GraphLayoutController.HierarchicalToTop GraphLayoutController.HierarchicalToBottom GraphLayoutController.Circular Please note that this layoutContext is used globally.
The default value for the automatic LayoutContext name is
"_Hierarchical left to right" as defined in
GraphLayoutController.HierarchicalToRight.
layoutContextName - the name of the layout context as String.public java.lang.String getAutomaticLayoutContextName()
protected void installLayoutController(GraphApplication gapp,
VisualGraphView vgv)
VisualGraphView instance in case no
LayoutController is associated to use a copy of the
LayoutController assigned to the given
GraphApplication and marked as default
LayoutController.
gapp - the GraphApplication to take the default
LayoutController fromvgv - the VisualGraphView instance to configureprotected void installInteractionSettings(VisualGraphView vgv)
VisualGraphView to use the interaction
settings that have been set in the preferences.
vgv - The VisualGraphView to configurepublic boolean registerDragRepresentation(VisualGraphView vgv)
Interactable instances. In subclasses call super after
you have registered the representations.
vgv - The VisualGraphView the representation should be
registered to.
public boolean registerHighlightRepresentation(VisualGraphView vgv)
Interactable instances. In subclasses call super after you
have registered the representations.
vgv - The VisualGraphView the representation should be
registered to.
protected void installClipboard(VisualGraphView vgv)
VisualGraphView to use the clipboard mode
that has been set in the preferences.
vgv - The VisualGraphView to configureprotected void installKeyboardCommands(VisualGraphView vgv)
VisualGraphView mappings between
KeyStrokes and BaseCommandes.
vgv - the VisualGraphView to add the keyboards to.KeyStrokeProvider.getCommandIds()
protected void addKeyCommand(VisualGraphView visualgraphview,
java.lang.String commandId)
KeyStroke
corresponding to the passed commandId using the
KeyStrokeProvider class and adds it to the passed
VisualGraphView.
visualgraphview - the VisualGraphView to the keyboard command to.commandId - the command to add.public java.lang.String getResourceName()
getResourceNames() instead!
public java.util.List getResourceNames()
getResourceName() method.
Strings of
resource files paths.public void setLocale(java.util.Locale locale)
locale - The locale to switch to.protected void updateResources(java.util.Locale locale)
locale - The locale to load the resources for.public AttributeEditorTranslatorPool getAttributeEditorTranslatorPool()
AttributeEditorTranslatorPool this application
is using. This may be null if no pool is used.
AttributeEditorTranslatorPool this application
is usingpublic AttributeEditorTranslator getPreferenceAttributeEditorTranslator()
AttributeEditorTranslator this application
is using for editing preferences. This may be null if none is used.
AttributeEditorTranslator this application
is using for editing preferences.public AttributeEditorTranslator getAttributeEditorTranslator()
AttributeEditorTranslator this application
is using for editing attributes in the main attribute editor. This may
be null if none is used.
AttributeEditorTranslator this application
is using for editing attributes in the main attribute editor.public AttributeEditorTranslator getLayoutEditorTranslator()
AttributeEditorTranslator this application
is using for editing attributes in the layout attributes editor. This may
be null if none is used.
AttributeEditorTranslator this application
is using for editing attributes in the layout attribute editor.public abstract AttributeEditorContainer getAttributeEditorContainer()
AttributeEditorContainer or null
if no such Container is used by this Application.
AttributeEditorContainer of this Application
or null.public abstract NavigatorContainer getNavigatorContainer()
NavigatorContainer of this Application
or null if no such Container is used.
NavigatorContainer of this Application
or null.public abstract LayoutToolsContainer getLayoutToolsContainer()
LayoutToolsContainer of this Application
or null if no such Container is used.
LayoutToolsContainer of this Application
or null.public abstract OutlinerContainer getOutlinerContainer()
OutlinerContainer of this Application
or null if no such Container is used.
OutlinerContainer of this Application or
null.public abstract RepositoryContainer getRepositoryContainer()
RepositoryContainer of this Application
or null if no such Container is used.
RepositoryContainer of this Application
or null.public Application getApplication()
public DocumentDropContext getDocumentDropContext()
public java.lang.String getTitle()
public void addPostLaunchTask(java.lang.Runnable postLaunchTask)
Runnable that is processed when calling
runPostLaunchTasks() which should be done after the
application is on screen.
postLaunchTask - The Runnable to addpublic boolean removePostLaunchTask(java.lang.Runnable postLaunchTask)
Runnable from the list that is processed when
calling runPostLaunchTasks() which should be done after the
application is on screen.
postLaunchTask - The Runnable to remove
public void runPostLaunchTasks()
public boolean exit()
public abstract void savePreferences()
public KeyStrokeProvider getKeyStrokeProvider()
Application.getKeyStrokeProvider() instead!
Application.getKeyStrokeProvider()public UIManager getUIManager()
Application.getUIManager() instead!
Application.getUIManager()public Preferences getPreferences()
Application.getPreferences() instead!
Application.getPreferences()public CommandRegistry getCommandRegistry()
Application.getCommandRegistry() instead!
Application.getCommandRegistry()public void setPreferences(Preferences preferences)
Application.setPreferences(Preferences) instead!
Application.setPreferences(Preferences)public LayoutController getDefaultLayoutController()
GraphApplication.getDefaultLayoutController()
GraphApplication.getDefaultLayoutController()public DragContext getDragContext()
GraphApplication.getDragContext()
GraphApplication.getDragContext()public java.util.Locale getLocale()
Application.getLocale()
Application.getLocale()public Applet getApplet()
Application.getApplet()
Application.getApplet()public RuleRegistry getRuleRegistry()
GraphApplication.getRuleRegistry()
GraphApplication.getRuleRegistry()public void setRuleRegistry(RuleRegistry registry)
GraphApplication.setRuleRegistry(RuleRegistry)
public void documentPreAdd(DocumentEvent documentevent)
throws DocumentEventVetoException
DocumentListener
documentPreAdd in interface DocumentListenerdocumentevent - the documentevent structure carrying information.
DocumentEventVetoException - indicates that the documentevent is
not desired.public void documentAdded(DocumentEvent documentevent)
DocumentListener
documentAdded in interface DocumentListenerdocumentevent - the documentevent structure carrying information.
public void documentPreRemove(DocumentEvent documentevent)
throws DocumentEventVetoException
DocumentListener
documentPreRemove in interface DocumentListenerdocumentevent - the documentevent structure carrying information.
DocumentEventVetoException - indicates that the documentevent is
not desired.public void documentRemoved(DocumentEvent documentevent)
DocumentListener
documentRemoved in interface DocumentListenerdocumentevent - the documentevent structure carrying information.public void documentSelected(DocumentEvent documentevent)
DocumentListener
documentSelected in interface DocumentListenerdocumentevent - the documentevent structure carrying information.public void documentUnselected(DocumentEvent documentevent)
DocumentListener
documentUnselected in interface DocumentListenerdocumentevent - the documentevent structure carrying information.public void documentModelChanged(DocumentEvent documentevent)
DocumentListener
documentModelChanged in interface DocumentListenerdocumentevent - the documentevent structure carrying information.protected final com.tensegrity.application.ApplicationFrame.CompositeViewListener getCompositeViewListener()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||