KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jface > viewers > ICheckable


1 /*******************************************************************************
2  * Copyright (c) 2000, 2007 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.jface.viewers;
12
13 /**
14  * Interface for objects that support elements with a checked state.
15  *
16  * @see ICheckStateListener
17  * @see CheckStateChangedEvent
18  */

19 public interface ICheckable {
20     /**
21      * Adds a listener for changes to the checked state of elements
22      * in this viewer.
23      * Has no effect if an identical listener is already registered.
24      *
25      * @param listener a check state listener
26      */

27     public void addCheckStateListener(ICheckStateListener listener);
28
29     /**
30      * Returns the checked state of the given element.
31      *
32      * @param element the element
33      * @return <code>true</code> if the element is checked,
34      * and <code>false</code> if not checked
35      */

36     public boolean getChecked(Object JavaDoc element);
37
38     /**
39      * Removes the given check state listener from this viewer.
40      * Has no effect if an identical listener is not registered.
41      *
42      * @param listener a check state listener
43      */

44     public void removeCheckStateListener(ICheckStateListener listener);
45
46     /**
47      * Sets the checked state for the given element in this viewer.
48      * Does not fire events to check state listeners.
49      *
50      * @param element the element
51      * @param state <code>true</code> if the item should be checked,
52      * and <code>false</code> if it should be unchecked
53      * @return <code>true</code> if the checked state could be set,
54      * and <code>false</code> otherwise
55      */

56     public boolean setChecked(Object JavaDoc element, boolean state);
57 }
58
Popular Tags