public abstract class DialogController
extends no.esito.jvine.controller.StateController
| Modifier and Type | Field and Description |
|---|---|
String |
dialogName
The dialog name
|
| Constructor and Description |
|---|
DialogController(String dialogName,
ApplicationController applicationController)
Constructs a new DialogControl with the specified dialog name.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
checkChange(RoleConstant role,
CheckType checkType)
Perform the specified check change on the specified role.
|
void |
clear(RoleConstant role,
boolean intercept)
Clears the specified role and all children.
|
void |
clearCurrent(RoleConstant role,
boolean intercept)
Clears the current instance of the specified role and propagates the
change to children.
|
void |
clearKeepKeys(RoleConstant role)
Clears the specified role and children but keeps the data belonging to
the key fields.
|
MessageReply |
dispatchMessage(Message message)
Dispatch the specified message.
|
MessageReply |
dispatchMessage(String messageID,
Object... args)
Dispatch the message with specified messageID and arguments.
|
MessageReply |
dispatchMessage(String messageID,
Throwable exception,
Object... args)
Dispatch the message with specified messageID, exception and arguments.
|
void |
display(RoleConstant role,
Object instance)
Displays the fields of the specified instance.
|
void |
display(RoleConstant role,
Object instance,
boolean changed)
Displays all fields of the specified instance.
|
void |
doCallBack(DialogCallBackValue callBackValue)
Perform the call back to the invoking dialog.
|
void |
doCallBack(Object value)
Perform the call back to the invoking dialog.
|
void |
doCallBack(Object value,
Integer opCode)
Perform the call back to the invoking dialog
|
Map<ValidationResult,ValidateContext> |
failedOnChangeValidator(Map<ValidationResult,ValidateContext> failedResult)
Hook method invoked when on change validation fails.
|
ActionHookList<?> |
getActionHookList(ActionTarget actionTarget,
ActionType actionType)
Get the list of action hooks for the specified action target and type.
|
<T> Collection<T> |
getAllInstances(RoleConstant role)
Get all the displayed instances of the specified role.
|
ApplicationController |
getApplicationController()
Get the application controller for this dialog
|
Collection<AttributeConstant> |
getChangedAttributes(RoleConstant role)
Gets the changed field attributes for the specified role.
|
Map<DialogObjectConstant,Collection<?>> |
getConversionMessages(RoleConstant role)
Get a map of dialog objects and conversion error messages for the
specified role.
|
<T> T |
getCurrentInstance(RoleConstant role)
Gets the current instance of the specified role.
|
<T extends DialogView> |
getDialogView()
Gets the dialog view class of this dialog.
|
DispatcherContext |
getDispatcherContext()
Get the message context.
|
<T> T |
getFieldValue(AttributeConstant attribute)
Gets the specified displayed attribute value.
|
<T> T |
getFieldValue(DialogObjectConstant dataItem)
Gets the specified displayed field value (converted from to model).
|
MessageDispatcher |
getMessageDispatcher()
Get the message dispatcher for this dialog controller
|
abstract String |
getObjectSelectionName()
Returns the name of the object selection.
|
abstract <T extends RoleConstant> |
getOSConst(String role)
Returns the constant denoting the role.
|
<T extends OSRole<?>> |
getOSRole(RoleConstant role)
Gets the object selection role.
|
abstract List<RoleConstant> |
getRoleConstants()
Returns the list of all role constants for the object selection
used in the dialog.
|
abstract Map<RoleConstant,OSRole<?>> |
getRoleMap()
Gives a map of role constants and object selection roles.
|
String |
getRoleStates()
Returns a string containing the role states of each role in this dialog's
object selection.
|
DialogSetupValue<?> |
getSetupValue() |
SpreadsheetExporter |
getSpreadsheetExporter() |
RoleState |
getState(RoleConstant role)
Get the state of the specified object selection role.
|
ViewModel |
getViewModel()
Get the ViewModel for the this dialog.
|
boolean |
hasConversionErrors(RoleConstant role)
Test if there are any current conversion errors for the specified role
|
void |
init()
Invoked after the dialog controller has been fully initialized.
|
<V> V |
invokeOnGui(Callable<V> guiMethod)
Invoke the specified callable on the gui thread.
|
void |
invokeOnGui(Runnable guiMethod)
Invoke the specified runnable on the gui thread.
|
boolean |
isChanged(RoleConstant role)
Test if any fields of the specified role is changed in the gui.
|
<T> T |
peek(RoleConstant role)
Create a new instance of the specified root and update it with the view's
field values.
|
void |
registerHook(ActionTarget actionTarget,
ActionType actionType,
ActionHook<?> hook)
Register the specified action hook.
|
void |
registerInterceptor(CheckType checkType,
Interceptor interceptor)
Registers an interceptor.
|
void |
setCallBack(CallBack callBack)
Set the call back used to perform dialog interaction between dialogs.
|
void |
setCurrentInstance(RoleConstant role,
Object instance)
Sets the current instance and recursively updates the view's model of
instances to display.
|
<T> void |
setCurrentInstances(RoleConstant role,
Collection<T> instances)
Sets the current instances for a "many" root role, and recursively updates
the view's model of instances to display.
|
void |
setFieldValue(AttributeConstant attribute,
Object value)
Sets the specified field value.
|
void |
setFieldValue(AttributeConstant attribute,
Object value,
boolean changed)
Sets the specified field value and changed status.
|
void |
setFieldValue(DialogObjectConstant field,
Object value)
Set the specified field value.
|
void |
setFieldValue(DialogObjectConstant field,
Object fieldValue,
boolean changed)
Set the specified field value and field changed status.
|
void |
setSetupValue(DialogSetupValue<?> setupValue)
Set a new setupValue for the dialog.
|
void |
setSpreadsheetExporter(SpreadsheetExporter spreadsheetExporter)
Set the current spreadsheet exporter.
|
void |
setState(RoleConstant role,
RoleState state)
Set the state of the specified object selection role.
|
void |
setup(DialogSetupValue<?> setupValue)
Invoked each time the dialog is opened.
|
String |
toString() |
Map<ValidationResult,ValidateContext> |
validate(RoleConstant osRole,
ValidationPolicy.Policy validationPolicy)
Run all validators with the specified policy for the specified role.
|
public final String dialogName
public DialogController(String dialogName, ApplicationController applicationController)
dialogName - the name of the dialog.applicationController - the application controllerpublic final Collection<AttributeConstant> getChangedAttributes(RoleConstant role)
role - the role in questionpublic final void setFieldValue(AttributeConstant attribute, Object value)
attribute - constant denoting the field.value - the value to display.public final void setFieldValue(AttributeConstant attribute, Object value, boolean changed)
attribute - constant denoting the field.value - the value to display.changed - the changed status of the field.public void init()
public void setup(DialogSetupValue<?> setupValue)
setupValue - the setup value.public final <T extends DialogView> T getDialogView()
T - The dialog view typepublic final ViewModel getViewModel()
getViewModel in class no.esito.jvine.controller.StateControllerJVineController.getViewModel()public final <T extends OSRole<?>> T getOSRole(RoleConstant role)
T - The expected return type, e.g. OSRole<?>.role - the constant denoting the role.ClassCastException - if the returned type does not match the
expected type.IllegalArgumentException - if the specified role is not found among
this dialog's object selection.public final <T> T getFieldValue(DialogObjectConstant dataItem)
T - The expected field value typedataItem - the constant denoting the view data item.ClassCastException - if the actual field value type is not
assignable to the expected field value type.public final <T> T getFieldValue(AttributeConstant attribute)
T - The expected field value typeattribute - the constant denoting the attribute.IllegalArgumentException - if no data item corresponds to the
specified attribute.ClassCastException - if the actual field value type is not
assignable to the expected field value type.public final void setFieldValue(DialogObjectConstant field, Object value)
field - dialog object constant denoting the view's data item.value - the value to display.public final void setFieldValue(DialogObjectConstant field, Object fieldValue, boolean changed)
changed parameter is true the field will be
considered changed (as if changed by a user). Otherwise the
field will be considered unchanged.field - the dialog object constant denoting the view's data item.fieldValue - the value to displaychanged - if truepublic final void registerHook(ActionTarget actionTarget, ActionType actionType, ActionHook<?> hook)
actionTarget - the action targetactionType - the action typehook - an action hook that should be invoked when the action runspublic ActionHookList<?> getActionHookList(ActionTarget actionTarget, ActionType actionType)
actionTarget - the target of the actionactionType - the action typepublic final void clear(RoleConstant role, boolean intercept)
role - the role to clear.intercept - if true, clear intercept will be invoked during clearpublic final void clearCurrent(RoleConstant role, boolean intercept)
role - the role to clear.intercept - if true, clear intecept will be invoked during clear.public final void clearKeepKeys(RoleConstant role)
role - the role to clear.public final ApplicationController getApplicationController()
getApplicationController in class no.esito.jvine.controller.StateControllerpublic final void setCallBack(CallBack callBack)
callBack - the call backpublic DialogSetupValue<?> getSetupValue()
public void setSetupValue(DialogSetupValue<?> setupValue)
setupValue - the setupValue to setpublic final boolean isChanged(RoleConstant role)
role - the role to test.true if at least one field value of the specified
role is dirty.ViewModel.getChangedAttributes(RoleConstant)public final boolean hasConversionErrors(RoleConstant role)
role - the role to test fortrue if any fields in the specified role has a
conversion error.public final Map<DialogObjectConstant,Collection<?>> getConversionMessages(RoleConstant role)
role - the role to get messages forpublic abstract String getObjectSelectionName()
public abstract List<RoleConstant> getRoleConstants()
public abstract <T extends RoleConstant> T getOSConst(String role)
T - The expected role constant type.role - the name of the roleClassCastException - if the returned type does not match the
expected type.public final void doCallBack(Object value)
value - an object to transfer back to the invoking dialogpublic final void doCallBack(DialogCallBackValue callBackValue)
callBackValue - the call back value to return to the invoking
dialog's call back.public final void doCallBack(Object value, Integer opCode)
value - an object to transfer back to the invoking dialogopCode - the opCode to transfer back to the invoking dialogpublic final void registerInterceptor(CheckType checkType, Interceptor interceptor)
checkType - the action type this interceptor intercepts.interceptor - the interceptor to register.public final boolean checkChange(RoleConstant role, CheckType checkType)
role - the target role of the check change.checkType - the check type to performtrue if the specified role and all child roles are
unchanged.public final <T> T peek(RoleConstant role)
T - The domain object type.role - the role to peek at.G9ClientException - if either convert of validate failed during
the update of the domain object from the view.ClassCastException - if the returned type does not match the
expected type.public final void display(RoleConstant role, Object instance)
role - the role of the instance to display.instance - the instance to display.public final <T> Collection<T> getAllInstances(RoleConstant role)
T - the expected domain type of the rolerole - the constant denoting the roleClassCastException - if the actual domain type does not match the
expected domain type of the specified role.public final void display(RoleConstant role, Object instance, boolean changed)
role - the role of the instance to display.instance - the instance to display.changed - if true the view's corresponding data items
will be considered changed, otherwise
unchanged.public final void setCurrentInstance(RoleConstant role, Object instance)
role - the role of the new current instanceinstance - the instance to set as the new current instance.public final <T> void setCurrentInstances(RoleConstant role, Collection<T> instances)
T - the expected domain typerole - the root role for the instancesinstances - the collection of instances to setpublic final <T> T getCurrentInstance(RoleConstant role)
T - the expected domain typerole - the constant denoting the role.ClassCastException - if the expected domain type is not assignable
to the actual domain type of the object selection role.public final RoleState getState(RoleConstant role)
role - the constant denoting the object selection rolepublic final void setState(RoleConstant role, RoleState state)
role - the constant denoting the object selection role.state - the new state to set.public final String getRoleStates()
public final void invokeOnGui(Runnable guiMethod) throws InvocationTargetException
guiMethod - the runnable to be run by the gui thread.InvocationTargetException - exceptions thrown by the runnable are
wrapped in an InvocationTargetException and re-thrown.public final <V> V invokeOnGui(Callable<V> guiMethod) throws InvocationTargetException
V - the return valueguiMethod - the callable to be invoked by the gui thread.InvocationTargetException - exceptions thrown by the callable are
wrapped in an InvocationTargetException and re-thrown.public final Map<ValidationResult,ValidateContext> validate(RoleConstant osRole, ValidationPolicy.Policy validationPolicy)
osRole - role to validatevalidationPolicy - policy to use when finding validatorspublic Map<ValidationResult,ValidateContext> failedOnChangeValidator(Map<ValidationResult,ValidateContext> failedResult)
failedResult - map of failed validation results and corresponding
contextpublic DispatcherContext getDispatcherContext()
public MessageDispatcher getMessageDispatcher()
no.esito.jvine.controller.StateControllergetMessageDispatcher in class no.esito.jvine.controller.StateControllerpublic MessageReply dispatchMessage(String messageID, Object... args)
messageID - string identifying the messageargs - message argumentsMessageDispatcher.dispatch(String, Object...)public MessageReply dispatchMessage(Message message)
message - the message to dispatchMessageDispatcher.dispatch(Message)public MessageReply dispatchMessage(String messageID, Throwable exception, Object... args)
messageID - string identifying the messageexception - the exception that caused the message to be dispatchedargs - message argumentsMessageDispatcher.dispatch(String, Throwable, Object...)public abstract Map<RoleConstant,OSRole<?>> getRoleMap()
public SpreadsheetExporter getSpreadsheetExporter()
public void setSpreadsheetExporter(SpreadsheetExporter spreadsheetExporter)
spreadsheetExporter - the new current spreadsheet exporterCopyright © 2006–2017 Esito AS. All rights reserved.