Created
November 15, 2019 15:11
-
-
Save werpu/f46ccb54ce89acc0df933050df35f3cf to your computer and use it in GitHub Desktop.
JSF.TS improved viewstate processing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* process the viewState update, update the affected | |
* forms with their respective new viewstate values | |
* and store them for later processing | |
*/ | |
processViewState(node: XMLQuery): boolean { | |
if( this.isViewStateNode(node)) { | |
let viewStateValue = node.textContent(); | |
this.internalContext.assign(APPLIED_VST, node.id.value).value = new ViewState(node.id.value, viewStateValue); | |
return true; | |
} | |
return false; | |
} | |
/** | |
* post update step, fix all the viewstates in the affected viewroots | |
* according to the spec | |
*/ | |
fixViewStates() { | |
Stream.ofAssoc<ViewState>(this.internalContext.getIf(APPLIED_VST).orElse({}).value) | |
.each((item: Array<any>) => { | |
let key = item[0]; | |
let value: ViewState = item[1]; | |
let nameSpace = DQ.byId(value.nameSpace).orElse(document.body); | |
//we search all child elements | |
let affectedForms = nameSpace.byTagName(TAG_FORM, true); | |
this.appendViewStateToForms(affectedForms, value.value); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment