Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
54 changed files
with
4,213 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | ||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> | ||
<head> | ||
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> | ||
<title>Aria Tester</title> | ||
<script type="text/javascript"> | ||
// Aria Templates framework parameters | ||
var Aria = { | ||
memCheckMode : false, // checks that constructors and destructors are well called on all objects | ||
debug : true | ||
}; | ||
|
||
</script> | ||
<script type="text/javascript" src="../bootstrap.js"></script> | ||
<script type="text/javascript" src="../css/atskin.js"></script> | ||
<style> | ||
html { | ||
overflow : hidden; | ||
} | ||
body { | ||
margin : 0px; | ||
background-color : #FAFAFA; | ||
font-family: tahoma,arial,helvetica,sans-serif; | ||
font-size: 11px; | ||
} | ||
</style> | ||
</head> | ||
<body > | ||
<div id="root"></div> | ||
<script type="text/javascript"> | ||
aria.core.AppEnvironment.setEnvironment({ | ||
contextualMenu:{enabled:true} // to get the right-click refresh menu | ||
}, null, true); | ||
|
||
var classpath = "aria.tester.runner.view.main.Main"; | ||
|
||
var width = {min : 180}; | ||
var height = {min : 342}; | ||
|
||
// set the minimum dimension of this page | ||
Aria.setRootDim({ | ||
width: width, | ||
height: height | ||
}); | ||
|
||
Aria.loadTemplate({ | ||
classpath:classpath, | ||
div:"root", | ||
width: width, | ||
height: height, | ||
moduleCtrl: { | ||
classpath: 'aria.tester.runner.ModuleController' | ||
} | ||
}); | ||
</script> | ||
</body> | ||
</html> |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
/* | ||
* Copyright 2012 Amadeus s.a.s. | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
Aria.classDefinition({ | ||
$classpath : 'aria.tester.runner.BaseFlow', | ||
$extends : 'aria.templates.FlowCtrl', | ||
$constructor:function() { | ||
this.$FlowCtrl.constructor.call(this); | ||
}, | ||
$prototype: { | ||
// Intercepting method called at the end of the module controller initialization: | ||
oninitCallback : function (param) { | ||
this.$FlowCtrl.oninitCallback.call(this, param); // call the method of the parent which sets this.data | ||
// the flow data is stored in the data model, to be accessible by templates: | ||
this.data.flow = this.flowData; | ||
}, | ||
|
||
// navigate is published in the Flow interface | ||
navigate:function(targetState) { | ||
var flowData = this.data.flow; | ||
var currentState = flowData.currentState; | ||
|
||
if (!this.isTransitionValid(currentState, targetState)) { | ||
return this.$logError("FLOW_INVALID_TRANSITION",[targetState]); | ||
} | ||
|
||
var json = aria.utils.Json; | ||
|
||
// change current state to new state | ||
json.setValue(flowData,"currentState",targetState); | ||
|
||
// Call the internal callback on valid state transitions | ||
this.onStateChange(targetState); | ||
|
||
// raise event to notify templates that current state changed | ||
this.$raiseEvent("stateChange"); | ||
}, | ||
|
||
/** | ||
* Will be called after each valid transition change | ||
* To be overrided by children classes | ||
* @param {String} state | ||
*/ | ||
onStateChange : function (state) {}, | ||
|
||
/** | ||
* Tells if a transition is valid. Note: this information is also | ||
* available in the data model | ||
* @param {String} targetState the state targetted by the transition | ||
* @return {Boolean} true if the transition is authorized | ||
*/ | ||
isTransitionValid:function(currentState, targetState) { | ||
var transitionMap = this._getTransitionMap(); | ||
|
||
return ( | ||
transitionMap[currentState] && | ||
transitionMap[currentState][targetState] | ||
); | ||
}, | ||
|
||
/** | ||
* | ||
* @return {Object} | ||
*/ | ||
_getTransitionMap : function () { | ||
var transitionMap = {}; | ||
var addValidTransition = function (startState, endState) { | ||
if (!transitionMap[startState]) { | ||
transitionMap[startState] = {}; | ||
} | ||
transitionMap[startState][endState] = true | ||
}; | ||
|
||
var flowData = this.flowData; | ||
var validTransitions = flowData.validTransitions; | ||
for (var i = 0 ; i < validTransitions.length ; i++) { | ||
var validTransition = validTransitions[i]; | ||
addValidTransition(validTransition[0], validTransition[1]) | ||
|
||
// reverse transition | ||
if (validTransition[2]) { | ||
addValidTransition(validTransition[1], validTransition[0]); | ||
} | ||
} | ||
return transitionMap; | ||
} | ||
} | ||
}); |
Oops, something went wrong.