/*----------------------------------------------------------------------------- The contents of this file are subject to the Mozilla Public License Version 1.1 (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.mozilla.org/MPL/ Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. The Original Code is Fever Framework code. The Initial Developer of the Original Code is Romain Ecarnot. Portions created by Initial Developer are Copyright (C) 2006 the Initial Developer. All Rights Reserved. Contributor(s): 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. -----------------------------------------------------------------------------*/ import com.bourre.utils.SharedObjectUtils; import fever.Fever; /** * Used by Pixlib ConfigLoader to map configuration xml * object. * * @author Romain Ecarnot */ dynamic class fever.conf.FeverConfiguration { //------------------------------------------------------------------------- // Private properties //------------------------------------------------------------------------- private static var _instance : FeverConfiguration; private var _success : Boolean; //------------------------------------------------------------------------- // Public properties //------------------------------------------------------------------------- /** Configuration loading status. */ public function get success() : Boolean { return _success; } /** Object with paths properties. */ public var paths : Object; /** Object with localisation properties. */ public var locales : Object; /** Object with fonts properties. */ public var fonts : Object; /** Object with themes properties. */ public var themes : Object; /** Object with bitmaps properties. */ public var bitmaps : Object; /** Object with sounds properties. */ public var sounds : Object; /** Object with dll properties. */ public var dll : Object; /** Base path for resources url. */ public var resourceURL : String; /** Path for localisation files. */ public var localeURL : String; /** Path for font libraries. */ public var fontURL : String; /** Path for theme libraries. */ public var themeURL : String; /** Path for bitmaps. */ public var bitmapURL : String; /** Path for sounds. */ public var soundURL : String; /** Path for sounds. */ public var dllURL : String; /** Defautl remoting gateway url. */ public var remotingURL : String; //------------------------------------------------------------------------- // Public API //------------------------------------------------------------------------- /** * */ public static function getInstance( ) : FeverConfiguration { if( !_instance ) _instance = new FeverConfiguration(); return _instance; } /** * Returns the full qualified path to localisation files. *
Equal to {@link #resourceURL} + {@link #localeURL} */ public function getLocalePath() : String { return resourceURL + localeURL; } /** * Returns the full qualified path to font libraries. *
Equal to {@link #resourceURL} + {@link #fontURL} */ public function getFontPath() : String { return resourceURL + fontURL; } /** * Returns the full qualified path to theme libraries. *
Equal to {@link #resourceURL} + {@link #themeURL} */ public function getThemePath() : String { return resourceURL + themeURL; } /** * Returns the full qualified path to bitmaps. *
Equal to {@link #resourceURL} + {@link #bitmapURL} */ public function getBitmapPath() : String { return resourceURL + bitmapURL; } /** * Returns the full qualified path to bitmaps. *
Equal to {@link #resourceURL} + {@link #soundURL} */ public function getSoundPath() : String { return resourceURL + soundURL; } /** * Returns the full qualified path to dll folders. */ public function getDLLPath() : String { return resourceURL + dllURL; } /** * Fever internal used. */ public function invalidate() : Void { _success = false; } /** * Retreives passed-in {@code propName} property stored in Application * SharedObject. */ public function load( propName : String ) { if( !propName ) propName = '.default'; return SharedObjectUtils.loadLocal( Fever.application.name, propName ); } /** * Stores passed-in {@code propValue} value in Application * SharedObject under {@code propName} name. */ public function save( propName : String, propValue ) : Void { if( !propName ) propName = '.default'; SharedObjectUtils.saveLocal( Fever.application.name, propName, propValue ); } //------------------------------------------------------------------------- // Private implementation //------------------------------------------------------------------------- /** * Constructor. */ private function FeverConfiguration() { _success = true; } }