# Class ContactsModel

java.lang.Object
com.codename1.ui.list.DefaultListModel
com.codename1.contacts.ContactsModel

All Implemented Interfaces:
  `ListModel, MultipleSelectionListModel`

public class ContactsModel extends DefaultListModel
This Contacts model is responsible for querying Contacts from the device and to cache the data for faster usage

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ContactsModel(String... ids)`
  Constructor with contacts ids

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `addItem(Object item)`
  Adds the specified item to the end of this list.
  `Object`
  `getItemAt(int index)`
  Returns the item at the given offset
  `void`
  `removeItem(int index)`
  Removes the item at the specified position in this list.
  `void`
  `setPlaceHolderImage(Image placeHolder)`
  Sets the Contacts place holder image.

  ### Methods inherited from class DefaultListModel

  `addDataChangedListener, addItemAtIndex, addSelectedIndices, addSelectionListener, fireDataChangedEvent, getList, getSelectedIndex, getSelectedIndices, getSize, isMultiSelectionMode, removeAll, removeDataChangedListener, removeSelectedIndices, removeSelectionListener, setItem, setMultiSelectionMode, setSelectedIndex, setSelectedIndices`
  Modifier and Type
  Method
  Description
  `void`
  `addDataChangedListener(DataChangedListener l)`
  Invoked to indicate interest in future change events
  `void`
  `addItemAtIndex(Object item, int index)`
  Adding an item to list at given index
  `void`
  `addSelectedIndices(int... indices)`
  Adds indices to set of selected indices.
  `void`
  `addSelectionListener(SelectionListener l)`
  Invoked to indicate interest in future selection events
  `protected void`
  `fireDataChangedEvent(int status, int index)`
  Broadcast a change event to all listeners
  `List`
  `getList()`
  Returns the internal list of items which makes traversal using iterators easier.
  `int`
  `getSelectedIndex()`
  Returns the selected list offset
  `int[]`
  `getSelectedIndices()`
  Gets the selected indices in this model.
  `int`
  `getSize()`
  Returns the number of items in the list
  `boolean`
  `isMultiSelectionMode()`
  Checks to see if this list model is in multi-selection mode.
  `void`
  `removeAll()`
  Removes all elements from the model
  `void`
  `removeDataChangedListener(DataChangedListener l)`
  Invoked to indicate no further interest in future change events
  `void`
  `removeSelectedIndices(int... indices)`
  Removes indices from the set of selected indices.
  `void`
  `removeSelectionListener(SelectionListener l)`
  Invoked to indicate no further interest in future selection events
  `void`
  `setItem(int index, Object item)`
  Change the item at the given index
  `void`
  `setMultiSelectionMode(boolean multiSelectionMode)`
  Enables or disables multi-selection mode.
  `void`
  `setSelectedIndex(int index)`
  Sets the selected list offset can be set to -1 to clear selection
  `void`
  `setSelectedIndices(int... indices)`
  For use with multi-selection mode.

  ### Methods inherited from class Object

  `clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`
  Modifier and Type
  Method
  Description
  `protected Object`
  `clone()`
  `boolean`
  `equals(Object obj)`
  Indicates whether some other object is "equal to" this one.
  `final Class`
  `getClass()`
  Returns the runtime class of an object.
  `int`
  `hashCode()`
  Returns a hash code value for the object.
  `final void`
  `notify()`
  Wakes up a single thread that is waiting on this object's monitor.
  `final void`
  `notifyAll()`
  Wakes up all threads that are waiting on this object's monitor.
  `String`
  `toString()`
  Returns a string representation of the object.
  `final void`
  `wait()`
  Causes current thread to wait until another thread invokes the method or the method for this object.
  `final void`
  `wait(long timeout)`
  Causes current thread to wait until either another thread invokes the method or the method for this object, or a specified amount of time has elapsed.
  `final void`
  `wait(long timeout, int nanos)`
  Causes current thread to wait until another thread invokes the method or the method for this object, or some other thread interrupts the current thread, or a certain amount of real time has elapsed.

- ## Constructor Details

  - ### ContactsModel

    public ContactsModel(String... ids)

    Constructor with contacts ids

    ###### Parameters

    - `ids`: the contact ids we would like this model to handle

- ## Method Details

  - ### setPlaceHolderImage

    public void setPlaceHolderImage(Image placeHolder)

    Sets the Contacts place holder image.

    ###### Parameters

    - `placeHolder`: image place holder for the contacts

  - ### getItemAt

    public Object getItemAt(int index)

    Returns the item at the given offset

    ###### Parameters

    - `index`: an index into this list

    ###### Returns

    the item at the specified index

    Specified by:
      `getItemAt` in interface `ListModel`
    Overrides:
      `getItemAt` in class `DefaultListModel`

  - ### addItem

    public void addItem(Object item)

    Adds the specified item to the end of this list. An optional operation for mutable lists, it can throw an unsupported operation exception if a list model is not mutable.

    ###### Parameters

    - `item`: the item to be added
    Specified by:
      `addItem` in interface `ListModel`
    Overrides:
      `addItem` in class `DefaultListModel`

  - ### removeItem

    public void removeItem(int index)

    Removes the item at the specified position in this list.

    ###### Parameters

    - `index`: the index of the item to removed
    Specified by:
      `removeItem` in interface `ListModel`
    Overrides:
      `removeItem` in class `DefaultListModel`