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: * Tom Schindl <tom.schindl@bestsolution.at> - port to MyGWT (issue 39)
11: *******************************************************************************/package net.mygwt.ui.client.viewer;
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: /**
22: * Adds a listener for changes to the checked state of elements
23: * in this viewer.
24: * Has no effect if an identical listener is already registered.
25: *
26: * @param listener a check state listener
27: */
28: public void addCheckStateListener(ICheckStateListener listener);
29:
30: /**
31: * Returns the checked state of the given element.
32: *
33: * @param element the element
34: * @return <code>true</code> if the element is checked,
35: * and <code>false</code> if not checked
36: */
37: public boolean getChecked(Object element);
38:
39: /**
40: * Removes the given check state listener from this viewer.
41: * Has no effect if an identical listener is not registered.
42: *
43: * @param listener a check state listener
44: */
45: public void removeCheckStateListener(ICheckStateListener listener);
46:
47: /**
48: * Sets the checked state for the given element in this viewer.
49: * Does not fire events to check state listeners.
50: *
51: * @param element the element
52: * @param state <code>true</code> if the item should be checked,
53: * and <code>false</code> if it should be unchecked
54: * @return <code>true</code> if the checked state could be set,
55: * and <code>false</code> otherwise
56: */
57: public boolean setChecked(Object element, boolean state);
58: }
|