com.tensegrity.application
Class DefaultGraphApplication

java.lang.Object
  extended bycom.tensegrity.application.DefaultGraphApplication
All Implemented Interfaces:
Application, GraphApplication
Direct Known Subclasses:
DefaultSwingGraphApplication, DefaultSwtGraphApplication

public abstract class DefaultGraphApplication
extends java.lang.Object
implements GraphApplication

The class DefaultGraphApplication is a default implementation of common functionality of a GraphApplication. It is still abstract though. Subclasses have to provide the application title, the resources and the implementations of some abstract methods introduced here.

Author:
BurkhardWick

Field Summary
protected  ApplicationFrame[] applicationFrames
          applicationFrames: internal array of ApplicationFrames.
 
Constructor Summary
DefaultGraphApplication(Applet applet)
          Constructor
 
Method Summary
protected abstract  ApplicationFrame[] createApplicationFrames()
          This method creates the ApplicationFrames of the application.
 Applet getApplet()
          Returns the applet if this application runs in an applet context or null if this is a standalone application.
 ApplicationFrame getApplicationFrame()
          Returns the active ApplicationFrame of this application.
 ApplicationFrame[] getApplicationFrames()
          Returns all ApplicationFrames of this application.
 CommandRegistry getCommandRegistry()
          Returns the CommandRegistry of this Application.
 LayoutController getDefaultLayoutController()
          Returns this applications default layout controller.
 DragContext getDragContext()
          Instance variable for the DragContext that is assigned to a concrete instance of an ApplicationFrame
 java.util.Locale getLocale()
          Returns the currently set Locale.
 PreferenceHelp getPreferenceHelp()
          Returns a PreferenceHelp instance that can be used to perform common tasks involving preferences.
 Preferences getPreferences()
          Returns the Preferences instance used by this Application.
 RuleRegistry getRuleRegistry()
          Returns this applications ruleregistry.
 java.util.List getUIManagerResources()
          Returns a list with all resource bundles the UIManager should load at initialization time.
protected abstract  void initGraphicsEnvironment()
          Implementations of this method should initialize the graphics environment. e.g. instances of TextOperations and ImageOperations should be registered here.
protected  void initLocale()
          Initializes the locale of the application.
 void savePreferences()
          Saves the currently stored Preferences of this application.
 void setPreferenceHelp(PreferenceHelp preferenceHelp)
          Sets the PreferenceHelp instance that can be used to perform common tasks involving preferences.
 void setPreferences(Preferences preferences)
          Sets the Preferences instance used by this Application.
 void setRuleRegistry(RuleRegistry ruleRegistry)
          Sets the applications ruleregistry.
 void showError(java.lang.String errormessage)
          Asks the application to show an error message-box with the given text.
 boolean shutDown()
          Invoked when the Application should be shut down.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.tensegrity.application.Application
getDefaultPreferencesFileName, getDefaultPreferencesLoadClass, getKeyStrokeProvider, getPreferencesFileName, getTitle, getUIManager, launch
 

Field Detail

applicationFrames

protected ApplicationFrame[] applicationFrames
applicationFrames: internal array of ApplicationFrames. Do not access this variable. It is only 'protected' for internal reasons.

Constructor Detail

DefaultGraphApplication

public DefaultGraphApplication(Applet applet)
Constructor

Parameters:
applet - The applet to use as context or null, if the application should be launched as stand alone.
Method Detail

getDragContext

public DragContext getDragContext()
Description copied from interface: GraphApplication
Instance variable for the DragContext that is assigned to a concrete instance of an ApplicationFrame

Specified by:
getDragContext in interface GraphApplication
Returns:
the current DragContext.

getRuleRegistry

public RuleRegistry getRuleRegistry()
Description copied from interface: GraphApplication
Returns this applications ruleregistry.

Specified by:
getRuleRegistry in interface GraphApplication
Returns:
the rule registry of this application

setRuleRegistry

public void setRuleRegistry(RuleRegistry ruleRegistry)
Description copied from interface: GraphApplication
Sets the applications ruleregistry.

Specified by:
setRuleRegistry in interface GraphApplication
Parameters:
ruleRegistry - the rule registry of this application

getDefaultLayoutController

public LayoutController getDefaultLayoutController()
Description copied from interface: GraphApplication
Returns this applications default layout controller.

Specified by:
getDefaultLayoutController in interface GraphApplication
Returns:
the default layout controller of this application

getPreferences

public Preferences getPreferences()
Description copied from interface: Application
Returns the Preferences instance used by this Application.

Specified by:
getPreferences in interface Application
Returns:
the Preferences instance of this Application.

setPreferences

public void setPreferences(Preferences preferences)
Description copied from interface: Application
Sets the Preferences instance used by this Application.

Specified by:
setPreferences in interface Application
Parameters:
preferences - the Preferences instance of this Application.

getUIManagerResources

public java.util.List getUIManagerResources()
Description copied from interface: Application
Returns a list with all resource bundles the UIManager should load at initialization time.

Specified by:
getUIManagerResources in interface Application
Returns:
a list with all resource bundles the UIManager should load at initialization time.

getCommandRegistry

public CommandRegistry getCommandRegistry()
Description copied from interface: Application
Returns the CommandRegistry of this Application.

Specified by:
getCommandRegistry in interface Application
Returns:
the CommandRegistry instance of this Application.

getLocale

public java.util.Locale getLocale()
Description copied from interface: Application
Returns the currently set Locale.

Specified by:
getLocale in interface Application
Returns:
the currently set Locale.

shutDown

public boolean shutDown()
Description copied from interface: Application
Invoked when the Application should be shut down. Returns false if the shut down should be canceled, otherwise true. Usually this method does not return at all and ends with a System.exit(0) call.

Specified by:
shutDown in interface Application
Returns:
false if the shut down should be canceled.

showError

public void showError(java.lang.String errormessage)
Description copied from interface: Application
Asks the application to show an error message-box with the given text.

Specified by:
showError in interface Application
Parameters:
errormessage - the text to display as the error.

getApplicationFrames

public ApplicationFrame[] getApplicationFrames()
Description copied from interface: Application
Returns all ApplicationFrames of this application.

Specified by:
getApplicationFrames in interface Application
Returns:
all ApplicationFrames of this application.

getApplicationFrame

public ApplicationFrame getApplicationFrame()
Description copied from interface: Application
Returns the active ApplicationFrame of this application.

Specified by:
getApplicationFrame in interface Application
Returns:
the active ApplicationFrame of this application.

getApplet

public Applet getApplet()
Description copied from interface: Application
Returns the applet if this application runs in an applet context or null if this is a standalone application.

Specified by:
getApplet in interface Application
Returns:
the applet or null

getPreferenceHelp

public PreferenceHelp getPreferenceHelp()
Description copied from interface: Application
Returns a PreferenceHelp instance that can be used to perform common tasks involving preferences.

Specified by:
getPreferenceHelp in interface Application
Returns:
a PreferenceHelp instance that can be used to perform common tasks involving preferences.

setPreferenceHelp

public void setPreferenceHelp(PreferenceHelp preferenceHelp)
Description copied from interface: Application
Sets the PreferenceHelp instance that can be used to perform common tasks involving preferences.

Specified by:
setPreferenceHelp in interface Application
Parameters:
preferenceHelp - the PreferenceHelp instance that can be used to perform common tasks involving preferences.

savePreferences

public void savePreferences()
Saves the currently stored Preferences of this application. This method does nothing, if getPreferences() returns null.

Specified by:
savePreferences in interface Application

initLocale

protected void initLocale()
Initializes the locale of the application. This method is called in the constructor before creating the GUI, so all dialogs will be created using the locale that is set in this method.


createApplicationFrames

protected abstract ApplicationFrame[] createApplicationFrames()
This method creates the ApplicationFrames of the application.

Returns:
An array of created application frames. The array can be empty but it must not be null

initGraphicsEnvironment

protected abstract void initGraphicsEnvironment()
Implementations of this method should initialize the graphics environment. e.g. instances of TextOperations and ImageOperations should be registered here.



Copyright © 2005 Tensegrity Software GmbH. All Rights Reserved. Date of creation: 09.06.2006.