jp.go.kokken.Ankou
クラス CompileResults

java.lang.Object
  拡張org.xml.sax.helpers.DefaultHandler
      拡張jp.go.kokken.Ankou.CompileResults
すべての実装インタフェース:
org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler

public class CompileResults
extends org.xml.sax.helpers.DefaultHandler

XML形式の結果をJTable形式に合わせます。

認められる入力形式は今のところ次のとおりです。

 <result>
 <item>
 <IPU hidden="yes" IPUStartTime="00030.088"/>
 <IPU IPUEndTime="00060.088"/>
 </item>
 </result>
 

それぞれの<item>はTableで列になり、 <IPUやLUWなど>はセルとなります。行の数は 始めのitemの持つTAGの数で決められます。この例では2です。

attributeで、hidden属性がついている場合その行は表示されませんが getHiddenAttribute()で取得できます。音を再生する場合などで 使われる場合この属性が使われる事があるためです。 実装が簡易版なのでhidden属性が存在するだけで 非表示用データとなります。

getAttributeまたはgetHiddenAttributeで 値を得るには、上の例では"IPU/@IPUStartTime"で検索 して下さい。

JTableのTableModelと隠し属性付のデータのTableModelは 別に保存されています。


入れ子クラスの概要
(パッケージプライベート)  class CompileResults.ReadOnlyTableModel
           
 
フィールドの概要
(パッケージプライベート)  int count
          初めてレコードを作ったか(テーブル初期化のため)
(パッケージプライベート)  int depth
          ツリーの深さ
(パッケージプライベート)  java.util.Vector headrecord
          テーブルヘッダのVECTOR
(パッケージプライベート)  java.util.Vector hiddenheadrecord
          テーブルヘッダのVECTOR
(パッケージプライベート)  CompileResults.ReadOnlyTableModel hiddenmodel
          隠し属性つきのデータのテーブルの内容
(パッケージプライベート)  java.util.Vector hiddenrecord
          テーブルに登録するためのレコードのVECTOR (1 item)
(パッケージプライベート) static org.apache.log4j.Logger logger
          log4j logger
(パッケージプライベート)  CompileResults.ReadOnlyTableModel model
          テーブルの内容
(パッケージプライベート)  java.util.Vector prerecord
          テーブルに登録した直前のVECTOR
(パッケージプライベート)  int previousdepth
          一回前に読んだツリーの深さ
(パッケージプライベート)  java.util.Vector record
          テーブルに登録するためのレコードのVECTOR (1 item)
 javax.swing.JTable table
          そのまま使えるSWING component
 
コンストラクタの概要
CompileResults()
          テーブルを初期化します。
 
メソッドの概要
 void addHiddenRow(java.util.Vector Names)
          隠しデータのTableにレコード行を追加します。
 void addRow(java.util.Vector Names)
          JTableにレコード行を追加します。
 void characters(char[] ch, int start, int length)
          Receive notification of character data.
 void endDocument()
          Receive notification of the end of the document.
 void endElement(java.lang.String uri, java.lang.String localName, java.lang.String qName)
          Receive notification of the end of an element.
 void error(org.xml.sax.SAXParseException e)
          Receive notification of a recoverable error.
 void fatalError(org.xml.sax.SAXParseException e)
          Receive notification of a non-recoverable error.
 java.lang.String getAttribute(java.lang.String AttributeName, int column)
          属性を探してその値を返します。
 java.lang.String getHiddenAttribute(java.lang.String AttributeName, int column)
          表示されない属性を探してその値を返します。
 void registerResults(java.lang.String results)
          結果の文字列からテーブルを作ります。
 void setHeadColumn(java.util.Vector columnNames)
          JTableを初期化しテーブルの一番上の行の表示を設定します。
 void setHiddenHeadColumn(java.util.Vector columnNames)
          隠し属性データのTableを初期化しテーブルの一番上の行の表示を設定します。
 void startDocument()
          Receive notification of the beginning of the document.
 void startElement(java.lang.String uri, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes atts)
          Receive notification of the beginning of an element.
 java.io.InputStream string2InputStream(java.lang.String aStr)
          文字列をInputStreamへ変換(ひどいメモリの無駄?)
 void warning(org.xml.sax.SAXParseException e)
          Receive notification of a warning.
 
クラス org.xml.sax.helpers.DefaultHandler から継承したメソッド
endPrefixMapping, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startPrefixMapping, unparsedEntityDecl
 
クラス java.lang.Object から継承したメソッド
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

フィールドの詳細

logger

static org.apache.log4j.Logger logger
log4j logger


table

public javax.swing.JTable table
そのまま使えるSWING component


model

CompileResults.ReadOnlyTableModel model
テーブルの内容


hiddenmodel

CompileResults.ReadOnlyTableModel hiddenmodel
隠し属性つきのデータのテーブルの内容


depth

int depth
ツリーの深さ


previousdepth

int previousdepth
一回前に読んだツリーの深さ


count

int count
初めてレコードを作ったか(テーブル初期化のため)


record

java.util.Vector record
テーブルに登録するためのレコードのVECTOR (1 item)


prerecord

java.util.Vector prerecord
テーブルに登録した直前のVECTOR


headrecord

java.util.Vector headrecord
テーブルヘッダのVECTOR


hiddenrecord

java.util.Vector hiddenrecord
テーブルに登録するためのレコードのVECTOR (1 item)


hiddenheadrecord

java.util.Vector hiddenheadrecord
テーブルヘッダのVECTOR

コンストラクタの詳細

CompileResults

public CompileResults()
テーブルを初期化します。

メソッドの詳細

setHeadColumn

public void setHeadColumn(java.util.Vector columnNames)
                   throws org.xml.sax.SAXException
JTableを初期化しテーブルの一番上の行の表示を設定します。 配列のサイズも同時に設定されます。

パラメータ:
columnNames - 表示する文字列のVector
例外:
java.lang.Exception - エラーがおきた時
org.xml.sax.SAXException

setHiddenHeadColumn

public void setHiddenHeadColumn(java.util.Vector columnNames)
                         throws org.xml.sax.SAXException
隠し属性データのTableを初期化しテーブルの一番上の行の表示を設定します。 配列のサイズも同時に設定されます。

パラメータ:
columnNames - 表示する文字列のVector
例外:
java.lang.Exception - エラーがおきた時
org.xml.sax.SAXException

addRow

public void addRow(java.util.Vector Names)
            throws org.xml.sax.SAXException
JTableにレコード行を追加します。 テーブルに列が足りないようだと、全部初期化して1から足します。 (境界エラー回避のため)

パラメータ:
Names - 表示する文字列のVector
例外:
org.xml.sax.SAXException - エラーがおきた時

addHiddenRow

public void addHiddenRow(java.util.Vector Names)
                  throws org.xml.sax.SAXException
隠しデータのTableにレコード行を追加します。 テーブルに列が足りないようだと、全部初期化して1から足します。 (境界エラー回避のため)

パラメータ:
Names - 表示する文字列のVector
例外:
org.xml.sax.SAXException - エラーがおきた時

string2InputStream

public java.io.InputStream string2InputStream(java.lang.String aStr)
                                       throws java.io.IOException
文字列をInputStreamへ変換(ひどいメモリの無駄?)

http://www.monyplaza.net/tips/java/java_tips5.xtpを利用

[JavaHouse-Brewers:38470] Re: String データをInputStream で読み込む方法 を参考

パラメータ:
aStr - 変換元文字列
戻り値:
InputStream 変換後ストリーム
例外:
java.io.IOException - 文字列用ストリームのオープン又は、 書込みで例外発生

registerResults

public void registerResults(java.lang.String results)
                     throws java.lang.IllegalArgumentException,
                            org.xml.sax.SAXException,
                            java.io.IOException
結果の文字列からテーブルを作ります。一旦 テーブルを初期化してから新たに作りなおします。

パラメータ:
results - 結果の文字列
例外:
java.lang.IllegalArgumentException - 結果が空の時
org.xml.sax.SAXException - XMLパースエラー
java.io.IOException - IOエラー(普通は起こらないはず)

getHiddenAttribute

public java.lang.String getHiddenAttribute(java.lang.String AttributeName,
                                           int column)
表示されない属性を探してその値を返します。

パラメータ:
AttributeName - 探す属性名
column - 何番目の値を返すか指定
戻り値:
見つけた値。見つからない時はnullを返します。

getAttribute

public java.lang.String getAttribute(java.lang.String AttributeName,
                                     int column)
属性を探してその値を返します。

パラメータ:
AttributeName - 探す属性名
column - 何番目の値を返すか指定
戻り値:
見つけた値。見つからない時はnullを返します。

startDocument

public void startDocument()
                   throws org.xml.sax.SAXException
Receive notification of the beginning of the document.

例外:
org.xml.sax.SAXException - Any SAX exception, possibly wrapping another exception.

endDocument

public void endDocument()
                 throws org.xml.sax.SAXException
Receive notification of the end of the document.

例外:
org.xml.sax.SAXException - Any SAX exception, possibly wrapping another exception.

startElement

public void startElement(java.lang.String uri,
                         java.lang.String localName,
                         java.lang.String qName,
                         org.xml.sax.Attributes atts)
                  throws org.xml.sax.SAXException
Receive notification of the beginning of an element.

itemレコードを読み込んでテーブルを作成する メインの関数です。1回目にitemレコードを読んだ時に setHeadColumn(String[] columnNames)を利用して テーブルの初期化を行ないます。以降、 レコードが大きい場合は原則として切り捨てます。

パラメータ:
uri - The Namespace URI, or the empty string if the element has no Namespace URI or if Namespace processing is not being performed.
localName - The local name (without prefix), or the empty string if Namespace processing is not being performed.
qName - The qualified name (with prefix), or the empty string if qualified names are not available.
atts - The attributes attached to the element. If there are no attributes, it shall be an empty Attributes object.
例外:
org.xml.sax.SAXException - Any SAX exception, possibly wrapping another exception.

endElement

public void endElement(java.lang.String uri,
                       java.lang.String localName,
                       java.lang.String qName)
                throws org.xml.sax.SAXException
Receive notification of the end of an element.

パラメータ:
uri - The Namespace URI, or the empty string if the element has no Namespace URI or if Namespace processing is not being performed.
localName - The local name (without prefix), or the empty string if Namespace processing is not being performed.
qName - The qualified XML 1.0 name (with prefix), or the empty string if qualified names are not available.
例外:
org.xml.sax.SAXException - Any SAX exception, possibly wrapping another exception.

characters

public void characters(char[] ch,
                       int start,
                       int length)
                throws org.xml.sax.SAXException
Receive notification of character data.

パラメータ:
ch - The characters from the XML document.
start - The start position in the array.
length - The number of characters to read from the array.
例外:
org.xml.sax.SAXException - Any SAX exception, possibly wrapping another exception.
関連項目:
DefaultHandler.ignorableWhitespace(char[], int, int), Locator

warning

public void warning(org.xml.sax.SAXParseException e)
Receive notification of a warning.

パラメータ:
e - The warning information encapsulated in a SAX parse exception.

error

public void error(org.xml.sax.SAXParseException e)
Receive notification of a recoverable error.

パラメータ:
e - The error information encapsulated in a SAX parse exception.

fatalError

public void fatalError(org.xml.sax.SAXParseException e)
Receive notification of a non-recoverable error.

パラメータ:
e - The error information encapsulated in a SAX parse exception.