Packagejp.co.fujitsu.reffi.client.flex.model
Classpublic class UserInteractiveCore
InheritanceUserInteractiveCore Inheritance BaseModel Inheritance flash.events.EventDispatcher

[概 要]

ユーザとのインタラクティブな会話を行う為の機能モデルです.

[詳 細]

Reffiが形成するシステムロジックフローを中断してユーザとの対話を行う画面を表示します。 Flexでは「表示された画面スレッド」と「画面を表示したスレッド」は常にパラレル動作しますが、 この機能モデルを使用することで、両スレッドが同期的に実行されます。 表示される画面の構成は各種プロパティを外部から設定することで変更出来ます。

[備 考]

View the examples



Public Properties
 PropertyDefined By
  buttonOption : int
[概 要] ボタン表示モードです.
UserInteractiveCore
  buttons : Array
[概 要] 表示するボタンです.
UserInteractiveCore
  cancelLabel : String
[概 要] 「キャンセルボタン」のラベルです.
UserInteractiveCore
  content : Container
[概 要] メイン表示内容です.
UserInteractiveCore
  contentPaddingBottom : int
[概 要] メイン表示領域の下パディングです.
UserInteractiveCore
  contentPaddingLeft : int
[概 要] メイン表示領域の左パディングです.
UserInteractiveCore
  contentPaddingRight : int
[概 要] メイン表示領域の右パディングです.
UserInteractiveCore
  contentPaddingTop : int
[概 要] メイン表示領域の上パディングです.
UserInteractiveCore
  controlBar : ControlBar
[概 要] ボタン配置領域です.
UserInteractiveCore
 Inheritedcontroller : BaseController
[概 要] このモデルを起動したコントローラインスタンスです.
BaseModel
 InheritedexecuteIndex : int
[概 要] 実行インデックス設定.
BaseModel
  interactiveScreen : Container
[概 要] 表示画面インスタンスです.
UserInteractiveCore
  message : String
[概 要] 表示するメッセージです.
UserInteractiveCore
  mode : int
[概 要] 画面表示モードです.
UserInteractiveCore
  noLabel : String
[概 要] 「いいえ」ボタンのラベルです.
UserInteractiveCore
 InheritedparameterMapping : ParameterMapping
[概 要] MVC各レイヤを伝播するパラメータオブジェクトです.
BaseModel
  screenHeight : int
[概 要] 表示画面の高さです.
UserInteractiveCore
  screenWidth : int
[概 要] 表示画面の幅です.
UserInteractiveCore
 Inheritedskip : Boolean
[概 要] このモデルを実行するか、コントローラが判断する為のフラグです.
BaseModel
 InheritedsuccessCount : int
[概 要] モデルインスタンス生存中に、何回モデル処理が成功したかを保持します.
BaseModel
  textInput : TextInput
[概 要] INPUT_MODE時のTextInputです.
UserInteractiveCore
  title : String
[概 要] 表示画面タイトルです.
UserInteractiveCore
  yesLabel : String
[概 要] 「はい」ボタンのラベルです.
UserInteractiveCore
Public Methods
 MethodDefined By
 Inherited
[概 要] モデル処理失敗イベントを発行するメソッドです.
BaseModel
 Inherited
[概 要] モデル処理完了イベントを発行するメソッドです.
BaseModel
 Inherited
[概 要] モデル処理成功イベントを発行するメソッドです.
BaseModel
  
getInputText():String
[概 要] INPUT_MODEで表示されているTextInputの値を取得します.
UserInteractiveCore
 Inherited
[概 要] ModelProcessEvent.SUCCESS発行回数を1増加させます.
BaseModel
  
onResult(event:Event):void
[概 要] ControllBarに配置されたボタンの押下イベントハンドラです.
UserInteractiveCore
 Inherited
run():void
[概 要] コントローラにコールされるモデルの主幹メソッドです.
BaseModel
Protected Methods
 MethodDefined By
  
createContent():Container
[概 要] ユーザとの対話内容を格納するコンテナインスタンスを生成します.
UserInteractiveCore
  
createControlBar():ControlBar
[概 要] 画面下部のボタン格納コントロールバーインスタンスを生成します.
UserInteractiveCore
  
createScreen():Container
[概 要] ユーザと対話を行う画面インスタンスを生成します.
UserInteractiveCore
 Inherited
[概 要] run()が終了したタイミングでテンプレートコールされるメソッドです.
BaseModel
  
mainProc():void
[override] [概 要] preProcで生成された画面インスタンスを表示します.
UserInteractiveCore
 Inherited
postProc():void
[概 要] 後処理テンプレートメソッドです.
BaseModel
  
preProc():Boolean
[override] [概 要] ユーザと対話する画面の初期化を行います.
UserInteractiveCore
 Inherited
trap(e:Error):Error
[概 要] run()内で発生した全例外をハンドリングするメソッドです.
BaseModel
Public Constants
 ConstantDefined By
  INPUT_MODE : int = 2
[static] メッセージ+テキスト入力の画面モードです.
UserInteractiveCore
  MESSAGE_MODE : int = 1
[static] メッセージ表示のみの画面モードです.
UserInteractiveCore
  YES_NO_CANCEL_OPTION : int = 7
[static] 「はい」「いいえ」「キャンセル」ボタンオプションです.
UserInteractiveCore
  YES_NO_OPTION : int = 3
[static] 「はい」「いいえ」ボタンオプションです.
UserInteractiveCore
  YES_OPTION : int = 1
[static] 「はい」ボタンオプションです.
UserInteractiveCore
Property Detail
buttonOptionproperty
buttonOption:int

[概 要]

ボタン表示モードです.

[詳 細]

YES_OPTION、YES_NO_OPTION、YES_NO_CANCEL_OPTIONを指定します。

[備 考]

The default value is YES_NO_OPTION.


Implementation
    public function get buttonOption():int
    public function set buttonOption(value:int):void
buttonsproperty 
buttons:Array

[概 要]

表示するボタンです.

[詳 細]

このプロパティが設定されている場合、buttonOptionプロパティの 設定より優先して配置されます。

[備 考]


Implementation
    public function get buttons():Array
    public function set buttons(value:Array):void
cancelLabelproperty 
cancelLabel:String

[概 要]

「キャンセルボタン」のラベルです.

[詳 細]

[備 考]


Implementation
    public function get cancelLabel():String
    public function set cancelLabel(value:String):void
contentproperty 
content:Container

[概 要]

メイン表示内容です.

[詳 細]

interactiveScreenの中に配置されるオブジェクトです。 createContentメソッドの戻り値が適用されます。 このプロパティを外部から設定するか、createContentメソッドを オーバーライドすることで、表示内容を変更できます。

[備 考]


Implementation
    public function get content():Container
    public function set content(value:Container):void
contentPaddingBottomproperty 
contentPaddingBottom:int

[概 要]

メイン表示領域の下パディングです.

[詳 細]

[備 考]

The default value is 10.


Implementation
    public function get contentPaddingBottom():int
    public function set contentPaddingBottom(value:int):void
contentPaddingLeftproperty 
contentPaddingLeft:int

[概 要]

メイン表示領域の左パディングです.

[詳 細]

[備 考]

The default value is 20.


Implementation
    public function get contentPaddingLeft():int
    public function set contentPaddingLeft(value:int):void
contentPaddingRightproperty 
contentPaddingRight:int

[概 要]

メイン表示領域の右パディングです.

[詳 細]

[備 考]

The default value is 20.


Implementation
    public function get contentPaddingRight():int
    public function set contentPaddingRight(value:int):void
contentPaddingTopproperty 
contentPaddingTop:int

[概 要]

メイン表示領域の上パディングです.

[詳 細]

[備 考]

The default value is 10.


Implementation
    public function get contentPaddingTop():int
    public function set contentPaddingTop(value:int):void
controlBarproperty 
controlBar:ControlBar

[概 要]

ボタン配置領域です.

[詳 細]

interactiveScreenの下部に配置されるオブジェクトです。 createControlBarメソッドの戻り値が適用されます。 このプロパティを外部から設定するか、createControlBarメソッドを オーバーライドすることで、ボタン配置部分を変更できます。

[備 考]


Implementation
    public function get controlBar():ControlBar
    public function set controlBar(value:ControlBar):void
interactiveScreenproperty 
interactiveScreen:Container

[概 要]

表示画面インスタンスです.

[詳 細]

表示される画面全体です。 createScreenメソッドの戻り値が適用されます。 このプロパティを外部から設定するか、createScreenメソッドを オーバーライドすることで、表示する画面を変更できます。

[備 考]

The default value is createScreeメソッドの戻り値.


Implementation
    public function get interactiveScreen():Container
    public function set interactiveScreen(value:Container):void

See also

createScreen()
messageproperty 
message:String

[概 要]

表示するメッセージです.

[詳 細]

メイン表示部分に表示されるメッセージです。

[備 考]


Implementation
    public function get message():String
    public function set message(value:String):void
modeproperty 
mode:int

[概 要]

画面表示モードです.

[詳 細]

MESSAGE_MODE、INPUT_MODEを指定します。

[備 考]

The default value is MESSAGE_MODE.


Implementation
    public function get mode():int
    public function set mode(value:int):void
noLabelproperty 
noLabel:String

[概 要]

「いいえ」ボタンのラベルです.

[詳 細]

[備 考]


Implementation
    public function get noLabel():String
    public function set noLabel(value:String):void
screenHeightproperty 
screenHeight:int

[概 要]

表示画面の高さです.

[詳 細]

設定されていない場合は内容物でパックされます。

[備 考]


Implementation
    public function get screenHeight():int
    public function set screenHeight(value:int):void
screenWidthproperty 
screenWidth:int

[概 要]

表示画面の幅です.

[詳 細]

設定されていない場合は内容物でパックされます。

[備 考]


Implementation
    public function get screenWidth():int
    public function set screenWidth(value:int):void
textInputproperty 
textInput:TextInput

[概 要]

INPUT_MODE時のTextInputです.

[詳 細]

[備 考]


Implementation
    public function get textInput():TextInput
    public function set textInput(value:TextInput):void

See also

getInputText()
titleproperty 
title:String

[概 要]

表示画面タイトルです.

[詳 細]

表示する画面のタイトル文言を指定します。

[備 考]


Implementation
    public function get title():String
    public function set title(value:String):void
yesLabelproperty 
yesLabel:String

[概 要]

「はい」ボタンのラベルです.

[詳 細]

[備 考]


Implementation
    public function get yesLabel():String
    public function set yesLabel(value:String):void
Method Detail
createContent()method
protected function createContent():Container

[概 要]

ユーザとの対話内容を格納するコンテナインスタンスを生成します.

[詳 細]

[備 考]

Returns
Container
createControlBar()method 
protected function createControlBar():ControlBar

[概 要]

画面下部のボタン格納コントロールバーインスタンスを生成します.

[詳 細]

[備 考]

Returns
ControlBar
createScreen()method 
protected function createScreen():Container

[概 要]

ユーザと対話を行う画面インスタンスを生成します.

[詳 細]

interactiveScreenプロパティにTitleWindowインスタンスを設定します。 titleプロパティが設定されている場合はTitleWindowのタイトルとして採用されます。 同様にscreenWidthプロパティ、screenHeightプロパティが設定されている場合、 TitleWindowの幅、高さとして設定されます。 screenWidthプロパティ、screenHeightプロパティが設定されていない場合、 TitleWindowのサイズは表示する内容物のサイズでパックされます。

[備 考]

Returns
Container
getInputText()method 
public function getInputText():String

[概 要]

INPUT_MODEで表示されているTextInputの値を取得します.

[詳 細]

[備 考]

Returns
String — INPUT_MODEテキスト入力値
mainProc()method 
override protected function mainProc():void

[概 要]

preProcで生成された画面インスタンスを表示します.

[詳 細]

"interactive"という名前でWindowManagerに表示処理委譲します。

[備 考]

onResult()method 
public function onResult(event:Event):void

[概 要]

ControllBarに配置されたボタンの押下イベントハンドラです.

[詳 細]

モデル終了イベント、モデル完了イベントを発行します。

[備 考]

Parameters

event:Event — ボタン押下イベント

preProc()method 
override protected function preProc():Boolean

[概 要]

ユーザと対話する画面の初期化を行います.

[詳 細]

interactiveScreenプロパティが設定されている(既に独自の画面が設定されている) 場合は処理を行いません。 interactiveScreenプロパティがnullの場合は、
  1. createScreenメソッド呼び出し
  2. (contentプロパティがnullの場合)createContentメソッド呼び出し
  3. (controllBarプロパティがnullの場合)createControllBarメソッド呼び出し
を行い、画面を生成します。 contentプロパティ、controlBarプロパティが既に設定されている場合は、それが 画面の内容物として優先的に採用されます。

[備 考]

Returns
Boolean — true
Constant Detail
INPUT_MODEConstant
public static const INPUT_MODE:int = 2

メッセージ+テキスト入力の画面モードです.

MESSAGE_MODEConstant 
public static const MESSAGE_MODE:int = 1

メッセージ表示のみの画面モードです.

YES_NO_CANCEL_OPTIONConstant 
public static const YES_NO_CANCEL_OPTION:int = 7

「はい」「いいえ」「キャンセル」ボタンオプションです.

YES_NO_OPTIONConstant 
public static const YES_NO_OPTION:int = 3

「はい」「いいえ」ボタンオプションです.

YES_OPTIONConstant 
public static const YES_OPTION:int = 1

「はい」ボタンオプションです.

Examples
HTTP送信前にユーザに送信是非を確認する
         public class SendAction extends BaseAction {
            
            override protected function prepare(parameterMapping:ParameterMapping):Boolean {
                var ret:Boolean = true;
                
                // 画面入力情報を取得します
                var postal:String = TextInput(getComponentByName("form.postal1")).text + "-" + 
                                    TextInput(getComponentByName("form.postal2")).text;
                var address:String = TextInput(getComponentByName("form.address")).text;
                var username:String = TextInput(getComponentByName("form.username")).text;
                var tel:String = TextInput(getComponentByName("form.tel1")).text + 
                      TextInput(getComponentByName("form.tel2")).text + 
                      TextInput(getComponentByName("form.tel3")).text;
                var fax:String = TextInput(getComponentByName("form.fax1")).text + 
                      TextInput(getComponentByName("form.fax2")).text + 
                      TextInput(getComponentByName("form.fax3")).text;
                var birth:String = TextInput(getComponentByName("form.birth")).text;
                var notes:String = TextArea(getComponentByName("form.notes")).text;
                
                // prepareメソッド外で利用する為、parameterMappingに設定しておきます
                parameterMapping.setParameter("postal", postal);
                parameterMapping.setParameter("address", address);
                parameterMapping.setParameter("username", username);
                parameterMapping.setParameter("tel", tel);
                parameterMapping.setParameter("fax", fax);
                parameterMapping.setParameter("birth", birth);
                parameterMapping.setParameter("notes", notes);
                    
                return ret;
            }
    
            // ① HTTP送信モデルの前にUserInteractiveCoreを予約します
            override protected function reserveModels(models:Array):void {
                models.push(Class(UserInteractiveCore));
                models.push(Class(HTTPServiceCore));
            }

            // ② UserInteractiveCoreで表示するメッセージを形成します
            //    HTTPServiceCoreのターン(index 1)では前回ターン(index 0)のUserInteractiveCoreの結果を判定し、
            //    「いいえ」が選択されていれば送信を取りやめます    
            override public function nextModel(index:int, prev:ModelProcessEvent, next:BaseModel):Boolean {
                switch(index) {
                    case 0:
                        var message:String = "以下の内容で送信しますか?\n\n";
                        message += "郵便番号:" + parameterMapping.getParameter("postal") + "\n";
                        message += "住所:" + parameterMapping.getParameter("address") + "\n";
                        message += "氏名:" + parameterMapping.getParameter("username") + "\n";
                        message += "電話番号:" + parameterMapping.getParameter("tel") + "\n";
                        message += "FAX:" + parameterMapping.getParameter("fax") + "\n";
                        message += "誕生日:" + parameterMapping.getParameter("birth") + "\n";
                        message += "備考:" + parameterMapping.getParameter("notes") + "\n";
    
                        UserInteractiveCore(next).message = message;
                        break;
                    case 1:
                        if(Button(MouseEvent(prev.cause).currentTarget).label == "いいえ") {
                            return false;
                        }
                        HTTPServiceCore(next).url ="webController";
                        HTTPServiceCore(next).resultFormat = RPCCore.E4X;
                        HTTPServiceCore(next).addUrlParameter("model.fqcn", "demo.rpc.model.DummyRestResponseModel");
                        HTTPServiceCore(next).addUrlParameter("forward.page", "DummyRestResponse.xml");
                        HTTPServiceCore(next).addUrlParameter("postal", parameterMapping.getParameter("postal") as String);
                        HTTPServiceCore(next).addUrlParameter("address", parameterMapping.getParameter("address") as String);
                        HTTPServiceCore(next).addUrlParameter("username", parameterMapping.getParameter("username") as String);
                        HTTPServiceCore(next).addUrlParameter("tel", parameterMapping.getParameter("tel") as String);
                        HTTPServiceCore(next).addUrlParameter("fax", parameterMapping.getParameter("fax") as String);
                        HTTPServiceCore(next).addUrlParameter("birth", parameterMapping.getParameter("birth") as String);
                        HTTPServiceCore(next).addUrlParameter("notes", parameterMapping.getParameter("notes") as String);
                        break;
                    case 2:
                        Alert.show("正常に送信されました");
                        break;
                        
                }
                return true;
            }
        }
      
     
様々な対話ウィンドウを連続で表示する
        override protected function reserveModels(models:Array):void{
            models.push(Class(UserInteractiveCore));
            models.push(Class(UserInteractiveCore));
            models.push(Class(UserInteractiveCore));
            models.push(Class(UserInteractiveCore));
        }
        
        override public function nextModel(index:int, prev:ModelProcessEvent, next:BaseModel):Boolean {
            switch(index){
                case 0:
                    // 次モデル設定
                    // 通常使用パターン
                    UserInteractiveCore(next).title = "確認";
                    UserInteractiveCore(next).message = "続行しますか?";
                    break;
                case 1:
                    // 前モデル結果評価
                    if(Button(MouseEvent(prev.cause).currentTarget).label == "いいえ") {
                        return false;
                    }
                    
                    // 次モデル設定
                    // 独自ボタン使用パターン
                    UserInteractiveCore(next).title = "質問1";
                    UserInteractiveCore(next).message = "性別を選択して下さい";
                    var male:Button = new Button();
                    male.label = "男";
                    var female:Button = new Button();
                    female.label = "女";
                    var buttons:Array = [male, female];
                    UserInteractiveCore(next).buttons = buttons;
                    break;
                case 2:
                    // 前モデル結果評価
                    var gender:Label = new Label();
                    gender.text = "性別:" + Button(MouseEvent(prev.cause).currentTarget).label;
                    DisplayObjectContainer(getComponentByName("userInteractive.vbox")).addChild(gender);
                
                    // 次モデル設定
                    // INPUTモード、ボタンオプション使用パターン
                    UserInteractiveCore(next).title = "質問2";
                    UserInteractiveCore(next).message = "氏名を入力して下さい";
                    UserInteractiveCore(next).mode = UserInteractiveCore.INPUT_MODE;
                    UserInteractiveCore(next).buttonOption = UserInteractiveCore.YES_OPTION;
                    break;
                case 3:
                    // 前モデル結果評価
                    var name:Label = new Label();
                    name.text = "氏名:" + UserInteractiveCore(prev.target).getInputText(); 
                    DisplayObjectContainer(getComponentByName("userInteractive.vbox")).addChild(name);
                    
                    // 次モデル設定
                    // 独自コンテントコンテナ使用パターン
                    var label:Label = new Label();
                    label.text = "血液型を選択して下さい";
                    var aType:RadioButton = new RadioButton();
                    aType.label = "A型";
                    aType.selected = true;
                    aType.name = "aType";
                    var bType:RadioButton = new RadioButton();
                    bType.label = "B型";
                    var abType:RadioButton = new RadioButton();
                    abType.label = "AB型";
                    var oType:RadioButton = new RadioButton();
                    oType.label = "O型";
                    
                    var bloodType:HBox = new HBox();
                    bloodType.addChild(aType);
                    bloodType.addChild(bType);
                    bloodType.addChild(abType);
                    bloodType.addChild(oType);

                    var content:VBox = new VBox();
                    content.addChild(label);
                    content.addChild(bloodType);
                                                            
                    UserInteractiveCore(next).title = "質問3";
                    UserInteractiveCore(next).content = content;
                    UserInteractiveCore(next).buttonOption = UserInteractiveCore.YES_OPTION;
                    break;
                case 4:
                    // 前モデル結果評価 
                    var blood:Label = new Label();
                    aType = RadioButton(getComponentByNameFrom(UserInteractiveCore(prev.target).content, "aType"));
                    blood.text = "血液型:" + aType.group.selection.label;  
                    DisplayObjectContainer(getComponentByName("userInteractive.vbox")).addChild(blood);

                    var send:Button = new Button();
                    send.label = "送信";
                    send.name = "userInteractive.send";
                    DisplayObjectContainer(getComponentByName("userInteractive.vbox")).addChild(send);
                    controller.eventBinder.addEventBindingImmediately("userInteractive.send", MouseEvent.CLICK, Class(SendAction));

            }
            return true;
        }
     

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