|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.swt.widgets.Widget
org.eclipse.swt.widgets.Control
org.eclipse.swt.widgets.Scrollable
org.eclipse.ercp.swt.mobile.SortedList
public class SortedList
Instances of this class represent a selectable user interface object that displays a sorted list of text items. The items may be displayed in ascending or descending order. The sorting algorithm is platform and locale dependent.
If the FILTER style is specified during construction, an associated label is also displayed showing characters entered which are then used to filter the list to show fewer items. The selection state of items filtered out of the list is cleared.
IMPORTANT: This class is not intended to be subclassed.
Note: Only one of SINGLE and MULTI may be specified. Only one of UP and DOWN may be specified.
Field Summary | |
---|---|
static int |
FILTER
constructor style specifying filter field should be displayed |
Constructor Summary | |
---|---|
SortedList(Composite parent,
int style)
Construct a new instance of this class given its parent and a style value describing its behavior and appearance. |
|
SortedList(Composite parent,
int style,
int modeStyle)
Construct a new instance of this class given its parent, a style value describing its behavior and appearance, and a mode style describing additional behavior modes. |
Method Summary | |
---|---|
void |
add(java.lang.String item)
Adds the argument to the receiver's list of items. |
void |
addSelectionListener(SelectionListener listener)
Adds the listener to the collection of listeners who will be notified when the receiver's selection changes, by sending it one of the messages defined in the SelectionListener interface. |
Point |
computeSize(int wHint,
int hHint,
boolean changed)
Returns the prefered size of the receiver. |
java.lang.String |
getFocus()
Returns the text of the item currently focused in the receiver, or null if no item has focus. |
int |
getItemHeight()
Returns the height (in pixels) of the area which would be used to display one of the items in the tree. |
java.lang.String[] |
getSelection()
Returns an array of Strings of items that are currently selected in the receiver. |
int |
getSelectionCount()
Returns the number of items currently selected. |
void |
remove(java.lang.String item)
Searches the receiver's list starting at the first item until an item is found that is equal to the argument, and removes that item from the list. |
void |
removeAll()
Removes all of the items from the receiver. |
void |
removeSelectionListener(SelectionListener listener)
Removes the listener from the collection of listeners who are notified when the receiver's selection changes. |
void |
select(java.lang.String item)
Selects the first item that has text matching the given string. |
void |
setItems(java.lang.String[] items)
Sets the receiver's items to be the given array of items. |
void |
setSelection(java.lang.String[] items)
Sets the receiver's selection to be the given array of items. |
void |
showSelection()
Scrolls the list as necessary to show the selected items. |
Methods inherited from class org.eclipse.swt.widgets.Scrollable |
---|
computeTrim, getClientArea, getHorizontalBar, getVerticalBar |
Methods inherited from class org.eclipse.swt.widgets.Widget |
---|
addDisposeListener, addListener, checkSubclass, checkWidget, dispose, getData, getData, getDisplay, getStyle, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, setData, setData, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int FILTER
Constructor Detail |
---|
public SortedList(Composite parent, int style)
The style
value is either one of the style constants defined in class
SWT
which is applicable to instances of this class, or
must be built by bitwise OR 'ing together (that is, using the
int
"|" operator) two or more of those SWT
style constants. Style bits are also inherited from superclasses.
SWT.UP
(the default) means the list is sorted so that numbers go from
low to high when the list is examined from top to bottom. SWT.DOWN
means the list is sorted so that numbers go from high to low when
examined from top to bottom.
parent
- a composite control which will be the parent of the new
instance (cannot be null)style
- the style of the control
java.lang.IllegalArgumentException
- SWTException
- SWT.SINGLE
,
SWT.MULTI
,
SWT.UP
,
SWT.DOWN
public SortedList(Composite parent, int style, int modeStyle)
The style
value is either one of the style constants defined in class
SWT
which is applicable to instances of this class, or
must be built by bitwise OR 'ing together (that is, using the
int
"|" operator) two or more of those SWT
style constants. Style bits are also inherited from superclasses.
SWT.UP
(the default) means the list is sorted in dictionary order
from top to bottom (i.e. A, B, C, ...). SWT.DOWN
means the list is sorted in reverse dictionary order from top to bottom (i.e.
Z, Y, X, ...).
The modeStyle
may specify the class constant FILTER
.
This style adds a text entry field to
the widget which does not receive focus, but will display characters
entered while the list has focus. These characters are used to filter the
list items so that fewer items are displayed in the list. The selection is
cleared for any items not shown as a result of filtering.
parent
- a composite control which will be the parent of the new
instance (cannot be null)style
- the style of the controlmodeStyle
- the mode for the control
java.lang.IllegalArgumentException
- SWTException
- SWT.SINGLE
,
SWT.MULTI
,
SWT.UP
,
SWT.DOWN
,
FILTER
Method Detail |
---|
public void add(java.lang.String item)
item
- text to be added to the list
java.lang.IllegalArgumentException
- SWTException
- SWTError
- setItems(String[])
,
remove(java.lang.String)
,
removeAll()
public void addSelectionListener(SelectionListener listener)
widgetSelected
is called when the selection changes.
widgetDefaultSelected
is typically called when selection
is finalized.
listener
- instance called when selection events occur
java.lang.IllegalArgumentException
- SWTException
- SWTError
- ListBox.removeSelectionListener(org.eclipse.swt.events.SelectionListener)
,
SelectionListener
public Point computeSize(int wHint, int hHint, boolean changed)
Description copied from class: Control
The preferred size of a control is the size that it would be best displayed at. The width hint and height hint arguments allow the caller to ask a control questions such as "Given a particular width, how high does the control need to be to show all of the contents?" To indicate that the caller does not wish to constrain a particular dimension, the constant SWT.DEFAULT is passed for the hint.
If the changed flag is true, it indicates that the receiver's contents
have changed, therefore any caches that a layout manager containing the
control may have been keeping need to be flushed. When the control is
resized, the changed flag will be false
, so layout
manager caches can be retained.
Overrides: computeSize
in class
Control
computeSize
in class Control
wHint
- the width hint (can be SWT.DEFAULT)hHint
- the height hint (can be SWT.DEFAULT)changed
- true if the control's contents have changed, and false
otherwise
Layout
,
Control.getBorderWidth()
,
Control.getBounds()
,
Control.getSize()
,
Control.pack(boolean)
,
"computeTrim, getClientArea for controls that implement them"public java.lang.String getFocus()
null
if no item has focus.
SWTException
- public int getItemHeight()
SWTException
- SWTError
- public java.lang.String[] getSelection()
SWTException
- SWTError
- getSelectionCount()
public int getSelectionCount()
SWTException
- SWTError
- getSelection()
public void remove(java.lang.String item)
item
- text of item to remove
java.lang.IllegalArgumentException
- SWTException
- SWTError
- add(String)
,
removeAll()
public void removeAll()
SWTException
- java.lang.IllegalArgumentException
- add(String)
,
remove(String)
,
setItems(String[])
public void removeSelectionListener(SelectionListener listener)
listener
- instance called when selection events occur
java.lang.IllegalArgumentException
- SWTException
- SWTError
- addSelectionListener(org.eclipse.swt.events.SelectionListener)
,
SelectionListener
public void select(java.lang.String item)
null
, the selection is cleared.
item
- text of item to select
java.lang.IllegalArgumentException
- SWTException
- public void setItems(java.lang.String[] items)
items
- array of text strings to be shown in list
java.lang.IllegalArgumentException
- SWTException
- SWTError
- add(java.lang.String)
public void setSelection(java.lang.String[] items)
items
- array of text strings to be selected in list
java.lang.IllegalArgumentException
- SWTException
- select(java.lang.String)
public void showSelection()
SWTException
- select(java.lang.String)
,
setSelection(java.lang.String[])
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |