|
||||||||||
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 |
boolean |
hasFilter
|
Fields inherited from class org.eclipse.swt.widgets.Control |
---|
internal_parent |
Fields inherited from class org.eclipse.swt.widgets.Widget |
---|
internal_handle, internal_style |
Constructor Summary | |
---|---|
SortedList(Composite parent,
int style)
|
|
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. |
boolean |
allowTraverseByArrowKey(Event event)
|
Point |
computeSize(int wHint,
int hHint,
boolean changed)
Returns the prefered size of the receiver. |
void |
dispose()
Disposes of the operating system resources associated with the receiver and all its descendents. |
boolean |
forceFocus()
Forces the receiver to have the keyboard focus, causing all keyboard events to be delivered to it. |
Rectangle |
getBounds()
Returns a rectangle describing the receiver's size and location relative to its parent (or its display if its parent is null), unless the receiver is a shell. |
protected Control |
getchild()
|
java.lang.String |
getFocus()
Returns the text of the item currently focused in the receiver, or null if no item has focus. |
Font |
getFont()
Returns the font that the receiver will use to paint textual information. |
int |
getItemHeight()
Returns the height (in pixels) of the area which would be used to display one of the items in the tree. |
Point |
getLocation()
Returns a point describing the receiver's location relative to its parent (or its display if its parent is null), unless the receiver is a shell. |
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. |
Point |
getSize()
Returns a point describing the receiver's size. |
void |
internal_createHandle(int index)
|
boolean |
isDisposed()
Returns true if the widget has been disposed,
and false otherwise. |
boolean |
isEnableTraverse()
|
boolean |
isFocusControl()
Returns true if the receiver has the user-interface
focus, and false otherwise. |
void |
pack()
Causes the receiver to be resized to its preferred size. |
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 |
setBounds(int x,
int y,
int width,
int height)
Sets the receiver's size and location to the rectangular area specified by the arguments. |
void |
setBounds(Rectangle rect)
Sets the receiver's size and location to the rectangular area specified by the argument. |
boolean |
setFocus()
Causes the receiver to have the keyboard focus, such that all keyboard events will be delivered to it. |
void |
setFont(Font font)
Sets the font that the receiver will use to paint textual information to the font specified by the argument, or to the default font for that kind of control if the argument is null. |
void |
setItems(java.lang.String[] items)
Sets the receiver's items to be the given array of items. |
void |
setLocation(int x,
int y)
Sets the receiver's location to the point specified by the arguments which are relative to the receiver's parent (or its display if its parent is null), unless the receiver is a shell. |
void |
setLocation(Point location)
Sets the receiver's location to the point specified by the arguments which are relative to the receiver's parent (or its display if its parent is null), unless the receiver is a shell. |
void |
setSelection(java.lang.String[] items)
Sets the receiver's selection to be the given array of items. |
void |
setSize(int width,
int height)
Sets the receiver's size to the point specified by the arguments. |
void |
setSize(Point size)
Sets the receiver's size to the point specified by the argument. |
void |
showSelection()
Scrolls the list as necessary to show the selected items. |
protected boolean |
traverse(Event event)
|
Methods inherited from class org.eclipse.swt.widgets.Scrollable |
---|
computeTrim, getClientArea, getHorizontalBar, getVerticalBar, internal_getNativeStyle |
Methods inherited from class org.eclipse.swt.widgets.Widget |
---|
addDisposeListener, addListener, checkSubclass, checkWidget, getData, getData, getDisplay, getStyle, internal_sendEvent, isListening, notifyListeners, removeDisposeListener, removeInternalFilter, removeListener, removeListener, sendEvent, 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
public boolean hasFilter
Constructor Detail |
---|
public SortedList(Composite parent, int style)
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 boolean isDisposed()
Widget
true
if the widget has been disposed,
and false
otherwise.
This method gets the dispose state for the widget. When a widget has been disposed, it is an error to invoke any other method using the widget.
isDisposed
in class Widget
true
when the widget is disposed and false
otherwisepublic void dispose()
Widget
true
when sent the message isDisposed()
.
Any internal connections between the widgets in the tree will
have been removed to facilitate garbage collection.
NOTE: This method is not called recursively on the descendents
of the receiver. This means that, widget implementers can not
detect when a widget is being disposed of by re-implementing
this method, but should instead listen for the Dispose
event.
dispose
in class Control
Widget.addDisposeListener(org.eclipse.swt.events.DisposeListener)
,
Widget.removeDisposeListener(org.eclipse.swt.events.DisposeListener)
,
Widget.checkWidget()
public boolean forceFocus()
Control
forceFocus
in class Control
true
if the control got focus, and false
if it was unable to.Control.setFocus()
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 Scrollable
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[])
public void internal_createHandle(int index)
internal_createHandle
in class Widget
public void setBounds(int x, int y, int width, int height)
Control
x
and
y
arguments are relative to the receiver's
parent (or its display if its parent is null), unless
the receiver is a shell. In this case, the x
and y
arguments are relative to the display.
Note: Attempting to set the width or height of the receiver to a negative number will cause that value to be set to zero instead.
setBounds
in class Control
x
- the new x coordinate for the receivery
- the new y coordinate for the receiverwidth
- the new width for the receiverheight
- the new height for the receiverpublic void setBounds(Rectangle rect)
Control
x
and
y
fields of the rectangle are relative to
the receiver's parent (or its display if its parent is null).
Note: Attempting to set the width or height of the receiver to a negative number will cause that value to be set to zero instead.
setBounds
in class Control
rect
- the new bounds for the receiverpublic void setLocation(int x, int y)
Control
setLocation
in class Control
x
- the new x coordinate for the receivery
- the new y coordinate for the receiverpublic void setLocation(Point location)
Control
setLocation
in class Control
location
- the new location for the receiverpublic void setSize(int width, int height)
Control
Note: Attempting to set the width or height of the receiver to a negative number will cause that value to be set to zero instead.
setSize
in class Control
width
- the new width for the receiverheight
- the new height for the receiverpublic void pack()
Control
pack
in class Control
Control.computeSize(int, int, boolean)
public void setSize(Point size)
Control
Note: Attempting to set the width or height of the receiver to a negative number will cause them to be set to zero instead.
setSize
in class Control
size
- the new size for the receiverpublic Rectangle getBounds()
Control
getBounds
in class Control
public Point getLocation()
Control
getLocation
in class Control
public Point getSize()
Control
getSize
in class Control
public boolean setFocus()
Control
setFocus
in class Control
true
if the control got focus, and false
if it was unable to.Control.forceFocus()
protected Control getchild()
public void setFont(Font font)
Control
setFont
in class Control
font
- the new font (or null)public Font getFont()
Control
getFont
in class Control
public boolean isFocusControl()
Control
true
if the receiver has the user-interface
focus, and false
otherwise.
isFocusControl
in class Control
public boolean isEnableTraverse()
isEnableTraverse
in class Control
public boolean allowTraverseByArrowKey(Event event)
allowTraverseByArrowKey
in class Control
protected boolean traverse(Event event)
traverse
in class Control
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |