org.fife.ui.app
Interface GUIApplication

All Superinterfaces:
DockableWindowConstants, GUIApplicationConstants
All Known Implementing Classes:
AbstractGUIApplication, AbstractPluggableGUIApplication, RText

public interface GUIApplication
extends GUIApplicationConstants

An interface for a generic GUI application. Your Swing application can override AbstractGUIApplication to have some of its basic code already implemented.

This class provides the framework for a GUI application having the following features:

Version:
0.5
Author:
Robert Futrell
See Also:
AbstractGUIApplication, AbstractPluggableGUIApplication

Nested Class Summary
static class GUIApplication.AboutAction
          The action that displays the application's About dialog.
static class GUIApplication.ExitAction
          Action that attempts to close the application.
static class GUIApplication.HelpAction
          The action that displays the application's Help dialog.
static class GUIApplication.ToggleStatusBarAction
          Action to toggle a GUIApplication's status bar.
static class GUIApplication.ToggleToolBarAction
          Action to toggle a GUIApplication's toolbar.
 
Field Summary
 
Fields inherited from interface org.fife.ui.app.GUIApplicationConstants
OS_LINUX, OS_MAC_OSX, OS_OTHER, OS_WINDOWS
 
Fields inherited from interface org.fife.ui.dockablewindows.DockableWindowConstants
BOTTOM, FLOATING, LEFT, RIGHT, TOP
 
Method Summary
 void addAction(java.lang.String key, javax.swing.Action action)
          Adds an action to this application's action map.
 void displayException(java.awt.Dialog dialog, java.lang.Throwable t)
          This method should be overridden to convey to the user that an Exception occurred in some way, for example, in a dialog box.
 void displayException(java.awt.Frame frame, java.lang.Throwable t)
          This method should be overridden to convey to the user that an Exception occurred in some way, for example, in a dialog box.
 void displayException(java.lang.Throwable t)
          This method should be overridden to convey to the user that an Exception occurred in some way, for example, in a dialog box.
 void doExit()
          Called when the user attempts to close the application, whether from an "Exit" menu item, closing the main application window, or any other means.
 javax.swing.JDialog getAboutDialog()
          Returns the About dialog for this application.
 javax.swing.Action getAction(java.lang.String key)
          Returns one of this application's actions.
 java.util.SortedSet<java.lang.String> getActionKeys()
          Returns the keys of all actions known to this application.
 javax.swing.Action[] getActions()
          Returns the actions of this GUI application as an array.
 HelpDialog getHelpDialog()
          Returns the Help dialog for this application, or null if this application does not have a Help dialog.
 java.awt.Image getIconImage()
          Return the image used for the icon of this GUI application.
 java.lang.String getInstallLocation()
          Returns the directory in which this GUI application is installed (running).
 javax.swing.JMenuBar getJMenuBar()
          Returns the menu bar this application is using.
 java.lang.String getLanguage()
          Returns the language used by this GUI application, in a Locale-friendly language string; e.g., en or es.
 int getOS()
          Returns an integer constant representing the OS.
 java.util.ResourceBundle getResourceBundle()
          Returns the resource bundle associated with this application.
 StatusBar getStatusBar()
          Returns the status bar this application is using.
 boolean getStatusBarVisible()
          Returns whether the status bar is visible.
 CustomizableToolBar getToolBar()
          Returns the toolbar this application is using.
 boolean getToolBarVisible()
          Returns whether the toolbar is visible in this application.
 java.lang.String getVersionString()
          Returns the version string for this application.
 boolean isMaximized()
          Returns true if this application's main window is maximized.
 GUIApplicationPreferences loadPreferences()
          Loads the preferences for this GUI application.
 void pack()
          Repacks the GUI application's main window.
 void setJMenuBar(javax.swing.JMenuBar menuBar)
          Sets the menu bar to use in this application.
 void setLanguage(java.lang.String language)
          Sets the language for this GUI application and all of its dialogs, UI widgets, etc.
 void setStatusBar(StatusBar statusBar)
          Sets the status bar to use in this application.
 void setStatusBarVisible(boolean visible)
          Sets whether the status bar is visible.
 void setToolBar(CustomizableToolBar toolBar)
          Sets the toolbar used by this GUI application.
 void setToolBarVisible(boolean visible)
          Sets whether the toolbar used by this GUI application is visible.
 

Method Detail

addAction

void addAction(java.lang.String key,
               javax.swing.Action action)
Adds an action to this application's action map.

Parameters:
key - The key with which to fetch the action via getAction.
action - The action to add.
See Also:
getAction(String)

displayException

void displayException(java.lang.Throwable t)
This method should be overridden to convey to the user that an Exception occurred in some way, for example, in a dialog box.

Parameters:
t - The exception/throwable that occurred.

displayException

void displayException(java.awt.Dialog dialog,
                      java.lang.Throwable t)
This method should be overridden to convey to the user that an Exception occurred in some way, for example, in a dialog box. This version is useful if a child dialog of the GUI application threw the Exception.

Parameters:
dialog - The child dialog that threw the Exception.
t - The exception/throwable that occurred.

displayException

void displayException(java.awt.Frame frame,
                      java.lang.Throwable t)
This method should be overridden to convey to the user that an Exception occurred in some way, for example, in a dialog box. This version is useful if a child frame of the GUI application threw the Exception.

Parameters:
frame - The child frame that threw the Exception.
t - The exception/throwable that occurred.

doExit

void doExit()
Called when the user attempts to close the application, whether from an "Exit" menu item, closing the main application window, or any other means. Applications should override this method to do any cleanup before the application exits. You can also prevent the application from closing based on the application's state in this method.


getAboutDialog

javax.swing.JDialog getAboutDialog()
Returns the About dialog for this application.

Returns:
The About dialog.
See Also:
AboutDialog

getAction

javax.swing.Action getAction(java.lang.String key)
Returns one of this application's actions.

Returns:
The action, or null if no action exists for the specified key.
See Also:
addAction(String, Action), getActions()

getActionKeys

java.util.SortedSet<java.lang.String> getActionKeys()
Returns the keys of all actions known to this application.

Returns:
The action keys.
See Also:
getAction(String)

getActions

javax.swing.Action[] getActions()
Returns the actions of this GUI application as an array.

Returns:
The actions.
See Also:
getAction(String)

getHelpDialog

HelpDialog getHelpDialog()
Returns the Help dialog for this application, or null if this application does not have a Help dialog.

Returns:
The Help dialog.

getIconImage

java.awt.Image getIconImage()
Return the image used for the icon of this GUI application.

Returns:
The image.

getInstallLocation

java.lang.String getInstallLocation()
Returns the directory in which this GUI application is installed (running).

Returns:
The directory.

getJMenuBar

javax.swing.JMenuBar getJMenuBar()
Returns the menu bar this application is using.

Returns:
The menu bar.
See Also:
setJMenuBar(javax.swing.JMenuBar)

getLanguage

java.lang.String getLanguage()
Returns the language used by this GUI application, in a Locale-friendly language string; e.g., en or es.

Returns:
The language being used by this application.

getOS

int getOS()
Returns an integer constant representing the OS. This can be handy for special case situations such as Mac OS-X (special application registration) or Windows (allow mixed case, etc.).

Returns:
An integer constant representing the OS.

getResourceBundle

java.util.ResourceBundle getResourceBundle()
Returns the resource bundle associated with this application.

Returns:
The resource bundle.

getStatusBar

StatusBar getStatusBar()
Returns the status bar this application is using.

Returns:
The status bar.
See Also:
setStatusBar(org.fife.ui.StatusBar)

getStatusBarVisible

boolean getStatusBarVisible()
Returns whether the status bar is visible.

Returns:
Whether the status bar is visible.
See Also:
setStatusBarVisible(boolean)

getToolBar

CustomizableToolBar getToolBar()
Returns the toolbar this application is using.

Returns:
The toolbar.
See Also:
setToolBar(org.fife.ui.CustomizableToolBar)

getToolBarVisible

boolean getToolBarVisible()
Returns whether the toolbar is visible in this application.

Returns:
Whether the toolbar is visible.
See Also:
setToolBarVisible(boolean)

getVersionString

java.lang.String getVersionString()
Returns the version string for this application.

Returns:
The version string.

isMaximized

boolean isMaximized()
Returns true if this application's main window is maximized.

Returns:
true if this applicaiton's window is maximized, or false if it isn't.

loadPreferences

GUIApplicationPreferences loadPreferences()
Loads the preferences for this GUI application. If this application does not use preferences or something, null is goes wrong, null is returned.

Returns:
This application's preferences.

pack

void pack()
Repacks the GUI application's main window. This should be called after things are added or removed from it.


setJMenuBar

void setJMenuBar(javax.swing.JMenuBar menuBar)
Sets the menu bar to use in this application.

Parameters:
menuBar - The menu bar.
See Also:
getJMenuBar()

setLanguage

void setLanguage(java.lang.String language)
Sets the language for this GUI application and all of its dialogs, UI widgets, etc.

Parameters:
language - The language to use. If null, English will be used.

setStatusBar

void setStatusBar(StatusBar statusBar)
Sets the status bar to use in this application.

Parameters:
statusBar - The status bar to use.
See Also:
getStatusBar()

setStatusBarVisible

void setStatusBarVisible(boolean visible)
Sets whether the status bar is visible.

Parameters:
visible - Whether the status bar is to be visible.
See Also:
getStatusBarVisible()

setToolBar

void setToolBar(CustomizableToolBar toolBar)
Sets the toolbar used by this GUI application.

Parameters:
toolBar - The toolbar to use.
See Also:
getToolBar()

setToolBarVisible

void setToolBarVisible(boolean visible)
Sets whether the toolbar used by this GUI application is visible.

Parameters:
visible - Whether the toolbar should be visible.
See Also:
getToolBarVisible()