All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.ibm.webrunner.bab.BABApp

java.lang.Object
   |
   +----com.ibm.webrunner.bab.BABApp

public class BABApp
extends Object
implements Serializable, FrameLayoutConstants
The BABApp is the controller of BAB Beans. The different BAB Beans share information and connected via BAB App. BAB App also serves as a registry where existence of the other BAB beans may be discovered. An application must have only one instance of BAB App at any time.

BAB APP provides with the following :

  1. UndoManager, that allows multi-level undo/redo of commands
  2. Single Entry point for applet or application run time (Not Available at this time )
  3. Context for application actions; Provides with application registered Model object and other application contextual information, frame, views, file extension to save application data, undo manager, statusbar, toolbar, etc.
  4. Selection and Activation Management for multiple views. (Not Available at this time )

The method modelChanged() must be called whenever your application model property is changed. This enables or diables the associated actions such as Save. Whenever the user performs a File->New or File->Open, BAB creates a new instance of your application model class and fires a NewModelEvent to make it known to other objects in the application. When this happens your Model instance has to be synchronized with the instance created by BAB.

The application main frame must be registered with the method setMainFrame(), additional frames may be added or removed with the methods addFrame() and removeFrame() respectively.

An application can replace the BABApp provided undoManager with it's own undoManager. This is normally done in multiple views applications that need an undo stack for each View. The view maintains it's own undoManager and replaces the BAB App undoManager with it's undoManager whenever it becomes an Active view.

Other Notes The method init() must be called just before realizing the GUI i.e. before calling the pack() or show() on the frame.
The Look and Feel Actions MetalAction, WindowsAction and Motif Actions require that all the application frames be registered with BAB App.

Modification(s) History :
09/15/98 - created

Version:
0.1
See Also:
addFrame

Variable Index

 o listenerList
 o LOOK_N_FEEL_USAGE
 o METAL
 o MOTIF
 o WINDOWS

Constructor Index

 o BABApp()
Empty constructor

Method Index

 o addAndDo(BCommand, BABContext)
Sets the presentation name and invokes doCommand() on the command, and pushes the command on the Undo satck
 o addFrame(JFrame)
Register an additional frame with the BAB App.
 o addNewModelListener(NewModelListener)
Add a listener to subscribe for NewModelEvent.
 o fireNewModelEvent(Object)
Send a NewModelEvent to the registered listeners to notify them of any state change.
 o getActions()
Returns all the BABApp aware actions
 o getAppDescription()
Returns the app description
 o getAppIcon()
Returns the app Icon
 o getAppletInstance()
Returns the applet instance
 o getAppMainFrame()
Returns the Main frame
 o getAppName()
Returns the app name
 o getAppResourceFile()
Return the Resouce File name with package name (without the extension) for your app.
 o getAppResources()
Returns the Resource bundle for your app.
 o getAppVersion()
Returns the app version
 o getCopyright()
Returns the copyright string
 o getCurrentLookAndFeel()
Return current Look and Feel
 o getFileExtension()
Returns the file extension for the app
 o getFrameLayout()
Returns the current frame layout
 o getFrames()
Retruns all the application frames
 o getInfoBus()
Returns this app's InfoBus
 o getModel()
Returns the application data model
 o getProperty(String)
Get value for a name.
 o getPropertyObject(String)
Returns a Property Object.
 o getStartupLookAndFeel()
Returns the startup look and feel
 o getStatusBar()
Returns the statusbar
 o getToolBar()
Returns the toolbar
 o getUndoManager()
Returns the UndoManager for the app
 o getViews()
Retruns all the BABApp aware views
 o init()
Initlizes the BAB App.
 o isApplet()
Is this an Applet ?
 o isAppletFrame()
Is this an AppletFrame ?
 o isAppletSecurityDisabled()
Returns true if applet security is disabled
 o isApplication()
Is this an Application ?
 o isIgnoreAppletVisibilityFlag()
Returns true if ignore applet visibilty flag is set to true
 o layItOut(Window, int)
Lay out the window.
 o modelChanged()
Notify the BAB App that model data has changed
 o removeFrame(JFrame)
Remove the frame that was previously registered with the BAB App.
 o removeNewModelListener(NewModelListener)
Remove a listener to un-subscribe for NewModelEvent.
 o setAppDescription(String)
Set app description
 o setAppIcon(Icon)
Set the app Icon
 o setAppletInstance(JApplet)
If this app is being run as an applet too, set the AppletInstance
 o setAppletSecurityDisabled(boolean)
Is the applet security disabled when run as applet, that allows the applet to access certain System resources such as disk, System registry, etc.
 o setAppMainFrame(JFrame)
Set the Main Frame of your app
 o setAppName(String)
Provide a name for your app
 o setAppResourceFile(String)
Set the Resouce File name with package name (without the extension) for your app.
 o setAppVersion(String)
Set app version
 o setCopyright(String)
Set copyright string for the app
 o setCurrentLookAndFeel(int)
Switch to a new look and feel.
 o setFileExtension(String)
Set File Extension that must be used for saving application data to a file
 o setFrameLayout(int)
Set where the frame be laid out
 o setIgnoreAppletVisibilityFlag(boolean)
Should BAB ignore applet enable flag set on all actions ? If so then the the irrespective of applet enable flag, all the actions are enabled when run as applet.
 o setInfoBus(BInfoBus)
Set the InfoBus bean for this app if infobus support is required
 o setLocale(Locale)
Sets a new Locale for your application.
 o setModel(Serializable)
Set the application data model
 o setProperty(String, Object)
Set Name-Value in the App's properties table.
 o setStartupLookAndFeel(int)
Which look and feel the app should start with, metal, windows or motif ?
 o setStatusBar(StatusBar)
Set the statusbar for this app
 o setToolBar(JToolBar)
Set the toolbar for this app
 o setUndoManager(UndoManager)
Set an undo Manager for the app, a default one is provided if not set

Variables

 o listenerList
 protected transient EventListenerList listenerList
 o METAL
 public static final int METAL
 o WINDOWS
 public static final int WINDOWS
 o MOTIF
 public static final int MOTIF
 o LOOK_N_FEEL_USAGE
 public static final String LOOK_N_FEEL_USAGE

Constructors

 o BABApp
 public BABApp()
Empty constructor

Methods

 o init
 public void init()
Initlizes the BAB App. This must be called before realizing the GUI, ie just before calling pack() or show() on the frame.

 o setAppName
 public void setAppName(String newAppName)
Provide a name for your app

 o getAppName
 public String getAppName()
Returns the app name

 o setAppDescription
 public void setAppDescription(String newAppDescription)
Set app description

 o getAppDescription
 public String getAppDescription()
Returns the app description

 o setAppIcon
 public void setAppIcon(Icon newAppIcon)
Set the app Icon

 o getAppIcon
 public Icon getAppIcon()
Returns the app Icon

 o setCopyright
 public void setCopyright(String newCopyright)
Set copyright string for the app

 o getCopyright
 public String getCopyright()
Returns the copyright string

 o setAppVersion
 public void setAppVersion(String newAppVersion)
Set app version

 o getAppVersion
 public String getAppVersion()
Returns the app version

 o setFileExtension
 public void setFileExtension(String newFileExtension)
Set File Extension that must be used for saving application data to a file

 o getFileExtension
 public String getFileExtension()
Returns the file extension for the app

 o setStartupLookAndFeel
 public void setStartupLookAndFeel(int newStartupLookAndFeel) throws IllegalArgumentException
Which look and feel the app should start with, metal, windows or motif ?

Parameters:
newStartupLookAndFeek - one of METAL, WIDNOWS or MOTIF
 o getStartupLookAndFeel
 public int getStartupLookAndFeel()
Returns the startup look and feel

 o setAppletSecurityDisabled
 public void setAppletSecurityDisabled(boolean newAppletSecurityDisabled)
Is the applet security disabled when run as applet, that allows the applet to access certain System resources such as disk, System registry, etc. If you have set your browser to allow access to these system resources for applets or this applet is certified when run, then set this flag to true

 o isAppletSecurityDisabled
 public boolean isAppletSecurityDisabled()
Returns true if applet security is disabled

 o setIgnoreAppletVisibilityFlag
 public void setIgnoreAppletVisibilityFlag(boolean newIgnoreAppletVisibilityFlag)
Should BAB ignore applet enable flag set on all actions ? If so then the the irrespective of applet enable flag, all the actions are enabled when run as applet.

 o isIgnoreAppletVisibilityFlag
 public boolean isIgnoreAppletVisibilityFlag()
Returns true if ignore applet visibilty flag is set to true

 o setUndoManager
 public void setUndoManager(UndoManager newUndoManager)
Set an undo Manager for the app, a default one is provided if not set

 o getUndoManager
 public UndoManager getUndoManager()
Returns the UndoManager for the app

 o getActions
 public Vector getActions()
Returns all the BABApp aware actions

 o getViews
 public Vector getViews()
Retruns all the BABApp aware views

 o getFrames
 public Vector getFrames()
Retruns all the application frames

 o setAppMainFrame
 public void setAppMainFrame(JFrame newAppMainFrame)
Set the Main Frame of your app

 o getAppMainFrame
 public JFrame getAppMainFrame()
Returns the Main frame

 o addAndDo
 public void addAndDo(BCommand command,
                      BABContext context)
Sets the presentation name and invokes doCommand() on the command, and pushes the command on the Undo satck

 o addFrame
 public void addFrame(JFrame frame)
Register an additional frame with the BAB App. The Main Frame is registered with setAppMainFrame().

 o removeFrame
 public void removeFrame(JFrame frame)
Remove the frame that was previously registered with the BAB App. App Main frames once registered cannot be removed.

 o setToolBar
 public void setToolBar(JToolBar newToolBar)
Set the toolbar for this app

 o getToolBar
 public JToolBar getToolBar()
Returns the toolbar

 o setStatusBar
 public void setStatusBar(StatusBar newStatusBar)
Set the statusbar for this app

 o getStatusBar
 public StatusBar getStatusBar()
Returns the statusbar

 o setModel
 public void setModel(Serializable newModel)
Set the application data model

 o getModel
 public Serializable getModel()
Returns the application data model

 o setInfoBus
 public void setInfoBus(BInfoBus newInfoBus)
Set the InfoBus bean for this app if infobus support is required

 o getInfoBus
 public BInfoBus getInfoBus()
Returns this app's InfoBus

 o setAppletInstance
 public void setAppletInstance(JApplet newAppletInstance)
If this app is being run as an applet too, set the AppletInstance

 o getAppletInstance
 public JApplet getAppletInstance()
Returns the applet instance

 o modelChanged
 public void modelChanged()
Notify the BAB App that model data has changed

 o setCurrentLookAndFeel
 public void setCurrentLookAndFeel(int which) throws IllegalArgumentException
Switch to a new look and feel. Note: This method is not swing thread safe. If the GUI is already realized and if you are not calling this from an event listener, then use SwingUtilities.invokeLater to invoke this method.

Parameters:
which - one of METAL, WIDNOWS or MOTIF
 o getCurrentLookAndFeel
 public int getCurrentLookAndFeel()
Return current Look and Feel

 o getProperty
 public String getProperty(String name)
Get value for a name. The order in which the 'name' is looked is as follows:

  • From name-value set explicitly and DYNAMICALLY by the user for the App, see below setProperty Though this is not the preferred way, beans within an App shell may exchange information through this.
    1. From Applet parameters, if this is being run as an applet.
    2. From Command line arguments if this is being run as an application.
    3. From your app Resources file.
    4. From Java System properties if run as an Application

     o getPropertyObject
     public Object getPropertyObject(String name)
    
    Returns a Property Object.

    See Also:
    getProperty
     o getAppResourceFile
     public String getAppResourceFile()
    
    Return the Resouce File name with package name (without the extension) for your app. The resource file may be either a property resource or a list resource bundle.

    See Also:
    getAppResources
     o setAppResourceFile
     public void setAppResourceFile(String resourceFileName)
    
    Set the Resouce File name with package name (without the extension) for your app. The resource file may be either a property resource or a list resource bundle.

    See Also:
    getAppResources
     o setLocale
     public void setLocale(Locale locale)
    
    Sets a new Locale for your application. Basically reloads the BAB Resource as well as the application resource file and sets the default locale to specified locale. You must call the super.setLocale() in your implementation. This updates the UI.

     o getAppResources
     public ResourceBundle getAppResources()
    
    Returns the Resource bundle for your app.

     o setFrameLayout
     public void setFrameLayout(int frameLayout)
    
    Set where the frame be laid out

    See Also:
    FrameLayoutConstants
     o getFrameLayout
     public int getFrameLayout()
    
    Returns the current frame layout

     o layItOut
     public static final void layItOut(Window window,
                                       int layout)
    
    Lay out the window. This must be called after calling pack() on the window. This is a utility method that you can use to layout any window/Dialogs at a specified location on the screen.

     o setProperty
     public synchronized Object setProperty(String name,
                                            Object value)
    
    Set Name-Value in the App's properties table. This replaces an existing name-value in the app's property table, throws NullPointerException if name or value is null.

    Returns:
    returns the previous value of the key if exists one.
     o isApplet
     public boolean isApplet()
    
    Is this an Applet ?

     o isAppletFrame
     public boolean isAppletFrame()
    
    Is this an AppletFrame ?

     o isApplication
     public boolean isApplication()
    
    Is this an Application ?

     o addNewModelListener
     public void addNewModelListener(NewModelListener l)
    
    Add a listener to subscribe for NewModelEvent.

     o removeNewModelListener
     public void removeNewModelListener(NewModelListener l)
    
    Remove a listener to un-subscribe for NewModelEvent.

     o fireNewModelEvent
     public void fireNewModelEvent(Object eventData)
    
    Send a NewModelEvent to the registered listeners to notify them of any state change.


    All Packages  Class Hierarchy  This Package  Previous  Next  Index