OracleJavaScript API Reference for Oracle ADF Faces

 

SUMMARY: FIELD | CONSTR | METHOD    DETAIL: FIELD | CONSTR | METHOD

oracle.adfinternal.view.js.behavior
Class AdfAutoSaveBehavior

Warning:

org.ecmascript.object.Object
   |
   +--oracle.adfinternal.view.js.behavior.AdfAutoSaveBehavior

public class AdfAutoSaveBehavior
extends Object
Client behavior implementation to trigger the custom autoSave event of the dirty value to a temporary store before session times out



Field Summary

private static Object
_IDLE_TIME_SUBMIT
private Object
_idleTimeSubmit
private static Object
_MIN_IDLE_TIME_SUBMIT


Fields inherited from org.ecmascript.object.Object

constructor, prototype


Constructor Summary

public
AdfAutoSaveBehavior(Object idleTimeSubmit)
Client behavior implementation to trigger the custom autoSave event of the dirty value to a temporary store before session times out


Method Summary

private static Object
_getAutoSaveBehavior(Object component)
Gets the autosave behavior from a component
private Object
_getSubmittedValue()
Need to get the submitted value of the peer and NOT the component as the implementation is different [i.e.
private Object
_handleValueUpdated()
When data is updated need to clear out the existing timeout for submitting the dirty content and set this._nonDirtySubmittedValue to the current submittedValue.
protected Object
Init(Object idleTimeSubmit)
Sets the _idleTimeSubmit based on whether the app has provide idleTimeSubmit 1) If provided will get the max of its value with _MIN_IDLE_TIME_SUBMIT [meaning won't allow it to be set lower than 30 sec as that would require too much of ppr] 2) If not provided will set it to the default of 5 min
protected static Object
InitClass()
Static values for AdfAutoSaveBehavior
public Object
initialize(Object component)
Note that we can not use AdfValueChangeEvent.VALUE_CHANGE_TYPE as our dirty constraint is much stricter than AdfValueChangeEvent.VALUE_CHANGE_TYPE which gets fired during the blur event.
private Object
_propertyChange(Object propertyChange)
Listen for disabled or readOnly property change to either setUp or tearDown the autoSave behavior
public static Object
removeTimer(Object componentId)
ValueUpdatedEvent is fired for the component on the server side.
private Object
_resetIdleSubmitHandler()
Clears out the idleSubmitHandler
private Object
_setUp()
Setup the autoSave feature 1) Add all the component events
private Object
_setUpComponentInitValue()
Sets up the initial value of _lastNonDirtySubmittedValue and remove the keyDown + mouseDown listeners
private Object
_setUpIdleTimer(Object componentEvent)
Sets up the idle timer
private Object
_submitDirty()
Submits a custom _autoSave event to the server with the current submittedValue
private Object
_tearDown()
Teardown the autoSave feature 1) Cancel the current idle submit handler if it exists 2) Reset _lastNonDirtySubmittedValue to null [so it can lazily be set again when the behavior is setup] 3) Remove all the component listeners


Field Detail


_IDLE_TIME_SUBMIT

private static Object _IDLE_TIME_SUBMIT

_idleTimeSubmit

private Object _idleTimeSubmit

_MIN_IDLE_TIME_SUBMIT

private static Object _MIN_IDLE_TIME_SUBMIT

Constructor Detail


AdfAutoSaveBehavior

public AdfAutoSaveBehavior(Object idleTimeSubmit)

Client behavior implementation to trigger the custom autoSave event of the dirty value to a temporary store before session times out

Parameters:
idleTimeSubmit    

Method Detail


_getAutoSaveBehavior

private static Object _getAutoSaveBehavior(Object component)

Gets the autosave behavior from a component

Parameters:
component    
Return:
Object

_getSubmittedValue

private Object _getSubmittedValue()

Need to get the submitted value of the peer and NOT the component as the implementation is different [i.e. for inputText comp.getSubmittedValue() returns null whereas for peer it gets the correct domElement's value]. Same for other components

Return:
Object

_handleValueUpdated

private Object _handleValueUpdated()

When data is updated need to clear out the existing timeout for submitting the dirty content and set this._nonDirtySubmittedValue to the current submittedValue.

Return:
Object

Init

protected Object Init(Object idleTimeSubmit)

Sets the _idleTimeSubmit based on whether the app has provide idleTimeSubmit 1) If provided will get the max of its value with _MIN_IDLE_TIME_SUBMIT [meaning won't allow it to be set lower than 30 sec as that would require too much of ppr] 2) If not provided will set it to the default of 5 min

Parameters:
idleTimeSubmit    
Return:
Object

InitClass

protected static Object InitClass()

Static values for AdfAutoSaveBehavior

Return:
Object

initialize

public Object initialize(Object component)

Note that we can not use AdfValueChangeEvent.VALUE_CHANGE_TYPE as our dirty constraint is much stricter than AdfValueChangeEvent.VALUE_CHANGE_TYPE which gets fired during the blur event. Also we can not listen to AdfValueChangeEvent.VALUE_CHANGE_TYPE and clear _idleSubmitHandler as that would cancel the submit even when the content has been dirtied. For instance: 1) User types something 2) _idleSubmitHandler gets setup to deliver the dirtied content 3) AdfValueChangeEvent.VALUE_CHANGE_TYPE gets fired due to user blurring away from the field w/o doing any further action 4) If we were to cancel _idleSubmitHandler then nothing would be submitted invalidating this ER

Parameters:
component    
Return:
Object

_propertyChange

private Object _propertyChange(Object propertyChange)

Listen for disabled or readOnly property change to either setUp or tearDown the autoSave behavior

Parameters:
propertyChange    
Return:
Object

removeTimer

public static Object removeTimer(Object componentId)

ValueUpdatedEvent is fired for the component on the server side. Looks up the behavior for provided componentId and invokes _handleValueUpdated to clear out _idleSubmitHandler

Parameters:
componentId    
Return:
Object

_resetIdleSubmitHandler

private Object _resetIdleSubmitHandler()

Clears out the idleSubmitHandler

Return:
Object

_setUp

private Object _setUp()

Setup the autoSave feature 1) Add all the component events

Return:
Object

_setUpComponentInitValue

private Object _setUpComponentInitValue()

Sets up the initial value of _lastNonDirtySubmittedValue and remove the keyDown + mouseDown listeners

Return:
Object

_setUpIdleTimer

private Object _setUpIdleTimer(Object componentEvent)

Sets up the idle timer

Parameters:
componentEvent    
Return:
Object

_submitDirty

private Object _submitDirty()

Submits a custom _autoSave event to the server with the current submittedValue

Return:
Object

_tearDown

private Object _tearDown()

Teardown the autoSave feature 1) Cancel the current idle submit handler if it exists 2) Reset _lastNonDirtySubmittedValue to null [so it can lazily be set again when the behavior is setup] 3) Remove all the component listeners

Return:
Object

SUMMARY: FIELD | CONSTR | METHOD    DETAIL: FIELD | CONSTR | METHOD

 

Generated on 2017.04.19 06:37 UTC
Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.