| //////////////////////////////////////////////////////////////////////////////// |
| // |
| // Licensed to the Apache Software Foundation (ASF) under one or more |
| // contributor license agreements. See the NOTICE file distributed with |
| // this work for additional information regarding copyright ownership. |
| // The ASF licenses this file to You 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. |
| // |
| //////////////////////////////////////////////////////////////////////////////// |
| package flashx.textLayout.property |
| { |
| import flashx.textLayout.debug.assert; |
| import flashx.textLayout.formats.FormatValue; |
| import flashx.textLayout.tlf_internal; |
| |
| use namespace tlf_internal; |
| |
| [ExcludeClass] |
| /** A property description with a Boolean value. @private */ |
| public class BooleanProperty extends Property |
| { |
| public function BooleanProperty(nameValue:String, defaultValue:Boolean, inherited:Boolean, category:String) |
| { |
| super(nameValue, defaultValue, inherited, category); |
| } |
| |
| /** @private */ |
| public override function setHelper(currVal:*,newObject:*):* |
| { |
| if (newObject === null) |
| newObject = undefined; |
| |
| if (newObject === undefined || newObject is Boolean || newObject == FormatValue.INHERIT) |
| return newObject; |
| |
| if (newObject == "true" || newObject == "false") |
| return newObject == "true"; |
| |
| Property.errorHandler(this,newObject); |
| return currVal; |
| } |
| |
| /** @private */ |
| public override function hash(val:Object, seed:uint):uint |
| { |
| if (val == FormatValue.INHERIT) |
| return UintProperty.doHash(inheritHashValue, seed); |
| CONFIG::debug { assert(!(val is String),"BooleanProperty.has non inherit string"); } |
| return UintProperty.doHash((val as Boolean) ? 1 : 0, seed); |
| } |
| } |
| } |