juife
v0.1a

net.sf.juife
Class DefaultComponentListModel

java.lang.Object
  extended by javax.swing.AbstractListModel
      extended by net.sf.juife.DefaultComponentListModel
All Implemented Interfaces:
java.io.Serializable, javax.swing.ListModel, ComponentListModel

public class DefaultComponentListModel
extends javax.swing.AbstractListModel
implements ComponentListModel

This class provides default implementation of the ComponentListModel interface.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.swing.AbstractListModel
listenerList
 
Constructor Summary
DefaultComponentListModel()
          Creates a new instance of DefaultComponentListModel
 
Method Summary
 void add(java.awt.Component c)
          Adds the specified component at the end of the list.
 java.awt.Component get(int index)
          Gets the component at the specified index.
 java.lang.Object getElementAt(int index)
          Gets the value at the specified index.
 int getSize()
          Gets the length of the list.
 int indexOf(java.lang.Object o)
          Gets the index of the first occurence of the given argument, testing for equality using the equals method.
 void insert(java.awt.Component c, int index)
          Inserts the specified component at the specified index.
 void moveDown(java.awt.Component c)
          Moves the specified component one position down in the list.
 void moveUp(java.awt.Component c)
          Moves the specified component one position up in the list.
 boolean remove(java.awt.Component c)
          Removes the specified component.
 java.awt.Component remove(int index)
          Removes the component at the specified position.
 java.awt.Component set(int index, java.awt.Component c)
          Replaces the component at the specified position with the specified component.
 int size()
          Gets the length of the list.
 
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

DefaultComponentListModel

public DefaultComponentListModel()
Creates a new instance of DefaultComponentListModel

Method Detail

get

public java.awt.Component get(int index)
Gets the component at the specified index.

Specified by:
get in interface ComponentListModel
Parameters:
index - The requested index.
Returns:
The component at the specified index.
Throws:
java.lang.ArrayIndexOutOfBoundsException - If the index is out of range.

getElementAt

public java.lang.Object getElementAt(int index)
Gets the value at the specified index.
Note: The preferred method to use is get(int).

Specified by:
getElementAt in interface javax.swing.ListModel
Parameters:
index - The requested index.
Returns:
The value at the specified index.

insert

public void insert(java.awt.Component c,
                   int index)
Inserts the specified component at the specified index.

Specified by:
insert in interface ComponentListModel
Parameters:
c - The component to be inserted.
index - The position of the new component.
Throws:
java.lang.ArrayIndexOutOfBoundsException - If the index is invalid.

add

public void add(java.awt.Component c)
Adds the specified component at the end of the list.

Specified by:
add in interface ComponentListModel
Parameters:
c - The component to be added.

set

public java.awt.Component set(int index,
                              java.awt.Component c)
Replaces the component at the specified position with the specified component.

Specified by:
set in interface ComponentListModel
Parameters:
index - The index of the component to replace.
c - The component to be stored at the specified position.
Returns:
The previous component at the specified position.

moveUp

public void moveUp(java.awt.Component c)
Moves the specified component one position up in the list.

Parameters:
c - The component to be moved up.

moveDown

public void moveDown(java.awt.Component c)
Moves the specified component one position down in the list.

Parameters:
c - The component to be moved down.

remove

public boolean remove(java.awt.Component c)
Removes the specified component.

Specified by:
remove in interface ComponentListModel
Parameters:
c - The component to be removed.
Returns:
true if the list contained the specified component, false otherwise.

remove

public java.awt.Component remove(int index)
Removes the component at the specified position.

Specified by:
remove in interface ComponentListModel
Parameters:
index - The index of the component to be removed.
Returns:
The removed component.
Throws:
java.lang.ArrayIndexOutOfBoundsException - If the index is out of range.

indexOf

public int indexOf(java.lang.Object o)
Gets the index of the first occurence of the given argument, testing for equality using the equals method.

Parameters:
o - An object.
Returns:
The index of the first occurence of the given argument or -1 if the object is not found.

getSize

public int getSize()
Gets the length of the list.

Specified by:
getSize in interface javax.swing.ListModel
Returns:
The length of the list.

size

public int size()
Gets the length of the list.

Specified by:
size in interface ComponentListModel
Returns:
The length of the list.

juife
v0.1a

Copyright © 2005 Grigor Iliev. All rights reserved. SourceForge.net Logo