All Packages Class Hierarchy This Package Previous Next Index
Class com.ibm.beans.demos.travel.flight.FlightInfoViewer
java.lang.Object
|
+----java.awt.Component
|
+----java.awt.Container
|
+----java.awt.Panel
|
+----com.ibm.beans.demos.travel.flight.FlightInfoViewer
- public class FlightInfoViewer
- extends Panel
- implements FlightInfoListener, Serializable, ActionListener, ListboxListener, ItemSelectable
This bean is a simple viewer for Airline Flight Information. It is
one of the beans that make up the complex composite flight selector
bean. Through republishing, the flight selector bean receives
FlightInfoEvent's sent from the FlightInfoDap that are then forwarded
to the flight info viewer which displays information representing
available flights from a Vector of FlightInformation objects stored
in the FlightInfoEvent object. A script ties the flight info viewer bean
to other beans that make up the composite flight selector bean so that each
time the user clicks on a flight, information about the flight is sent to the
image viewer bean and the text area bean. When the user has decided on a particular
flight, he or she can then click on the Ok button, which causes the viewer
to fire a FlightRequestedEvent to the itinerary bean.
- See Also:
- FlightInfoDap, FlightInfoEvent, FlightInformation, FlightRequestedEvent
-
FlightInfoViewer()
- Constructs an instance of the FlightInfoViewer bean.
-
actionPerformed(ActionEvent)
- Responds to the user clicking on the Ok button, by
firing a FlightRequested event to all registered listeners.
-
addFlightRequestedListener(FlightRequestedListener)
- Registers a listener for the FlightRequestedEvent.
-
addItemListener(ItemListener)
- Registers a listener for an ItemEvent.
-
createListBox()
- Creates, initializes, and embeds the MultiColumnListbox.
-
doLayout()
- Sizes and positions the MultiColumnListbox within the viewer based on
the current size of the viewer.
-
fireFlightRequested()
- Notifies all registered listeners that a flight has been requested.
-
fireItem()
- Notifies all registered listeners that a flight has been selected.
-
FlightInformationChanged(FlightInfoEvent)
- Receives Flight Information data from the FlightInfoDap.
-
getAvailableFlights()
- Returns the Vector of FlightInformation objects corresponding to the
list of available flights.
-
getListBox()
- Retrieves a reference to the embedded MultiColumnListbox control.
-
getPreferredSize()
- Returns the preferredSize property of this bean.
-
getSelectedFlight()
- Returns the FlightInformation object corresponding to the
currently selected flight.
-
getSelectedObjects()
- Returns an array of FlightInformation objects corresponding to the
currently selected flight.
-
removeFlightRequestedListener(FlightRequestedListener)
- Deregisters a listener for the FlightRequestedEvent.
-
removeItemListener(ItemListener)
- Deregisters a listener for an ItemEvent.
-
rowDeselected(ListboxEvent)
- Responds to the user deselecting a flight from the list of available
flights, by firing a new ItemEvent to each of the registered listeners.
-
rowSelected(ListboxEvent)
- Responds to the user selecting a flight from the list of available
flights, by firing a new ItemEvent to each of the registered listeners.
-
setAvailableFlights(Vector)
- Updates Flight Information data.
FlightInfoViewer
public FlightInfoViewer()
- Constructs an instance of the FlightInfoViewer bean. The constructor
initializes instance data and creates and embeds the MultiColumnListbox
control, which is used to convey the Airline Flight Information to the
user. The MultiColumnListbox is initially empty; it will be filled in
when the FlightInformationChanged() method is invoked.
- See Also:
- createListBox
createListBox
public void createListBox()
- Creates, initializes, and embeds the MultiColumnListbox.
FlightInformationChanged
public void FlightInformationChanged(FlightInfoEvent flightInfoEvent)
- Receives Flight Information data from the FlightInfoDap. The Vector of
FlightInformation objects is retrieved from the FlightInfoEvent, and
passed to the setAvailableFlights() method.
- Parameters:
- flightInfoEvent - A FlightInfoEvent object describing the event that occurred.
- See Also:
- setAvailableFlights, FlightInfoEvent
rowSelected
public void rowSelected(ListboxEvent listboxEvent)
- Responds to the user selecting a flight from the list of available
flights, by firing a new ItemEvent to each of the registered listeners.
- Parameters:
- listboxEvent - An ListboxEvent object describing the event that occurred.
- See Also:
- fireItem
rowDeselected
public void rowDeselected(ListboxEvent listboxEvent)
- Responds to the user deselecting a flight from the list of available
flights, by firing a new ItemEvent to each of the registered listeners.
- Parameters:
- listboxEvent - An ListboxEvent object describing the event that occurred.
- See Also:
- fireItem
fireItem
public void fireItem()
- Notifies all registered listeners that a flight has been selected. In
the demo scenario, this event fires in response to the user clicking on
one of the items in the MultiColumnListbox, and the ImageViewer bean and
TextArea bean are updated using data from the FlightInformation object contained in the
ItemEvent by means of a script attached to this method.
- See Also:
- rowSelected, rowDeselected
addItemListener
public synchronized void addItemListener(ItemListener itemListener)
- Registers a listener for an ItemEvent.
- Parameters:
- itemListener - The registering ItemListener.
- See Also:
- removeItemListener
removeItemListener
public synchronized void removeItemListener(ItemListener itemListener)
- Deregisters a listener for an ItemEvent.
- Parameters:
- itemListener - The deregistering ItemListener.
- See Also:
- addItemListener
getSelectedObjects
public Object[] getSelectedObjects()
- Returns an array of FlightInformation objects corresponding to the
currently selected flight. In the demo, since the MultiColumnListbox
containing the flight information is set to single-select mode, this
will always be either null or an array with one element. This
method is required by the ItemSelectable interface; in general,
it is probably easier to use the getSelectedFlight() method, which
avoids the need to have to index into an array).
- Returns:
- An array of FlightInformation objects describing the selected flight.
- See Also:
- getSelectedFlight
getSelectedFlight
public FlightInformation getSelectedFlight()
- Returns the FlightInformation object corresponding to the
currently selected flight. If multiple selections were enabled
for the MultiColumnListbox, the getSelectedObjects() method
would have to be used instead of this method.
- Returns:
- A FlightInformation object describing the selected flight.
- See Also:
- getSelectedObjects
getAvailableFlights
public Vector getAvailableFlights()
- Returns the Vector of FlightInformation objects corresponding to the
list of available flights.
- Returns:
- A Vector of FlightInformation objects corresponding to the available flights.
- See Also:
- setAvailableFlights, FlightInformation
setAvailableFlights
public synchronized void setAvailableFlights(Vector newAvailableFlights)
- Updates Flight Information data. In the demo scenario, this information
comes from a FlightInfoEvent fired by the FlightInfoDap. Any currently
displayed flight information is cleared, and a new list of flight
information is presented.
- Parameters:
- newAvailableFlights - A Vector of FlightInformation objects.
- See Also:
- FlightInformationChanged, getAvailableFlights, FlightInformation
actionPerformed
public void actionPerformed(ActionEvent actionEvent)
- Responds to the user clicking on the Ok button, by
firing a FlightRequested event to all registered listeners.
- Parameters:
- actionEvent - An ActionEvent object describing the event that occurred.
- See Also:
- fireFlightRequested
fireFlightRequested
public void fireFlightRequested()
- Notifies all registered listeners that a flight has been requested.
In the demo scenario, this event fires in response to receiving
an actionPerformed event from the Ok button, and the
itinerary bean is the only registered listener.
- See Also:
- actionPerformed, FlightRequested
addFlightRequestedListener
public synchronized void addFlightRequestedListener(FlightRequestedListener fRL)
- Registers a listener for the FlightRequestedEvent.
- Parameters:
- fRL - The registering FlightRequestedListener.
- See Also:
- removeFlightRequestedListener
removeFlightRequestedListener
public synchronized void removeFlightRequestedListener(FlightRequestedListener fRL)
- Deregisters a listener for the FlightRequestedEvent.
- Parameters:
- fRL - The deregistering FlightRequestedListener.
- See Also:
- addFlightRequestedListener
getPreferredSize
public Dimension getPreferredSize()
- Returns the preferredSize property of this bean. This is used to
determine the initial size of the viewer in the Layout view).
- Returns:
- A Dimension object containing the preferred width and height.
- Overrides:
- getPreferredSize in class Container
doLayout
public void doLayout()
- Sizes and positions the MultiColumnListbox within the viewer based on
the current size of the viewer.
- Overrides:
- doLayout in class Container
getListBox
public MultiColumnListbox getListBox()
- Retrieves a reference to the embedded MultiColumnListbox control.
- Returns:
- A reference to the embedded listBox.
All Packages Class Hierarchy This Package Previous Next Index