jp.co.fujitsu.reffi.client.nexaweb.model
クラス XalReturnPossibilityModel

java.lang.Object
  上位を拡張 jp.co.fujitsu.reffi.client.nexaweb.model.BaseModel
      上位を拡張 jp.co.fujitsu.reffi.client.nexaweb.model.XalReturnPossibilityModel
すべての実装されたインタフェース:
Model
直系の既知のサブクラス:
HTTPRequestCore, SubscribeCore

public abstract class XalReturnPossibilityModel
extends BaseModel

[概 要]

処理の結果、新規xalを画面挿入する可能性の有るモデルが継承するクラスです。

[詳 細]

xalを画面にレンダリングした後、、ウィンドウ識別を容易にする為の機能を提供します。
継承クラスはaddIdentifierToWindows(Document)を呼び出すことによって、
取得したxal内ウィンドウレベルエレメントに対して「parentId」、「communicateId」属性を付与します。

[備 考]

parentId、communicateIdについてはaddIdentifierToWindows(Document)を参照して下さい。

使用例)
・同じxalを複数読み込むが、読み込んだ後にユニークに特定する

 public class MapXalFetchAction extends BaseAction {
     @Override
    protected void reserveModels(List> models) {
        models.add(HTTPRequestCore.class);
    }

    @Override
   public boolean nextModel(int index, ModelProcessEvent prev, Model next) throws Exception {
        switch(index){
            case 0:
                // 都道府県選択コンボボックスから選択中の都道府県を取得
                String prefecture = getElementValueByName("comboPrefecture").getElementValue(0).getValue();

                // *サーバロジックは任意
                ((HTTPRequestCore)next).setRequestUrl("webcontroller");
                ((HTTPRequestCore)next).addUrlParameters("forward.page", "/pages/map.xal");
                
                // 取得予定のxal内ウィンドウcommunicateIdに都道府県名を設定
                ((HTTPRequestCore)next).setCommunicateId(prefecture);
                break;
        }
        return true;
    }
 }   
 
結果、ui Documentには以下のように挿入され、communicateIdで同一xalがユニーク識別可能になります。
     <ui>
         <window name="map" communicateId="hokkaido">
                 :
         </window>
 
         <window name="map" communicateId="tokyo">
                 :
         </window>
     </ui>
 

[環 境] JDK 6.0 Update 11

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

作成者:
Project Reffi

コンストラクタの概要
XalReturnPossibilityModel()
           
 
メソッドの概要
protected  Vector<Element> addIdentifierToWindows(Document document)
          [概 要] 通信の結果取得したウィンドウレベルエレメントに識別子parentId、communicateIdを付与します。
 String getCommunicateId()
          [概 要] 通信識別IDを取得します。
 Element getEventSourceWindow()
          [概 要] このモデルを起動したコンポーネントが属するウィンドウレベルエレメントを返却します。
protected  void mainproc()
          [概 要] 主処理です。
 void setCommunicateId(String communicateId)
          [概 要] 通信識別IDを設定します。
 void setEventSourceWindow(Element eventSourceWindow)
          [概 要] このモデルを起動したコンポーネントが属するウィンドウレベルエレメントを設定します。
 
クラス jp.co.fujitsu.reffi.client.nexaweb.model.BaseModel から継承されたメソッド
addModelProcessListener, finalproc, fireModelFailure, fireModelFinished, fireModelSuccess, getController, getExecuteIndex, getListenerList, getParameterMapping, getResult, getSuccessCount, incrementSuccessCount, isSkip, postproc, preproc, removeModelProcessListener, run, setController, setExecuteIndex, setListenerList, setParameterMapping, setResult, setSkip, trap
 
クラス java.lang.Object から継承されたメソッド
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

コンストラクタの詳細

XalReturnPossibilityModel

public XalReturnPossibilityModel()
メソッドの詳細

getEventSourceWindow

public Element getEventSourceWindow()

[概 要]

このモデルを起動したコンポーネントが属するウィンドウレベルエレメントを返却します。

[詳 細]

eventSourceWindowフィールド値を返却します。

[備 考]

戻り値:
このモデルを起動したコンポーネントが属するウィンドウレベルエレメント

setEventSourceWindow

public void setEventSourceWindow(Element eventSourceWindow)

[概 要]

このモデルを起動したコンポーネントが属するウィンドウレベルエレメントを設定します。

[詳 細]

eventSourceWindowフィールド値を、引数eventSourceWindowで設定します。

[備 考]

パラメータ:
eventSourceWindow - このモデルを起動したコンポーネントが属するウィンドウレベルエレメント

getCommunicateId

public String getCommunicateId()

[概 要]

通信識別IDを取得します。

[詳 細]

communicateIdフィールド値を返却します。

[備 考]

setCommunicateId(String)によって任意設定されていない場合、
UUID.randomUUID().toString()
が返却されます。

戻り値:
通信識別ID

setCommunicateId

public void setCommunicateId(String communicateId)

[概 要]

通信識別IDを設定します。

[詳 細]

communicateIdフィールド値を、引数communicateIdで設定します。

[備 考]

パラメータ:
communicateId - 通信識別ID

mainproc

protected void mainproc()
                 throws Exception

[概 要]

主処理です。

[詳 細]

アクションから譲渡された、イベント発生元ウィンドウレベルエレメントを、 フィールドに保存します。

[備 考]

保存されたイベント発生元ウィンドウレベルエレメントのid属性値が、 新たに取得したウィンドウレベルエレメントのparentId属性値として設定されます。

オーバーライド:
クラス BaseModel 内の mainproc
例外:
Exception - オーバーライド先で発生する可能性が有る例外

addIdentifierToWindows

protected Vector<Element> addIdentifierToWindows(Document document)

[概 要]

通信の結果取得したウィンドウレベルエレメントに識別子parentId、communicateIdを付与します。

[詳 細]

引数Documentに含まれる、window、dialogエレメントを取得し、 privateオーバーロードメソッドに処理委譲します。

[備 考]

「parentId」について

通信の結果新しく取得したウィンドウレベルエレメントの親を識別する為のIDです。
「親」はDOM構造的な親では無く、画面の発生元を表します。
Aウィンドウ内アクション発生 → XalReturnPossibilityModel通信発生、の結果として Bウィンドウが画面表示された場合、
Aウィンドウ(id="123")はBウィンドウ(id="456", parentId="123")の親となります。

「communicateId」について

1通信を識別する為のIDです。
同じ画面(同じxal)が複数クライアント上に存在するような場合にA.xalとA´.xalを 識別する為に使用します。

     <ui>
         // A通信の結果取得したA.xal
         <window name="abc" id="nx-12345" communicateId="com_A">
             <button name="btn">
         </window>
 
         // B通信の結果取得したA.xal
         <window name="abc" id="nx-67890" communicateId="com_B">
             <button name="btn">
         </window>
     </ui>
 
上記の場合、abcウィンドウはcommunicateIdを判断することによってユニークに 識別出来ます。
又、idとは違う為、Document内でユニークである必要は有りません。

パラメータ:
document - 通信の結果取得したXML Document
戻り値:
documentに存在するウィンドウレベルエレメント群


Copyright(C) Fujitsu All Rights Reserved.