|
||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Custom implementations of InfoBusDataController can be added to an InfoBus to optimize the distribution of InfoBusEvents to InfoBusDataProducers and InfoBusDataConsumers.
Internally, an InfoBus maintains a set of InfoBusDataControllers that are active on the bus and passes an incoming request to each of them until notified that further distribution is unnecessary (via getStopFlag). The set of controllers will always contain a DefaultController, which is always the last to receive requests that have not been handled by another controller.
InfoBusEventListener
,
InfoBus
Method Summary | |
void |
addDataConsumer(InfoBusDataConsumer consumer)
Called by the InfoBus each time an InfoBusDataConsumer joins the InfoBus after the DataController did, to update the DataController of the addition of the consumer. |
void |
addDataProducer(InfoBusDataProducer producer)
Called by the InfoBus each time an InfoBusDataProducer joins the InfoBus after the DataController did, to update the DataController of the addition of the producer. |
boolean |
findDataItem(java.lang.String dataItemName,
java.awt.datatransfer.DataFlavor[] flavors,
InfoBusDataConsumer consumer,
java.util.Vector foundItem)
Called by the InfoBus when a consumer wishes to find a DataItem matching the given dataItemName. |
boolean |
findMultipleDataItems(java.lang.String dataItemName,
java.awt.datatransfer.DataFlavor[] flavors,
InfoBusDataConsumer consumer,
java.util.Vector foundItems)
Called by the InfoBus when a consumer wishes to find ALL DataItems matching the given dataItemName. |
boolean |
fireItemAvailable(java.lang.String dataItemName,
java.awt.datatransfer.DataFlavor[] flavors,
InfoBusDataProducer source)
Called by the InfoBus when the producer "source" requests the distribution of an InfoBusItemAvailable event to consumers on the InfoBus. |
boolean |
fireItemRevoked(java.lang.String dataItemName,
InfoBusDataProducer producer)
Called by the InfoBus when a producer requests the distribution of an InfoBusItemRevoked event to consumers on the InfoBus. |
void |
removeDataConsumer(InfoBusDataConsumer consumer)
Called by the InfoBus each time an InfoBusDataConsumer leaves the InfoBus to alert the DataController of the change. |
void |
removeDataProducer(InfoBusDataProducer producer)
Called by the InfoBus each time an InfoBusDataProducer leaves the InfoBus to alert the DataController of the change. |
void |
setConsumerList(java.util.Vector consumers)
Called once by the InfoBus when the DataController adds itself. |
void |
setProducerList(java.util.Vector producers)
Called once by the InfoBus when the DataController adds itself. |
Method Detail |
public void setConsumerList(java.util.Vector consumers)
consumers
- the Vector of InfoBusDataConsumers held by the InfoBus
when the DataController added itself to the buspublic void setProducerList(java.util.Vector producers)
producers
- the Vector of InfoBusDataProducers held by the InfoBus
when the DataController added itself to the buspublic void addDataConsumer(InfoBusDataConsumer consumer)
consumer
- the DataConsumer now joining the InfoBuspublic void addDataProducer(InfoBusDataProducer producer)
producer
- the DataProducer now joining the InfoBuspublic void removeDataConsumer(InfoBusDataConsumer consumer)
consumer
- the DataConsumer that is leaving the InfoBuspublic void removeDataProducer(InfoBusDataProducer producer)
producer
- the DataProducer that is leaving the InfoBuspublic boolean fireItemAvailable(java.lang.String dataItemName, java.awt.datatransfer.DataFlavor[] flavors, InfoBusDataProducer source)
Note that the DataController should copy the source field it receives to any target-specific method that the controller calls
dataItemName
- the name of the DataItem made available by sourceflavors
- the DataFlavors the source makes available (optional, possibly null)source
- the Producer offering the DataItemInfoBus.fireItemAvailable(java.lang.String, java.awt.datatransfer.DataFlavor[], javax.infobus.InfoBusDataProducer)
public boolean fireItemRevoked(java.lang.String dataItemName, InfoBusDataProducer producer)
Note that the DataController should copy the source field it receives to any target-specific method that the controller calls
dataItemName
- the name of the DataItem being revoked by sourceproducer
- the Producer no longer offering the DataItemInfoBus.fireItemRevoked(java.lang.String, javax.infobus.InfoBusDataProducer)
public boolean findDataItem(java.lang.String dataItemName, java.awt.datatransfer.DataFlavor[] flavors, InfoBusDataConsumer consumer, java.util.Vector foundItem)
If the DataController returns a DataItem from this method, the InfoBus will stop seeking the data and return that DataItem (calling no other controllers). If foundItem is empty when the call completes, the InfoBus uses the boolean return value to determine whether to continue polling controllers: if true, polling stops and null is returned to the consumer.
dataItemName
- the name of the DataItem that the consumer is seekingflavors
- the DataFlavors the consumer prefers (optional, possibly null)consumer
- the Consumer seeking the datafoundItem
- a Vector for storing the result which will be empty
when the method is calledInfoBus.findDataItem(java.lang.String, java.awt.datatransfer.DataFlavor[], javax.infobus.InfoBusDataConsumer)
public boolean findMultipleDataItems(java.lang.String dataItemName, java.awt.datatransfer.DataFlavor[] flavors, InfoBusDataConsumer consumer, java.util.Vector foundItems)
All non-null responses should be stored in the foundItems Vector. The responses returned by this controller will be concatenated with those of the controllers called before and after this one. If the return value is true, no further controllers will be polled.
dataItemName
- the name of the DataItem that the consumer is seekingflavors
- the DataFlavors the consumer prefers (optional, possibly null)consumer
- the Consumer seeking the datafoundItems
- a Vector for storing all non-null results; will be
empty when the method is calledInfoBus.findDataItem(java.lang.String, java.awt.datatransfer.DataFlavor[], javax.infobus.InfoBusDataConsumer)
|
||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |