|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.browsecode.helpers.reorderablelistpanel.ReorderableListModelWithOrderIndexStub<E>
public class ReorderableListModelWithOrderIndexStub<E>
A stub for making a ReorderableListModel which has a IntegerDataBit for the OrderIndex -- i.e. this uses the ReorderableObject interface to keep track of the items in the list. The OrderIndex is a number which duplicates the place in the list where the data is. First, implement ReorderableObject for your object -- this has both the item and a reference to it's OrderIndex. Also supports undo (in progress!)
Nested Class Summary | |
---|---|
static interface |
ReorderableListModelWithOrderIndexStub.ReorderableObject<E2>
|
Field Summary | |
---|---|
static java.lang.String |
ABSTRACTION_ERROR
|
protected java.util.Vector<javax.swing.event.UndoableEditListener> |
undoableEditListeners
|
Fields inherited from interface org.browsecode.helpers.reorderablelistpanel.ReorderableListModel |
---|
INSERTED_FROM_DELETED_HERE, INSERTED_FROM_ELSEWHERE |
Constructor Summary | |
---|---|
ReorderableListModelWithOrderIndexStub()
|
Method Summary | |
---|---|
void |
addReorderableChangeListener(ReorderableChangeListener<E> reorderableChangeListener)
|
void |
addUndoableEditListener(javax.swing.event.UndoableEditListener listener)
Registers the given observer to begin receiving notifications when undoable edits are made to the document. |
boolean |
canItemBeMovedElsewhere()
Removed means can it be moved to somewhere else, NOT deleted -- it must always be deletable. |
boolean |
deleteItem(E item,
int oldIndex)
Call this when an item has been deleted. |
protected void |
deleteItem(ReorderableListModelWithOrderIndexStub.ReorderableObject<E> justDeleted)
If an object is deleted from the list, this method is fired and should be used to keep track of which items should not be saved anymore and deleted when this set is saved. |
protected boolean |
deleteItemProtected(E item,
int oldIndex,
boolean fireUndoableEdit)
|
void |
fireUndoableEdit(ReorderableListModelWithOrderIndexStub fireOn,
javax.swing.undo.UndoableEdit edit)
For other classes that want to use the same list of undoableEditListeners. |
protected void |
fireUndoableEdit(javax.swing.undo.UndoableEdit edit)
|
protected boolean |
getHasBeenChanged()
|
int |
getItemCount()
|
protected java.lang.String |
getItemsName()
For undos and presentation names -- so we can say what we're moving/deleting/inserting |
protected java.util.Vector<ReorderableListModelWithOrderIndexStub.ReorderableObject<E>> |
getItemsVector()
Should return a non-cloned version of the list of items -- the vector will be changed to reflect the order, etc. |
protected E |
getNewItem()
Creates a new item for the list, but does not insert it into the list. |
protected ReorderableListModelWithOrderIndexStub.ReorderableObject<E> |
getNewItem(int indexAt)
Should not insert item, but should get a new one and return it. |
protected ReorderableListModelWithOrderIndexStub.ReorderableObject<E> |
getReorderableObjectFor(E reorderableItem)
|
protected java.util.Vector<E> |
getVectorOfReorderableItems()
This may be wrong for your class, if your ReorderableListItem is not the item itself. |
E |
insertNewItemAt(int indexAt)
Creates a new item for the list and puts it into the index that it's listed as. |
protected E |
insertNewItemAtProtected(ReorderableListModelWithOrderIndexStub.ReorderableObject<E> item,
int indexAt,
boolean fireUndoableEdit)
|
java.util.Iterator<E> |
iterator()
Get the items. |
boolean |
moveItemElsewhere(E item,
int oldIndex)
Removed means it was moved to somewhere else, NOT deleted. |
protected boolean |
moveItemElsewhereProtected(E item,
int oldIndex,
boolean fireUndoableEdit)
|
boolean |
moveItemToIndex(E item,
java.lang.Integer oldIndex,
int newIndex)
Items are moved around in the list, or added to the list this way, too. |
protected boolean |
moveItemToIndexProtected(E item,
java.lang.Integer oldIndex,
int newIndex,
boolean fireUndoableEdit)
|
void |
removeReorderableChangeListener(ReorderableChangeListener<E> reorderableChangeListener)
|
void |
removeUndoableEditListener(javax.swing.event.UndoableEditListener listener)
Unregisters the given observer from the notification list so it will no longer receive updates. |
protected void |
resetHasBeenChanged()
|
protected void |
setCachedReorderableItems(java.util.Vector<E> cache)
|
boolean |
shouldFireUndoableEdits()
Also public for other classes that want to use the same list of undoableEditListeners. |
protected boolean |
undeleteItem(ReorderableListModelWithOrderIndexStub.ReorderableObject<E> aboutToUndelete)
Undelete an item that was just deleted using deleteItem(). |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static java.lang.String ABSTRACTION_ERROR
protected java.util.Vector<javax.swing.event.UndoableEditListener> undoableEditListeners
Constructor Detail |
---|
public ReorderableListModelWithOrderIndexStub()
Method Detail |
---|
protected java.util.Vector<ReorderableListModelWithOrderIndexStub.ReorderableObject<E>> getItemsVector()
protected java.lang.String getItemsName()
protected void deleteItem(ReorderableListModelWithOrderIndexStub.ReorderableObject<E> justDeleted)
justDeleted
- protected boolean undeleteItem(ReorderableListModelWithOrderIndexStub.ReorderableObject<E> aboutToUndelete)
justUndeleted
- public boolean moveItemToIndex(E item, java.lang.Integer oldIndex, int newIndex)
ReorderableListModel
moveItemToIndex
in interface ReorderableListModel<E>
oldIndex
- The old index it had in this parent -- if it is new or dropped from another pane, oldIndex is null.newIndex
- The index it should be dropped into
protected boolean moveItemToIndexProtected(E item, java.lang.Integer oldIndex, int newIndex, boolean fireUndoableEdit)
public boolean deleteItem(E item, int oldIndex)
ReorderableListModel
deleteItem
in interface ReorderableListModel<E>
protected boolean deleteItemProtected(E item, int oldIndex, boolean fireUndoableEdit)
protected ReorderableListModelWithOrderIndexStub.ReorderableObject<E> getNewItem(int indexAt)
protected E getNewItem()
public E insertNewItemAt(int indexAt)
ReorderableListModel
insertNewItemAt
in interface ReorderableListModel<E>
protected E insertNewItemAtProtected(ReorderableListModelWithOrderIndexStub.ReorderableObject<E> item, int indexAt, boolean fireUndoableEdit)
public boolean canItemBeMovedElsewhere()
ReorderableListModel
canItemBeMovedElsewhere
in interface ReorderableListModel<E>
public boolean moveItemElsewhere(E item, int oldIndex)
ReorderableListModel
moveItemElsewhere
in interface ReorderableListModel<E>
protected boolean moveItemElsewhereProtected(E item, int oldIndex, boolean fireUndoableEdit)
public java.util.Iterator<E> iterator()
ReorderableListModel
iterator
in interface ReorderableListModel<E>
public int getItemCount()
getItemCount
in interface ReorderableListModel<E>
public void addReorderableChangeListener(ReorderableChangeListener<E> reorderableChangeListener)
addReorderableChangeListener
in interface ReorderableListModel<E>
public void removeReorderableChangeListener(ReorderableChangeListener<E> reorderableChangeListener)
removeReorderableChangeListener
in interface ReorderableListModel<E>
reorderableChangeListener
- the ReorderableChangeListener to removepublic void addUndoableEditListener(javax.swing.event.UndoableEditListener listener)
listener
- the observer to registerUndoableEditEvent
public void removeUndoableEditListener(javax.swing.event.UndoableEditListener listener)
listener
- the observer to registerUndoableEditEvent
public boolean shouldFireUndoableEdits()
fireOn
- edit
- protected void fireUndoableEdit(javax.swing.undo.UndoableEdit edit)
public void fireUndoableEdit(ReorderableListModelWithOrderIndexStub fireOn, javax.swing.undo.UndoableEdit edit)
fireOn
- edit
- protected boolean getHasBeenChanged()
protected void resetHasBeenChanged()
protected void setCachedReorderableItems(java.util.Vector<E> cache)
protected java.util.Vector<E> getVectorOfReorderableItems()
protected ReorderableListModelWithOrderIndexStub.ReorderableObject<E> getReorderableObjectFor(E reorderableItem)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |