01: /*******************************************************************************
02: * Copyright (c) 2000, 2006 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: * Darrell Meyer <darrell@mygwt.net> - derived implementation
11: * Tom Schindl <tom.schindl@bestsolution.at> - bugfixes in issues: 41
12: *******************************************************************************/package net.mygwt.ui.client.viewer;
13:
14: import java.util.Iterator;
15: import java.util.List;
16:
17: /**
18: * A selection containing elements.
19: */
20: public interface ISelection {
21:
22: /**
23: * Returns the first element in this selection, or null if the selection is
24: * empty.
25: *
26: * @return an element, or null if none
27: */
28: public Object getFirstElement();
29:
30: /**
31: * Returns whether this selection is empty.
32: *
33: * @return <code>true</code> if this selection is empty, and
34: * <code>false</code> otherwise
35: */
36: public boolean isEmpty();
37:
38: /**
39: * Returns an iterator over the elements of this selection.
40: *
41: * @return an iterator over the selected elements
42: */
43: public Iterator iterator();
44:
45: /**
46: * Returns the number of elements selected in this selection.
47: *
48: * @return the number of elements selected
49: */
50: public int size();
51:
52: /**
53: * Returns the elements in this selection as an array.
54: *
55: * @return the selected elements as an array
56: */
57: public Object[] toArray();
58:
59: /**
60: * Returns the elements in this selection as a <code>List</code>.
61: *
62: * @return the selected elements as a list
63: */
64: public List toList();
65:
66: }
|