Package | jp.co.fujitsu.reffi.client.flex.model |
Class | public class UserInteractiveCore |
Inheritance | UserInteractiveCore ![]() ![]() |
[概 要]
ユーザとのインタラクティブな会話を行う為の機能モデルです.[詳 細]
Reffiが形成するシステムロジックフローを中断してユーザとの対話を行う画面を表示します。表示される画面の構成は各種プロパティを外部から設定することで変更出来ます。
[備 考]
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.
Property | Defined 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 | ||
![]() | controller : BaseController
[概 要] このモデルを起動したコントローラインスタンスです. | BaseModel | |
![]() | executeIndex : int [概 要] 実行インデックス設定. | BaseModel | |
interactiveScreen : Container [概 要] 表示画面インスタンスです. | UserInteractiveCore | ||
message : String [概 要] 表示するメッセージです. | UserInteractiveCore | ||
mode : int [概 要] 画面表示モードです. | UserInteractiveCore | ||
noLabel : String [概 要] 「いいえ」ボタンのラベルです. | UserInteractiveCore | ||
![]() | parameterMapping : ParameterMapping
[概 要] MVC各レイヤを伝播するパラメータオブジェクトです. | BaseModel | |
screenHeight : int [概 要] 表示画面の高さです. | UserInteractiveCore | ||
screenWidth : int [概 要] 表示画面の幅です. | UserInteractiveCore | ||
![]() | skip : Boolean [概 要] このモデルを実行するか、コントローラが判断する為のフラグです. | BaseModel | |
![]() | successCount : int [概 要] モデルインスタンス生存中に、何回モデル処理が成功したかを保持します. | BaseModel | |
textInput : TextInput [概 要] INPUT_MODE時のTextInputです. | UserInteractiveCore | ||
title : String [概 要] 表示画面タイトルです. | UserInteractiveCore | ||
yesLabel : String [概 要] 「はい」ボタンのラベルです. | UserInteractiveCore |
Method | Defined by | ||
---|---|---|---|
![]() |
dispatchModelFailure(event:ModelProcessEvent):void
[概 要] モデル処理失敗イベントを発行するメソッドです. | BaseModel | |
![]() |
dispatchModelFinished(event:ModelProcessEvent):void
[概 要] モデル処理完了イベントを発行するメソッドです. | BaseModel | |
![]() |
dispatchModelSuccess(event:ModelProcessEvent):void
[概 要] モデル処理成功イベントを発行するメソッドです. | BaseModel | |
getInputText():String
[概 要] INPUT_MODEで表示されているTextInputの値を取得します. | UserInteractiveCore | ||
![]() |
incrementSuccessCount():int
[概 要] ModelProcessEvent.SUCCESS発行回数を1増加させます. | BaseModel | |
onResult(event:Event):void
[概 要] ControllBarに配置されたボタンの押下イベントハンドラです. | UserInteractiveCore | ||
![]() |
run():void
[概 要] コントローラにコールされるモデルの主幹メソッドです. | BaseModel |
Method | Defined by | ||
---|---|---|---|
createContent():Container
[概 要] ユーザとの対話内容を格納するコンテナインスタンスを生成します. | UserInteractiveCore | ||
createControlBar():ControlBar
[概 要] 画面下部のボタン格納コントロールバーインスタンスを生成します. | UserInteractiveCore | ||
createScreen():Container
[概 要] ユーザと対話を行う画面インスタンスを生成します. | UserInteractiveCore | ||
![]() |
finallyProc():void
[概 要] run()が終了したタイミングでテンプレートコールされるメソッドです. | BaseModel | |
mainProc():void
[概 要] preProcで生成された画面インスタンスを表示します. | UserInteractiveCore | ||
![]() |
postProc():void
[概 要] 後処理テンプレートメソッドです. | BaseModel | |
preProc():Boolean
[概 要] ユーザと対話する画面の初期化を行います. | UserInteractiveCore | ||
![]() |
trap(e:Error):Error
[概 要] run()内で発生した全例外をハンドリングするメソッドです. | BaseModel |
Constant | Defined 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 |
buttonOption | property |
buttonOption:int
[read-write]
[概 要]
ボタン表示モードです.[詳 細]
YES_OPTION、YES_NO_OPTION、YES_NO_CANCEL_OPTIONを指定します。[備 考]
The default value is YES_NO_OPTION
.
public function get buttonOption():int
public function set buttonOption(value:int):void
buttons | property |
buttons:Array
[read-write]
[概 要]
表示するボタンです.[詳 細]
このプロパティが設定されている場合、buttonOptionプロパティの 設定より優先して配置されます。[備 考]
実装 public function get buttons():Array
public function set buttons(value:Array):void
cancelLabel | property |
cancelLabel:String
[read-write]
[概 要]
「キャンセルボタン」のラベルです.[詳 細]
[備 考]
実装 public function get cancelLabel():String
public function set cancelLabel(value:String):void
content | property |
content:Container
[read-write]
[概 要]
メイン表示内容です.[詳 細]
interactiveScreenの中に配置されるオブジェクトです。 createContentメソッドの戻り値が適用されます。[備 考]
実装 public function get content():Container
public function set content(value:Container):void
contentPaddingBottom | property |
contentPaddingBottom:int
[read-write]
[概 要]
メイン表示領域の下パディングです.[詳 細]
[備 考]
The default value is 10
.
public function get contentPaddingBottom():int
public function set contentPaddingBottom(value:int):void
contentPaddingLeft | property |
contentPaddingLeft:int
[read-write]
[概 要]
メイン表示領域の左パディングです.[詳 細]
[備 考]
The default value is 20
.
public function get contentPaddingLeft():int
public function set contentPaddingLeft(value:int):void
contentPaddingRight | property |
contentPaddingRight:int
[read-write]
[概 要]
メイン表示領域の右パディングです.[詳 細]
[備 考]
The default value is 20
.
public function get contentPaddingRight():int
public function set contentPaddingRight(value:int):void
contentPaddingTop | property |
contentPaddingTop:int
[read-write]
[概 要]
メイン表示領域の上パディングです.[詳 細]
[備 考]
The default value is 10
.
public function get contentPaddingTop():int
public function set contentPaddingTop(value:int):void
controlBar | property |
controlBar:ControlBar
[read-write]
[概 要]
ボタン配置領域です.[詳 細]
interactiveScreenの下部に配置されるオブジェクトです。 createControlBarメソッドの戻り値が適用されます。[備 考]
実装 public function get controlBar():ControlBar
public function set controlBar(value:ControlBar):void
interactiveScreen | property |
interactiveScreen:Container
[read-write]
[概 要]
表示画面インスタンスです.[詳 細]
表示される画面全体です。[備 考]
The default value is createScreeメソッドの戻り値
.
public function get interactiveScreen():Container
public function set interactiveScreen(value:Container):void
関連項目
message | property |
message:String
[read-write]
[概 要]
表示するメッセージです.[詳 細]
メイン表示部分に表示されるメッセージです。[備 考]
実装 public function get message():String
public function set message(value:String):void
mode | property |
mode:int
[read-write]
[概 要]
画面表示モードです.[詳 細]
MESSAGE_MODE、INPUT_MODEを指定します。[備 考]
The default value is MESSAGE_MODE
.
public function get mode():int
public function set mode(value:int):void
noLabel | property |
noLabel:String
[read-write]
[概 要]
「いいえ」ボタンのラベルです.[詳 細]
[備 考]
実装 public function get noLabel():String
public function set noLabel(value:String):void
screenHeight | property |
screenHeight:int
[read-write]
[概 要]
表示画面の高さです.[詳 細]
設定されていない場合は内容物でパックされます。[備 考]
実装 public function get screenHeight():int
public function set screenHeight(value:int):void
screenWidth | property |
screenWidth:int
[read-write]
[概 要]
表示画面の幅です.[詳 細]
設定されていない場合は内容物でパックされます。[備 考]
実装 public function get screenWidth():int
public function set screenWidth(value:int):void
textInput | property |
textInput:TextInput
[read-write]
[概 要]
INPUT_MODE時のTextInputです.[詳 細]
[備 考]
実装 public function get textInput():TextInput
public function set textInput(value:TextInput):void
関連項目
title | property |
title:String
[read-write]
[概 要]
表示画面タイトルです.[詳 細]
表示する画面のタイトル文言を指定します。[備 考]
実装 public function get title():String
public function set title(value:String):void
yesLabel | property |
yesLabel:String
[read-write]
[概 要]
「はい」ボタンのラベルです.[詳 細]
[備 考]
実装 public function get yesLabel():String
public function set yesLabel(value:String):void
createContent | () | method |
protected function createContent():Container
[概 要]
ユーザとの対話内容を格納するコンテナインスタンスを生成します.[詳 細]
[備 考]
戻り値Container |
createControlBar | () | method |
protected function createControlBar():ControlBar
[概 要]
画面下部のボタン格納コントロールバーインスタンスを生成します.[詳 細]
[備 考]
戻り値ControlBar |
createScreen | () | method |
protected function createScreen():Container
[概 要]
ユーザと対話を行う画面インスタンスを生成します.[詳 細]
interactiveScreenプロパティにTitleWindowインスタンスを設定します。 titleプロパティが設定されている場合はTitleWindowのタイトルとして採用されます。
同様にscreenWidthプロパティ、screenHeightプロパティが設定されている場合、
TitleWindowの幅、高さとして設定されます。
screenWidthプロパティ、screenHeightプロパティが設定されていない場合、
TitleWindowのサイズは表示する内容物のサイズでパックされます。
[備 考]
戻り値Container |
getInputText | () | method |
public function getInputText():String
[概 要]
INPUT_MODEで表示されているTextInputの値を取得します.[詳 細]
[備 考]
戻り値String — INPUT_MODEテキスト入力値
|
mainProc | () | method |
protected override function mainProc():void
[概 要]
preProcで生成された画面インスタンスを表示します.[詳 細]
"interactive"という名前でWindowManagerに表示処理委譲します。[備 考]
onResult | () | method |
public function onResult(event:Event):void
[概 要]
ControllBarに配置されたボタンの押下イベントハンドラです.[詳 細]
モデル終了イベント、モデル完了イベントを発行します。[備 考]
パラメータevent:Event — ボタン押下イベント
|
preProc | () | method |
protected override function preProc():Boolean
[概 要]
ユーザと対話する画面の初期化を行います.[詳 細]
interactiveScreenプロパティが設定されている(既に独自の画面が設定されている) 場合は処理を行いません。interactiveScreenプロパティがnullの場合は、
[備 考]
戻り値Boolean — true
|
INPUT_MODE | constant |
public static const INPUT_MODE:int = 2
メッセージ+テキスト入力の画面モードです.
MESSAGE_MODE | constant |
public static const MESSAGE_MODE:int = 1
メッセージ表示のみの画面モードです.
YES_NO_CANCEL_OPTION | constant |
public static const YES_NO_CANCEL_OPTION:int = 7
「はい」「いいえ」「キャンセル」ボタンオプションです.
YES_NO_OPTION | constant |
public static const YES_NO_OPTION:int = 3
「はい」「いいえ」ボタンオプションです.
YES_OPTION | constant |
public static const YES_OPTION:int = 1
「はい」ボタンオプションです.