|
CubeTwister 2.0alpha142 2012-02-11 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjavax.swing.AbstractListModel
ch.randelshofer.gui.list.DefaultMutableListModel<T>
public class DefaultMutableListModel<T>
Default implementation of a MutableListModel.
| Field Summary |
|---|
| Fields inherited from class javax.swing.AbstractListModel |
|---|
listenerList |
| Constructor Summary | |
|---|---|
DefaultMutableListModel()
Creates a new instance of DefaultMutableListModel |
|
DefaultMutableListModel(java.util.Collection<T> data)
|
|
DefaultMutableListModel(T[] data)
|
|
| Method Summary | |
|---|---|
void |
add(int index,
T element)
Inserts the specified element at the specified position in this list Shifts the element currently at that position (if any) and any subsequent elements to the right (adds one to their indices). |
void |
add(T element)
Adds the element to the end of the list. |
int |
addAll(int index,
java.util.List l)
|
void |
create(int index,
java.lang.Object type)
Creates the specified element type at the specified position in this list Shifts the element currently at that position (if any) and any subsequent elements to the right (adds one to their indices). |
java.awt.datatransfer.Transferable |
exportTransferable(int[] indices)
Creates a Transferable to use as the source for a data transfer of the specified elements. |
javax.swing.Action[] |
getActions(int[] indices)
Gets actions for the specified elements. |
java.lang.Object |
getCreatableType(int index)
Returns the default type of elements that can be created at the specified index of the list. |
java.lang.Object[] |
getCreatableTypes(int index)
Returns the types of elements that can be created at the specified index of the list. |
T |
getElementAt(int index)
Returns the value at the specified index. |
java.util.List<java.awt.datatransfer.DataFlavor> |
getImportableFlavors()
Gets the importable data flavors for this list model. |
int |
getSize()
Returns the length of the list. |
int |
importTransferable(java.awt.datatransfer.Transferable t,
int action,
int index,
boolean asChild)
Causes a transfer to the model from the specified transferable. |
boolean |
isAddable(int index)
Returns true if an element can be added at the specified index. |
boolean |
isEditable(int index)
Returns true if the value of the specified element may be changed using setElementAt(Object,int). |
boolean |
isImportable(java.awt.datatransfer.DataFlavor[] transferFlavors,
int action,
int index,
boolean asChild)
Indicates whether the model would accept an import of the given set of data flavors prior to actually attempting to import it. |
boolean |
isRemovable(int index)
Returns true if the specified element may be removed. |
java.util.Iterator |
iterator()
|
java.lang.Object |
remove(int index)
Removes an element from the model. |
void |
set(int index,
T value)
Sets the value of an element at the given index. |
void |
setElementAt(java.lang.Object value,
int index)
Sets the value of an element at the given index. |
void |
setImportableFlavors(java.util.List<java.awt.datatransfer.DataFlavor> newValue)
Sets the importable data flavors for this list model. |
| 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 |
| Constructor Detail |
|---|
public DefaultMutableListModel()
public DefaultMutableListModel(java.util.Collection<T> data)
public DefaultMutableListModel(T[] data)
| Method Detail |
|---|
public java.lang.Object[] getCreatableTypes(int index)
getCreatableTypes in interface MutableListModelindex - The insertion point. 0 <= index <= getSize()
public java.lang.Object getCreatableType(int index)
getCreatableType in interface MutableListModelindex - The insertion point. 0 <= index <= getSize()
public void create(int index,
java.lang.Object type)
create in interface MutableListModelindex - index at which the specified element is to be inserted.type - element type to be inserted.
java.lang.IllegalArgumentException - if the type is not contained in
the array returned by getInsertableTypes(int).
java.lang.IndexOutOfBoundsException - if the index is out of range
(index < 0 || index > size()).public boolean isAddable(int index)
isAddable in interface MutableListModelindex - index of the element. 0 <= index <= getSize()add(int, Object)
public void add(int index,
T element)
index - index at which the specified element is to be inserted.element - element to be inserted.
java.lang.IllegalArgumentException - if the element is not of an
acceptable type returned by getInsertableTypes(int).
java.lang.IndexOutOfBoundsException - if the index is out of range
(index < 0 || index > size()).public void add(T element)
element - the element.
IllegalStateExcepton - if isElementInsertableAt(getSize()) returns false.public boolean isRemovable(int index)
isRemovable in interface MutableListModelindex - index of the element. 0 <= index <= getSize()remove(int)public java.lang.Object remove(int index)
remove in interface MutableListModelindex - index of the element. 0 <= index <= getSize()
java.lang.IllegalStateException - if the element may not be removed.isRemovable(int)public boolean isEditable(int index)
setElementAt(Object,int).
isEditable in interface MutableListModelindex - index of the element. 0 <= index <= getSize()setElementAt(Object, int)public T getElementAt(int index)
getElementAt in interface javax.swing.ListModelindex - the requested index
index
public void setElementAt(java.lang.Object value,
int index)
setElementAt in interface MutableListModelvalue - - the new valueindex - - the index whose value is to be changed. 0 <= index < getSize()
java.lang.IllegalStateException - if the element is not editable.isEditable(int)
public void set(int index,
T value)
index - - the index whose value is to be changed. 0 <= index < getSize()value - - the new value
java.lang.IllegalStateException - if the element is not editable.isEditable(int)public javax.swing.Action[] getActions(int[] indices)
getActions in interface MutableListModelindices - The elements.public int getSize()
getSize in interface javax.swing.ListModelpublic java.awt.datatransfer.Transferable exportTransferable(int[] indices)
exportTransferable in interface MutableListModelindices - Element indices.
public boolean isImportable(java.awt.datatransfer.DataFlavor[] transferFlavors,
int action,
int index,
boolean asChild)
isImportable in interface MutableListModeltransferFlavors - the data formats availableaction - The action DnDConstants.ACTION_COPY, .ACTION_MOVE or
.ACTION_LINK.index - The insertion point. 0 <= index <= getSize()asChild - True if the Transferable is dropped as a child of
the element.
DnDConstants
public int importTransferable(java.awt.datatransfer.Transferable t,
int action,
int index,
boolean asChild)
throws java.awt.datatransfer.UnsupportedFlavorException,
java.io.IOException
importTransferable in interface MutableListModelt - The transfer data.action - The action DnDConstants.ACTION_COPY, .ACTION_MOVE or
.ACTION_LINK.index - The insertion point. 0 <= index <= getSize()asChild - True if the Transferable is dropped as a child of
the element.
java.awt.datatransfer.UnsupportedFlavorException
java.io.IOException
public int addAll(int index,
java.util.List l)
public java.util.Iterator iterator()
public void setImportableFlavors(java.util.List<java.awt.datatransfer.DataFlavor> newValue)
newValue - A list which contains the data flavors.public java.util.List<java.awt.datatransfer.DataFlavor> getImportableFlavors()
|
(c) Werner Randelshofer. All rights reserved. |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||