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 :
- UndoManager, that allows multi-level undo/redo of commands
- Single Entry point for applet or application run time (Not Available at this time )
- 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.
- 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
-
listenerList
-
-
LOOK_N_FEEL_USAGE
-
-
METAL
-
-
MOTIF
-
-
WINDOWS
-
-
BABApp()
- Empty constructor
-
addAndDo(BCommand, BABContext)
- Sets the presentation name and invokes doCommand() on the command, and pushes the command on the Undo satck
-
addFrame(JFrame)
- Register an additional frame with the BAB App.
-
addNewModelListener(NewModelListener)
- Add a listener to subscribe for NewModelEvent.
-
fireNewModelEvent(Object)
- Send a NewModelEvent to the registered listeners to notify them
of any state change.
-
getActions()
- Returns all the BABApp aware actions
-
getAppDescription()
- Returns the app description
-
getAppIcon()
- Returns the app Icon
-
getAppletInstance()
- Returns the applet instance
-
getAppMainFrame()
- Returns the Main frame
-
getAppName()
- Returns the app name
-
getAppResourceFile()
- Return the Resouce File name with package name (without the extension) for your app.
-
getAppResources()
- Returns the Resource bundle for your app.
-
getAppVersion()
- Returns the app version
-
getCopyright()
- Returns the copyright string
-
getCurrentLookAndFeel()
- Return current Look and Feel
-
getFileExtension()
- Returns the file extension for the app
-
getFrameLayout()
- Returns the current frame layout
-
getFrames()
- Retruns all the application frames
-
getInfoBus()
- Returns this app's InfoBus
-
getModel()
- Returns the application data model
-
getProperty(String)
- Get value for a name.
-
getPropertyObject(String)
- Returns a Property Object.
-
getStartupLookAndFeel()
- Returns the startup look and feel
-
getStatusBar()
- Returns the statusbar
-
getToolBar()
- Returns the toolbar
-
getUndoManager()
- Returns the UndoManager for the app
-
getViews()
- Retruns all the BABApp aware views
-
init()
- Initlizes the BAB App.
-
isApplet()
- Is this an Applet ?
-
isAppletFrame()
- Is this an AppletFrame ?
-
isAppletSecurityDisabled()
- Returns true if applet security is disabled
-
isApplication()
- Is this an Application ?
-
isIgnoreAppletVisibilityFlag()
- Returns true if ignore applet visibilty flag is set to true
-
layItOut(Window, int)
- Lay out the window.
-
modelChanged()
- Notify the BAB App that model data has changed
-
removeFrame(JFrame)
- Remove the frame that was previously registered with the BAB App.
-
removeNewModelListener(NewModelListener)
- Remove a listener to un-subscribe for NewModelEvent.
-
setAppDescription(String)
- Set app description
-
setAppIcon(Icon)
- Set the app Icon
-
setAppletInstance(JApplet)
- If this app is being run as an applet too, set the AppletInstance
-
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.
-
setAppMainFrame(JFrame)
- Set the Main Frame of your app
-
setAppName(String)
- Provide a name for your app
-
setAppResourceFile(String)
- Set the Resouce File name with package name (without the extension) for your app.
-
setAppVersion(String)
- Set app version
-
setCopyright(String)
- Set copyright string for the app
-
setCurrentLookAndFeel(int)
- Switch to a new look and feel.
-
setFileExtension(String)
- Set File Extension that must be used for saving application data to a file
-
setFrameLayout(int)
- Set where the frame be laid out
-
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.
-
setInfoBus(BInfoBus)
- Set the InfoBus bean for this app if infobus support is required
-
setLocale(Locale)
- Sets a new Locale for your application.
-
setModel(Serializable)
- Set the application data model
-
setProperty(String, Object)
- Set Name-Value in the App's properties table.
-
setStartupLookAndFeel(int)
- Which look and feel the app should start with, metal, windows or motif ?
-
setStatusBar(StatusBar)
- Set the statusbar for this app
-
setToolBar(JToolBar)
- Set the toolbar for this app
-
setUndoManager(UndoManager)
- Set an undo Manager for the app, a default one is provided if not set
listenerList
protected transient EventListenerList listenerList
METAL
public static final int METAL
WINDOWS
public static final int WINDOWS
MOTIF
public static final int MOTIF
LOOK_N_FEEL_USAGE
public static final String LOOK_N_FEEL_USAGE
BABApp
public BABApp()
- Empty constructor
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.
setAppName
public void setAppName(String newAppName)
- Provide a name for your app
getAppName
public String getAppName()
- Returns the app name
setAppDescription
public void setAppDescription(String newAppDescription)
- Set app description
getAppDescription
public String getAppDescription()
- Returns the app description
setAppIcon
public void setAppIcon(Icon newAppIcon)
- Set the app Icon
getAppIcon
public Icon getAppIcon()
- Returns the app Icon
setCopyright
public void setCopyright(String newCopyright)
- Set copyright string for the app
getCopyright
public String getCopyright()
- Returns the copyright string
setAppVersion
public void setAppVersion(String newAppVersion)
- Set app version
getAppVersion
public String getAppVersion()
- Returns the app version
setFileExtension
public void setFileExtension(String newFileExtension)
- Set File Extension that must be used for saving application data to a file
getFileExtension
public String getFileExtension()
- Returns the file extension for the app
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
getStartupLookAndFeel
public int getStartupLookAndFeel()
- Returns the startup look and feel
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
isAppletSecurityDisabled
public boolean isAppletSecurityDisabled()
- Returns true if applet security is disabled
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.
isIgnoreAppletVisibilityFlag
public boolean isIgnoreAppletVisibilityFlag()
- Returns true if ignore applet visibilty flag is set to true
setUndoManager
public void setUndoManager(UndoManager newUndoManager)
- Set an undo Manager for the app, a default one is provided if not set
getUndoManager
public UndoManager getUndoManager()
- Returns the UndoManager for the app
getActions
public Vector getActions()
- Returns all the BABApp aware actions
getViews
public Vector getViews()
- Retruns all the BABApp aware views
getFrames
public Vector getFrames()
- Retruns all the application frames
setAppMainFrame
public void setAppMainFrame(JFrame newAppMainFrame)
- Set the Main Frame of your app
getAppMainFrame
public JFrame getAppMainFrame()
- Returns the Main frame
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
addFrame
public void addFrame(JFrame frame)
- Register an additional frame with the BAB App. The Main Frame is
registered with setAppMainFrame().
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.
setToolBar
public void setToolBar(JToolBar newToolBar)
- Set the toolbar for this app
getToolBar
public JToolBar getToolBar()
- Returns the toolbar
setStatusBar
public void setStatusBar(StatusBar newStatusBar)
- Set the statusbar for this app
getStatusBar
public StatusBar getStatusBar()
- Returns the statusbar
setModel
public void setModel(Serializable newModel)
- Set the application data model
getModel
public Serializable getModel()
- Returns the application data model
setInfoBus
public void setInfoBus(BInfoBus newInfoBus)
- Set the InfoBus bean for this app if infobus support is required
getInfoBus
public BInfoBus getInfoBus()
- Returns this app's InfoBus
setAppletInstance
public void setAppletInstance(JApplet newAppletInstance)
- If this app is being run as an applet too, set the AppletInstance
getAppletInstance
public JApplet getAppletInstance()
- Returns the applet instance
modelChanged
public void modelChanged()
- Notify the BAB App that model data has changed
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
getCurrentLookAndFeel
public int getCurrentLookAndFeel()
- Return current Look and Feel
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.
- From Applet parameters, if this is being run as an applet.
- From Command line arguments if this is being run as an application.
- From your app Resources file.
- From Java System properties if run as an Application
getPropertyObject
public Object getPropertyObject(String name)
- Returns a Property Object.
- See Also:
- getProperty
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
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
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.
getAppResources
public ResourceBundle getAppResources()
- Returns the Resource bundle for your app.
setFrameLayout
public void setFrameLayout(int frameLayout)
- Set where the frame be laid out
- See Also:
- FrameLayoutConstants
getFrameLayout
public int getFrameLayout()
- Returns the current frame layout
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.
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.
isApplet
public boolean isApplet()
- Is this an Applet ?
isAppletFrame
public boolean isAppletFrame()
- Is this an AppletFrame ?
isApplication
public boolean isApplication()
- Is this an Application ?
addNewModelListener
public void addNewModelListener(NewModelListener l)
- Add a listener to subscribe for NewModelEvent.
removeNewModelListener
public void removeNewModelListener(NewModelListener l)
- Remove a listener to un-subscribe for NewModelEvent.
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