Packagejp.co.fujitsu.reffi.client.flex.util
Classpublic class CompositionSearchUtil

[概 要]

アプリケーションにロードされている構成要素を検索するクラスです.

[詳 細]

AVM上に読み込んでいる、画面コンポーネントやコントローラを検索します。
画面コンポーネントを探す場合、検索キーとしてname属性値、もしくはid属性値を指定します。

[備 考]

name属性値でコンポーネントを検索する場合、画面上のコンテナの子を再帰的に走査します。
読み込まれているコンテナによっては子要素にアクセス出来ない(セキュリティエラーが発生する) ものが有ります(例 GoogleMapのMapオブジェクト)。
このエラーは、ClientConfigクラスのexcludeFromComponentSearchプロパティに走査対象外クラス型を 追加することで回避できます。
        package mapdemo.controller {
        
            import com.google.maps.Map;
            import com.google.maps.MapEvent;
            
            import jp.co.fujitsu.reffi.client.flex.controller.BaseController;
            import jp.co.fujitsu.reffi.client.flex.controller.ClientConfig;
            import jp.co.fujitsu.reffi.client.flex.controller.EventBinder;
            
            import mapdemo.action.MapReadyAction;
            
            public class MapDemoController extends BaseController {

                // アプリケーション初期化時に走査対象外クラスとしてcom.google.maps.Mapを追加        
                override protected function initialize(clientConfig:ClientConfig):void {
                    clientConfig.excludeFromComponentSearch.push(Class(Map));
                }

                override protected function bind(eventBinder:EventBinder):void {
                    eventBinder.addEventBinding("mapPanel.map", MapEvent.MAP_READY, Class(MapReadyAction));
                        :
                        :
  

Copyright (c) 2008-2009 FUJITSU Japan All rights reserved.



Public Methods
 MethodDefined by
  
searchApplication(document:Object):Application
[static]

[概 要]

引数documentが所属するApplicationを検索します.
CompositionSearchUtil
  
searchComponentById(document:Object, id:String, searchRange:int):DisplayObject
[static]

[概 要]

引数idと合致するid属性を持つコンポーネントを検索します.
CompositionSearchUtil
  
searchComponentByName(document:Object, namePattern:String, searchRange:int):DisplayObject
[static]

[概 要]

引数namePatternと合致するname属性を持つコンポーネントを検索します.
CompositionSearchUtil
  
searchComponentsById(document:Object, id:String, searchRange:int):Array
[static]

[概 要]

引数idと合致するid属性を持つコンポーネント群を検索します.
CompositionSearchUtil
  
searchComponentsByName(document:Object, namePattern:String, searchRange:int):Array
[static]

[概 要]

引数namePatternと合致するname属性を持つコンポーネント群を検索します.
CompositionSearchUtil
  
searchController(document:Object):BaseController
[static]

[概 要]

引数documentが所属するApplicationを管理するコントローラを検索します.
CompositionSearchUtil
  
searchDocument(displayObject:DisplayObject):DisplayObject
[static]

[概 要]

引数displayObjectが所属するDocumentを検索します.
CompositionSearchUtil
  
searchParentUIComponent(displayObject:DisplayObject):UIComponent
[static]

[概 要]

引数displayObjectの直近の親UIComponentを検索します.
CompositionSearchUtil
Public Constants
 ConstantDefined by
  ALL_RANGE : int = 3
[static] 自SystemManager範囲を表す定数です。
CompositionSearchUtil
  DOCUMENT_RANGE : int = 1
[static] 自Document範囲を表す定数です。
CompositionSearchUtil
  OTHER_DOCUMENTS_RANGE : int = 2
[static] SystemManager配下の、自Documentを除いた他Document範囲を表す定数です。
CompositionSearchUtil
Method detail
searchApplication()method
public static function searchApplication(document:Object):Application

[概 要]

引数documentが所属するApplicationを検索します.

[詳 細]

引数documentのparentApplicationを取得して返却します。
documentがApplicationであった場合は引数documentを返却します。

[備 考]

パラメータ
document:Object — Applicationを探すためのdocument

戻り値
Application
searchComponentById()method 
public static function searchComponentById(document:Object, id:String, searchRange:int):DisplayObject

[概 要]

引数idと合致するid属性を持つコンポーネントを検索します.

[詳 細]

[備 考]

パラメータ
document:Object — 取得するコンポーネントid属性値
 
id:String
 
searchRange:int

戻り値
DisplayObject — idを基に取得した画面コンポーネント
searchComponentByName()method 
public static function searchComponentByName(document:Object, namePattern:String, searchRange:int):DisplayObject

[概 要]

引数namePatternと合致するname属性を持つコンポーネントを検索します.

[詳 細]

第一引数documentからnamePatternをname属性値として持つコンポーネントを再帰的に検索します。
document領域内に存在しなかった場合、SystemManagerが持つ他の子Documentを同様に検索します。
検索途中、該当するコンポーネントが発見された時点でそのコンポーネントを返却します。

[備 考]

パラメータ
document:Object — 検索対象document
 
namePattern:String — 取得したいコンポーネントのname属性値
 
searchRange:int — 検索範囲

戻り値
DisplayObject
searchComponentsById()method 
public static function searchComponentsById(document:Object, id:String, searchRange:int):Array

[概 要]

引数idと合致するid属性を持つコンポーネント群を検索します.

[詳 細]

[備 考]

パラメータ
document:Object — 取得するコンポーネントid属性値
 
id:String
 
searchRange:int

戻り値
Array — idを基に取得した画面コンポーネント
searchComponentsByName()method 
public static function searchComponentsByName(document:Object, namePattern:String, searchRange:int):Array

[概 要]

引数namePatternと合致するname属性を持つコンポーネント群を検索します.

[詳 細]

第一引数document、SystemManagerが持つ他の子Documentの順番で namePatternをname属性値として持つコンポーネントを再帰的に検索します。

ロードされている全コンポーネントの内、namePatternに合致する全コンポーネントの配列を返却します。

[備 考]

パラメータ
document:Object
 
namePattern:String — コンポーネントを探す範囲(デフォルト:ALL_RANGE)
 
searchRange:int

戻り値
Array


AVM上のname属性の付いた全DisplayObjectを取得する
   var allNamedComponents:Array = getComponentsByName(".*");
   
「btn」という文字列を含むname属性値が付与されている全DisplayObjectを取得する
   var allNamedButtons:Array = getComponentsByName(".*btn.*");
   

searchController()method 
public static function searchController(document:Object):BaseController

[概 要]

引数documentが所属するApplicationを管理するコントローラを検索します.

[詳 細]

コントローラに管理されている、AVM上にロードされているコントローラマップから、 引数documentを管理しているコントローラインスタンスを返却します。

[備 考]

パラメータ
document:Object

戻り値
BaseController
searchDocument()method 
public static function searchDocument(displayObject:DisplayObject):DisplayObject

[概 要]

引数displayObjectが所属するDocumentを検索します.

[詳 細]

[備 考]

パラメータ
displayObject:DisplayObject

戻り値
DisplayObject
searchParentUIComponent()method 
public static function searchParentUIComponent(displayObject:DisplayObject):UIComponent

[概 要]

引数displayObjectの直近の親UIComponentを検索します.

[詳 細]

displayObjectのparentプロパティを辿ってUIComponentである親を継続走査します。
引数指定されたのがparentを持たないstage等であった場合、Application.applicationが返却されます。

[備 考]

パラメータ
displayObject:DisplayObject

戻り値
UIComponent
Constant detail
ALL_RANGEconstant
public static const ALL_RANGE:int = 3

自SystemManager範囲を表す定数です。

DOCUMENT_RANGEconstant 
public static const DOCUMENT_RANGE:int = 1

自Document範囲を表す定数です。

OTHER_DOCUMENTS_RANGEconstant 
public static const OTHER_DOCUMENTS_RANGE:int = 2

SystemManager配下の、自Documentを除いた他Document範囲を表す定数です。