|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.swing.AbstractListModel
edu.rit.slides.ScreenChooser
public class ScreenChooser
Class ScreenChooser provides an object for choosing a theatre from a list of available theatres in the Slides application.
A screen chooser implements interface ScreenDiscoveryListener. A screen chooser object can be hooked
up to a
ScreenDiscoveryObject
when
the screen discovery object is constructed. The screen discovery object
notifies the screen chooser whenever a theatre becomes available or
unavailable, and the screen chooser updates the list of available theatres
accordingly.
A screen chooser also implements interfaces ListModel and
ListSelectionListener
. A screen chooser can be hooked up to a
Java Swing
JList
by calling the screen
chooser's setJList() method. The screen chooser updates the JList
display whenever the list of available theatres changes. The screen chooser
also makes sure the same theatre stays selected in the JList when the list of
available theatres changes. When the user selects a theatre from the JList
display, the JList informs the screen chooser which theatre was selected.
Field Summary |
---|
Fields inherited from class javax.swing.AbstractListModel |
---|
listenerList |
Constructor Summary | |
---|---|
ScreenChooser(ScreenSelectionListener theListener)
Construct a new screen chooser. |
Method Summary | |
---|---|
Object |
getElementAt(int i)
Returns the name of the theatre at the given index in the theatre list. |
int |
getSize()
Returns the number of theatres in the theatre list. |
void |
selectTheatre(Screen theTheatre)
Select the given theatre. |
void |
setJList(JList theJList)
Set the JList associated with this screen chooser. |
void |
theatreAdded(Screen theHandle,
String theName)
Notify this screen chooser that a newly discovered theatre was added to the list of discovered theatres. |
void |
theatreNameChanged(Screen theHandle,
String theName)
Notify this screen discovery listener that an existing theatre's name was changed in the list of discovered theatres. |
void |
theatreRemoved(Screen theHandle)
Notify this screen discovery listener that a previously discovered theatre was removed from the list of discovered theatres. |
void |
valueChanged(ListSelectionEvent e)
Report that the theatre selection changed. |
Methods inherited from class javax.swing.AbstractListModel |
---|
addListDataListener, fireContentsChanged, fireIntervalAdded, fireIntervalRemoved, getListDataListeners, getListeners, removeListDataListener |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ScreenChooser(ScreenSelectionListener theListener)
theListener
- Screen selection listener. If non-null, the listener will be notified
whenever the selected theatre changes.Method Detail |
---|
public void setJList(JList theJList)
theJList
- JList.public void theatreAdded(Screen theHandle, String theName)
theatreAdded
in interface ScreenDiscoveryListener
theHandle
- Theatre multihandle implementing interface
Screen
.theName
- Theatre name.public void theatreNameChanged(Screen theHandle, String theName)
theatreNameChanged
in interface ScreenDiscoveryListener
theHandle
- Theatre multihandle implementing interface
Screen
.theName
- Theatre name.public void theatreRemoved(Screen theHandle)
theatreRemoved
in interface ScreenDiscoveryListener
theHandle
- Theatre multihandle implementing interface
Screen
.public void selectTheatre(Screen theTheatre)
theTheatre
- Multihandle of the theatre to select.public int getSize()
getSize
in interface ListModel
public Object getElementAt(int i)
getElementAt
in interface ListModel
i
- Index.
public void valueChanged(ListSelectionEvent e)
valueChanged
in interface ListSelectionListener
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |