FileDocCategorySizeDatePackage
ToDoListImpl.javaAPI DocphoneME MR2 API (J2ME)3634Wed May 02 18:00:28 BST 2007com.sun.kvem.midp.pim

ToDoListImpl

public class ToDoListImpl extends AbstractPIMList implements javax.microedition.pim.ToDoList
Class ToDoListImpl implements methods of PIM interface ToDoList.

Fields Summary
Constructors Summary
ToDoListImpl(String name, int mode, Object handle)
Construct a ToDo handler.

param
name descriptive name for list
param
mode access mode
param
handle handle of the list

        super(PIM.TODO_LIST, name, mode, handle);
    
Methods Summary
public javax.microedition.pim.ToDocreateToDo()
Creates a ToDo entry.

return
ToDo entry

        return new ToDoImpl(this);
    
public javax.microedition.pim.ToDoimportToDo(javax.microedition.pim.ToDo item)
Initializes a ToDo entry from a previous item.

param
item template containing input data
return
initialized ToDo entry

        return new ToDoImpl(this, item);
    
public java.util.Enumerationitems(int field, long startDate, long endDate)
Gets an Enumeration of the items in the list.

param
field identifier of field
param
startDate beginning of range
param
endDate end of range
return
Enumeration of matching events

        if (getFieldDataType(field) != PIMItem.DATE) {
            throw new IllegalArgumentException("Not a DATE field");
        }
        if (endDate < startDate) {
            throw new IllegalArgumentException("Start date"
                + " must precede end date");
        }
        Vector results = new Vector();
        Vector keys = new Vector();
        for (Enumeration e = items(); e.hasMoreElements(); ) {
            ToDo item = (ToDo) e.nextElement();
            int indices = item.countValues(field);
            for (int i = 0; i < indices; i++) {
                long date = item.getDate(field, i);
                if (date >= startDate && date <= endDate) {
                    // include result
                    KeySortUtility.store(keys, results, date, item);
                    break;
                }
            }
        }
        return results.elements();
    
public voidremoveToDo(javax.microedition.pim.ToDo item)
Removes an entry from a ToDo list.

param
item the entry to be removed
throws
PIMException if the item is not int the list

        removeItem(item);