frysk.gui.monitor
Class ObservableLinkedList
java.lang.Object
java.util.AbstractCollection
java.util.AbstractList
java.util.AbstractSequentialList
java.util.LinkedList
frysk.gui.monitor.ObservableLinkedList
- All Implemented Interfaces:
- SaveableXXX, Serializable, Cloneable, Iterable, Collection, Deque, List, Queue
- Direct Known Subclasses:
- CoreDebugDataModel
public class ObservableLinkedList
- extends LinkedList
- implements SaveableXXX
Extends LinkedList but accepts observers that will
be notified when elements are added/removed.
Not all functions are overwritten check to see that
the function you use is overwritten and the appropriate
listeners are being notified.
Overwrites the copy constructor to dynamically call
copy constructor of all elements and add them to the
new list.
Knows how to save its elements and load them.
should really be called ObservableSavableCopyiableLinkedList
- See Also:
- Serialized Form
Method Summary |
void |
add(int index,
Object element)
|
boolean |
add(Object o)
|
void |
clear()
|
void |
copyFromList(ObservableLinkedList other)
|
void |
dontSaveObject()
object will not be saved if save is called |
void |
doSaveObject()
Object will be savable if save is called |
void |
load(Element node)
To load a stored property one does this:
String someString = node.getAttributeValue("someString");
To load @link frysk.gui.monitor.SaveableXXX one gets the appropriet
node and tells that object to load itself from that node. |
Object |
remove(int index)
|
boolean |
remove(Object o)
|
void |
save(Element node)
Save object to the given node
Saving Conventions:
If this object has a property such as a
String, char, int, etc, that is saved by
using node.setAttribute("someProperty", someProperty);
If this object contains composing @link frysk.gui.monitor.SaveableXXX
then a node is created for that and that object is told to save itself
to that node. |
boolean |
shouldSaveObject()
queried to see if this object should be saved
or not |
void |
swap(Object oldObject,
Object newObject)
Removed oldObject and add newObject in its spot |
Methods inherited from class java.util.LinkedList |
addAll, addAll, addFirst, addLast, clone, contains, descendingIterator, element, get, getFirst, getLast, indexOf, lastIndexOf, listIterator, offer, offerFirst, offerLast, peek, peekFirst, peekLast, poll, pollFirst, pollLast, pop, push, remove, removeFirst, removeFirstOccurrence, removeLast, removeLastOccurrence, set, size, toArray, toArray |
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
itemAdded
public final GuiObservable itemAdded
itemRemoved
public final GuiObservable itemRemoved
ObservableLinkedList
public ObservableLinkedList()
ObservableLinkedList
public ObservableLinkedList(ObservableLinkedList other,
boolean copyObjects)
copyFromList
public void copyFromList(ObservableLinkedList other)
add
public boolean add(Object o)
- Specified by:
add
in interface Collection
- Specified by:
add
in interface Deque
- Specified by:
add
in interface List
- Specified by:
add
in interface Queue
- Overrides:
add
in class LinkedList
add
public void add(int index,
Object element)
- Specified by:
add
in interface List
- Overrides:
add
in class LinkedList
remove
public Object remove(int index)
- Specified by:
remove
in interface List
- Overrides:
remove
in class LinkedList
remove
public boolean remove(Object o)
- Specified by:
remove
in interface Collection
- Specified by:
remove
in interface Deque
- Specified by:
remove
in interface List
- Overrides:
remove
in class LinkedList
clear
public void clear()
- Specified by:
clear
in interface Collection
- Specified by:
clear
in interface List
- Overrides:
clear
in class LinkedList
swap
public void swap(Object oldObject,
Object newObject)
- Removed oldObject and add newObject in its spot
- Parameters:
oldObject
- newObject
-
save
public void save(Element node)
- Description copied from interface:
SaveableXXX
- Save object to the given node
Saving Conventions:
If this object has a property such as a
String, char, int, etc, that is saved by
using node.setAttribute("someProperty", someProperty);
If this object contains composing @link frysk.gui.monitor.SaveableXXX
then a node is created for that and that object is told to save itself
to that node. Example:
Element filtersNode = new Element("filtersList");
this.filtersList.save(filtersNode);
node.addContent(filtersNode);
Be careful some times one wants to save the objects name rather
than the object itself, and then use the name to later recreate
that object via a managers. Like observers for instance. Perhaps
objects such as these should be smart enough to use a manager to
save/load themselves, that way an api client doesnt have to worry
... one day :).
- Specified by:
save
in interface SaveableXXX
load
public void load(Element node)
- Description copied from interface:
SaveableXXX
- To load a stored property one does this:
String someString = node.getAttributeValue("someString");
To load @link frysk.gui.monitor.SaveableXXX one gets the appropriet
node and tells that object to load itself from that node.
Example:
Element filtersNode = node.getChild("filtersList");
this.filtersList.load(filtersNode);
- Specified by:
load
in interface SaveableXXX
shouldSaveObject
public boolean shouldSaveObject()
- Description copied from interface:
SaveableXXX
- queried to see if this object should be saved
or not
- Specified by:
shouldSaveObject
in interface SaveableXXX
- Returns:
- wether this object should be saved or not
doSaveObject
public void doSaveObject()
- Description copied from interface:
SaveableXXX
- Object will be savable if save is called
- Specified by:
doSaveObject
in interface SaveableXXX
dontSaveObject
public void dontSaveObject()
- Description copied from interface:
SaveableXXX
- object will not be saved if save is called
- Specified by:
dontSaveObject
in interface SaveableXXX