|
JavaTM 2 Platform Standard Ed. 5.0 |
|||||||||
| 前のクラス 次のクラス | フレームあり フレームなし | |||||||||
| 概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド | |||||||||
java.lang.Objectjavax.swing.text.View
javax.swing.text.CompositeView
public abstract class CompositeView
CompositeView は、1 つ以上の子ビューを管理する、抽象 View の実装です (CompositeView では比較的少数の子ビューを管理する)。CompositeView は、BoxView など、子の View を含む、View の実装の開始ポイントとして使用されます。子の View のコレクションを管理するサブクラスでは、replace(int, int, javax.swing.text.View[]) メソッドが使用されます。DocumentListener 通知中に View が replace を呼び出すので、通常 replace を直接呼び出す必要はありません。
CompositeView は、子の View にレイアウトポリシーを強制しませんが、これから含むことになる子の View の挿入は許可します。インセットは、setInsets(short, short, short, short) または setParagraphInsets(javax.swing.text.AttributeSet) によって設定できます。
View の抽象メソッドに加え、CompositeView のサブクラスもオーバーライドする必要があります。
isBefore(int, int, java.awt.Rectangle) - 指定された View の位置が、CompositeView の視覚空間の前にあるかどうかを調べるisAfter(int, int, java.awt.Rectangle) - 指定された View の位置が、CompositeView の視覚空間の後ろにあるかどうかを調べるgetViewAtPoint(int, int, java.awt.Rectangle) - 指定された視覚位置のビューを返すchildAllocation(int, java.awt.Rectangle) - 特定の子 View の境界を返す。CompositeView の Inset により境界をオフセットしたあとで、getChildAllocation は childAllocation を呼び出す
| フィールドの概要 |
|---|
| クラス javax.swing.text.View から継承されたフィールド |
|---|
BadBreakWeight, ExcellentBreakWeight, ForcedBreakWeight, GoodBreakWeight, X_AXIS, Y_AXIS |
| インタフェース javax.swing.SwingConstants から継承されたフィールド |
|---|
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST |
| コンストラクタの概要 | |
|---|---|
CompositeView(Element elem)
指定された要素の CompositeView を構築します。 |
|
| メソッドの概要 | |
|---|---|
protected abstract void |
childAllocation(int index,
Rectangle a)
指定された子への割り当てを返します。 |
protected boolean |
flipEastAndWestAtEnds(int position,
Position.Bias bias)
次のビューをどの方向に配置するかを決定します。 |
protected short |
getBottomInset()
下のインセットを取得します。 |
Shape |
getChildAllocation(int index,
Shape a)
指定された、描画する子ビューへの割り当てを取り出します。 |
protected Rectangle |
getInsideAllocation(Shape a)
ビューに指定された不変の割り当てを、内部割り当てを表す可変割り当てに変更します。 |
protected short |
getLeftInset()
左のインセットを取得します。 |
protected int |
getNextEastWestVisualPositionFrom(int pos,
Position.Bias b,
Shape a,
int direction,
Position.Bias[] biasRet)
カーソルを置くことのできる、次の視覚的な位置を返します。 |
protected int |
getNextNorthSouthVisualPositionFrom(int pos,
Position.Bias b,
Shape a,
int direction,
Position.Bias[] biasRet)
カーソルを置くことのできる、次の視覚的な位置を返します。 |
int |
getNextVisualPositionFrom(int pos,
Position.Bias b,
Shape a,
int direction,
Position.Bias[] biasRet)
キャレットが配置される可能性のある、視覚的に表された次のモデル位置を決定する手段を提供します。 |
protected short |
getRightInset()
右のインセットを取得します。 |
protected short |
getTopInset()
上のインセットを取得します。 |
View |
getView(int n)
コンテナ内の n 番目のビューを返します。 |
protected abstract View |
getViewAtPoint(int x,
int y,
Rectangle alloc)
指定された座標の子ビューを取り出します。 |
protected View |
getViewAtPosition(int pos,
Rectangle a)
モデル内の指定された位置を示す子ビューを取り出します。 |
int |
getViewCount()
このビューの子ビューの数を返します。 |
int |
getViewIndex(int pos,
Position.Bias b)
モデル内に指定された位置を表す子ビューインデックスを返します。 |
protected int |
getViewIndexAtPosition(int pos)
モデル内の指定された位置を表す、子ビューのインデックスを取り出します。 |
protected abstract boolean |
isAfter(int x,
int y,
Rectangle alloc)
ある点が、矩形範囲の後にあるかどうかを判定します。 |
protected abstract boolean |
isBefore(int x,
int y,
Rectangle alloc)
ある点が、矩形範囲の前にあるかどうかを判定します。 |
protected void |
loadChildren(ViewFactory f)
ビューを初期化するためにすべての子をロードします。 |
Shape |
modelToView(int p0,
Position.Bias b0,
int p1,
Position.Bias b1,
Shape a)
ドキュメントモデルの座標空間からビューの座標空間へのマッピングを提供します。 |
Shape |
modelToView(int pos,
Shape a,
Position.Bias b)
ドキュメントモデルの座標空間からビューの座標空間へのマッピングを提供します。 |
void |
replace(int offset,
int length,
View[] views)
子ビューを置換します。 |
protected void |
setInsets(short top,
short left,
short bottom,
short right)
ビューのインセットを設定します。 |
protected void |
setParagraphInsets(AttributeSet attr)
指定された属性から選ばれた段落属性から、インセットを設定します。 |
void |
setParent(View parent)
ビューの親を設定します。 |
int |
viewToModel(float x,
float y,
Shape a,
Position.Bias[] bias)
ビューの座標空間からモデルの論理座標空間へのマッピングを提供します。 |
| クラス java.lang.Object から継承されたメソッド |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| コンストラクタの詳細 |
|---|
public CompositeView(Element elem)
CompositeView を構築します。
elem - このビューが扱う要素| メソッドの詳細 |
|---|
protected void loadChildren(ViewFactory f)
setParent(javax.swing.text.View) メソッドによって呼び出されます。サブクラスは、このメソッドを再実装して別の方法で子ビューを初期化できます。デフォルトの実装は、子要素ごとに子ビューを作成します。
f - ビューファクトリsetParent(javax.swing.text.View)public void setParent(View parent)
loadChildren メソッドの呼び出しとともにスーパークラスの動作を提供するために実装し直されます。子をコンストラクタの中にロードしないようにしてください。これは、親を設定する動作が原因となって、たとえば収容側 Container を取得するために、子が階層をさかのぼって検索しようとするからです。このビューが子を持つ場合は、ビュー階層内のある位置から別の位置へ移動しているので、loadChildren メソッドは呼び出されません。
View 内の setParentparent - ビューの親。ない場合は nullpublic int getViewCount()
View 内の getViewCountgetView(int)public View getView(int n)
View 内の getViewn - 目的のビューの番号 >= 0 && < getViewCount()
n のビュー
public void replace(int offset,
int length,
View[] views)
null に設定された親を持ち、削除されるビューの内部参照をしているので、ガベージとして回収できます。
View 内の replaceoffset - 新規ビューを挿入するための、子ビューの開始インデックス。0 以上で、getViewCount 以下length - 削除する現在の子ビューの数。この値は 0 以上で、(getViewCount() - offset) 以下views - 追加する子ビュー。追加する子 (削除しやすい) がないことを示す場合は、null の可能性もある
public Shape getChildAllocation(int index,
Shape a)
View 内の getChildAllocationindex - 子のインデックス >= 0 && < getViewCount()a - このビューに対する割り当て
public Shape modelToView(int pos,
Shape a,
Position.Bias b)
throws BadLocationException
View 内の modelToViewpos - 変換対象の位置 >= 0a - 描画のために割り当てられた領域b - Position.Bias.Forward または Position.Bias.Backward のバイアス値
BadLocationException - 指定された位置が、関連するドキュメント内の有効な位置を表さない場合View.modelToView(int, java.awt.Shape, javax.swing.text.Position.Bias)
public Shape modelToView(int p0,
Position.Bias b0,
int p1,
Position.Bias b1,
Shape a)
throws BadLocationException
View 内の modelToViewp0 - 変換対象の位置 >= 0b0 - 位置が 2 つのビューの境界である場合に、p0 によって表される直前の文字または次の文字へのバイアス。Position.Bias.Forward または Position.Bias.Backwardp1 - 変換対象の位置 >= 0b1 - 位置が 2 つのビューの境界である場合に、p1 によって表される直前の文字または次の文字へのバイアスa - 描画のために割り当てられた領域
BadLocationException - 指定された位置が、関連するドキュメント内の有効な位置を表さない場合
IllegalArgumentException - bias 引数が無効な場合View.viewToModel(float, float, java.awt.Shape, javax.swing.text.Position.Bias[])
public int viewToModel(float x,
float y,
Shape a,
Position.Bias[] bias)
View 内の viewToModelx - 変換するビュー位置の x 座標 >= 0y - 変換するビュー位置の y 座標 >= 0a - 描画のために割り当てられた領域bias - Position.Bias.Forward または Position.Bias.Backward
View.viewToModel(float, float, java.awt.Shape, javax.swing.text.Position.Bias[])
public int getNextVisualPositionFrom(int pos,
Position.Bias b,
Shape a,
int direction,
Position.Bias[] biasRet)
throws BadLocationException
getNextNorthSouthVisualPositionFrom(int, javax.swing.text.Position.Bias, java.awt.Shape, int, javax.swing.text.Position.Bias[]) や getNextEastWestVisualPositionFrom(int, javax.swing.text.Position.Bias, java.awt.Shape, int, javax.swing.text.Position.Bias[]) の簡易メソッドです。
View 内の getNextVisualPositionFrompos - 変換対象の位置 >= 0b - Position.Bias.Forward または Position.Bias.Backward のバイアス値a - 描画のために割り当てられた領域direction - 現在位置からの方向。これは、キーボードに通常存在する矢印キーと見なすことができ、 次のどれかになるSwingConstants.WEST SwingConstants.EAST SwingConstants.NORTH SwingConstants.SOUTH biasRet - チェックされたバイアスを含む配列
BadLocationException - @exception IllegalArgumentException direction が無効な場合
public int getViewIndex(int pos,
Position.Bias b)
getViewIndexByPosition メソッドを呼び出すためにこのメソッドを実装しています。
View 内の getViewIndexpos - 位置 >= 0
protected abstract boolean isBefore(int x,
int y,
Rectangle alloc)
x - X 座標 >= 0y - Y 座標 >= 0alloc - 矩形
protected abstract boolean isAfter(int x,
int y,
Rectangle alloc)
x - X 座標 >= 0y - Y 座標 >= 0alloc - 矩形
protected abstract View getViewAtPoint(int x,
int y,
Rectangle alloc)
x - X 座標 >= 0y - Y 座標 >= 0alloc - 入り口での親の割り当て。出口では、子への割り当てに変更される
protected abstract void childAllocation(int index,
Rectangle a)
index - 子のインデックス >= 0 && < getViewCount()a - 入り口での、ボックスの内部への割り当て。および、出口での、子ビューへの割り当て
protected View getViewAtPosition(int pos,
Rectangle a)
pos - 位置 >= 0a - 入り口での、ボックスの内部への割り当て。および、出口での、割り当てられた位置を含むビューへの割り当て
nullprotected int getViewIndexAtPosition(int pos)
pos - 位置 >= 0
protected Rectangle getInsideAllocation(Shape a)
childAllocation メソッドに送られます。
a - ビューに指定された割り当て
null であれば、戻り値も nullprotected void setParagraphInsets(AttributeSet attr)
attr - 属性
protected void setInsets(short top,
short left,
short bottom,
short right)
top - 上のインセット >= 0left - 左のインセット >= 0bottom - 下のインセット >= 0right - 右のインセット >= 0protected short getLeftInset()
protected short getRightInset()
protected short getTopInset()
protected short getBottomInset()
protected int getNextNorthSouthVisualPositionFrom(int pos,
Position.Bias b,
Shape a,
int direction,
Position.Bias[] biasRet)
throws BadLocationException
pos - 変換対象の位置 >= 0b - Position.Bias.Forward または Position.Bias.Backward のバイアス値a - 描画のために割り当てられた領域direction - 現在位置からの方向。これは、キーボードに通常存在する矢印キーと見なすことができ、 次のどれかになるSwingConstants.NORTH SwingConstants.SOUTH biasRet - チェックされたバイアスを含む配列
BadLocationException - @exception IllegalArgumentException direction が無効な場合getNextVisualPositionFrom(int, javax.swing.text.Position.Bias, java.awt.Shape, int, javax.swing.text.Position.Bias[])
protected int getNextEastWestVisualPositionFrom(int pos,
Position.Bias b,
Shape a,
int direction,
Position.Bias[] biasRet)
throws BadLocationException
pos - 変換対象の位置 >= 0b - Position.Bias.Forward または Position.Bias.Backward のバイアス値a - 描画のために割り当てられた領域direction - 現在位置からの方向。これは、キーボードに通常存在する矢印キーと見なすことができ、 次のどれかになるSwingConstants.WEST SwingConstants.EAST biasRet - チェックされたバイアスを含む配列
BadLocationException - @exception IllegalArgumentException direction が無効な場合getNextVisualPositionFrom(int, javax.swing.text.Position.Bias, java.awt.Shape, int, javax.swing.text.Position.Bias[])
protected boolean flipEastAndWestAtEnds(int position,
Position.Bias bias)
View が考慮されます。通常は、EAST への View がインデックス n + 1、WEST への View がインデックス n -1 となるように、View は左から右へレイアウトされます。双方向テキストなど一部の場合では、EAST への View をインデックス n + 1 ではなくインデックス n -1 に、または WEST への View をインデックス n - 1 ではなくインデックス n + 1 にすることもできます。この場合、このメソッドは true を返し、View が降順にレイアウトされていることを示します。
ここでは無条件に false が返されます。View を降順に配置する可能性がある場合、サブクラスはこのメソッドをオーバーライドします。
position - モデルへの位置bias - Position.Bias.Forward または Position.Bias.Backward
|
JavaTM 2 Platform Standard Ed. 5.0 |
|||||||||
| 前のクラス 次のクラス | フレームあり フレームなし | |||||||||
| 概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド | |||||||||
Copyright 2004 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Documentation Redistribution Policy も参照してください。