SRJRCFrames
v0.1.296

de.schwarzrot.app.support
Class AbstractApplication<C extends ApplicationConfig>

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by java.awt.Panel
              extended by java.applet.Applet
                  extended by javax.swing.JApplet
                      extended by de.schwarzrot.app.support.AbstractApplication<C>
Type Parameters:
C - - config type for application
All Implemented Interfaces:
Application<C>, ImageObserver, MenuContainer, Serializable, EventListener, Accessible, RootPaneContainer, ApplicationListener

public abstract class AbstractApplication<C extends ApplicationConfig>
extends JApplet
implements Application<C>

base class for a pluggable application. Application means some kind of controller with a main window. The meaning of "main window" depends on the configurated active desktop. Basic stuff stil to be implemented by any descendants:

createPane()
the most important function to implement, as it determines the look of the application (the content of the toplevel window).
createStatusBar()
create an implementation of StatusBar or just a subclass of AbstractStatusBar
ActionHandler
subclass an AbstractActionHandler to define the Actions and link the callbacks to the application-functions.
the application-functions
linked to useractions via ActionHandlers.

The Application uses the Applets lifecycle, as it is loaded at startup and stay alive until the applications frame terminates.

init
called when the application is loaded, but does not have an visual context yet
start
called when the visual context is created and the application should start user interaction
stop
called when the user closes the visual context. Depending on the active desktop, there may be other applications active, so the Application will stay alive, without visual context and of cause withou user interation
destroy
called when the application frame terminates. Depending on the active desktop, this may happen on closing the applications window or on closing the desktops window.

Author:
Reinhard Mantey
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JApplet
JApplet.AccessibleJApplet
 
Nested classes/interfaces inherited from class java.applet.Applet
Applet.AccessibleApplet
 
Nested classes/interfaces inherited from class java.awt.Panel
Panel.AccessibleAWTPanel
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
protected static RootWindowHandler desktop
           
protected static MessageSource msgSource
           
protected static TransactionFactory taFactory
           
 
Fields inherited from class javax.swing.JApplet
accessibleContext, rootPane, rootPaneCheckingEnabled
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface de.schwarzrot.app.Application
ID_NOT_IMPLEMENTED, TITLE_ERROR, TITLE_HINT, TITLE_NOT_IMPLEMENTED
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
protected AbstractApplication(String name)
           
 
Method Summary
protected abstract  JComponent createPane()
           
abstract  AbstractStatusBar createStatusBar()
           
 ApplicationActionHandler getActionHandler()
           
 C getAppConfig()
           
 ClassLoader getClassLoader()
           
 Container getContentPane()
           
 JToolBar getExtraToolBar(int orientation)
           
 DefaultMutableTreeNode getHelpRoot()
           
 JComponent getInfo()
           
 org.apache.commons.logging.Log getLogger()
           
 Window getMainWindow()
          returns the window, which contains the applications toplevel window.
 JMenuBar getMenuBar()
           
 Point getStartupPos(int defX, int defY)
           
 Dimension getStartupSize(Dimension defaultSize)
           
 AbstractStatusBar getStatusBar()
           
 String getTitleKey()
           
 JToolBar getToolBar()
           
 MainFrame getTopWindow()
          returns the area, where the visual parts of the application are shown.
 String getVersion()
           
 void init()
           
 boolean isCacheable()
           
 boolean isDefaultMaximized()
           
protected  boolean notImplementedYet()
           
 void onApplicationEvent(ApplicationEvent arg0)
           
 boolean preExit()
          called by desktop before the application will be closed.
 void refresh()
           
 void setActionHandler(ApplicationActionHandler handler)
           
 void setAppConfig(C appConfig)
           
 void setClassLoader(ClassLoader classLoader)
           
 void setDefaultMaximized(boolean defaultMaximized)
           
 void setHelpRoot(DefaultMutableTreeNode helpRoot)
           
 void setMenuBar(JMenuBar menuBar)
           
 void setName(String name)
           
 void setTitle(String title)
           
 void setToolBar(JToolBar toolBar)
           
 void setTopWindow(MainFrame topWindow)
           
protected abstract  void setup()
           
 void start()
           
 void stop()
           
 String toString()
           
 
Methods inherited from class javax.swing.JApplet
addImpl, createRootPane, getAccessibleContext, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isRootPaneCheckingEnabled, paramString, remove, repaint, setContentPane, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
 
Methods inherited from class java.applet.Applet
destroy, getAppletContext, getAppletInfo, getAudioClip, getAudioClip, getCodeBase, getDocumentBase, getImage, getImage, getLocale, getParameter, getParameterInfo, isActive, newAudioClip, play, play, resize, resize, setStub, showStatus
 
Methods inherited from class java.awt.Panel
addNotify
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, removeAll, removeContainerListener, removeNotify, setComponentZOrder, setFocusCycleRoot, 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, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setPreferredSize, setSize, setSize, setVisible, show, show, size, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface de.schwarzrot.app.Application
destroy, getConfigPage, getName
 

Field Detail

desktop

protected static RootWindowHandler desktop

msgSource

protected static MessageSource msgSource

taFactory

protected static TransactionFactory taFactory
Constructor Detail

AbstractApplication

protected AbstractApplication(String name)
Method Detail

createStatusBar

public abstract AbstractStatusBar createStatusBar()
Specified by:
createStatusBar in interface Application<C extends ApplicationConfig>

getActionHandler

public final ApplicationActionHandler getActionHandler()
Specified by:
getActionHandler in interface Application<C extends ApplicationConfig>

getAppConfig

public final C getAppConfig()
Specified by:
getAppConfig in interface Application<C extends ApplicationConfig>

getClassLoader

public final ClassLoader getClassLoader()
Specified by:
getClassLoader in interface Application<C extends ApplicationConfig>

getContentPane

public Container getContentPane()
Specified by:
getContentPane in interface Application<C extends ApplicationConfig>
Specified by:
getContentPane in interface RootPaneContainer
Overrides:
getContentPane in class JApplet

getExtraToolBar

public final JToolBar getExtraToolBar(int orientation)
Specified by:
getExtraToolBar in interface Application<C extends ApplicationConfig>

getHelpRoot

public final DefaultMutableTreeNode getHelpRoot()
Specified by:
getHelpRoot in interface Application<C extends ApplicationConfig>

getInfo

public JComponent getInfo()
Specified by:
getInfo in interface Application<C extends ApplicationConfig>

getLogger

public final org.apache.commons.logging.Log getLogger()

getMainWindow

public final Window getMainWindow()
Description copied from interface: Application
returns the window, which contains the applications toplevel window. This is always a window - usable as parent for dialogs or so, but it does not necessarily be identical with the return value of getTopWindow. If both return values differ, the window from getMainWindow() is the parent of getTopWindow().

Specified by:
getMainWindow in interface Application<C extends ApplicationConfig>
Returns:
the applications main window

getMenuBar

public final JMenuBar getMenuBar()
Specified by:
getMenuBar in interface Application<C extends ApplicationConfig>

getStartupPos

public final Point getStartupPos(int defX,
                                 int defY)
Specified by:
getStartupPos in interface Application<C extends ApplicationConfig>

getStartupSize

public Dimension getStartupSize(Dimension defaultSize)
Specified by:
getStartupSize in interface Application<C extends ApplicationConfig>

getStatusBar

public final AbstractStatusBar getStatusBar()
Specified by:
getStatusBar in interface Application<C extends ApplicationConfig>

getTitleKey

public final String getTitleKey()
Specified by:
getTitleKey in interface Application<C extends ApplicationConfig>

getToolBar

public final JToolBar getToolBar()
Specified by:
getToolBar in interface Application<C extends ApplicationConfig>

getTopWindow

public final MainFrame getTopWindow()
Description copied from interface: Application
returns the area, where the visual parts of the application are shown. That may be a window, but need not be. The returned type depends on the active desktop implementation.

Specified by:
getTopWindow in interface Application<C extends ApplicationConfig>
Returns:
the applications top visual area

getVersion

public final String getVersion()
Specified by:
getVersion in interface Application<C extends ApplicationConfig>

init

public final void init()
Specified by:
init in interface Application<C extends ApplicationConfig>
Overrides:
init in class Applet

isCacheable

public boolean isCacheable()

isDefaultMaximized

public final boolean isDefaultMaximized()

onApplicationEvent

public void onApplicationEvent(ApplicationEvent arg0)
Specified by:
onApplicationEvent in interface ApplicationListener

preExit

public boolean preExit()
Description copied from interface: Application
called by desktop before the application will be closed. An application can signal with the return value, that it is stil busy and should not be closed. The application should not assume, that the return value is respected in all cases.

Specified by:
preExit in interface Application<C extends ApplicationConfig>
Returns:
- a returnvalue of true means "ok to exit", false means "I'm still busy"

refresh

public final void refresh()
Specified by:
refresh in interface Application<C extends ApplicationConfig>

setActionHandler

public final void setActionHandler(ApplicationActionHandler handler)

setAppConfig

public final void setAppConfig(C appConfig)
Specified by:
setAppConfig in interface Application<C extends ApplicationConfig>

setClassLoader

public final void setClassLoader(ClassLoader classLoader)
Specified by:
setClassLoader in interface Application<C extends ApplicationConfig>

setDefaultMaximized

public final void setDefaultMaximized(boolean defaultMaximized)

setHelpRoot

public final void setHelpRoot(DefaultMutableTreeNode helpRoot)
Specified by:
setHelpRoot in interface Application<C extends ApplicationConfig>

setMenuBar

public final void setMenuBar(JMenuBar menuBar)
Specified by:
setMenuBar in interface Application<C extends ApplicationConfig>

setName

public final void setName(String name)
Specified by:
setName in interface Application<C extends ApplicationConfig>
Overrides:
setName in class Component

setTitle

public void setTitle(String title)
Specified by:
setTitle in interface Application<C extends ApplicationConfig>

setToolBar

public final void setToolBar(JToolBar toolBar)
Specified by:
setToolBar in interface Application<C extends ApplicationConfig>

setTopWindow

public void setTopWindow(MainFrame topWindow)
Specified by:
setTopWindow in interface Application<C extends ApplicationConfig>

start

public void start()
Specified by:
start in interface Application<C extends ApplicationConfig>
Overrides:
start in class Applet

stop

public void stop()
Specified by:
stop in interface Application<C extends ApplicationConfig>
Overrides:
stop in class Applet

toString

public String toString()
Overrides:
toString in class Component

createPane

protected abstract JComponent createPane()

notImplementedYet

protected boolean notImplementedYet()

setup

protected abstract void setup()

SRJRCFrames
v0.1.296

hosted at
Find SRJRCFrames at SourceForge.net. Fast, secure and free:
           Open Source Software download
Submit a bug or request a feature

SRJRCFrames is published according to the GNU General Public License
Copyright 2005-2012 Reinhard Mantey - some rights reserved.