|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.swing.AbstractListModel PIRL.Conductor.Maestro.Theater_List_Model
public class Theater_List_Model
A Theater_List_Model extends the AbstractListModel to provide management of a list of Theater objects.
Field Summary | |
---|---|
static String |
ID
Class identification name with source code version and date. |
Fields inherited from class javax.swing.AbstractListModel |
---|
listenerList |
Constructor Summary | |
---|---|
Theater_List_Model()
|
Method Summary | |
---|---|
Theater_List_Model |
Add(Theater theater)
Add a Theater to the data model. |
void |
addElement(Object element)
|
void |
Clear()
Clear the data model of all entries. |
boolean |
Close_All()
Close all Theaters registered in the data model. |
boolean |
Close(int index)
Close a Theater at an index in the data model. |
boolean |
Close(Theater theater)
Close a Theater registered in the data model. |
Object |
getElementAt(int index)
Get the Theater name at the data model index. |
Object |
getSelectedItem()
Get the currently selected item location. |
int |
getSize()
Get the number of entries in the data model. |
int |
Index(String location)
|
int |
Index(Theater theater)
|
void |
insertElementAt(Object element,
int index)
|
String |
Location(int index)
Get the Theater location for a data model index. |
String |
Location(Messenger messenger)
|
String |
Location(String messenger_address)
|
String |
Location(Theater theater)
Get the location for a Theater in the data model. |
protected boolean |
Location(Theater theater,
String location,
int index)
Set a location at a data model index. |
protected static int |
Matching_Index(Theater theater,
List<Theater> theaters)
Get the index of a Theater in a list of Theaters that matches. |
Theater |
Messenger_Theater(String messenger_address)
Get the Theater for a Messenger address. |
boolean |
Opened(int index)
|
boolean |
Opened(String location)
|
String |
Previous_Location()
Get the previously selected item location. |
void |
Receive_Timeout(int timeout)
Set the maximum amount of time, in seconds, that will be used when waiting for a Theater protocol Message to be received. |
Theater |
Remove(int index)
|
Theater |
Remove(Theater theater)
|
void |
removeElement(Object element)
|
void |
removeElementAt(int index)
|
Theater_List_Model |
Replace(List<Theater> theaters)
|
void |
setSelectedItem(Object item)
Set the currently selected item. |
Theater |
Theater(int index)
|
Theater |
Theater(Messenger messenger)
|
Theater |
Theater(String location)
|
int |
Total_Opened()
|
void |
Update()
|
void |
Update(int index)
|
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 |
Methods inherited from interface javax.swing.ListModel |
---|
addListDataListener, removeListDataListener |
Field Detail |
---|
public static final String ID
Constructor Detail |
---|
public Theater_List_Model()
Method Detail |
---|
public void addElement(Object element)
addElement
in interface MutableComboBoxModel
public void insertElementAt(Object element, int index)
insertElementAt
in interface MutableComboBoxModel
public void removeElement(Object element)
removeElement
in interface MutableComboBoxModel
public void removeElementAt(int index)
removeElementAt
in interface MutableComboBoxModel
public void setSelectedItem(Object item)
If the item is null nothing is done.
If the item is a Theater its location
is used.
Otherwise the item must be a location String. The location is converted
to the abbreviated location
form.
If the item location is equal to the currently selected item location
nothing is done.
The previously selected item location
is
set to the currently selected item location and the currently selected
item location is then set to the new item location. All listeners are
notified that the selected item has changed.
setSelectedItem
in interface ComboBoxModel
item
- A Theater or location String.public Object getSelectedItem()
N.B.: The abbreviated form of the Theater location is returned.
getSelectedItem
in interface ComboBoxModel
Theater.Location(String)
,
Theater.Full_Location(String)
public String Previous_Location()
Each time the currently selected item is updated
with a new value the previously selected item is set to the
currently selected item before it is changed.
N.B.: The abbreviated form of the Theater location is returned.
currently selected
item location
unless both are null. This will be null until the
second change of the currently selected item.public Object getElementAt(int index)
getElementAt
in interface ListModel
index
- A data model index.
public int getSize()
getSize
in interface ListModel
Total_Opened()
public Theater_List_Model Add(Theater theater)
If a Theater at the location
of the specified
Theater is already in the data model that entry is replaced. Otherwise
a new entry for the specified Theater is added to the data model.
If addition of the specified Theater resulted in a location name change
, notification is
sent to all listeners that the entire list may have changed;
otherwise notification of a change to only the affected data model
index is sent.
theater
- A Theater to be added to the data model. If null nothing
is done.
protected boolean Location(Theater theater, String location, int index)
If the theater is non-null the Theater
location
overrides the specified location. Otherwise, if the
specified location is non-null it is set to the standard location format
. The abbreviated theater name
is obtained from
the location.
If the name is different from the location the names list is searched for names not at the specified index that match the new name. If a match is found a name changed flag is set and all matching names are reset to the location (the name is changed to the location). This ensures that names will always be unique.
If the specified index equals the list size - the location is a new addition to the list - the name and location are added to their lists and a null place-holder entry is added to the Theaters list. Otherwise the location replaces an existing location and the name replaces the existing name.
The name changed flag is returned as a signal that a notification should be sent that the entire list may have changed due to the name change; the change is not limited to the specified index.
theater
- A Theater object. If null and the location is
null nothing is done and false is returned.location
- A Theater location String. If null or empty the
Theater location
is used.index
- A data model index where the location is to be set.
If less than zero or greater than the list size nothing is done
and false is returned.
public Theater_List_Model Replace(List<Theater> theaters)
public Theater Remove(int index)
public Theater Remove(Theater theater)
public void Clear()
N.B.: The Theaters are not closed
.
Close_All()
public int Index(Theater theater)
public int Index(String location)
protected static int Matching_Index(Theater theater, List<Theater> theaters)
Theaters match when their locations
are equal.
theater
- A Theater to be matched.theaters
- A List of Theater objects.
public Theater Theater(int index)
public Theater Theater(String location)
public Theater Theater(Messenger messenger)
public Theater Messenger_Theater(String messenger_address)
messenger_address
- A Messenger address
.
public String Location(int index)
index
- A data model index.
Theater location
for the
Theater at the same index if the index has a Theater; but since
there may be no Theater for an index the locations list is used
instead.public String Location(Messenger messenger)
public String Location(String messenger_address)
public String Location(Theater theater)
theater
- A Theater.
public void Receive_Timeout(int timeout)
timeout
- The timeout
value
to be applied to all Theaters in the data model.public boolean Opened(int index)
public boolean Opened(String location)
public int Total_Opened()
public void Update(int index)
public void Update()
public boolean Close(int index)
If the Theater is closed (the return value is true) a change notification
is sent
to all listeners
.
index
- A data model index. If the index is invalid or no
Theater is present at the index nothing is done.
public boolean Close(Theater theater)
If the Theater is closed (the return value is true) a change notification
is sent
to all listeners
.
theater
- A Theater to be closed. N.B.: If the theater
is not registered in this data model nothing is done.
public boolean Close_All()
If any Theater is closed (the return value is true) a change notification
is sent
to all listeners
.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |