public class ParagraphView extends FlowView implements TabExpander
breakView メソッドが呼び出されて各行に分割して収めるように試みられます。ViewFlowView.FlowStrategy| 修飾子と型 | フィールドと説明 |
|---|---|
protected int |
firstLineIndent
左側からのインセットによる先頭行のインデントです。
|
layoutPool, layoutSpan, strategyBadBreakWeight, ExcellentBreakWeight, ForcedBreakWeight, GoodBreakWeight, X_AXIS, Y_AXISBOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST| コンストラクタと説明 |
|---|
ParagraphView(Element elem)
指定された要素の
ParagraphView を構築します。 |
| 修飾子と型 | メソッドと説明 |
|---|---|
View |
breakView(int axis, float len, Shape a)
指定された軸および指定された長さでこのビューを分割します。
|
protected SizeRequirements |
calculateMinorAxisRequirements(int axis, SizeRequirements r)
短軸方向に沿った段落に対する必要量を計算します。
|
void |
changedUpdate(DocumentEvent changes, Shape a, ViewFactory f)
このビューが扱う位置で属性が変更されたことをドキュメントから通知します。
|
protected View |
createRow()
フローの子に相当する行を保持するために使用する
View を作成します。 |
protected int |
findOffsetToCharactersInString(char[] string, int start)
ドキュメント内の次の文字を
string 内の任意の文字を使って検索します。検索はオフセット start から開始します。 |
protected boolean |
flipEastAndWestAtEnds(int position, Position.Bias bias)
次のビューをどの方向に配置するかを決定します。
|
float |
getAlignment(int axis)
軸に沿ったこのビューの望ましいレイアウトを決定します。
|
int |
getBreakWeight(int axis, float len)
指定された位置のブレークウェイトを取得します。
|
protected int |
getClosestPositionTo(int pos, Position.Bias b, Shape a, int direction, Position.Bias[] biasRet, int rowIndex, int x)
x にもっとも近接したモデル内の位置を返します。 |
int |
getFlowSpan(int index)
指定された子のインデックスに反してフローする制約スパンを取得します。
|
int |
getFlowStart(int index)
フロースパンを開始する、フロー軸に沿った位置を取得します。
|
protected View |
getLayoutView(int index)
指定された
index のビューを返します。 |
protected int |
getLayoutViewCount()
このビューが扱うビューの数を返します。
|
protected int |
getNextNorthSouthVisualPositionFrom(int pos, Position.Bias b, Shape a, int direction, Position.Bias[] biasRet)
カーソルを置くことのできる、次の視覚的な位置を返します。方向は右 (east) または左 (west) になります。
|
protected float |
getPartialSize(int startOffset, int endOffset)
startOffset と endOffset の間のビューが使うサイズを返します。 |
protected float |
getTabBase()
タブ計算の開始位置を返します。
|
protected TabSet |
getTabSet()
タブの計算で使う
Tabset を取得します。 |
float |
nextTabStop(float x, int tabOffset)
指定された参照位置より後ろの次のタブストップ位置を返します。
|
void |
paint(Graphics g, Shape a)
指定されたレンダリング表面およびその表面上の領域を使ってレンダリングします。
|
protected void |
setFirstLineIndent(float fi)
先頭行のインデントを設定します。
|
protected void |
setJustification(int j)
位置揃えの形式を設定します。
|
protected void |
setLineSpacing(float ls)
行間隔を設定します。
|
protected void |
setPropertiesFromAttributes()
属性から、キャッシュに書き込まれるプロパティーを設定します。
|
getFlowAxis, getViewIndexAtPosition, insertUpdate, layout, loadChildren, removeUpdate, setParentbaselineLayout, baselineRequirements, calculateMajorAxisRequirements, childAllocation, forwardUpdate, getAxis, getChildAllocation, getHeight, getMaximumSpan, getMinimumSpan, getOffset, getPreferredSpan, getResizeWeight, getSpan, getViewAtPoint, getWidth, isAfter, isAllocationValid, isBefore, isLayoutValid, layoutChanged, layoutMajorAxis, layoutMinorAxis, modelToView, paintChild, preferenceChanged, replace, setAxis, setSize, viewToModelgetBottomInset, getInsideAllocation, getLeftInset, getNextEastWestVisualPositionFrom, getNextVisualPositionFrom, getRightInset, getTopInset, getView, getViewAtPosition, getViewCount, getViewIndex, modelToView, setInsets, setParagraphInsetsappend, breakView, createFragment, forwardUpdateToView, getAttributes, getBreakWeight, getContainer, getDocument, getElement, getEndOffset, getGraphics, getParent, getStartOffset, getToolTipText, getViewFactory, getViewIndex, insert, isVisible, modelToView, remove, removeAll, updateChildren, updateLayout, viewToModelpublic ParagraphView(Element elem)
ParagraphView を構築します。elem - このビューが扱う要素protected void setJustification(int j)
j - 次の値のいずれか。
StyleConstants.ALIGN_LEFT
StyleConstants.ALIGN_CENTER
StyleConstants.ALIGN_RIGHT
protected void setLineSpacing(float ls)
ls - 値は、行の高さの係数protected void setFirstLineIndent(float fi)
fi - ポイント単位の値protected void setPropertiesFromAttributes()
protected int getLayoutViewCount()
View の各部分を配列するために使用されたいくつかの行です。これは、2 次元に並べられたビューの数で、このビューが扱う要素の子要素の数に等しくなります。ParagraphView が扱うビューの数protected View getLayoutView(int index)
index のビューを返します。段落の子ビューは、子要素を表す Views の各部分を配列するために使用されたいくつかの行です。このメソッドは、子要素インデックスを扱うビューを (分割前に) 返します。これらは、ファクトリから (子要素を表すために) 作成され、レイアウトに使用されるビューです。index - 要求するビューの indexindex のビューprotected int getNextNorthSouthVisualPositionFrom(int pos,
Position.Bias b,
Shape a,
int direction,
Position.Bias[] biasRet)
throws BadLocationException
CompositeView からオーバーライドされます。getNextNorthSouthVisualPositionFrom、クラス: CompositeViewpos - モデルへの位置b - Position.Bias.Forward または Position.Bias.Backwarda - 描画するために割り当てられた領域direction - SwingConstants.NORTH または SwingConstants.SOUTHbiasRet - このメソッドで確認されるバイアスを持つ配列BadLocationExceptionCompositeView.getNextVisualPositionFrom(int, javax.swing.text.Position.Bias, java.awt.Shape, int, javax.swing.text.Position.Bias[])protected int getClosestPositionTo(int pos,
Position.Bias b,
Shape a,
int direction,
Position.Bias[] biasRet,
int rowIndex,
int x)
throws BadLocationException
x にもっとも近接したモデル内の位置を返します。rowIndex は、検索対象のビューのインデックスを指定します。pos - モデルへの位置a - 描画するために割り当てられた領域direction - 次の値のいずれか。
SwingConstants.NORTH
SwingConstants.SOUTH
biasRet - このメソッドで確認されるバイアスを持つ配列rowIndex - ビューのインデックスx - 対象となる x 座標x にもっとも近いモデル位置BadLocationExceptionprotected 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 が降順にレイアウトされていることを示します。
テキストが右から左へレイアウトされている場合は true を返し、そうでない場合 false を返します。
flipEastAndWestAtEnds、クラス: BoxViewposition - モデルへの位置bias - Position.Bias.Forward または Position.Bias.Backwardpublic int getFlowSpan(int index)
getFlowSpan、クラス: FlowViewindex - 照会されるビューのインデックスindex で指定されたビューの制約スパンFlowView.getFlowStart(int)public int getFlowStart(int index)
getFlowStart、クラス: FlowViewindex - 照会されるビューのインデックスindex で指定されたビューの位置FlowView.getFlowSpan(int)protected View createRow()
View を作成します。public float nextTabStop(float x,
int tabOffset)
getTabbedSpan を呼び出して子ビューの望ましいスパンを決定します。論理子ビューは、タブの展開方法を認識している段落に対してそのタブ展開を委譲します。そのタブ展開の必要性を段落に委譲するビューには、LabelView などがあります。
このメソッドを実装すると、段落要素の属性セットで TabSet を見つけようとします。1 つ見つかるとその設定が使われ、それ以外の場合にはデフォルトの展開が提供されます。タブ展開のベース位置は、段落のもっとも近い割り当てからの左インセット (子の配置の基準) です。
nextTabStop、インタフェース: TabExpanderx - X 参照位置tabOffset - タブが発生するテキストストリーム内の位置 >= 0TabSet, TabStop, LabelViewprotected TabSet getTabSet()
Tabset を取得します。TabSetprotected float getPartialSize(int startOffset,
int endOffset)
startOffset と endOffset の間のビューが使うサイズを返します。子ビューが TabableView インタフェースを実装する場合に、これは getPartialView を使ってサイズを計算します。サイズが必要で、View が TabableView インタフェースを実装しない場合は、preferredSpan が使われます。startOffset - ドキュメントの開始オフセット >= 0endOffset - ドキュメントの終了オフセット >= startOffsetprotected int findOffsetToCharactersInString(char[] string,
int start)
string 内の任意の文字を使って検索します。検索はオフセット start から開始します。どの文字も見つからない場合は、-1 が返されます。string - 文字列start - モデル内の開始位置 >= 0protected float getTabBase()
public void paint(Graphics g, Shape a)
paint、クラス: BoxViewg - 使用する描画表面a - 描画するために割り当てられた領域View.paint(java.awt.Graphics, java.awt.Shape)public float getAlignment(int axis)
getAlignment、クラス: BoxViewaxis - View.X_AXIS または View.Y_AXISpublic View breakView(int axis, float len, Shape a)
ParagraphView インスタンスは、len が最初の行より後ろにある場合にのみ、Y_AXIS だけに沿って分割可能です。
axis - View.X_AXIS または View.Y_AXISlen - 指定された軸に沿って分割する位置 >= 0a - ビューの現在の割り当てView.breakView(int, int, float, float)public int getBreakWeight(int axis,
float len)
ParagraphView インスタンスは、len が最初の列より後ろにある場合にのみ、Y_AXIS だけに沿って分割可能です。長さが 1 列より短い場合、BadBreakWeight の値が返されます。
axis - View.X_AXIS または View.Y_AXISlen - 分割する位置 >= 0GoodBreakWeight または BadBreakWeight のどれかView.getBreakWeight(int, float, float)protected SizeRequirements calculateMinorAxisRequirements(int axis, SizeRequirements r)
これはスーパークラスのサイズ要件を使用し、隣接するビューの輪郭の分割できない領域を考慮して変更します。それらのビューについての最小のサイズ要件は、隣接フラグメントの合計以上にする必要があります。
axis パラメータが View.X_AXIS でも View.Y_AXIS でもない場合、IllegalArgumentException がスローされます。r パラメータが null の場合、新規 SizeRequirements オブジェクトが作成され、それ以外の場合は指定された SizeRequirements オブジェクトが返されます。
calculateMinorAxisRequirements、クラス: FlowViewaxis - 副軸r - 入力 SizeRequirements オブジェクトSizeRequirements オブジェクトIllegalArgumentException - axis パラメータが無効の場合SizeRequirementspublic void changedUpdate(DocumentEvent changes, Shape a, ViewFactory f)
changedUpdate、クラス: FlowViewchanges - 関連するドキュメントからの変更情報a - ビューの現在の割り当てf - ビューが子を持つ場合に再構築に使用するファクトリView.changedUpdate(javax.swing.event.DocumentEvent, java.awt.Shape, javax.swing.text.ViewFactory) バグまたは機能を送信
詳細な API リファレンスおよび開発者ドキュメントについては、Java SE のドキュメントを参照してください。そのドキュメントには、概念的な概要、用語の定義、回避方法、有効なコード例などの、開発者を対象にしたより詳細な説明が含まれています。
Copyright © 1993, 2013, Oracle and/or its affiliates. All rights reserved.