public class ViewInvocationHandler extends Object implements InvocationHandler
Invocation handler used for forwarding proxied methods for views. In order to completely conform to framework operations, underlying class is required to have the following properties:
DMXViewDeclaration
annotationDMXViewDeclaration.Render
DMXViewDeclaration.ViewUI
DMXViewDeclaration.ConstructUI
Class must provide default, no-argument constructor, or a constructor with single argument of type
DMXDefaultAdapter
. If later is provided, it will take precedence over the no-argument constructor. This
can be used to set DMXDefaultAdapter
filed if it needs to be used.
Method annotated with DMXViewDeclaration.ConstructUI
will be invoked on UI thread. All UI construction
operation should be performed in this method, so that UI can be constructed properly.
Modifier and Type | Field and Description |
---|---|
protected Method |
addChildMethod
Method for adding child view.
|
protected DMXExtensionCallback |
callback
Extension callback used by this class.
|
protected FieldAccessor |
constraintField
View placement constraint field.
|
protected Method |
constraintMethod
Method for getting placement constraint.
|
protected Method |
constructUiMethod
Method for initial UI construction.
|
protected FieldAccessor |
dlgField
Dialog field for view.
|
protected Method |
dlgResultMethod
Method for getting dialog result.
|
protected boolean |
extendable
If
true , indicates that underlying object implements
DMXExtendable . |
protected boolean |
isDialog
Indicates whether this view is dialog view.
|
protected boolean |
isModal
If this view is dialog view, this indicates modality.
|
protected Map<String,Object> |
modelData
Values of model data fields.
|
protected Map<String,FieldAccessor> |
modelFields
Fields of underlying object declared as model data.
|
protected String |
parentViewId
ID of this view's parent.
|
protected Method |
renderMethod
Method to render the view.
|
protected String |
title
Title for dialog view.
|
protected Object |
underlying
Underlying object.
|
protected Method |
viewActivationMethod
Method for setting active child view.
|
protected String |
viewId
ID of this view.
|
protected FieldAccessor |
viewUiField
Field for view UI.
|
protected Method |
viewUiMethod
Method for getting view UI.
|
Modifier | Constructor and Description |
---|---|
protected |
ViewInvocationHandler()
Default constructor used only from subclasses.
|
|
ViewInvocationHandler(Class clazz,
DMXDefaultAdapter adapter)
Create new instance.
|
Modifier and Type | Method and Description |
---|---|
String |
getUnderlyingClassName()
Returns class name of the underlying object.
|
protected void |
initialize(Class clazz,
DMXDefaultAdapter adapter)
Initializes this handler with correct values from underlying object.
|
Object |
invoke(Object proxy,
Method method,
Object[] args) |
protected String viewId
protected String parentViewId
protected Object underlying
protected Map<String,FieldAccessor> modelFields
protected Method renderMethod
protected Method addChildMethod
protected FieldAccessor viewUiField
protected Method viewUiMethod
protected FieldAccessor constraintField
protected Method constraintMethod
protected Method constructUiMethod
protected Method viewActivationMethod
protected DMXExtensionCallback callback
protected boolean extendable
true
, indicates that underlying object implements
DMXExtendable
.protected Method dlgResultMethod
protected FieldAccessor dlgField
protected boolean isDialog
protected boolean isModal
protected String title
protected ViewInvocationHandler()
public ViewInvocationHandler(Class clazz, DMXDefaultAdapter adapter) throws InstantiationException, IllegalAccessException, IncompleteDeclarationException, NoSuchMethodException, InvocationTargetException
clazz
- view classadapter
- adapter instanceInstantiationException
- if class can not be instantiatedIllegalAccessException
- if element can not be accessedIncompleteDeclarationException
- if some of the required view annotations are missingNoSuchMethodException
- if method does not existInvocationTargetException
- if an error occurs during executionprotected final void initialize(Class clazz, DMXDefaultAdapter adapter) throws IllegalAccessException, IncompleteDeclarationException, NoSuchMethodException, InvocationTargetException
clazz
- class of underlying objectadapter
- platform adapterIllegalAccessException
- if fields or methods cannot be accessedIncompleteDeclarationException
- if some of the required annotations are missinNoSuchMethodException
- if required method does not existInvocationTargetException
- if an error occurspublic Object invoke(Object proxy, Method method, Object[] args) throws Throwable
invoke
in interface InvocationHandler
Throwable
public String getUnderlyingClassName()
Copyright © 2012-2014 Vektor Software. All Rights Reserved.