public class BoxView extends CompositeView
各軸のレイアウトは、layoutMajorAxisメソッドとlayoutMinorAxisメソッドとで別々に処理されます。サブクラスは、これらのメソッドをもう一度実装することで、レイアウト・アルゴリズムを変更します。これらのメソッドは、キャッシュされたレイアウト情報があるかどうか、またキャッシュが有効であるかどうかによって、必要に応じて呼び出されます。通常、軸に沿った指定サイズが変更される場合や、layoutChangedが呼び出されてレイアウトが強制的に変更される場合に、これらのメソッドが呼び出されます。キャッシュされたレイアウト情報がある場合は、layoutChangedメソッドで無効にされます。親ビューに通知された要件は、calculateMajorAxisRequirementsメソッドやcalculateMinorAxisRequirementsメソッドで計算されます。レイアウト・アルゴリズムが変更された場合、これらのメソッドは再度実装される必要があります。
BadBreakWeight, 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| 修飾子と型 | メソッドと説明 |
|---|---|
protected void |
baselineLayout(int targetSpan, int axis, int[] offsets, int[] spans)
使用する領域の幅(または高さ)である
targetSpanを指定したBoxViewにおける、各子ビューの位置とエクステントを計算します。 |
protected SizeRequirements |
baselineRequirements(int axis, SizeRequirements r)
各子ビューのサイズを調べて、この
BoxViewのサイズ要件を計算します。 |
protected SizeRequirements |
calculateMajorAxisRequirements(int axis, SizeRequirements r)
主軸
axisのサイズ要件を計算します。 |
protected SizeRequirements |
calculateMinorAxisRequirements(int axis, SizeRequirements r)
副軸
axisのサイズ要件を計算します。 |
protected void |
childAllocation(int index, Rectangle alloc)
子ビューに領域を割り当てます。
|
protected boolean |
flipEastAndWestAtEnds(int position, Position.Bias bias)
次のビューをどの方向に配置するかを決定します。
|
protected void |
forwardUpdate(DocumentEvent.ElementChange ec, DocumentEvent e, Shape a, ViewFactory f)
指定された
DocumentEventを、モデルへの変更について通知する必要のある子ビューに転送します。 |
float |
getAlignment(int axis)
軸に沿ったこのビューの望ましいレイアウトを決定します。
|
int |
getAxis()
タイル軸のプロパティを取得します。
|
Shape |
getChildAllocation(int index, Shape a)
指定された子ビューの割り当てを取得します。
|
int |
getHeight()
ボックスの現在の高さを返します。
|
float |
getMaximumSpan(int axis)
このビューの最大スパンを軸に沿って指定します。
|
float |
getMinimumSpan(int axis)
このビューの最小スパンを軸に沿って指定します。
|
protected int |
getOffset(int axis, int childIndex)
特定の子について、現在のレイアウトのオフセットを取得します。
|
float |
getPreferredSpan(int axis)
このビューに適切なスパンを軸に沿って指定します。
|
int |
getResizeWeight(int axis)
サイズ変更のウエイトを取得します。
|
protected int |
getSpan(int axis, int childIndex)
特定の子について、現在のレイアウトのスパンを取得します。
|
protected View |
getViewAtPoint(int x, int y, Rectangle alloc)
指定された座標の子ビューを取得します。
|
int |
getWidth()
ボックスの現在の幅を返します。
|
protected boolean |
isAfter(int x, int y, Rectangle innerAlloc)
ある点が、割り当てられた領域のあとにあるかどうかを判定します。
|
protected boolean |
isAllocationValid()
子への割当てが現在も有効かどうかを判定します。
|
protected boolean |
isBefore(int x, int y, Rectangle innerAlloc)
ある点が、割り当てられた領域の前にあるかどうかを判定します。
|
protected boolean |
isLayoutValid(int axis)
指定された軸に沿ってレイアウトが有効かどうかを決定します。
|
protected void |
layout(int width, int height)
ボックスのレイアウトを実行します。
|
void |
layoutChanged(int axis)
軸に沿ったレイアウトを無効にします。
|
protected void |
layoutMajorAxis(int targetSpan, int axis, int[] offsets, int[] spans)
ボックスの主軸をレイアウトします。
|
protected void |
layoutMinorAxis(int targetSpan, int axis, int[] offsets, int[] spans)
ボックスの副軸をレイアウトします。
|
Shape |
modelToView(int pos, Shape a, Position.Bias b)
ドキュメント・モデルの座標空間からビューの座標空間へのマッピングを提供します。
|
void |
paint(Graphics g, Shape allocation)
特定のレンダリング表面とその表面上の領域を使用して
BoxViewをレンダリングします。 |
protected void |
paintChild(Graphics g, Rectangle alloc, int index)
子をペイントします。
|
void |
preferenceChanged(View child, boolean width, boolean height)
子に呼び出され、そのスパンの設定が変更されたことを示します。
|
void |
replace(int index, int length, View[] elems)
レイアウトを無効にして、要求または割当てのキャッシュのサイズを変更します。
|
void |
setAxis(int axis)
タイル軸のプロパティを設定します。
|
void |
setSize(float width, float height)
ビューのサイズを設定します。
|
int |
viewToModel(float x, float y, Shape a, Position.Bias[] bias)
ビューの座標空間からモデルの論理座標空間へのマッピングを提供します。
|
getBottomInset, getInsideAllocation, getLeftInset, getNextEastWestVisualPositionFrom, getNextNorthSouthVisualPositionFrom, getNextVisualPositionFrom, getRightInset, getTopInset, getView, getViewAtPosition, getViewCount, getViewIndex, getViewIndexAtPosition, loadChildren, modelToView, setInsets, setParagraphInsets, setParentappend, breakView, changedUpdate, createFragment, forwardUpdateToView, getAttributes, getBreakWeight, getContainer, getDocument, getElement, getEndOffset, getGraphics, getParent, getStartOffset, getToolTipText, getViewFactory, getViewIndex, insert, insertUpdate, isVisible, modelToView, remove, removeAll, removeUpdate, updateChildren, updateLayout, viewToModelpublic BoxView(Element elem, int axis)
BoxViewを構築します。elem - このビューが扱う要素axis - View.X_AXISまたはView.Y_AXISpublic int getAxis()
View.X_AXISまたはView.Y_AXISpublic void setAxis(int axis)
axis - View.X_AXISまたはView.Y_AXISpublic void layoutChanged(int axis)
setSizeメソッドが次回このビューに呼び出されたときに更新されます。axis - View.X_AXISまたはView.Y_AXISprotected boolean isLayoutValid(int axis)
axis - View.X_AXISまたはView.Y_AXISprotected void paintChild(Graphics g, Rectangle alloc, int index)
g - グラフィックス・コンテキストalloc - ペイントのために割り当てられた領域index - 子のインデックス。0以上でgetViewCount()より小さい値public void replace(int index,
int length,
View[] elems)
replace、クラス: CompositeViewindex - 新規ビューを挿入するための、子ビューの開始インデックス。この値は0以上で、getViewCount以下length - 削除する既存の子ビューの数。この値は0以上で、(getViewCount() - offset)以下elems - 追加する子ビュー。追加される子がない場合は、nullも可(削除に便利)protected void forwardUpdate(DocumentEvent.ElementChange ec, DocumentEvent e, Shape a, ViewFactory f)
DocumentEventを、モデルへの変更について通知する必要のある子ビューに転送します。先頭の子のボックスの部分をボックスの最後に転送する前に、子がその要件を変更しており、割当てが有効であった場合、再ペイントされます。forwardUpdate、クラス: Viewec - このビューが扱う要素への変更。変更がなかった場合、nullになる可能性があるe - 関連するドキュメントからの変更情報a - ビューの現在の割当てf - ビューが子を持つ場合に再構築に使用するファクトリView.insertUpdate(javax.swing.event.DocumentEvent, java.awt.Shape, javax.swing.text.ViewFactory), View.removeUpdate(javax.swing.event.DocumentEvent, java.awt.Shape, javax.swing.text.ViewFactory), View.changedUpdate(javax.swing.event.DocumentEvent, java.awt.Shape, javax.swing.text.ViewFactory)public void preferenceChanged(View child, boolean width, boolean height)
preferenceChanged、クラス: Viewchild - 子ビューwidth - 幅の設定が変更された場合にtrueheight - 高さの設定が変更された場合にtrueJComponent.revalidate()public int getResizeWeight(int axis)
getResizeWeight、クラス: Viewaxis - View.X_AXISまたはView.Y_AXISIllegalArgumentException - 軸が無効な場合public void setSize(float width,
float height)
public void paint(Graphics g, Shape allocation)
BoxViewをレンダリングします。指定されたGraphicsのクリップ境界を交差する子だけが描画されます。paint、クラス: Viewg - 使用する描画表面allocation - 描画するために割り当てられた領域View.paint(java.awt.Graphics, java.awt.Shape)public Shape getChildAllocation(int index, Shape a)
nullを返すために実装し、そうでない場合はスーパー・クラスが実行されます。getChildAllocation、クラス: CompositeViewindex - 子のインデックス。0以上でgetViewCount()より小さい値a - このビューに対する割当てaがnullの場合はnull。レイアウトが無効の場合もnullpublic Shape modelToView(int pos, Shape a, Position.Bias b) throws BadLocationException
modelToView、クラス: CompositeViewpos - 変換対象の位置>= 0a - 描画するために割り当てられた領域b - Position.Bias.ForwardまたはPosition.Bias.Backwardのバイアス値BadLocationException - 指定された位置が、関連するドキュメント内の有効な位置を示さない場合View.modelToView(int, java.awt.Shape, javax.swing.text.Position.Bias)public int viewToModel(float x,
float y,
Shape a,
Position.Bias[] bias)
viewToModel、クラス: CompositeViewx - 変換するビュー位置のx座標>= 0y - 変換するビュー位置のy座標>= 0a - 描画するために割り当てられた領域bias - Position.Bias.ForwardまたはPosition.Bias.BackwardView.viewToModel(float, float, java.awt.Shape, javax.swing.text.Position.Bias[])public float getAlignment(int axis)
getAlignment、クラス: Viewaxis - View.X_AXISまたはView.Y_AXISIllegalArgumentException - 軸が無効な場合public float getPreferredSpan(int axis)
getPreferredSpan、クラス: Viewaxis - View.X_AXISまたはView.Y_AXISIllegalArgumentException - 軸が無効な型View.getPreferredSpan(int)public float getMinimumSpan(int axis)
getMinimumSpan、クラス: Viewaxis - View.X_AXISまたはView.Y_AXISIllegalArgumentException - 軸が無効な型View.getPreferredSpan(int)public float getMaximumSpan(int axis)
getMaximumSpan、クラス: Viewaxis - View.X_AXISまたはView.Y_AXISIllegalArgumentException - 軸が無効な型View.getPreferredSpan(int)protected boolean isAllocationValid()
protected boolean isBefore(int x,
int y,
Rectangle innerAlloc)
isBefore、クラス: CompositeViewx - X座標>= 0y - Y座標>= 0innerAlloc - 割り当てられた領域。インセットの内側の領域protected boolean isAfter(int x,
int y,
Rectangle innerAlloc)
isAfter、クラス: CompositeViewx - X座標>= 0y - Y座標>= 0innerAlloc - 割り当てられた領域。インセットの内側の領域protected View getViewAtPoint(int x, int y, Rectangle alloc)
getViewAtPoint、クラス: CompositeViewx - X座標>= 0y - Y座標>= 0alloc - 入口では親の内部割当て。出口で子の割当てに変更protected void childAllocation(int index,
Rectangle alloc)
childAllocation、クラス: CompositeViewindex - 割り当てる子ビューのインデックス。0以上でgetViewCount()より小さい値alloc - 割り当てられる領域protected void layout(int width,
int height)
width - 幅(インセット内)>= 0height - 高さ(インセット内)>= 0public int getWidth()
public int getHeight()
protected void layoutMajorAxis(int targetSpan,
int axis,
int[] offsets,
int[] spans)
targetSpan - ビューに指定されたスパンの合計。子をレイアウトするために使用されるaxis - レイアウトされる軸offsets - 各子ビューのビューの起点からのオフセット。これは戻り値であり、このメソッドの実装によって割り当てられるspans - 各子ビューのスパン。これは戻り値であり、このメソッドの実装によって割り当てられるprotected void layoutMinorAxis(int targetSpan,
int axis,
int[] offsets,
int[] spans)
targetSpan - ビューに指定されたスパンの合計。子をレイアウトするために使用されるaxis - レイアウトされる軸offsets - 各子ビューのビューの起点からのオフセット。これは戻り値であり、このメソッドの実装によって割り当てられるspans - 各子ビューのスパン。これは戻り値であり、このメソッドの実装によって割り当てられるprotected SizeRequirements calculateMajorAxisRequirements(int axis, SizeRequirements r)
axisのサイズ要件を計算します。axis - 調査中の軸r - SizeRequirementsオブジェクト。nullの場合、1つ作成されるSizeRequirementsオブジェクトSizeRequirementsprotected SizeRequirements calculateMinorAxisRequirements(int axis, SizeRequirements r)
axisのサイズ要件を計算します。axis - 調査中の軸r - SizeRequirementsオブジェクト。nullの場合、1つ作成されるSizeRequirementsオブジェクトSizeRequirementsprotected void baselineLayout(int targetSpan,
int axis,
int[] offsets,
int[] spans)
targetSpanを指定したBoxViewにおける、各子ビューの位置とエクステントを計算します。targetSpan - ビューに指定されたスパンの合計。子をレイアウトするために使用されるaxis - 調査中の軸。View.X_AXISまたはView.Y_AXISoffsets - 空の配列。このメソッドによって各子ビューの位置を指定する値が割り当てられるspans - 空の配列。このメソッドによって各子ビューのエクステントを指定する値が割り当てられるprotected SizeRequirements baselineRequirements(int axis, SizeRequirements r)
BoxViewのサイズ要件を計算します。axis - 調査中の軸r - SizeRequirementsオブジェクト。nullの場合、1つ作成されるSizeRequirementsオブジェクトprotected int getOffset(int axis,
int childIndex)
axis - 調査中の軸childIndex - 要求された子のインデックスprotected int getSpan(int axis,
int childIndex)
axis - 調査中の軸childIndex - 要求された子のインデックスprotected boolean flipEastAndWestAtEnds(int position,
Position.Bias bias)
Viewがインデックスn+1、WESTへのViewがインデックスn -1となるように、Viewは左から右へレイアウトされます。双方向テキストなど一部の場合では、EASTへのViewをインデックスn+1ではなくインデックスn -1に、またはWESTへのViewをインデックスn - 1ではなくインデックスn+1にすることもできます。この場合、このメソッドはtrueを返し、Viewが降順にレイアウトされていることを示します。そうでない場合はfalseを返し、Viewが昇順にレイアウトされていることを示します。
レシーバがY_AXISに沿ってViewを配置している場合、positionとbiasの描画を行うView上で同じメソッドを呼び出すことで値を返します。そうでない場合は、falseを返します。
flipEastAndWestAtEnds、クラス: CompositeViewposition - モデルへの位置bias - Position.Bias.ForwardまたはPosition.Bias.Backwardpositionやbiasの描画を行うViewの周りにあるViewが降順にレイアウトされている場合はtrue。そうでない場合はfalse バグまたは機能を送信
詳細なAPIリファレンスおよび開発者ドキュメントについては、Java SEのドキュメントを参照してください。そのドキュメントには、概念的な概要、用語の定義、回避方法、有効なコード例などの、開発者を対象にしたより詳細な説明が含まれています。
Copyright© 1993, 2014, Oracle and/or its affiliates. All rights reserved.