This page was saved using jaction on 2006-09-04 8:33:42.
Address: http://flexdocs.kr/docs/flex2/langref/mx/formatters/Formatter.html
Title: mx.formatters.Formatter (Flex™ 2 레퍼런스 가이드)  •  Size: 27384
Packagemx.formatters
Classpublic class Formatter
InheritanceFormatter Inheritance Object
SubclassesCurrencyFormatter , DateFormatter , NumberFormatter , PhoneFormatter , ZipCodeFormatter

Formatter 클래스는 모든 데이터 Formatter의 기본 클래스입니다. Formatter 클래스의 모든 서브 클래스에서는,format() Methods를 재정의(override) 할 필요가 있습니다.

MXML 문장구조법expandedMXML 문장구조법의 비표시

다음의 태그 속성이 Formatter 클래스에서 정의되어 이 클래스의 모든 서브 클래스에 Inheritance됩니다.

 <mx:tagname Properties error="" /> 

View the examples

See also

custom Formatter의 작성


Public property
 property정의
 Inheritedconstructor : Object
특정의 object 인스턴스의 클래스 object 또는 constructor    함수에의 참조입니다.
Object
  error : String
에러가 발생했을 때에 Formatter에 의해 보존되는 설명을 나타냅니다.
Formatter
 Inheritedprototype : Object
[static] 클래스 또는 함수 object의 prototype object에의 참조입니다.
Object
Protected property
 property정의
  defaultInvalidFormatError : String = "Invalid format"
무효인 포맷 string가 formatter로 지정된 것을 나타내는 에러 메세지입니다.
Formatter
  defaultInvalidValueError : String = "Invalid value"
무효인 값이 formatter로 지정된 것을 나타내는 에러 메세지입니다.
Formatter
  packageResources : ResourceBundle
[static] formatters.properties 로부터의 모든 심볼을 포함한 ResourceBundle object입니다.
Formatter
Public Methods
 Methods정의
  Formatter ()
constructor   .
Formatter
  format (value:Object ):String
값을 포맷 해, 새롭고 포맷 된 값을 포함한 string를 돌려줍니다.
Formatter
 InheritedhasOwnProperty (name:String ):Boolean
object로 지정된 property가 정의되고 있는지 어떤지를 나타냅니다.
Object
 InheritedisPrototypeOf (theClass:Object ):Boolean
Object 클래스의 인스턴스가, Parameters로서 지정된 object의 prototype 체인내에 있을지 어떨지를 나타냅니다.
Object
 InheritedpropertyIsEnumerable (name:String ):Boolean
지정된 property가 존재해, 열거 가능한가 어떤가를 나타냅니다.
Object
 InheritedsetPropertyIsEnumerable (name:String , isEnum:Boolean = true):void
루프 처리에 대한 다이나믹 property의 가용성을 설정합니다.
Object
 InheritedtoString ():String
지정된 object의 string 표현을 돌려줍니다.
Object
 InheritedvalueOf ():Object
지정된 object의 원시적치를 돌려줍니다.
Object
property의 상세
defaultInvalidFormatErrorproperty
protected var defaultInvalidFormatError:String = "Invalid format"

무효인 포맷 string가 formatter로 지정된 것을 나타내는 에러 메세지입니다.

디폴트치"Invalid format".

defaultInvalidValueErrorproperty 
protected var defaultInvalidValueError:String = "Invalid value"

무효인 값이 formatter로 지정된 것을 나타내는 에러 메세지입니다.

디폴트치"Invalid value".

errorproperty 
public var error:String

에러가 발생했을 때에 Formatter에 의해 보존되는 설명을 나타냅니다. 이 property로 사용 가능한 값에 대해서는, 각 Formatter의 설명을 참조해 주세요.

서브 클래스에서는 format() Methods 중(안)에서 이 값을 설정할 필요가 있습니다.

packageResourcesproperty 
protected static var packageResources:ResourceBundle

formatters.properties 로부터의 모든 심볼을 포함한 ResourceBundle object입니다.

constructor    의 상세
Formatter()constructor   
public 함수 Formatter()

constructor   .

Methods의 상세
format()Methods
public function format(value:Object ):String

값을 포맷 해, 새롭고 포맷 된 값을 포함한 string를 돌려줍니다. 모든 서브 클래스에서 이 Methods를 재정의(override) 해, Formatter를 Implements할 필요가 있습니다.

Parameters
value:Object — 포맷 하는 값을 나타냅니다.

반환값
String — 포맷 한 string를 나타냅니다.
Examples
SimpleFormatterExample
<? xml version="1.0"? >
<! -- Simple example to demonstrate the Formatter class.  -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">

    <mx:Script>
        <! [CDATA[

            // Event handler to format the input.             
            private function Format() :void
            {
                // The format() method returns the formatted String,
                // or an empty String if there is an error.
                var formattedVal:String = numberFormatter.format(inputVal.text);

                if (formattedVal.length==0) {
                    // If there is an error, the Format.error property 
                    // contains the reason.
                    formattedNumber.text=numberFormatter.error;
                }
                
                else {
                    formattedNumber.text=formattedVal;
                }
            }
        ]]>
    </mx:Script>

    <mx:NumberFormatter id="numberFormatter"/>

    <mx:Panel title="NumberFormatter Example" width="75%" height="75%" 
            paddingTop="10" paddingLeft="10" paddingRight="10" paddingBottom="10">

        <mx:Form>
            <mx:FormItem label="Enter number - a letter is invalid:">
                <mx:TextInput id="inputVal" text="" width="75%"/>
            </mx:FormItem>

            <mx:FormItem label="Formatted number: ">
                <mx:TextInput id="formattedNumber" editable="false" width="75%"/>
            </mx:FormItem>

            <mx:FormItem>
                <mx:Button label="Validate and Format" click="Format();"/>
            </mx:FormItem>
        </mx:Form>
  
    </mx:Panel>
</mx:Application>






 

코멘트가 추가되었을 경우, 메일로 받기. | 코멘트 리포트

현재의 페이지: http://flexdocs.kr/docs/flex2/langref/mx/formatters/Formatter.html