Oracle Data-aware Controls Reference

oracle.dacf.control
Class ControlSupport

java.lang.Object
  extended byoracle.dacf.util.InfoBusMemberHelper
      extended byoracle.dacf.control.ConsumerSupport
          extended byoracle.dacf.control.ControlSupport
All Implemented Interfaces:
oracle.dacf.rp.Consumer, java.util.EventListener, javax.infobus.InfoBusDataConsumer, javax.infobus.InfoBusEventListener, InfoBusManagerListener, javax.infobus.InfoBusMember, oracle.dacf.rp.Participant, java.beans.PropertyChangeListener
Direct Known Subclasses:
ControlSupportHC

public class ControlSupport
extends ConsumerSupport
implements javax.infobus.InfoBusDataConsumer, InfoBusManagerListener, oracle.dacf.rp.Consumer

This class provides default implementations for most of the methods in the Control interface.

Data aware controls must implement the Control interface in order to plug into the runtime framework.

Data aware controls should delegate the methods in the Control interface to this class, which provides a standard implementation.

This class also implements the InfoBusMember and InfoBusDataConsumer interfaces, and manages the connection to the InfoBus as well as the DataItem rendezvous.

The control will automatically be registered for DataItemChange events with the bound data item if the data item supports the DataItemChangeManager interface.


Field Summary
protected  Control _control
           
protected  java.lang.String _dataItemName
           
protected  java.util.Vector _enabledListeners
           
protected  java.lang.String _infoBusName
           
protected  java.util.Vector _navigatedListeners
           
protected  java.util.Vector _navigatingListeners
           
 
Fields inherited from class oracle.dacf.util.InfoBusMemberHelper
m_infoBus, m_propListeners, m_sourceRef, m_syncLock, m_vetoListeners
 
Constructor Summary
ControlSupport(Control control)
          Constructs the support object for a given data aware control.
 
Method Summary
protected  void _setDataItem(java.lang.Object dataItem)
          Binds the control to a data item.
protected  void _updateEnabled()
           
 void addControlEnabledListener(ControlEnabledListener l)
          Adds a ControlEnabledListener.
 void addNavigatedListener(NavigatedListener listener)
          Adds a navigated listener to this control.
 void addNavigatingListener(NavigatingListener listener)
          Adds a navigating listener to this control.
 void dataItemAvailable(javax.infobus.InfoBusItemAvailableEvent event)
          This method is called by the InfoBus class on behalf of a data producer that is announcing the availability of a new data item by name.
 void dataItemRevoked(javax.infobus.InfoBusItemRevokedEvent event)
          This method is called by the InfoBus class on behalf of a data producer that is revoking the availability of a previously announced data item.
protected  void finalize()
          Disconnects from the InfoBus.
 java.lang.Object getDataItem()
          Returns the InfoBus DataItem this control is bound to.
 java.lang.String getDataItemName()
          Returns the name of the InfoBus DataItem this control is bound to.
 java.lang.String getInfoBusName()
          Returns the name of the InfoBus this control is connected to.
 void handleRequestFocus()
          Delegates focus changes to the NavigationManager.
 boolean isEnabled()
           
 boolean isFocusValidated()
          Determines whether setting focus to this control causes validation.
 void processNavigatedEvent(NavigatedEvent event)
          Processes a navigated event for this control.
 void processNavigatingEvent(NavigatingEvent event)
          Processes a navigating event for this control.
 void propertyChange(java.beans.PropertyChangeEvent event)
          This method gets called when the object's InfoBus property is changed.
 void releaseResources(InfoBusManagerReleaseEvent e)
          A signalling method used to indicate the the control should free all resources and unregister any listeners that it has registered.
 void removeControlEnabledListener(ControlEnabledListener l)
          Removes a ControlEnabledListener.
 void removeNavigatedListener(NavigatedListener listener)
          Removes a navigated listener from this control.
 void removeNavigatingListener(NavigatingListener listener)
          Removes a navigating listener from this control.
 void setDataItemName(java.lang.String dataItemName)
          Sets the name of the InfoBus DataItem this control is bound to.
 void setEnabled(boolean b)
          An override of java.awt.Component.setEnabled.
 void setFocusValidated(boolean focusValidated)
          Sets whether focus into this control causes validation to occur.
 void setInfoBusName(java.lang.String infoBusName)
          Sets the name of the InfoBus this control is connected to.
 
Methods inherited from class oracle.dacf.control.ConsumerSupport
available, revoked
 
Methods inherited from class oracle.dacf.util.InfoBusMemberHelper
addInfoBusPropertyListener, addInfoBusVetoableListener, clearRef, getInfoBus, joinInfoBus, joinInfoBus, leaveInfoBus, removeInfoBusPropertyListener, removeInfoBusVetoableListener, setInfoBus
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface oracle.dacf.rp.Consumer
available, revoked
 

Field Detail

_control

protected Control _control

_infoBusName

protected java.lang.String _infoBusName

_navigatedListeners

protected java.util.Vector _navigatedListeners

_navigatingListeners

protected java.util.Vector _navigatingListeners

_enabledListeners

protected java.util.Vector _enabledListeners

_dataItemName

protected java.lang.String _dataItemName
Constructor Detail

ControlSupport

public ControlSupport(Control control)
Constructs the support object for a given data aware control.

Parameters:
control - The data aware control.
Method Detail

addControlEnabledListener

public final void addControlEnabledListener(ControlEnabledListener l)
Adds a ControlEnabledListener.

The listener will be notified when the enabled state of the control changes.


removeControlEnabledListener

public final void removeControlEnabledListener(ControlEnabledListener l)
Removes a ControlEnabledListener.


finalize

protected void finalize()
                 throws java.lang.Throwable
Disconnects from the InfoBus.

Throws:
java.lang.Throwable - If fatal error.

releaseResources

public void releaseResources(InfoBusManagerReleaseEvent e)
Description copied from interface: InfoBusManagerListener
A signalling method used to indicate the the control should free all resources and unregister any listeners that it has registered.

Specified by:
releaseResources in interface InfoBusManagerListener

setEnabled

public void setEnabled(boolean b)
An override of java.awt.Component.setEnabled.

This method is used to track the intentions of the programmer. With it we can insure that when the DataItem is available, the control reflects his wishes.

Parameters:
b - boolean flag indicating whether the control is enabled

isEnabled

public boolean isEnabled()

getInfoBusName

public final java.lang.String getInfoBusName()
Returns the name of the InfoBus this control is connected to.

Returns:
The name of the InfoBus this control is connected to.
See Also:
Control.getInfoBusName()

setInfoBusName

public void setInfoBusName(java.lang.String infoBusName)
Sets the name of the InfoBus this control is connected to.

By default, the control is connected to the default InfoBus, named Control.DEFAULT_INFOBUS_NAME.

If the named InfoBus does not exist, it is created automatically.

If the control is already connected to an InfoBus, it is disconnected first.

Parameters:
infoBusName - The name of the InfoBus to connect to.
See Also:
Control.DEFAULT_INFOBUS_NAME, Control.setInfoBusName(java.lang.String)

getDataItemName

public java.lang.String getDataItemName()
Returns the name of the InfoBus DataItem this control is bound to.

Returns:
The name of the InfoBus DataItem this control is bound to, or null if the control is unbound.
See Also:
getDataItem(), Control.getDataItemName()

setDataItemName

public void setDataItemName(java.lang.String dataItemName)
Sets the name of the InfoBus DataItem this control is bound to.

The DataItem with the given name is searched for on the InfoBus, and if found, is bound to this control.

If the control is already bound to a DataItem, it is unbound first.

Parameters:
dataItemName - The name of the DataItem to bind to.
See Also:
getDataItem(), Control.setDataItemName(java.lang.String)

getDataItem

public java.lang.Object getDataItem()
Returns the InfoBus DataItem this control is bound to.

Specified by:
getDataItem in class ConsumerSupport
Returns:
The InfoBus DataItem this control is bound to, or null if the control is unbound.
See Also:
Control.getDataItem()

isFocusValidated

public final boolean isFocusValidated()
Determines whether setting focus to this control causes validation.

Returns:
true if focus into this control causes validation to occur, false otherwise.
See Also:
Control.isFocusValidated()

setFocusValidated

public final void setFocusValidated(boolean focusValidated)
Sets whether focus into this control causes validation to occur.

Parameters:
focusValidated - If true, focus into this control will cause validation to occur.
See Also:
Control.setFocusValidated(boolean)

addNavigatedListener

public final void addNavigatedListener(NavigatedListener listener)
Adds a navigated listener to this control.

The listener will be notified of NavigateIn and NavigateOut events.

Parameters:
listener - The listener to add.
See Also:
Control.addNavigatedListener(oracle.dacf.control.NavigatedListener)

removeNavigatedListener

public final void removeNavigatedListener(NavigatedListener listener)
Removes a navigated listener from this control.

Parameters:
listener - The listener to remove.
See Also:
Control.removeNavigatedListener(oracle.dacf.control.NavigatedListener)

processNavigatedEvent

public void processNavigatedEvent(NavigatedEvent event)
Processes a navigated event for this control.

This method is for use by the NavigationManager only.

Parameters:
event - The navigated event.
See Also:
Control.processNavigatedEvent(oracle.dacf.control.NavigatedEvent)

addNavigatingListener

public final void addNavigatingListener(NavigatingListener listener)
Adds a navigating listener to this control.

The listener will be notified of NavigateIn and NavigateOut events.

Parameters:
listener - The listener to add.
See Also:
Control.addNavigatingListener(oracle.dacf.control.NavigatingListener)

removeNavigatingListener

public final void removeNavigatingListener(NavigatingListener listener)
Removes a navigating listener from this control.

Parameters:
listener - The listener to remove.
See Also:
Control.removeNavigatingListener(oracle.dacf.control.NavigatingListener)

processNavigatingEvent

public void processNavigatingEvent(NavigatingEvent event)
                            throws NavigatingException
Processes a navigating event for this control.

This method is for use by the NavigationManager only.

Parameters:
event - The navigating event.
Throws:
NavigatingException - If the navigation is redirected to a different control.
See Also:
Control.processNavigatingEvent(oracle.dacf.control.NavigatingEvent)

dataItemAvailable

public void dataItemAvailable(javax.infobus.InfoBusItemAvailableEvent event)
This method is called by the InfoBus class on behalf of a data producer that is announcing the availability of a new data item by name.

If the control is not currently bound to a data item, and the name of the new data item matches the control's data item name, then the control is bound to the new data item.

If the control is not currently bound to a data item, and the name of the new data item is a prefix for the control's data item name, then the InfoBus is searched for a matching data item, and the control is bound to it if one is found. For example, if the item A.B.C is announced as available, and the control's data item name is set to A.B.C.D.E, the control will ask the InfoBus to find the data item A.B.C.D.E in response to the announcement of A.B.C -- this means that producers only need to publish their root prefix, and allows them to create child producers on demand.

Specified by:
dataItemAvailable in interface javax.infobus.InfoBusDataConsumer
Parameters:
event - The event.

dataItemRevoked

public void dataItemRevoked(javax.infobus.InfoBusItemRevokedEvent event)
This method is called by the InfoBus class on behalf of a data producer that is revoking the availability of a previously announced data item.

If the name of the data item in the event matches the control's data item name, the control is unbound from its data item.

Specified by:
dataItemRevoked in interface javax.infobus.InfoBusDataConsumer
Parameters:
event - The event.

propertyChange

public void propertyChange(java.beans.PropertyChangeEvent event)
This method gets called when the object's InfoBus property is changed.

The object is removed as a data consumer from its previous InfoBus, and is added as a consumer to its new InfoBus.

Specified by:
propertyChange in interface java.beans.PropertyChangeListener
Parameters:
event - The event.

handleRequestFocus

public void handleRequestFocus()
Delegates focus changes to the NavigationManager.

UI controls should override the requestFocus() method of Component and invoke this method after invoking super.requestFocus().


_setDataItem

protected void _setDataItem(java.lang.Object dataItem)
Binds the control to a data item.

If the new data item implements the DataItemChangeManager interface, the control is added as a DataItemChangeListener for the data item.

The control's dataItemChanged and dataItemValueChanged methods are invoked after the control has been bound to the new data item.

Specified by:
_setDataItem in class ConsumerSupport
Parameters:
dataItem - The new data item to bind to.

_updateEnabled

protected void _updateEnabled()

Oracle Data-aware Controls Reference

 

Copyright © 1997, 2003, Oracle. All rights reserved.