+++ /dev/null
-<html>\r
-<head>\r
- <title>The source code</title>\r
- <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />\r
- <script type="text/javascript" src="../resources/prettify/prettify.js"></script>\r
-</head>\r
-<body onload="prettyPrint();">\r
- <pre class="prettyprint lang-js"><div id="cls-Ext.air.FileProvider"></div>/**\r
- * @class Ext.air.FileProvider\r
- * @extends Ext.state.Provider\r
- * \r
- * An Ext state provider implementation for Adobe AIR that stores state in the application \r
- * storage directory.\r
- * \r
- * @constructor\r
- * @param {Object} config\r
- */\r
-Ext.air.FileProvider = function(config){\r
- Ext.air.FileProvider.superclass.constructor.call(this);\r
- \r
- this.defaultState = {\r
- mainWindow : {\r
- width:780,\r
- height:580,\r
- x:10,\r
- y:10\r
- }\r
- };\r
- \r
- Ext.apply(this, config);\r
- this.state = this.readState();\r
- \r
- var provider = this;\r
- air.NativeApplication.nativeApplication.addEventListener('exiting', function(){\r
- provider.saveState();\r
- });\r
-};\r
-\r
-Ext.extend(Ext.air.FileProvider, Ext.state.Provider, {\r
- <div id="cfg-Ext.air.FileProvider-file"></div>/**\r
- * @cfg {String} file\r
- * The file name to use for the state file in the application storage directory\r
- */\r
- file: 'extstate.data',\r
- \r
- <div id="cfg-Ext.air.FileProvider-defaultState"></div>/**\r
- * @cfg {Object} defaultState\r
- * The default state if no state file can be found\r
- */\r
- // private\r
- readState : function(){\r
- var stateFile = air.File.applicationStorageDirectory.resolvePath(this.file);\r
- if(!stateFile.exists){\r
- return this.defaultState || {};\r
- }\r
- \r
- var stream = new air.FileStream();\r
- stream.open(stateFile, air.FileMode.READ);\r
- \r
- var stateData = stream.readObject();\r
- stream.close();\r
- \r
- return stateData || this.defaultState || {};\r
- },\r
-\r
- // private\r
- saveState : function(name, value){\r
- var stateFile = air.File.applicationStorageDirectory.resolvePath(this.file);\r
- var stream = new air.FileStream();\r
- stream.open(stateFile, air.FileMode.WRITE);\r
- stream.writeObject(this.state);\r
- stream.close();\r
- }\r
-});</pre> \r
-</body>\r
-</html>
\ No newline at end of file