org.fife.ui.app
Class AbstractPluggableGUIApplication

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by java.awt.Window
              extended by java.awt.Frame
                  extended by javax.swing.JFrame
                      extended by org.fife.ui.app.AbstractGUIApplication
                          extended by org.fife.ui.app.AbstractPluggableGUIApplication
All Implemented Interfaces:
com.apple.osxadapter.NativeMacApp, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants, GUIApplication, GUIApplicationConstants, DockableWindowConstants
Direct Known Subclasses:
RText

public abstract class AbstractPluggableGUIApplication
extends AbstractGUIApplication

An extension of AbstractGUIApplication adding the ability to add/remove plug-ins.

Version:
0.5
Author:
Robert Futrell
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JFrame
javax.swing.JFrame.AccessibleJFrame
 
Nested classes/interfaces inherited from class java.awt.Frame
java.awt.Frame.AccessibleAWTFrame
 
Nested classes/interfaces inherited from class java.awt.Window
java.awt.Window.AccessibleAWTWindow
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Nested classes/interfaces inherited from interface org.fife.ui.app.GUIApplication
GUIApplication.AboutAction, GUIApplication.ExitAction, GUIApplication.HelpAction, GUIApplication.ToggleStatusBarAction, GUIApplication.ToggleToolBarAction
 
Field Summary
 
Fields inherited from class org.fife.ui.app.AbstractGUIApplication
ABOUT_ACTION_KEY, actualContentPane, EXIT_ACTION_KEY, HELP_ACTION_KEY, mainContentPanel, STATUS_BAR_PROPERTY, STATUS_BAR_VISIBLE_PROPERTY, TOOL_BAR_PROPERTY, TOOL_BAR_VISIBLE_PROPERTY
 
Fields inherited from class javax.swing.JFrame
accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
 
Fields inherited from class java.awt.Frame
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
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
 
Fields inherited from interface javax.swing.WindowConstants
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
AbstractPluggableGUIApplication(java.lang.String jarFile)
          Constructor.
AbstractPluggableGUIApplication(java.lang.String title, java.lang.String jarFile)
          Constructor.
AbstractPluggableGUIApplication(java.lang.String title, java.lang.String jarFile, GUIApplicationPreferences prefs)
          Constructor.
 
Method Summary
 void addPlugin(Plugin plugin)
          Adds a plugin to this GUI application.
 Plugin[] getPlugins()
          Returns all installed plug-ins.
 int getSplitPaneDividerLocation(int splitPane)
          Returns the location of the divider of the specified split pane.
protected  void handleInstallPlugin(Plugin plugin)
          Does the dirty work of actually installing a plugin.
 boolean isPluginLoadingComplete()
          Returns whether all plug-ins have been loaded for this application.
protected  void preDisplayInit(GUIApplicationPreferences prefs, SplashScreen splashScreen)
          This is called in the GUI application's constructor.
 boolean removePlugin(Plugin plugin)
          Tries to uninstall and remove the specified plugin.
 void setContentPane(java.awt.Container contentPane)
          This method sets the content pane.
 void setSplitPaneDividerLocation(int splitPane, int pos)
          Sets the position of the divider for the specified split pane.
 
Methods inherited from class org.fife.ui.app.AbstractGUIApplication
about, addAction, addToolBar, createAboutDialog, createActions, createMenuBar, createSplashScreen, createStatusBar, createToolBar, displayException, displayException, displayException, displayException, displayException, displayException, doExit, get3rdPartyLookAndFeelInfo, getAboutDialog, getAction, getActionKeys, getActions, getContentPane, getHelpDialog, getInstallLocation, getLanguage, getLocationOfJar, getLookAndFeelManager, getOptionsDialog, getOS, getPreferencesClassName, getResourceBundle, getResourceBundleClassName, getStatusBar, getStatusBarVisible, getString, getString, getString, getString, getString, getToolBar, getToolBarVisible, getVersionString, isMaximized, loadActionShortcuts, loadPreferences, openFile, preferences, preMenuBarInit, preStatusBarInit, preToolBarInit, processWindowEvent, quit, saveActionShortcuts, setLanguage, setLookAndFeelManager, setStatusBar, setStatusBarVisible, setToolBar, setToolBarVisible, updateLookAndFeel
 
Methods inherited from class javax.swing.JFrame
addImpl, createRootPane, frameInit, getAccessibleContext, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, remove, repaint, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
 
Methods inherited from class java.awt.Frame
addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setResizable, setState, setTitle, setUndecorated
 
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOwnedWindows, getOwner, getOwnerlessWindows, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isShowing, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setVisible, show, toBack, toFront
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, setBackground, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.fife.ui.app.GUIApplication
getIconImage, getJMenuBar, pack, setJMenuBar
 
Methods inherited from interface java.awt.MenuContainer
getFont, postEvent
 

Constructor Detail

AbstractPluggableGUIApplication

public AbstractPluggableGUIApplication(java.lang.String jarFile)
Constructor.

Parameters:
jarFile - The name (not full path) of the JAR file containing the main class of this application (e.g. "Foobar.jar").

AbstractPluggableGUIApplication

public AbstractPluggableGUIApplication(java.lang.String title,
                                       java.lang.String jarFile)
Constructor.

Parameters:
title - The title for this frame.
jarFile - The name (not full path) of the JAR file containing the main class of this application (e.g. "Foobar.jar").

AbstractPluggableGUIApplication

public AbstractPluggableGUIApplication(java.lang.String title,
                                       java.lang.String jarFile,
                                       GUIApplicationPreferences prefs)
Constructor. This constructor is useful when you are making a clone of the current application (e.g., "Open in New Window...") and you want the two instances to have the same properties.

Parameters:
title - The title for this frame.
jarFile - The name (not full path) of the JAR file containing the main class of this application (e.g. "Foobar.jar").
prefs - The preferences with which to initialize this application.
Method Detail

addPlugin

public final void addPlugin(Plugin plugin)
Adds a plugin to this GUI application. Note this should only be called on the EDT.

Parameters:
plugin - The plugin to add.
See Also:
handleInstallPlugin(org.fife.ui.app.Plugin), removePlugin(org.fife.ui.app.Plugin), isPluginLoadingComplete()

getPlugins

public Plugin[] getPlugins()
Returns all installed plug-ins. Note that this returns the actual plug-ins and not deep copies, so any changes made to the plug-ins in the array will affect the application itself.

Returns:
All installed plug-ins. If no plug-ins are installed, a zero-length array is returned.
See Also:
addPlugin(Plugin), removePlugin(Plugin), isPluginLoadingComplete()

getSplitPaneDividerLocation

public int getSplitPaneDividerLocation(int splitPane)
Returns the location of the divider of the specified split pane.

Parameters:
splitPane - One of GUIApplicationConstants.TOP, LEFT, BOTTOM, or RIGHT.
Throws:
java.lang.IllegalArgumentException - If splitPane is invalid.
See Also:
setSplitPaneDividerLocation(int, int)

handleInstallPlugin

protected void handleInstallPlugin(Plugin plugin)
Does the dirty work of actually installing a plugin. This method should be overridden by subclasses to do stuff as appropriate for a plugin. A subclass of GUIPlugin will already have its dockable windows added to the GUI; anything else that is application-specific should be done here.

This default version of the method does nothing.

Parameters:
plugin - The plugin to install.

isPluginLoadingComplete

public boolean isPluginLoadingComplete()
Returns whether all plug-ins have been loaded for this application. This does not count plug-ins added programmatically via addPlugin(Plugin), although that isn't usually done (plug-ins are usually all loaded automatically by the PluginLoader.

Returns:
Whether the loading of plug-ins is complete.

preDisplayInit

protected void preDisplayInit(GUIApplicationPreferences prefs,
                              SplashScreen splashScreen)
This is called in the GUI application's constructor. It is a chance for subclasses to do initialization of stuff that will be needed by the application right before it is displayed.

This method loads all plug-ins. If you override this method, you should be sure to call super.preDisplayInit(). This should be called after the GUI has been finalized so that plug-ins can access all parts of the GUI.

Specified by:
preDisplayInit in class AbstractGUIApplication
Parameters:
prefs - The preferences of the application.
splashScreen - The "splash screen" for this application. This value may be null.

removePlugin

public boolean removePlugin(Plugin plugin)
Tries to uninstall and remove the specified plugin. This should only be called on the EDT.

Parameters:
plugin - The plugin to remove.
Returns:
Whether the uninstall was successful.
See Also:
addPlugin(Plugin)

setContentPane

public void setContentPane(java.awt.Container contentPane)
This method sets the content pane. It is overridden so it does not meddle with the status bar, toolbar, etc.

Specified by:
setContentPane in interface javax.swing.RootPaneContainer
Overrides:
setContentPane in class AbstractGUIApplication
Parameters:
contentPane - The new content pane.
See Also:
AbstractGUIApplication.getContentPane()

setSplitPaneDividerLocation

public void setSplitPaneDividerLocation(int splitPane,
                                        int pos)
Sets the position of the divider for the specified split pane. Note that if no plug-ins are docked at the specified location (and thus no split pane is there), this method does nothing.

Parameters:
splitPane - The split pane for which to set the divider location; one of GUIApplicationConstants.TOP, LEFT, BOTTOM or RIGHT.
pos - The new position for the divider.
See Also:
getSplitPaneDividerLocation(int)