javax.infobus
Class InfoBusItemAvailableEvent
java.lang.Object
|
+--java.util.EventObject
|
+--javax.infobus.InfoBusEvent
|
+--javax.infobus.InfoBusItemAvailableEvent
- public final class InfoBusItemAvailableEvent
- extends InfoBusEvent
InfoBusItemAvailableEvent is sent when an InfoBusDataProducer wants
to notify InfoBusDataConsumers that a named DataItem
is available and will be returned on request.
The data producer causes this event to be
distributed to consumers by calling InfoBus.fireItemAvailable().
- See Also:
- Serialized Form
Method Summary |
java.awt.datatransfer.DataFlavor[] |
getDataFlavors()
Returns a reference to an array of DataFlavor objects
that describe the formats the producer can provide,
either in the data item itself or by way of
Transferable.getTransferData(). |
InfoBusDataProducer |
getSourceAsProducer()
Returns the source of the InfoBusItemAvailableEvent, which is
always an InfoBusDataProducer. |
java.lang.Object |
requestDataItem(InfoBusDataConsumer consumer,
java.awt.datatransfer.DataFlavor[] flavors)
Sends an InfoBusItemRequestedEvent directly to the producer that
announced the item's availability. |
Methods inherited from class java.util.EventObject |
getSource,
toString |
Methods inherited from class java.lang.Object |
equals,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
getDataFlavors
public java.awt.datatransfer.DataFlavor[] getDataFlavors()
- Returns a reference to an array of DataFlavor objects
that describe the formats the producer can provide,
either in the data item itself or by way of
Transferable.getTransferData().
This method allows a consumer to consider the type of information
being announced as available before requesting a data item.
If this method returns null,
the producer did not specify the DataFlavors in announcing this data.
- Returns:
- an array of supported flavors or null if the producer is not
specifying flavors
requestDataItem
public java.lang.Object requestDataItem(InfoBusDataConsumer consumer,
java.awt.datatransfer.DataFlavor[] flavors)
- Sends an InfoBusItemRequestedEvent directly to the producer that
announced the item's availability. Calling this method directly on
announcement is more efficient than broadcasting a request event,
and ensures that the item returned will be from the announcer rather
than some other producer capable of creating an event with the
requested name.
When flavors is not null, it specifies an array of flavors the consumer
can use. The producer may decide not to return an item if it cannot
provide it in one of these flavors.
- Parameters:
consumer
- the consumer making the requestflavors
- the consumer's preferred DataFlavors for the item- Returns:
- the data item named in the AvailableEvent, or null if the
producer cannot fulfill the request
getSourceAsProducer
public InfoBusDataProducer getSourceAsProducer()
- Returns the source of the InfoBusItemAvailableEvent, which is
always an InfoBusDataProducer.
- Returns:
- the source of this event.