Package com._1c.g5.aef2.swt.views
Class SwtView<VM extends IControlViewModel,NC extends org.eclipse.swt.widgets.Widget>
- java.lang.Object
-
- com._1c.g5.aef2.views.View<SwtRenderingParameters,VM,NC>
-
- com._1c.g5.aef2.swt.views.SwtView<VM,NC>
-
- All Implemented Interfaces:
IView<SwtRenderingParameters,VM,NC>
- Direct Known Subclasses:
SwtStandardView
public abstract class SwtView<VM extends IControlViewModel,NC extends org.eclipse.swt.widgets.Widget> extends View<SwtRenderingParameters,VM,NC>
Base class for SWT-based views.
-
-
Constructor Summary
Constructors Constructor Description SwtView()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected intcomputeNativeStyle(VM viewModel)Computes an SWT widget style flags.abstract NCcreateNativeControl(org.eclipse.swt.widgets.Composite parent, VM viewModel)Creates a native control for this view.static org.eclipse.swt.widgets.CompositegetContentControl(org.eclipse.swt.widgets.Control control)Obtains the composite control that represents the actual content.protected voidhandleFocusEvent(FocusEvent event, VM viewModel, NC control)HandlesFocusEvent.protected booleanisControlDisposed(NC control)Returnstrueif native control is disposed.static voidsetContentControl(org.eclipse.swt.widgets.Control control, org.eclipse.swt.widgets.Composite content)Associates the composite content control with the given control.protected voiduiAsyncExec(Runnable runnable)Executes the givenrunnablein UI thread only if the control and its display are not disposed.protected voiduiSyncExec(Runnable runnable)Executes the givenrunnablein UI thread only if the control and its display are not disposed.-
Methods inherited from class com._1c.g5.aef2.views.View
bind, bindListener, bindNativeControl, bindValue, bindValue, bindViewModel, getNativeControl, getParameters, getViewModel, handleEventChannelEvent, initialize, manageObservable, queueAndWaitEvent, queueEvent, registerEventChannelListener, unbind, unbindNativeControl, unbindViewModel, unmanageObservable, unregisterEventChannelListener
-
-
-
-
Method Detail
-
getContentControl
public static final org.eclipse.swt.widgets.Composite getContentControl(org.eclipse.swt.widgets.Control control)
Obtains the composite control that represents the actual content.- Parameters:
control- The control.- Returns:
- The content control.
-
setContentControl
public static final void setContentControl(org.eclipse.swt.widgets.Control control, org.eclipse.swt.widgets.Composite content)Associates the composite content control with the given control.- Parameters:
control- The control.content- The content control.
-
createNativeControl
public abstract NC createNativeControl(org.eclipse.swt.widgets.Composite parent, VM viewModel)
Creates a native control for this view.- Parameters:
parent- the parent composite to place a control in.viewModel- the view mode to create a control for.- Returns:
-
handleFocusEvent
protected void handleFocusEvent(FocusEvent event, VM viewModel, NC control)
Description copied from class:ViewHandlesFocusEvent.- Specified by:
handleFocusEventin classView<SwtRenderingParameters,VM extends IControlViewModel,NC extends org.eclipse.swt.widgets.Widget>- Parameters:
event- the focus event, cannot benull.viewModel- the view model, cannot benull.control- the native control, cannot benull.
-
isControlDisposed
protected final boolean isControlDisposed(NC control)
Description copied from class:ViewReturnstrueif native control is disposed.- Specified by:
isControlDisposedin classView<SwtRenderingParameters,VM extends IControlViewModel,NC extends org.eclipse.swt.widgets.Widget>- Parameters:
control- the native control, cannot benull.- Returns:
trueif native control is disposed,false- otherwise.
-
computeNativeStyle
protected int computeNativeStyle(VM viewModel)
Computes an SWT widget style flags. Override it to customize the flags.- Parameters:
viewModel- the view model to compute a style from.- Returns:
- the computed style.
- See Also:
Widget.getStyle()
-
uiSyncExec
protected final void uiSyncExec(Runnable runnable)
Executes the givenrunnablein UI thread only if the control and its display are not disposed. The thread which calls this method is suspended until the runnable completes.- Parameters:
runnable- the runnable to execute, cannot benull.
-
uiAsyncExec
protected final void uiAsyncExec(Runnable runnable)
Executes the givenrunnablein UI thread only if the control and its display are not disposed. The caller of this method continues to run in parallel.- Parameters:
runnable- the runnable to execute, cannot benull.
-
-