org.eclipse.jface.databinding.swt
Class SWTObservables
java.lang.Object
org.eclipse.jface.databinding.swt.SWTObservables
-
public class SWTObservables
- extends
Object
A factory for creating observables for SWT widgets
-
Since:
- 1.1
Methods inherited from class java.lang.
Object
|
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait
|
SWTObservables
public SWTObservables()
getRealm
public static
Realm getRealm(
Display display)
- Returns the realm representing the UI thread for the given display.
-
-
Parameters:
-
display
-
-
Returns:
- the realm representing the UI thread for the given display
observeDelayedValue
public static
ISWTObservableValue observeDelayedValue(int delay,
ISWTObservableValue observable)
- Returns an observable which delays notification of value change events
from
observable
until delay
milliseconds have
elapsed since the last change event, or until a FocusOut event is
received from the underlying widget (whichever happens first). This
observable helps to boost performance in situations where an observable
has computationally expensive listeners (e.g. changing filters in a
viewer) or many dependencies (master fields with multiple detail fields).
A common use of this observable is to delay validation of user input
until the user stops typing in a UI field.
To notify about pending changes, the returned observable fires a stale
event when the wrapped observable value fires a change event, and remains
stale until the delay has elapsed and the value change is fired. A call
to
getValue()
while a value change is
pending will fire the value change immediately, short-circuiting the
delay.
Note that this observable will not forward
ValueChangingEvent
events from a wrapped
IVetoableValue
.
-
-
Parameters:
-
delay
- the delay in milliseconds -
observable
- the observable being delayed
-
Returns:
- an observable which delays notification of value change events
from
observable
until delay
milliseconds have elapsed since the last change event. -
Since:
- 1.2
observeEnabled
public static
ISWTObservableValue observeEnabled(
Control control)
- Returns an observable value tracking the enabled state of the given
control
-
-
Parameters:
-
control
- the control to observe
-
Returns:
- an observable value tracking the enabled state of the given
control
observeVisible
public static
ISWTObservableValue observeVisible(
Control control)
- Returns an observable value tracking the visible state of the given
control
-
-
Parameters:
-
control
- the control to observe
-
Returns:
- an observable value tracking the visible state of the given
control
observeTooltipText
public static
ISWTObservableValue observeTooltipText(
Widget widget)
- Returns an observable tracking the tooltip text of the given item. The
supported types are:
- org.eclipse.swt.widgets.Control
- org.eclipse.swt.custom.CTabItem
- org.eclipse.swt.widgets.TabItem
- org.eclipse.swt.widgets.TableColumn
- org.eclipse.swt.widgets.ToolItem
- org.eclipse.swt.widgets.TrayItem
- org.eclipse.swt.widgets.TreeColumn
-
-
Parameters:
-
widget
-
-
Returns:
- an observable value tracking the tooltip text of the given item
-
Since:
- 1.3
observeTooltipText
public static
ISWTObservableValue observeTooltipText(
Control control)
- Returns an observable value tracking the tooltip text of the given
control
-
-
Parameters:
-
control
- the control to observe
-
Returns:
- an observable value tracking the tooltip text of the given
control
observeSelection
public static
ISWTObservableValue observeSelection(
Control control)
- Returns an observable observing the selection attribute of the provided
control
. The supported types are:
- org.eclipse.swt.widgets.Spinner
- org.eclipse.swt.widgets.Button
- org.eclipse.swt.widgets.Combo
- org.eclipse.swt.custom.CCombo
- org.eclipse.swt.widgets.List
- org.eclipse.swt.widgets.Scale
-
-
Parameters:
-
control
-
-
Returns:
- observable value
-
Throws:
-
IllegalArgumentException
- if control
type is unsupported
observeMin
public static
ISWTObservableValue observeMin(
Control control)
- Returns an observable observing the minimum attribute of the provided
control
. The supported types are:
- org.eclipse.swt.widgets.Spinner
- org.eclipse.swt.widgets.Scale
-
-
Parameters:
-
control
-
-
Returns:
- observable value
-
Throws:
-
IllegalArgumentException
- if control
type is unsupported
observeMax
public static
ISWTObservableValue observeMax(
Control control)
- Returns an observable observing the maximum attribute of the provided
control
. The supported types are:
- org.eclipse.swt.widgets.Spinner
- org.eclipse.swt.widgets.Scale
-
-
Parameters:
-
control
-
-
Returns:
- observable value
-
Throws:
-
IllegalArgumentException
- if control
type is unsupported
observeText
public static
ISWTObservableValue observeText(
Control control,
int[] events)
- Returns an observable observing the text attribute of the provided
control
. The supported types are:
- org.eclipse.swt.widgets.Text
- org.eclipse.swt.custom.StyledText (as of 1.3)
-
-
Parameters:
-
control
- -
events
- array of SWT event types to register for change events. May
include
SWT.None
,
SWT.Modify
,
SWT.FocusOut
or
SWT.DefaultSelection
.
-
Returns:
- observable value
-
Throws:
-
IllegalArgumentException
- if control
type is unsupported -
Since:
- 1.3
observeText
public static
ISWTObservableValue observeText(
Control control,
int event)
- Returns an observable observing the text attribute of the provided
control
. The supported types are:
- org.eclipse.swt.widgets.Text
- org.eclipse.swt.custom.StyledText (as of 1.3)
-
-
Parameters:
-
control
- -
event
- event type to register for change events
-
Returns:
- observable value
-
Throws:
-
IllegalArgumentException
- if control
type is unsupported
observeText
public static
ISWTObservableValue observeText(
Widget widget)
- Returns an observable observing the text attribute of the provided
widget
. The supported types are:
- org.eclipse.swt.widgets.Button (as of 1.3)
- org.eclipse.swt.custom.CCombo
- org.eclipse.swt.custom.CLabel
- org.eclipse.swt.widgets.Combo
- org.eclipse.swt.widgets.Item
- org.eclipse.swt.widgets.Label
- org.eclipse.swt.widgets.Link (as of 1.2)
- org.eclipse.swt.widgets.Shell
- org.eclipse.swt.widgets.StyledText (as of 1.3)
- org.eclipse.swt.widgets.Text (as of 1.3)
-
-
Parameters:
-
widget
-
-
Returns:
- observable value
-
Throws:
-
IllegalArgumentException
- if the type of widget
is unsupported -
Since:
- 1.3
observeText
public static
ISWTObservableValue observeText(
Control control)
- Returns an observable observing the text attribute of the provided
control
. The supported types are:
- org.eclipse.swt.widgets.Button (as of 1.3)
- org.eclipse.swt.custom.CCombo
- org.eclipse.swt.custom.CLabel
- org.eclipse.swt.widgets.Combo
- org.eclipse.swt.widgets.Label
- org.eclipse.swt.widgets.Link (as of 1.2)
- org.eclipse.swt.widgets.Shell
- org.eclipse.swt.custom.StyledText (as of 1.3)
- org.eclipse.swt.widgets.Text (as of 1.3)
-
-
Parameters:
-
control
-
-
Returns:
- observable value
-
Throws:
-
IllegalArgumentException
- if control
type is unsupported
observeMessage
public static
ISWTObservableValue observeMessage(
Widget widget)
- Returns an observable observing the message attribute of the provided
widget
. the supported types are:
- org.eclipse.swt.widgets.Text
- org.eclipse.swt.widgets.ToolTip
-
-
Parameters:
-
widget
-
-
Returns:
- an observable observing the message attribute of the provided
widget
. -
Since:
- 1.3
observeImage
public static
ISWTObservableValue observeImage(
Widget widget)
- Returns an observable observing the image attribute of the provided
widget
. The supported types are:
- org.eclipse.swt.widgets.Button
- org.eclipse.swt.custom.CLabel
- org.eclipse.swt.widgets.Item
- org.eclipse.swt.widgets.Label
-
-
Parameters:
-
widget
-
-
Returns:
- observable value
-
Throws:
-
IllegalArgumentException
- if widget
type is unsupported -
Since:
- 1.3
observeItems
public static
IObservableList observeItems(
Control control)
- Returns an observable observing the items attribute of the provided
control
. The supported types are:
- org.eclipse.swt.widgets.Combo
- org.eclipse.swt.custom.CCombo
- org.eclipse.swt.widgets.List
-
-
Parameters:
-
control
-
-
Returns:
- observable list
-
Throws:
-
IllegalArgumentException
- if control
type is unsupported
observeSingleSelectionIndex
public static
ISWTObservableValue observeSingleSelectionIndex(
Control control)
- Returns an observable observing the single selection index attribute of
the provided
control
. The supported types are:
- org.eclipse.swt.widgets.Table
- org.eclipse.swt.widgets.Combo
- org.eclipse.swt.custom.CCombo
- org.eclipse.swt.widgets.List
-
-
Parameters:
-
control
-
-
Returns:
- observable value
-
Throws:
-
IllegalArgumentException
- if control
type is unsupported
observeForeground
public static
ISWTObservableValue observeForeground(
Control control)
- Returns an observable value tracking the foreground color of the given
control
-
-
Parameters:
-
control
- the control to observe
-
Returns:
- an observable value tracking the foreground color of the given
control
observeBackground
public static
ISWTObservableValue observeBackground(
Control control)
- Returns an observable value tracking the background color of the given
control
-
-
Parameters:
-
control
- the control to observe
-
Returns:
- an observable value tracking the background color of the given
control
observeFont
public static
ISWTObservableValue observeFont(
Control control)
- Returns an observable value tracking the font of the given control.
-
-
Parameters:
-
control
- the control to observe
-
Returns:
- an observable value tracking the font of the given control
observeSize
public static
ISWTObservableValue observeSize(
Control control)
- Returns an observable value tracking the size of the given control.
-
-
Parameters:
-
control
- the control to observe
-
Returns:
- an observable value tracking the size of the given control
-
Since:
- 1.3
observeLocation
public static
ISWTObservableValue observeLocation(
Control control)
- Returns an observable value tracking the location of the given control.
-
-
Parameters:
-
control
- the control to observe
-
Returns:
- an observable value tracking the location of the given control
-
Since:
- 1.3
observeFocus
public static
ISWTObservableValue observeFocus(
Control control)
- Returns an observable value tracking the focus of the given control.
-
-
Parameters:
-
control
- the control to observe
-
Returns:
- an observable value tracking the focus of the given control
-
Since:
- 1.3
observeBounds
public static
ISWTObservableValue observeBounds(
Control control)
- Returns an observable value tracking the bounds of the given control.
-
-
Parameters:
-
control
- the control to observe
-
Returns:
- an observable value tracking the bounds of the given control
-
Since:
- 1.3
observeEditable
public static
ISWTObservableValue observeEditable(
Control control)
- Returns an observable observing the editable attribute of the provided
control
. The supported types are:
- org.eclipse.swt.widgets.Text
-
-
Parameters:
-
control
-
-
Returns:
- observable value
-
Throws:
-
IllegalArgumentException
- if control
type is unsupported
Guidelines for using Eclipse APIs.
Copyright (c) Eclipse contributors and others 2000, 2008. All rights reserved.