| 
 | JavaTM Platform Standard Ed. 6 | |||||||||
| 前のクラス 次のクラス | フレームあり フレームなし | |||||||||
| 概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド | |||||||||
java.lang.Objectjavax.swing.text.View
javax.swing.text.CompositeView
javax.swing.text.BoxView
public class BoxView
ビューは、ビューの子を軸に沿ってタイリングすることで、1 つのボックスの形状に配置します。このボックスは、子の配列をするところでは子の柔軟性も考慮されるという点で、TeX に用意されているボックスと似ています。したがって、行、段落、リスト項目、列、ページなどのコレクションを表示するのに便利な基本単位です。子のタイリングが行われる軸は、主軸とみなされます。これに直角の軸は、副軸です。
各軸のレイアウトは、layoutMajorAxis メソッドと layoutMinorAxis メソッドとで別々に処理されます。サブクラスは、これらのメソッドをもう一度実装することで、レイアウトアルゴリズムを変更します。これらのメソッドは、キャッシュされたレイアウト情報があるかどうか、またキャッシュが有効であるかどうかによって、必要に応じて呼び出されます。通常、軸に沿った指定サイズが変更される場合や、layoutChanged が呼び出されてレイアウトが強制的に変更される場合に、これらのメソッドが呼び出されます。キャッシュされたレイアウト情報がある場合は、layoutChanged メソッドで無効にされます。親ビューに通知された要件は、calculateMajorAxisRequirements メソッドや calculateMinorAxisRequirements メソッドで計算されます。レイアウトアルゴリズムが変更された場合、これらのメソッドは再度実装される必要があります。
| フィールドの概要 | 
|---|
| クラス 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 | 
| コンストラクタの概要 | |
|---|---|
| BoxView(Element elem,
        int axis)BoxViewを構築します。 | |
| メソッドの概要 | |
|---|---|
| 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)ビューの座標空間からモデルの論理座標空間へのマッピングを提供します。 | 
| クラス javax.swing.text.View から継承されたメソッド | 
|---|
| append, 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, viewToModel | 
| クラス java.lang.Object から継承されたメソッド | 
|---|
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| コンストラクタの詳細 | 
|---|
public BoxView(Element elem,
               int axis)
BoxView を構築します。
elem - このビューが扱う要素axis - View.X_AXIS または View.Y_AXIS| メソッドの詳細 | 
|---|
public int getAxis()
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_AXIS
protected void paintChild(Graphics g,
                          Rectangle alloc,
                          int index)
g - グラフィックスコンテキストalloc - ペイントのために割り当てられた領域index - 子のインデックス >= 0 && < getViewCount()
public void replace(int index,
                    int length,
                    View[] elems)
CompositeView 内の replaceindex - 新規ビューを挿入するための、子ビューの開始インデックス。 この値は 0 以上で、getViewCount 以下length - 削除する既存の子ビューの数。 この値は 0 以上で、(getViewCount() - offset) 以下elems - 追加する子ビュー。 追加される子がない場合は、null も可 (削除に便利)
protected void forwardUpdate(DocumentEvent.ElementChange ec,
                             DocumentEvent e,
                             Shape a,
                             ViewFactory f)
DocumentEvent をモデルの変更通知が必要な子ビューに転送します。先頭の子のボックスの部分をボックスの最後に転送する前に、子がその要件を変更しており、割り当てが有効であった場合、再ペイントされます。
View 内の forwardUpdateec - このビューが扱う要素への変更。 変更がなかった場合、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)
View 内の preferenceChangedchild - 子ビューwidth - 幅の設定が変更された場合に trueheight - 高さの設定が変更された場合に trueJComponent.revalidate()public int getResizeWeight(int axis)
View 内の getResizeWeightaxis - View.X_AXIS または View.Y_AXIS
IllegalArgumentException - 軸が無効な場合
public void setSize(float width,
                    float height)
View 内の setSizewidth - 幅 >= 0height - 高さ >= 0
public void paint(Graphics g,
                  Shape allocation)
BoxView を描画します。指定された Graphics のクリップ境界を交差する子だけが描画されます。
View 内の paintg - 使用する描画表面allocation - 描画のために割り当てられた領域View.paint(java.awt.Graphics, java.awt.Shape)
public Shape getChildAllocation(int index,
                                Shape a)
null を返すために実装し、そうでない場合はスーパークラスが実行されます。
CompositeView 内の getChildAllocationindex - 子のインデックス >= 0  && < getViewCount()a - このビューに対する割り当て
 a が null の場合は null。 レイアウトが無効の場合も null
public Shape modelToView(int pos,
                         Shape a,
                         Position.Bias b)
                  throws BadLocationException
CompositeView 内の modelToViewpos - 変換対象の位置 >= 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)
CompositeView 内の 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 float getAlignment(int axis)
View 内の getAlignmentaxis - View.X_AXIS または View.Y_AXIS
IllegalArgumentException - 軸が無効な場合public float getPreferredSpan(int axis)
View 内の getPreferredSpanaxis - View.X_AXIS または View.Y_AXIS
IllegalArgumentException - 軸が無効な型View.getPreferredSpan(int)public float getMinimumSpan(int axis)
View 内の getMinimumSpanaxis - View.X_AXIS または View.Y_AXIS
IllegalArgumentException - 軸が無効な型View.getPreferredSpan(int)public float getMaximumSpan(int axis)
View 内の getMaximumSpanaxis - View.X_AXIS または View.Y_AXIS
IllegalArgumentException - 軸が無効な型View.getPreferredSpan(int)protected boolean isAllocationValid()
protected boolean isBefore(int x,
                           int y,
                           Rectangle innerAlloc)
CompositeView 内の isBeforex - X 座標 >= 0y - Y 座標 >= 0innerAlloc - 割り当てられた領域。 インセットの内側の領域
protected boolean isAfter(int x,
                          int y,
                          Rectangle innerAlloc)
CompositeView 内の isAfterx - X 座標 >= 0y - Y 座標 >= 0innerAlloc - 割り当てられた領域。 インセットの内側の領域
protected View getViewAtPoint(int x,
                              int y,
                              Rectangle alloc)
CompositeView 内の getViewAtPointx - X 座標 >= 0y - Y 座標 >= 0alloc - 入口では親の内部割り当て。 出口で子の割り当てに変更
protected void childAllocation(int index,
                               Rectangle alloc)
CompositeView 内の childAllocationindex - 割り当てる子ビューのインデックス。 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 オブジェクトSizeRequirements
protected SizeRequirements calculateMinorAxisRequirements(int axis,
                                                          SizeRequirements r)
axis のサイズ要件を計算します。
axis - 調査中の軸r - SizeRequirements オブジェクト。 null の場合、1 つ作成される
SizeRequirements オブジェクトSizeRequirements
protected 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 が考慮されます。通常は、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 が昇順にレイアウトされていることを示します。
 
レシーバが Y_AXIS に沿って View を配置している場合、position と bias の描画を行う View 上で同じメソッドを呼び出すことで値を返します。そうでない場合は、false を返します。
CompositeView 内の flipEastAndWestAtEndsposition - モデルへの位置bias - Position.Bias.Forward または Position.Bias.Backward
position や bias の描画を行う View の周りにある View が降順にレイアウトされている場合は true。そうでない場合は false| 
 | JavaTM Platform Standard Ed. 6 | |||||||||
| 前のクラス 次のクラス | フレームあり フレームなし | |||||||||
| 概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド | |||||||||
Copyright 2009 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Documentation Redistribution Policy も参照してください。