jp.co.fujitsu.reffi.client.swing.parser
クラス ComponentValueParser

java.lang.Object
  上位を拡張 jp.co.fujitsu.reffi.client.swing.parser.ComponentValueParser
すべての実装されたインタフェース:
Parser

public class ComponentValueParser
extends java.lang.Object
implements Parser

[概 要]

各種コンポーネントが持つ値を包括的に取得する為のパーサです。

[詳 細]

各種コンポーネントは値の保持の仕方が異なります。
(textFieldコンポーネントはtext属性値を値として保持し、listBoxコンポーネントは selected属性がついているlistItem子コンポーネントのtext属性値を値として保持する等)

このクラスを使用してパースすることで、統一的な値へのアクセスと、 共通のオブジェクトによる値の保持が行われます。

[備 考]

このクラスのperseメソッドはElementの種類を意識せず、 単一の方法で値を取る為の手法を提供します。

NexawebコンポーネントとReffiが提供するValuePaserの対応表

コンポーネント種 対応する値取得パーサクラス 値取得の対象
button jp.co.fujitsu.reffi.client.nexaweb.parser.ButtonValueParser text属性値
label jp.co.fujitsu.reffi.client.nexaweb.parser.LabelValueParser text属性値
passwordField jp.co.fujitsu.reffi.client.nexaweb.parser.PasswordFieldValueParser text属性値
textField jp.co.fujitsu.reffi.client.nexaweb.parser.TextFieldValueParser text属性値
checkBox jp.co.fujitsu.reffi.client.nexaweb.parser.CheckBoxValueParser selected="true"属性値があれば"true"、なければ"false"
radioButton jp.co.fujitsu.reffi.client.nexaweb.parser.RadioButtonValueParser selected="true"属性値があれば"true"、なければ"false"
comboBox jp.co.fujitsu.reffi.client.nexaweb.parser.ComboBoxValueParser selected="true"属性値がついたlistBox/listItemコンポーネントのvalue属性値
listBox jp.co.fujitsu.reffi.client.nexaweb.parser.ListBoxValueParser selected="true"属性値がついたlistItemコンポーネントのvalue属性値
horizontalSlider jp.co.fujitsu.reffi.client.nexaweb.parser.HorizontalSliderValueParser position属性値、なければ"0"
verticalSlider jp.co.fujitsu.reffi.client.nexaweb.parser.VerticalSliderValueParser position属性値、なければ"0"
textArea jp.co.fujitsu.reffi.client.nexaweb.parser.TextAreaValueParser テキストノード値
textView jp.co.fujitsu.reffi.client.nexaweb.parser.TextViewValueParser テキストノード値
table jp.co.fujitsu.reffi.client.nexaweb.parser.TableValueParser row/cellコンポーネントのtext属性値

[環 境] JDK 6.0 Update 11

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

作成者:
Project Reffi

フィールドの概要
static java.util.Map<java.lang.Class<? extends java.awt.Component>,java.lang.Class<? extends Parser>> PARSERS
          コンポーネント種類毎に用意されたパーサ群をマッピングします。
 
コンストラクタの概要
ComponentValueParser()
           
 
メソッドの概要
static void addParser(java.lang.Class<? extends java.awt.Component> elementName, java.lang.Class<? extends Parser> parser)
          [概 要] 任意のParserを追加します。
 ComponentValues parse(java.awt.Component component)
          [概 要] Swingコンポーネントの値解析を行うメソッドです。
 
クラス java.lang.Object から継承されたメソッド
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

フィールドの詳細

PARSERS

public static final java.util.Map<java.lang.Class<? extends java.awt.Component>,java.lang.Class<? extends Parser>> PARSERS
コンポーネント種類毎に用意されたパーサ群をマッピングします。

コンストラクタの詳細

ComponentValueParser

public ComponentValueParser()
メソッドの詳細

parse

public ComponentValues parse(java.awt.Component component)
                      throws java.lang.Exception

[概 要]

Swingコンポーネントの値解析を行うメソッドです。

[詳 細]

引数elementのローカル名を元にPARSERSからParserクラスを取り出し インスタンス化、parseメソッドを引数elementで呼び出します。

[備 考]

定義:
インタフェース Parser 内の parse
パラメータ:
component - 解析対象コンポーネント
例外:
java.lang.Exception

addParser

public static void addParser(java.lang.Class<? extends java.awt.Component> elementName,
                             java.lang.Class<? extends Parser> parser)

[概 要]

任意のParserを追加します。

[詳 細]

各コンポーネント名に対応する、値パーサマップに新規、上書き追加します。

[備 考]

パラメータ:
elementName - 解析対象コンポーネント名
parser - 解析オブジェクト


Copyright © 2008-2010. All Rights Reserved.