01: /*******************************************************************************
02: * Copyright (c) 2000, 2007 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.jface.viewers;
11:
12: /**
13: * Interface for objects that support elements with a checked state.
14: *
15: * @see ICheckStateListener
16: * @see CheckStateChangedEvent
17: */
18: public interface ICheckable {
19: /**
20: * Adds a listener for changes to the checked state of elements
21: * in this viewer.
22: * Has no effect if an identical listener is already registered.
23: *
24: * @param listener a check state listener
25: */
26: public void addCheckStateListener(ICheckStateListener listener);
27:
28: /**
29: * Returns the checked state of the given element.
30: *
31: * @param element the element
32: * @return <code>true</code> if the element is checked,
33: * and <code>false</code> if not checked
34: */
35: public boolean getChecked(Object element);
36:
37: /**
38: * Removes the given check state listener from this viewer.
39: * Has no effect if an identical listener is not registered.
40: *
41: * @param listener a check state listener
42: */
43: public void removeCheckStateListener(ICheckStateListener listener);
44:
45: /**
46: * Sets the checked state for the given element in this viewer.
47: * Does not fire events to check state listeners.
48: *
49: * @param element the element
50: * @param state <code>true</code> if the item should be checked,
51: * and <code>false</code> if it should be unchecked
52: * @return <code>true</code> if the checked state could be set,
53: * and <code>false</code> otherwise
54: */
55: public boolean setChecked(Object element, boolean state);
56: }
|