javax.infobus
Class InfoBusItemRequestedEvent

java.lang.Object
  |
  +--java.util.EventObject
        |
        +--javax.infobus.InfoBusEvent
              |
              +--javax.infobus.InfoBusItemRequestedEvent

public final class InfoBusItemRequestedEvent
extends InfoBusEvent

This event is sent on behalf of a data consumer to find a named data item it would like to receive. The data consumer causes this event to be distributed to producers by calling one of the InfoBus findXXX methods.

A data producer can respond to this event by setting the data item field in this event with the requested DataItem object, using the setDataItem method. The InfoBus calls the getDataItem method on this event to get the data item to return to the data consumer via the InfoBus findXXX method that was originally called.

See Also:
Serialized Form

Method Summary
 java.awt.datatransfer.DataFlavor[] getDataFlavors()
          Exposes the DataFlavors that the consumer prefers, as a hint to producers that can supply data in more than one format.
 java.lang.Object getDataItem()
          Allows the handler of the event to unpack a DataItem that was provided in response to the request.
 InfoBusDataConsumer getSourceAsConsumer()
          Returns the source of the InfoBusItemRequestedEvent, which is always an InfoBusDataConsumer.
 void setDataItem(java.lang.Object item)
          If the DataItem field in the event is currently null, sets that field to the value passed as item.
 
Methods inherited from class javax.infobus.InfoBusEvent
getDataItemName
 
Methods inherited from class java.util.EventObject
getSource, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

getDataFlavors

public java.awt.datatransfer.DataFlavor[] getDataFlavors()
Exposes the DataFlavors that the consumer prefers, as a hint to producers that can supply data in more than one format. If this method returns null, the consumer did not provide any DataFlavor preferences when it requested the event.

The consumer may specify MIME types in the order it prefers, including InfoBus and standard MIME types. A special MIME string MIME_TYPE_ANY_ACCESS indicates that a consumer will accept any type of InfoBus access interface available for the item. The producer is not required to consider the requested DataFlavors in supplying the data item.

Returns:
the consumer's preferred flavors, or null if unspecified

setDataItem

public void setDataItem(java.lang.Object item)
If the DataItem field in the event is currently null, sets that field to the value passed as item. A producer which has the data specified by the event's DataItem name can return that data by calling setDataItem with it.

This is a write-once method, and attempts to replace a non-null DataItem have no effect. The DataItemm field is null [writable] when this event is first delivered to a producer.

Parameters:
item - the value to set the DataItem field to

getDataItem

public java.lang.Object getDataItem()
Allows the handler of the event to unpack a DataItem that was provided in response to the request.
Returns:
the data item provided by a responding producer, or null if no producers provided data

getSourceAsConsumer

public InfoBusDataConsumer getSourceAsConsumer()
Returns the source of the InfoBusItemRequestedEvent, which is always an InfoBusDataConsumer.
Returns:
the source of this event.