Business Components

oracle.jbo.uicli.binding
Class JUIteratorBinding

java.lang.Object
  |
  +--oracle.jbo.uicli.binding.JUIteratorBinding
All Implemented Interfaces:
java.util.EventListener, RowNavigationListener, RowSetListener, RowSetManagementListener

public class JUIteratorBinding
extends java.lang.Object
implements RowSetListener, RowSetManagementListener

JUIteratorBinding is the binding class that interacts with BC4J RowIterator objects to iterate over rows and provide the current row(s) to display to various control bindings. JUIteratorBinding objects are named and uniquely identified by name in a JUFormBinding which acts as a container of iterator bindings. This class handles the events generated from the associated BC4J RowIterator and sends the current Row (rows in range) over to individual control bindings to display current data. This class also manages the findMode data for the associated BC4J iterator and ViewObject.

At runtime, an application can bind an instance of oracle.jbo.NavigatableRowIterator to a JUIteratorBinding object using the bindRowSetIterator method.


Constructor Summary
TypeConstructor
protected JUIteratorBinding()
           
  JUIteratorBinding(ApplicationModule am, java.lang.String voName, java.lang.String rsiName)
          When the usage only needs one row at a time, use this constructor to create an iterator binding.
  JUIteratorBinding(ApplicationModule am, java.lang.String voName, java.lang.String rsiName, int rangeSize)
          Use this constructor if a usage needs a specific range size on the associated iterator.
  JUIteratorBinding(RowSetIterator rsi)
          When an application has a BC4J RowSet it should use this constructor.
 
Method Summary
TypeMethod
 void addActionBinding(JUCtrlActionBinding bnd)
          Adds the given action control binding object to its list.
 void addValueBinding(JUCtrlValueBinding bnd)
          Adds the given control binding object to its list.
 void bindRowSetIterator(NavigatableRowIterator iter, boolean initRangeSize)
          Use this method to bind a new instance of RowIterator from a BC4J ViewObject to this iterator.
 void executeQuery()
          Executes the query or the RowSet behind this iterator binding object.
 void executeQueryIfNeeded()
          Executes the query or the RowSet behind this iterator binding object if not already executed.
 java.util.ArrayList getActionBindingList()
          Returns a list of JUCtrlActionBinding objects that are associated with this iterator binding.
 Row[] getAllRowsInRange()
          Returns an array of rows in the current range of the current RowIterator.
 JUApplication getApplication()
          Helper method to return the JUApplication from this binding's FormBinding.
 ApplicationModule getApplicationModule()
          Returns the instance of ApplicationModule in which this iterator binding has an associated iterator.
 Row getCurrentRow()
          Returns the current row of the iterator with which this binding object is associated.
 JUFormBinding getFormBinding()
          Return form binding object of this iterator binding's container.
 RowSetIterator getLovRowSetIterator()
          *** For internal framework use only ***
 java.lang.String getName()
          Returns the name of this iterator binding.
 NavigatableRowIterator getNavigatableRowIterator()
          Returns the current RowIterator, which can be a data RowSetIterator or a find mode ViewCriteria based on the find mode.
 Row getRowAtRangeIndex(int rangeIndex)
          Returns the row of given range index.
 RowSetIterator getRowSetIterator()
          Returns the current data RowSetIterator that holds rows with which this iterator binding object and its associated control-bindings are working.
 java.lang.Object getSyncLock()
          *** For internal framework use only ***
 java.util.ArrayList getValueBindingList()
          Returns a list of JUCtrlValueBinding objects that are associated with this iterator binding.
 java.lang.String getViewDefName()
          *** For internal framework use only *** Returns the name of the ViewDefinition object.
 ViewObject getViewObject()
          Returns the instance of ViewObject of the RowIterator to which this iterator binding is associated.
 java.lang.String getVOName()
          Returns the name of the ViewObject instance of the iterator to which this iterator binding is associated.
 boolean isFindMode()
          Returns true if this iterator binding is in find mode.
 void iteratorClosed(RowSetManagementEvent event)
          *** For internal framework use only *** Resets the internal state of this binding object and marks it as unusable.
 void iteratorReset(RowSetManagementEvent event)
          *** For internal framework use only *** Notifies all control bindings that the BC4J iterator has been reset and there is no current row at this time.
 void navigated(NavigationEvent event)
          *** For internal framework use only ***
 void rangeRefreshed(RangeRefreshEvent event)
          *** For internal framework use only ***
 void rangeScrolled(ScrollEvent event)
          *** For internal framework use only ***
 boolean removeActionBinding(JUCtrlActionBinding bnd)
          Removes the given action control binding object from its list.
 boolean removeValueBinding(JUCtrlValueBinding bnd)
          Removes the given control binding object from its list.
 void reportException(boolean markDead, java.lang.Exception ex)
          Utility method to report exceptions via the containing Form binding object.
 void resolveRangeSize(int rangeSize)
          Sets this iterator binding and it's associated RowIterator's range size to the greater of this either the iterator's range size and the given range size.
 void rowDeleted(DeleteEvent event)
          *** For internal framework use only ***
 void rowInserted(InsertEvent event)
          *** For internal framework use only ***
 void rowUpdated(UpdateEvent event)
          *** For internal framework use only ***
 void setFormBinding(JUFormBinding formBnd)
          *** For internal framework use only ***
 void setName(java.lang.String name)
          *** For internal framework use only ***
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JUIteratorBinding

protected JUIteratorBinding()

JUIteratorBinding

public JUIteratorBinding(ApplicationModule am,
                         java.lang.String voName,
                         java.lang.String rsiName,
                         int rangeSize)
Use this constructor if a usage needs a specific range size on the associated iterator. Objects of type JUCtrlRangeBinding may use this constructor to specify a default range size for the iterator.

JUIteratorBinding

public JUIteratorBinding(ApplicationModule am,
                         java.lang.String voName,
                         java.lang.String rsiName)
When the usage only needs one row at a time, use this constructor to create an iterator binding.

JUIteratorBinding

public JUIteratorBinding(RowSetIterator rsi)
When an application has a BC4J RowSet it should use this constructor.
Method Detail

getName

public final java.lang.String getName()
Returns the name of this iterator binding. Iterator Binding objects are uniquely identified by name in a JUFormBinding.

setName

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

getVOName

public final java.lang.String getVOName()
Returns the name of the ViewObject instance of the iterator to which this iterator binding is associated.

getViewDefName

public final java.lang.String getViewDefName()
*** For internal framework use only *** Returns the name of the ViewDefinition object.

reportException

public void reportException(boolean markDead,
                            java.lang.Exception ex)
Utility method to report exceptions via the containing Form binding object.

bindRowSetIterator

public void bindRowSetIterator(NavigatableRowIterator iter,
                               boolean initRangeSize)
Use this method to bind a new instance of RowIterator from a BC4J ViewObject to this iterator. This method should be used to display data from a different RowIterator of the same ViewObject type in a given form. For example, if a tree is used to navigate Departments and their employees, upon selecting an employee node, an application can pass the Employee node's RowIterator over to this iterator binding, to update the display in another panel of Employee data with the currently selected Employee.

This method will not directly update the controls. The caller can optionally call navigated(null) method, with null for the Event parameter to notify each control bound to this iterator binding to update it's displayed value with the new iterator's current row.

Parameters:
iter - RowIterator instance from which to display data in bound controls.
initRangeSize - determines whether this iterator's range size should be adjusted to this binding's range size. This should be used to extend the range size from the default in the RowIterator to whatever is required by this iterator binding. For example, if a RowIterator whose range size is 1 is passed to this method and a grid control is bound to this iterator binding, then the grid may need more than one row to display from the current range. So, this flag should be true in that case to allow the grid to get the full range of rows to display, rather than updating its display one row at a time.

rangeRefreshed

public void rangeRefreshed(RangeRefreshEvent event)
*** For internal framework use only ***

Handles the rangeRefereshed event generated by the current RowIterator. If the range size of this binding is 1, then calls updateValuesFromRow() with the current row as the argument to notify all control bindings associated with this iterator binding of the change in current row. If the range size is not 1, then this method calls updateValuesFromRows() passing in the current range of rows to all JUCtrlRangeBinding control bindings.

Specified by:
rangeRefreshed in interface RowSetListener
Following copied from interface: oracle.jbo.RowSetListener
Parameters:
event - a description of the new ranges.

rangeScrolled

public void rangeScrolled(ScrollEvent event)
*** For internal framework use only ***

This method invokes updateRangeScrolled method on all instances of JUCtrlRangeBinding objects associated with this iterator binding, to notify them of the change in current range of rows.

Specified by:
rangeScrolled in interface RowSetListener
Following copied from interface: oracle.jbo.RowSetListener
Parameters:
event - a description of the new range.

rowInserted

public void rowInserted(InsertEvent event)
*** For internal framework use only ***

If range size of this iterator binding is not 1, this method invokes updateRowInserted method on all instances of JUCtrlValueBinding objects associated with this iterator binding, to notify them of the newly inserted row.

Specified by:
rowInserted in interface RowSetListener
Following copied from interface: oracle.jbo.RowSetListener
Parameters:
event - a description of the new Row object.

rowDeleted

public void rowDeleted(DeleteEvent event)
*** For internal framework use only ***

If range size of this iterator binding is not 1, this method invokes updateRowDeleted method on all instances of JUCtrlValueBinding objects associated with this iterator binding, to notify them of the newly inserted row.

This method also sets the currency on the RowIterator to the next row (if available) or previous row (if available) or simply a NO row by calling navigated() with no current row.

Specified by:
rowDeleted in interface RowSetListener
Following copied from interface: oracle.jbo.RowSetListener
Parameters:
event - a description of the deleted Row object.

rowUpdated

public void rowUpdated(UpdateEvent event)
*** For internal framework use only ***

Invokes updateValuesFromRow() to notify all control bindings of a change in an attribute in the row.

Specified by:
rowUpdated in interface RowSetListener
Following copied from interface: oracle.jbo.RowSetListener
Parameters:
event - a description of the modified Row object.

navigated

public void navigated(NavigationEvent event)
*** For internal framework use only ***

Calls updateNavigated() for all JUCtrlRangeBinding instances associated with this iterator binding object, or calls updateValuesFromRow() on all other control binding instances, passing in the current row instance from the RowIterator.

Specified by:
navigated in interface RowSetListener
Following copied from interface: oracle.jbo.RowSetListener
Parameters:
event - a description of the new and previous current rows.

getSyncLock

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

iteratorReset

public void iteratorReset(RowSetManagementEvent event)
*** For internal framework use only *** Notifies all control bindings that the BC4J iterator has been reset and there is no current row at this time.
Specified by:
iteratorReset in interface RowSetManagementListener
Following copied from interface: oracle.jbo.RowSetManagementListener
Parameters:
event - a description of the event.

iteratorClosed

public void iteratorClosed(RowSetManagementEvent event)
*** For internal framework use only *** Resets the internal state of this binding object and marks it as unusable.
Specified by:
iteratorClosed in interface RowSetManagementListener
Following copied from interface: oracle.jbo.RowSetManagementListener
Parameters:
event - a description of the event.

getApplicationModule

public ApplicationModule getApplicationModule()
Returns the instance of ApplicationModule in which this iterator binding has an associated iterator.

getViewObject

public ViewObject getViewObject()
Returns the instance of ViewObject of the RowIterator to which this iterator binding is associated.

resolveRangeSize

public void resolveRangeSize(int rangeSize)
Sets this iterator binding and it's associated RowIterator's range size to the greater of this either the iterator's range size and the given range size. If either is -1, then that takes precedence, so that range size = all rows.

getRowSetIterator

public RowSetIterator getRowSetIterator()
Returns the current data RowSetIterator that holds rows with which this iterator binding object and its associated control-bindings are working.

getNavigatableRowIterator

public NavigatableRowIterator getNavigatableRowIterator()
Returns the current RowIterator, which can be a data RowSetIterator or a find mode ViewCriteria based on the find mode.

isFindMode

public final boolean isFindMode()
Returns true if this iterator binding is in find mode.

executeQuery

public void executeQuery()
Executes the query or the RowSet behind this iterator binding object.

executeQueryIfNeeded

public void executeQueryIfNeeded()
Executes the query or the RowSet behind this iterator binding object if not already executed.

getCurrentRow

public Row getCurrentRow()
Returns the current row of the iterator with which this binding object is associated. In find mode, this returns an instance of ViewCriteriaRow.

getRowAtRangeIndex

public Row getRowAtRangeIndex(int rangeIndex)
Returns the row of given range index.
Parameters:
rangeIndex - The range index of the row.

getAllRowsInRange

public Row[] getAllRowsInRange()
Returns an array of rows in the current range of the current RowIterator.

getFormBinding

public JUFormBinding getFormBinding()
Return form binding object of this iterator binding's container.

setFormBinding

public void setFormBinding(JUFormBinding formBnd)
*** For internal framework use only ***

getApplication

public JUApplication getApplication()
Helper method to return the JUApplication from this binding's FormBinding.

getValueBindingList

public java.util.ArrayList getValueBindingList()
Returns a list of JUCtrlValueBinding objects that are associated with this iterator binding. Returns null if no control binding is registered with this object.

addValueBinding

public void addValueBinding(JUCtrlValueBinding bnd)
Adds the given control binding object to its list.

removeValueBinding

public boolean removeValueBinding(JUCtrlValueBinding bnd)
Removes the given control binding object from its list. Returns true if remove was successful.

getActionBindingList

public java.util.ArrayList getActionBindingList()
Returns a list of JUCtrlActionBinding objects that are associated with this iterator binding. Returns null if no action control binding is registered with this object.

addActionBinding

public void addActionBinding(JUCtrlActionBinding bnd)
Adds the given action control binding object to its list.

removeActionBinding

public boolean removeActionBinding(JUCtrlActionBinding bnd)
Removes the given action control binding object from its list. Returns true if remove was successful.

getLovRowSetIterator

public RowSetIterator getLovRowSetIterator()
*** For internal framework use only ***

Business Components