Business Components

oracle.jbo.uicli.binding
Class JUApplication

java.lang.Object
  |
  +--oracle.jbo.uicli.binding.JUApplication
All Implemented Interfaces:
java.util.EventListener, TransactionStateListener

public class JUApplication
extends java.lang.Object
implements TransactionStateListener

The application class that manages connection to a BC4J Application Module. The JUApplication class provides:

Version:
PUBLIC
See Also:
ApplicationModule, Transaction, JUTransactionStateListener, JUErrorHandler

Field Summary
TypeField
protected  java.util.ArrayList mStatusBarList
          JUStatusBarInterface objects that are notified with status bar messages.
protected  java.util.ArrayList mTxnListeners
          JUTransactionStateListener objects that are notified of commit or rollback events when generated from BC4J Application Module
 
Constructor Summary
JUApplication()
           
JUApplication(ApplicationModule am)
          Constructor used internally by the framework to associate an application module with a JClient application object.
JUApplication(java.util.Hashtable context, java.lang.String rootAMDefName, java.lang.Object userData)
          Constructs a root JUApplication object that connects to a BC4J Application Module of the given name.
JUApplication(JUApplication parent, ApplicationModule am, java.lang.Object userData)
          Constructor to be used to create a nested JUApplication inside another JUApplication object.
 
Method Summary
TypeMethod
 void addFormBinding(JUFormBinding formBnd)
          Register the given form binding object with this application.
 void addFormBinding(java.lang.String name, JUFormBinding formBnd)
          Register the given form binding object with this application with the given name.
 void addStatusBarInterface(JUStatusBarInterface statusBar)
          Add the given status bar object to this application's list.
 void addTransactionStateListener(JUTransactionStateListener statusBar)
          Adds listeners like StatusBar and NavigationBars that have to listen and react to transaction's modified state.
 void commitTransaction()
          Helper method that invokes beforeSaveTransaction event on all JUPanelBinding objects and then invokes the BC4J transaction's commit() method to save all changes to the database.
 JUFormBinding createFormBinding(java.lang.String name, java.lang.String formDefName, boolean initialize)
          *** For internal framework use only ***
 void createRootApplicationModule()
          *** Advanced method ***
 void displayStatus(JUIteratorBinding iterBinding, java.lang.String msgId, java.lang.Object[] params)
          Send the given message Id and parameter list along with the current iterator binding object to all status bar instances registered with this Application.
 void displayStatus(java.lang.String msg)
          Send the given message to all status bar interface objects registered with this application.
 void doneCommit(TransactionStateEvent event)
          Implementation of oracle.jbo.TransactionStateListener interface.
 void doneRollback(TransactionStateEvent event)
          Implementation of oracle.jbo.TransactionStateListener interface.
 JUFormBinding findFormBinding(java.lang.String name)
          Return the JUFormBinding instance registered with this JUAppication with the given name.
 void focusGained(JUIteratorBinding iterBinding, JUControlBinding binding, int attrIndex)
          *** For internal framework use only *** This method is used by the framework to display currency information in the status bars.
 ApplicationModule getApplicationModule()
          Returns the associated oracle.jbo.ApplicationModule object
 java.util.Hashtable getContext()
          Returns the context object with which the root JUApplication was created.
 java.util.Properties getDBConnectionProps()
          *** For internal framework use only ***
 java.lang.String getDBConnectionURL()
          *** For internal framework use only ***
 JUApplicationDefImpl getDef()
          *** For internal framework use only ***
 JUErrorHandler getErrorHandler()
          Returns the JUErrorHandler registered with the root JUApplication.
 boolean getErrorHandlerActive()
          Returns the error-handler active state of the root JUApplication object.
 java.lang.String getName()
          *** For internal framework use only *** Returns the instance name of this JUApplication object.
 java.lang.String getPackageName()
          *** For internal framework use only ***
 JUApplication getParent()
          Returns the container JUApplication object if any.
 java.lang.String getRootAMDefName()
          Returns root JUApplication's ApplicationModule definition name.
 JUApplication getRootApplication()
          Returns the root JUApplication object.
 java.lang.Object getUserData()
          *** For internal framework use only ***
 void initialize()
          *** Advanced method ***
 void initializeFormFromDef(java.lang.String name)
          *** For internal framework use only ***
 boolean isRoot()
          Returns true if this JUApplication is the root JUApplication.
 boolean isTransactionModified()
          Returns true if this JUApplication has modified attribute values.
 void removeFormBinding(JUFormBinding formBnd)
          Remove the JUFormBinding object of the given name (if any).
 void removeStatusBarInterface(JUStatusBarInterface statusBar)
          Remove the given instance of status bar interface if found.
 void removeTransactionStateListener(JUTransactionStateListener statusBar)
          Remove the given object from JUTransactionStateListener list.
 void reportException(JUFormBinding formBnd, java.lang.Exception ex)
          This method is used by all framework binding objects to report exceptions.
 void rollbackTransaction()
          Helper method that invokes rollback on the current Transaction.
 void setConnectionInfo(java.lang.String dbConnectionURL, java.util.Properties dbConnectionProps)
          *** For internal framework use only ***
 void setDef(JUApplicationDefImpl appDef)
          *** For internal framework use only ***
 void setErrorHandler(JUErrorHandler errHandler)
          Registers a JUErrorHandler with the root JUApplication.
 void setErrorHandlerActive(boolean b)
          *** Advanced method ***
 void setName(java.lang.String name)
          *** For internal framework use only ***
 void setPackageName(java.lang.String packageName)
          *** For internal framework use only ***
 void setTransactionModified()
          If this transaction is not in modified state, this method sets it to a modified state.
 void transactionStateChanged(boolean state)
          Use this method to notify all transaction state change listeners of the change
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mStatusBarList

protected java.util.ArrayList mStatusBarList
JUStatusBarInterface objects that are notified with status bar messages.

mTxnListeners

protected java.util.ArrayList mTxnListeners
JUTransactionStateListener objects that are notified of commit or rollback events when generated from BC4J Application Module
Constructor Detail

JUApplication

public JUApplication()

JUApplication

public JUApplication(java.util.Hashtable context,
                     java.lang.String rootAMDefName,
                     java.lang.Object userData)
Constructs a root JUApplication object that connects to a BC4J Application Module of the given name.
Parameters:
context - Context to pass on to the BC4J Application Module on creation.
rootAMDefName - Name that identifies the root BC4J Application Module.
userData - Data to store with the JUApplication object.

JUApplication

public JUApplication(ApplicationModule am)
Constructor used internally by the framework to associate an application module with a JClient application object.

JUApplication

public JUApplication(JUApplication parent,
                     ApplicationModule am,
                     java.lang.Object userData)
Constructor to be used to create a nested JUApplication inside another JUApplication object.
Method Detail

getName

public final java.lang.String getName()
*** For internal framework use only *** Returns the instance name of this JUApplication object.

setName

public final void setName(java.lang.String name)
*** For internal framework use only ***

Sets the instance name of this JUApplication Object


getDef

public final JUApplicationDefImpl getDef()
*** For internal framework use only ***

Returns the definition object for this JUApplication


setDef

public final void setDef(JUApplicationDefImpl appDef)
*** For internal framework use only ***

Sets the definition object of this JUApplication Object


initialize

public void initialize()
*** Advanced method ***

Creates a connection to the BC4J application module.


reportException

public final void reportException(JUFormBinding formBnd,
                                  java.lang.Exception ex)
This method is used by all framework binding objects to report exceptions. If this JUApplication is not the root, it calls the equivalent method on the root.

If the error handler is set to active state, then this method calls the registered error handler's reportException method. Othewise, it simply throws the given exception as a JboException.

See Also:
JUErrorHandler, JboException

getErrorHandler

public final JUErrorHandler getErrorHandler()
Returns the JUErrorHandler registered with the root JUApplication. By default a JClient application has an instance of JUErrorHandlerDialog registered as the default JUErrorHandler.
See Also:
JUErrorHandlerDialog

setErrorHandler

public final void setErrorHandler(JUErrorHandler errHandler)
Registers a JUErrorHandler with the root JUApplication. By default a JClient application has an instance of JUErrorHandlerDialog registered as the default JUErrorHandler. Applications should use this method to register custom error handling object so that all errors raised in the framework goes through the Application's error handling object. Custom error handlers need to implement the JUErrorHandler interface.

Note that errors are sent to the registered error handler only when the error handler state is marked active (which is true by default) using the setErrorHandlerActive method.

See Also:
JUErrorHandler, JUErrorHandlerDialog

getErrorHandlerActive

public final boolean getErrorHandlerActive()
Returns the error-handler active state of the root JUApplication object. This is used to control whether to throw an exception raised by the framework (which is used by automated regression tests to trap exceptions and log them). By default the state is set to true - meaning raise all exceptions via the registered error handler.

setErrorHandlerActive

public final void setErrorHandlerActive(boolean b)
*** Advanced method ***

Sets the error-handler active state of the root JUApplication object. This is used to control whether to throw an exception raised by the framework (which is used by automated regression tests to trap exceptions and log them). By default the state is set to true - meaning raise all exceptions via the registered error handler.


createRootApplicationModule

public final void createRootApplicationModule()
*** Advanced method ***

If this JUAppication is root, and the root's application module is not created, this method creates a root BC4J Application Module using the root application module def name and the context information (both passed to the constructor of the root JUApplication).

Throws:
ApplicationModuleCreateException - if the application module is not created, perhaps due to an improper root application module name.
See Also:
ApplicationModule, ApplicationModuleHome.create()

getContext

public final java.util.Hashtable getContext()
Returns the context object with which the root JUApplication was created.

getRootAMDefName

public final java.lang.String getRootAMDefName()
Returns root JUApplication's ApplicationModule definition name.

getDBConnectionURL

public final java.lang.String getDBConnectionURL()
*** For internal framework use only ***

getDBConnectionProps

public final java.util.Properties getDBConnectionProps()
*** For internal framework use only ***

setConnectionInfo

public final void setConnectionInfo(java.lang.String dbConnectionURL,
                                    java.util.Properties dbConnectionProps)
*** For internal framework use only ***

getPackageName

public final java.lang.String getPackageName()
*** For internal framework use only ***

setPackageName

public final void setPackageName(java.lang.String packageName)
*** For internal framework use only ***

getApplicationModule

public final ApplicationModule getApplicationModule()
Returns the associated oracle.jbo.ApplicationModule object

isRoot

public final boolean isRoot()
Returns true if this JUApplication is the root JUApplication. Root JUApplication is responsible for establishing connection to a BC4J root Application Module and Transaction objects.

getParent

public final JUApplication getParent()
Returns the container JUApplication object if any. This should be null in case this application object is the root.

getRootApplication

public final JUApplication getRootApplication()
Returns the root JUApplication object.

getUserData

public final java.lang.Object getUserData()
*** For internal framework use only ***

removeFormBinding

public final void removeFormBinding(JUFormBinding formBnd)
Remove the JUFormBinding object of the given name (if any).

addFormBinding

public final void addFormBinding(JUFormBinding formBnd)
Register the given form binding object with this application. If this form binding object has no name or null name, framework generates a unique name for the object (in the context of this application module).

addFormBinding

public final void addFormBinding(java.lang.String name,
                                 JUFormBinding formBnd)
Register the given form binding object with this application with the given name.

findFormBinding

public final JUFormBinding findFormBinding(java.lang.String name)
Return the JUFormBinding instance registered with this JUAppication with the given name. If the name does not match, return null.

createFormBinding

public final JUFormBinding createFormBinding(java.lang.String name,
                                             java.lang.String formDefName,
                                             boolean initialize)
*** For internal framework use only ***

Create a JUFormBinding instance using the given name and form definition.


initializeFormFromDef

public final void initializeFormFromDef(java.lang.String name)
*** For internal framework use only ***

addStatusBarInterface

public final void addStatusBarInterface(JUStatusBarInterface statusBar)
Add the given status bar object to this application's list. Messages sent via displayMessage method will be given out to all registered status bar instances.

removeStatusBarInterface

public final void removeStatusBarInterface(JUStatusBarInterface statusBar)
Remove the given instance of status bar interface if found.

displayStatus

public final void displayStatus(JUIteratorBinding iterBinding,
                                java.lang.String msgId,
                                java.lang.Object[] params)
Send the given message Id and parameter list along with the current iterator binding object to all status bar instances registered with this Application. This method is used by the framework to display status bar messages from the oracle.jbo.uicli.UIMessageBundle

displayStatus

public final void displayStatus(java.lang.String msg)
Send the given message to all status bar interface objects registered with this application.

focusGained

public final void focusGained(JUIteratorBinding iterBinding,
                              JUControlBinding binding,
                              int attrIndex)
*** For internal framework use only *** This method is used by the framework to display currency information in the status bars. When a control bound to a given attribute for a given iterator binding gets focus, this method is invoked to update all status bars.

commitTransaction

public final void commitTransaction()
Helper method that invokes beforeSaveTransaction event on all JUPanelBinding objects and then invokes the BC4J transaction's commit() method to save all changes to the database.

rollbackTransaction

public final void rollbackTransaction()
Helper method that invokes rollback on the current Transaction.

isTransactionModified

public final boolean isTransactionModified()
Returns true if this JUApplication has modified attribute values.

setTransactionModified

public final void setTransactionModified()
If this transaction is not in modified state, this method sets it to a modified state. This method is invoked in the framework to set the transaction state to modified status. Also all JUTransactionStateListeners are notified of this state-change so that status bars and navigation bars could update their display.

transactionStateChanged

public final void transactionStateChanged(boolean state)
Use this method to notify all transaction state change listeners of the change

addTransactionStateListener

public final void addTransactionStateListener(JUTransactionStateListener statusBar)
Adds listeners like StatusBar and NavigationBars that have to listen and react to transaction's modified state.

removeTransactionStateListener

public final void removeTransactionStateListener(JUTransactionStateListener statusBar)
Remove the given object from JUTransactionStateListener list.

doneCommit

public final void doneCommit(TransactionStateEvent event)
Implementation of oracle.jbo.TransactionStateListener interface. Sends the transactionStateChanged event to all JUTransactionStateListeners registered with this application.
Specified by:
doneCommit in interface TransactionStateListener
Parameters:
event - A description of the event.

doneRollback

public final void doneRollback(TransactionStateEvent event)
Implementation of oracle.jbo.TransactionStateListener interface. Sends the transactionStateChanged event to all JUTransactionStateListeners registered with this application.
Specified by:
doneRollback in interface TransactionStateListener
Parameters:
event - A description of the event.

Business Components