Java プラットフォーム 1.2

javax.swing.plaf.basic
クラス BasicTreeUI

java.lang.Object
  |
  +--javax.swing.plaf.ComponentUI
        |
        +--javax.swing.plaf.TreeUI
              |
              +--javax.swing.plaf.basic.BasicTreeUI
直接の既知のサブクラス:
MetalTreeUI

public class BasicTreeUI
extends TreeUI

階層的なデータ構造の Basic 仕様 Look & Feel による実装です。


内部クラスの概要
 class BasicTreeUI.CellEditorHandler
          セル編集イベントを取得し、それに応じてツリーを更新するリスナーです。
 class BasicTreeUI.ComponentHandler
          スクロール時に必要に応じて、適切なサイズを更新します。
 class BasicTreeUI.FocusHandler
          フォーカスを失ったとき、あるいは取得したときに、先導選択行をペイントし直します。
 class BasicTreeUI.KeyHandler
          複数のキー押下イベントを取得してイベントを適切に生成するために使われます。
 class BasicTreeUI.MouseHandler
          TreeMouseListener は、マウスイベントに基づいて選択を更新します。
 class BasicTreeUI.MouseInputHandler
          マウスが離されるまで、マウス移動イベントを含めたすべてのマウスイベントを指定された転送先に渡します。
 class BasicTreeUI.NodeDimensionsHandler
          ノードのサイズを取得するクラスです。
 class BasicTreeUI.PropertyChangeHandler
          ツリーのプロパティ変更リスナーです。
 class BasicTreeUI.SelectionModelPropertyChangeHandler
          TreeSelectionModel のリスナーです。
 class BasicTreeUI.TreeCancelEditingAction
          アクションが実行されたときに cancelEditing を呼び出す ActionListener です。
 class BasicTreeUI.TreeExpansionHandler
          ノードの展開または折りたたみに応じて TreeState を更新します。
 class BasicTreeUI.TreeHomeAction
          エンドアクションおよびホームアクションを処理するために使われます。
 class BasicTreeUI.TreeIncrementAction
          アップアクションおよびダウンアクションを処理するために使われます。
 class BasicTreeUI.TreeModelHandler
          すべての TreeModel イベントを TreeState に転送します。
 class BasicTreeUI.TreePageAction
          ページアップイベントおよびページダウンイベントを処理します。
 class BasicTreeUI.TreeSelectionHandler
          選択モデルの変更を待機し、変更があった場合に表示を更新します。
 class BasicTreeUI.TreeToggleAction
          最初に選択された行で、展開状態が切り替えられます。
 class BasicTreeUI.TreeTraverseAction
          左矢印キーと右矢印キーに使われるアクションです。
 
フィールドの概要
protected  TreeCellEditor cellEditor
          ツリーのエディタです。
protected  Icon collapsedIcon
           
protected  boolean createdCellEditor
          現在ツリーにあるエディタがこのインスタンスによって作成された場合に true に設定されます。
protected  boolean createdRenderer
          現在ツリーにあるレンダリングがこのインスタンスによって作成された場合に true に設定されます。
protected  TreeCellRenderer currentCellRenderer
          実際のセルの描画を行うために使われているレンダリングです。
protected  int depthOffset
          x 位置を正確に計算するための深さのオフセットの量です。
protected  Hashtable drawingCache
          垂直線の描画を最小化するために使われます。
protected  Component editingComponent
          これは編集時に、実際の編集を行う Component になります。
protected  TreePath editingPath
          編集中のパスです。
protected  int editingRow
          編集中の行です。
protected  boolean editorHasDifferentSize
          エディタのサイズがレンダリングと異なる場合に true に設定されます。
protected  Icon expandedIcon
           
protected  boolean largeModel
          largeModel の最適化を行なっている場合は true です。
protected  int lastSelectedRow
          最後に選択された行のインデックスです。
protected  int leftChildIndent
          左マージンと垂直の破線が描画される位置の間の距離です。
protected  AbstractLayoutCache.NodeDimensions nodeDimensions
          TreeState に対しノードに必要なサイズを通知します。
protected  Dimension preferredMinSize
          適切な最小サイズです。
protected  Dimension preferredSize
          すべてのノードを完全に表示するために必要なサイズです。
protected  CellRendererPane rendererPane
          TreeCellRenderer をペイントするために使われます。
protected  int rightChildIndent
          セルの内容が描画される位置を示すために leftChildIndent に加算される距離です。
protected  boolean stopEditingInCompleteEditing
          編集時に、shouldSelectCell() が true を返した場合に false に設定されます。
protected  int totalChildIndent
          インデントされる総距離です。
protected  JTree tree
          描画先のコンポーネントです。
protected  TreeModel treeModel
          何を表示するかを示すために使われます。
protected  TreeSelectionModel treeSelectionModel
          選択を維持するモデルです。
protected  AbstractLayoutCache treeState
          サイズ変更および展開状態を処理するオブジェクトです。
protected  boolean validCachedPreferredSize
          preferredSize が有効かどうかを示します。
 
コンストラクタの概要
BasicTreeUI()
           
 
メソッドの概要
 void cancelEditing(JTree tree)
          現在の編集セッションを取り消します。
protected  void checkForClickInExpandControl(TreePath path, int mouseX, int mouseY)
          mouseX および mouseYrow の展開または折りたたみに使われる領域にある場合、このメソッドは行の展開状態を切り替えます。
protected  void completeEditing()
          編集セッションを中止するためにメッセージとして送られます。
protected  void completeEditing(boolean messageStop, boolean messageCancel, boolean messageTree)
          編集セッションを中止します。
protected  void completeUIInstall()
          すべてのデフォルトおよびリスナーがインストールされたあとに installUI から呼び出されます。
protected  void completeUIUninstall()
           
protected  void configureLayoutCache()
          Look & Feel を提供しているツリーに基づいて TreeState のインスタンスをリセットします。
protected  CellEditorListener createCellEditorListener()
          現在のエディタからのイベントを処理するリスナーを作成します。
protected  CellRendererPane createCellRendererPane()
          レンダリングコンポーネントが配置されているレンダリング区画を返します。
protected  ComponentListener createComponentListener()
          新しい ComponentHandler を作成し、それを返します。
protected  TreeCellEditor createDefaultCellEditor()
          デフォルトのセルエディタを作成します。
protected  TreeCellRenderer createDefaultCellRenderer()
          各ノードを描画するために使われるデフォルトのセルレンダリングを返します。
protected  FocusListener createFocusListener()
          フォーカスを失ったとき、および取得したときに表示を更新するリスナーを作成します。
protected  KeyListener createKeyListener()
          ツリーからキーイベントを取得するリスナーを作成します。
protected  AbstractLayoutCache createLayoutCache()
          ノードのサイズと展開状態を管理するオブジェクトを作成します。
protected  MouseListener createMouseListener()
          マウスイベントに基づいて選択を更新するリスナーを作成します。
protected  AbstractLayoutCache.NodeDimensions createNodeDimensions()
          ツリーの指定されたノードのサイズを示すことができる NodeDimensions のインスタンスを生成します。
protected  PropertyChangeListener createPropertyChangeListener()
          ツリーの変更に基づいて UI を更新するリスナーを作成します。
protected  PropertyChangeListener createSelectionModelPropertyChangeListener()
          選択モデルからプロパティ変更イベントを取得するリスナーを作成します。
protected  TreeExpansionListener createTreeExpansionListener()
          ノードの展開状態が変更されたときにツリーの状態を更新するオブジェクトを作成し、それを返します。
protected  TreeModelListener createTreeModelListener()
          モデルが変更されたときにツリーを更新できるリスナーを返します。
protected  TreeSelectionListener createTreeSelectionListener()
          選択変更メソッドに基づいて表示を更新するリスナーを作成します。
static ComponentUI createUI(JComponent x)
           
protected  void drawCentered(Component c, Graphics graphics, Icon icon, int x, int y)
           
protected  void drawDashedHorizontalLine(Graphics g, int y, int x1, int x2)
           
protected  void drawDashedVerticalLine(Graphics g, int x, int y1, int y2)
           
protected  void ensureRowsAreVisible(int beginRow, int endRow)
          beginRow と endRow によって識別されるすべての行が可視になります。
protected  TreeCellEditor getCellEditor()
           
protected  TreeCellRenderer getCellRenderer()
          currentCellRenderer を返します。
 TreePath getClosestPathForLocation(JTree tree, int x, int y)
          x、y にもっとも近いノードのパスを返します。
 Icon getCollapsedIcon()
           
 TreePath getEditingPath(JTree tree)
          編集中の要素のパスを返します。
 Icon getExpandedIcon()
           
protected  Color getHashColor()
           
protected  int getHorizontalLegBuffer()
          ノード間の脚の水平要素は、デフォルトでは子ノードの左側の右で始まります。
protected  TreePath getLastChildPath(TreePath parent)
          parent の最後の子のパスを返します。
 int getLeftChildIndent()
           
 Dimension getMaximumSize(JComponent c)
          このコンポーネントの最大サイズを返します。
 Dimension getMinimumSize(JComponent c)
          このコンポーネントの最小サイズを返します。
protected  TreeModel getModel()
           
 Rectangle getPathBounds(JTree tree, TreePath path)
          path の最後の項目が描画されるラベル部分を囲む Rectangle を返します。
 TreePath getPathForRow(JTree tree, int row)
          渡された行のパスを返します。
 Dimension getPreferredMinSize()
          適切な最小サイズを返します。
 Dimension getPreferredSize(JComponent c)
          ツリーを正しく表示するために適切なサイズを返します。
 Dimension getPreferredSize(JComponent c, boolean checkConsistancy)
          c でツリーを表すための適切なサイズを返します。
 int getRightChildIndent()
           
 int getRowCount(JTree tree)
          表示されている行数を返します。
 int getRowForPath(JTree tree, TreePath path)
          path で識別される最後の可視項目の行を返します。
protected  int getRowHeight()
           
protected  TreeSelectionModel getSelectionModel()
           
protected  boolean getShowsRootHandles()
           
protected  int getVerticalLegBuffer()
          ノード間の脚の垂直要素は、デフォルトでは親ノードの下端から始まります。
protected  void handleExpandControlClick(TreePath path, int mouseX, int mouseY)
          ユーザが特定の行をクリックしたときにメッセージとして送られ、toggleExpandState を呼び出します。
protected  void installComponents()
          レンダリング区画である、ツリーのサブコンポーネントをインストールします。
protected  void installDefaults()
           
protected  void installKeyboardActions()
           
protected  void installListeners()
           
 void installUI(JComponent c)
           
protected  boolean isEditable()
           
 boolean isEditing(JTree tree)
          ツリーが編集中の場合に true を返します。
protected  boolean isLargeModel()
           
protected  boolean isLeaf(int row)
           
protected  boolean isLocationInExpandControl(TreePath path, int mouseX, int mouseY)
          mouseX および mouseY がノードの展開または折りたたみに使われる行の領域にあり、row にあるノードが葉を表さない場合に true を返します。
protected  boolean isMultiSelectEvent(MouseEvent event)
          true が返された場合、ノード上のマウスイベントがアンカーポイントから選択されます。
protected  boolean isRootVisible()
           
protected  boolean isToggleEvent(MouseEvent event)
          true が返された場合、マウスの下の行がイベントに基づいて切り替えられます。
protected  boolean isToggleSelectionEvent(MouseEvent event)
          true が返された場合、ノード上のマウスイベントに基づいてマウスの下の行だけが選択を切り替えられます。
 void paint(Graphics g, JComponent c)
           
protected  void paintExpandControl(Graphics g, Rectangle clipBounds, Insets insets, Rectangle bounds, TreePath path, int row, boolean isExpanded, boolean hasBeenExpanded, boolean isLeaf)
          行の展開 (切り替え) 部分をペイントします。
protected  void paintHorizontalLine(Graphics g, JComponent c, int y, int left, int right)
          水平線をペイントします。
protected  void paintHorizontalPartOfLeg(Graphics g, Rectangle clipBounds, Insets insets, Rectangle bounds, TreePath path, int row, boolean isExpanded, boolean hasBeenExpanded, boolean isLeaf)
          脚の水平部分をペイントします。
protected  void paintRow(Graphics g, Rectangle clipBounds, Insets insets, Rectangle bounds, TreePath path, int row, boolean isExpanded, boolean hasBeenExpanded, boolean isLeaf)
          行のレンダリング部分をペイントします。
protected  void paintVerticalLine(Graphics g, JComponent c, int x, int top, int bottom)
          垂直線をペイントします。
protected  void paintVerticalPartOfLeg(Graphics g, Rectangle clipBounds, Insets insets, TreePath path)
          脚の垂直部分をペイントします。
protected  void pathWasCollapsed(TreePath path)
          VisibleTreeNode が折りたたまれたあとに、VisibleTreeNode からメッセージとして送られます。
protected  void pathWasExpanded(TreePath path)
          VisibleTreeNode が展開されたあとに、VisibleTreeNode からメッセージとして送られます。
protected  void prepareForUIInstall()
          tree インスタンス変数が設定されたあとに、デフォルトおよびリスナーがインストールされる前に呼び出されます。
protected  void prepareForUIUninstall()
           
protected  void selectPathForEvent(TreePath path, MouseEvent event)
          特定の行での MouseEvent に基づいて選択を更新するためにメッセージとして送られます。
protected  void setCellEditor(TreeCellEditor editor)
          セルエディタを設定します。
protected  void setCellRenderer(TreeCellRenderer tcr)
          TreeCellRenderer を tcr に設定します。
 void setCollapsedIcon(Icon newG)
           
protected  void setEditable(boolean newValue)
          レシーバが編集を許可するかどうかを設定します。
 void setExpandedIcon(Icon newG)
           
protected  void setHashColor(Color color)
           
protected  void setLargeModel(boolean largeModel)
          必要な場合に、componentListener を更新します。
 void setLeftChildIndent(int newAmount)
           
protected  void setModel(TreeModel model)
          TreeModel を設定します。
 void setPreferredMinSize(Dimension newSize)
          適切な最小サイズを設定します。
 void setRightChildIndent(int newAmount)
           
protected  void setRootVisible(boolean newValue)
          ルートを可視に設定します。
protected  void setRowHeight(int rowHeight)
          行の高さを設定します。
protected  void setSelectionModel(TreeSelectionModel newLSM)
          選択モデルをリセットします。
protected  void setShowsRootHandles(boolean newValue)
          ノードのハンドルが表示されるかどうかを示します。
protected  boolean shouldPaintExpandControl(TreePath path, int row, boolean isExpanded, boolean hasBeenExpanded, boolean isLeaf)
          指定された行で展開 (切り替え) コントロールが描画されなければならない場合に true を返します。
protected  boolean startEditing(TreePath path, MouseEvent event)
          cellEditor がある場合に、shouldSelectCell が true を返したときにノードの編集を開始します。
 void startEditingAtPath(JTree tree, TreePath path)
          path の最後の項目を選択し、その項目の編集を試みます。
 boolean stopEditing(JTree tree)
          現在の編集セッションを中止します。
protected  void toggleExpandState(TreePath path)
          path が展開されてない場合にそれを展開します。
protected  void uninstallComponents()
          レンダリング区画をアンインストールします。
protected  void uninstallDefaults()
           
protected  void uninstallKeyboardActions()
           
protected  void uninstallListeners()
           
 void uninstallUI(JComponent c)
           
protected  void updateCachedPreferredSize()
          getPreferredSize() から返される preferredSize インスタンス変数を更新します。
protected  void updateCellEditor()
          JTree が編集できるかどうかに応じて cellEditor を更新します。
protected  void updateDepthOffset()
          各深さのオフセットを更新します。
protected  void updateExpandedDescendants(TreePath path)
          ツリーから展開されている下位ノードを取得し、ツリー状態に転送することで、path 内のすべての下位ノードの展開状態を更新します。
protected  void updateLayoutCacheExpandedNodes()
          JTree で展開されているすべてのノードを LayoutCache で展開します。
protected  void updateRenderer()
          レンダリングが変更されたときにツリーからメッセージとして送られます。
protected  void updateSize()
          キャッシュに格納されているサイズを無効とマークし、treeDidChange を使ってツリーにメッセージを送ります。
 
クラス javax.swing.plaf.ComponentUI から継承したメソッド
contains, getAccessibleChild, getAccessibleChildrenCount, update
 
クラス java.lang.Object から継承したメソッド
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

フィールドの詳細

collapsedIcon

protected transient Icon collapsedIcon

expandedIcon

protected transient Icon expandedIcon

leftChildIndent

protected int leftChildIndent
左マージンと垂直の破線が描画される位置の間の距離です。

rightChildIndent

protected int rightChildIndent
セルの内容が描画される位置を示すために leftChildIndent に加算される距離です。

totalChildIndent

protected int totalChildIndent
インデントされる総距離です。leftChildIndent と rightChildIndent の合計です。

preferredMinSize

protected Dimension preferredMinSize
適切な最小サイズです。

lastSelectedRow

protected int lastSelectedRow
最後に選択された行のインデックスです。

tree

protected JTree tree
描画先のコンポーネントです。

currentCellRenderer

protected transient TreeCellRenderer currentCellRenderer
実際のセルの描画を行うために使われているレンダリングです。

createdRenderer

protected boolean createdRenderer
現在ツリーにあるレンダリングがこのインスタンスによって作成された場合に true に設定されます。

cellEditor

protected transient TreeCellEditor cellEditor
ツリーのエディタです。

createdCellEditor

protected boolean createdCellEditor
現在ツリーにあるエディタがこのインスタンスによって作成された場合に true に設定されます。

stopEditingInCompleteEditing

protected boolean stopEditingInCompleteEditing
編集時に、shouldSelectCell() が true を返した場合に false に設定されます。shouldSelectCell() の true は、ノードが編集前に選択されなければならないことを意味します。completeEditing で使われます。

rendererPane

protected CellRendererPane rendererPane
TreeCellRenderer をペイントするために使われます。

preferredSize

protected Dimension preferredSize
すべてのノードを完全に表示するために必要なサイズです。

validCachedPreferredSize

protected boolean validCachedPreferredSize
preferredSize が有効かどうかを示します。

treeState

protected AbstractLayoutCache treeState
サイズ変更および展開状態を処理するオブジェクトです。

drawingCache

protected Hashtable drawingCache
垂直線の描画を最小化するために使われます。

largeModel

protected boolean largeModel
largeModel の最適化を行なっている場合は true です。これをサポートしないサブクラスは、createLayoutCache をオーバーライドすると、FixedHeightLayoutCache のインスタンスを返さないようにすることができます。

nodeDimensions

protected AbstractLayoutCache.NodeDimensions nodeDimensions
TreeState に対しノードに必要なサイズを通知します。

treeModel

protected TreeModel treeModel
何を表示するかを示すために使われます。

treeSelectionModel

protected TreeSelectionModel treeSelectionModel
選択を維持するモデルです。

depthOffset

protected int depthOffset
x 位置を正確に計算するための深さのオフセットの量です。これは、ルートが可視かどうか、ルートのハンドルが可視どうかによって決まります。

editingComponent

protected Component editingComponent
これは編集時に、実際の編集を行う Component になります。

editingPath

protected TreePath editingPath
編集中のパスです。

editingRow

protected int editingRow
編集中の行です。editingComponent が null ではない場合だけ参照されます。

editorHasDifferentSize

protected boolean editorHasDifferentSize
エディタのサイズがレンダリングと異なる場合に true に設定されます。
コンストラクタの詳細

BasicTreeUI

public BasicTreeUI()
メソッドの詳細

createUI

public static ComponentUI createUI(JComponent x)

getHashColor

protected Color getHashColor()

setHashColor

protected void setHashColor(Color color)

setLeftChildIndent

public void setLeftChildIndent(int newAmount)

getLeftChildIndent

public int getLeftChildIndent()

setRightChildIndent

public void setRightChildIndent(int newAmount)

getRightChildIndent

public int getRightChildIndent()

setExpandedIcon

public void setExpandedIcon(Icon newG)

getExpandedIcon

public Icon getExpandedIcon()

setCollapsedIcon

public void setCollapsedIcon(Icon newG)

getCollapsedIcon

public Icon getCollapsedIcon()

setLargeModel

protected void setLargeModel(boolean largeModel)
必要な場合に、componentListener を更新します。

isLargeModel

protected boolean isLargeModel()

setRowHeight

protected void setRowHeight(int rowHeight)
行の高さを設定します。これは、treeState に転送されます。

getRowHeight

protected int getRowHeight()

setCellRenderer

protected void setCellRenderer(TreeCellRenderer tcr)
TreeCellRenderer を tcr に設定します。これにより、updateRenderer が呼び出されます。

getCellRenderer

protected TreeCellRenderer getCellRenderer()
currentCellRenderer を返します。これは、ツリーレンダリングまたは defaultCellRenderer (null でない方) になります。

setModel

protected void setModel(TreeModel model)
TreeModel を設定します。

getModel

protected TreeModel getModel()

setRootVisible

protected void setRootVisible(boolean newValue)
ルートを可視に設定します。

isRootVisible

protected boolean isRootVisible()

setShowsRootHandles

protected void setShowsRootHandles(boolean newValue)
ノードのハンドルが表示されるかどうかを示します。

getShowsRootHandles

protected boolean getShowsRootHandles()

setCellEditor

protected void setCellEditor(TreeCellEditor editor)
セルエディタを設定します。

getCellEditor

protected TreeCellEditor getCellEditor()

setEditable

protected void setEditable(boolean newValue)
レシーバが編集を許可するかどうかを設定します。

isEditable

protected boolean isEditable()

setSelectionModel

protected void setSelectionModel(TreeSelectionModel newLSM)
選択モデルをリセットします。適切なリスナーがモデルでインストールされます。

getSelectionModel

protected TreeSelectionModel getSelectionModel()

getPathBounds

public Rectangle getPathBounds(JTree tree,
                               TreePath path)
path の最後の項目が描画されるラベル部分を囲む Rectangle を返します。path のコンポーネントのどれかが現在有効な場合は null を返します。
オーバーライド:
クラス TreeUI 内の getPathBounds

getPathForRow

public TreePath getPathForRow(JTree tree,
                              int row)
渡された行のパスを返します。行が可視でない場合は null が返されます。
オーバーライド:
クラス TreeUI 内の getPathForRow

getRowForPath

public int getRowForPath(JTree tree,
                         TreePath path)
path で識別される最後の可視項目の行を返します。path の要素のどれかが現在可視でない場合は -1 を返します。
オーバーライド:
クラス TreeUI 内の getRowForPath

getRowCount

public int getRowCount(JTree tree)
表示されている行数を返します。
オーバーライド:
クラス TreeUI 内の getRowCount

getClosestPathForLocation

public TreePath getClosestPathForLocation(JTree tree,
                                          int x,
                                          int y)
x、y にもっとも近いノードのパスを返します。可視項目が現在ない場合は null が返され、そうでない場合は常に有効なパスが返されます。返されたオブジェクトが正確に x、y の位置にあるかどうかを調べるには、返されたパスの境界を取得し、それを基準に x、y を比較します。
オーバーライド:
クラス TreeUI 内の getClosestPathForLocation

isEditing

public boolean isEditing(JTree tree)
ツリーが編集中の場合に true を返します。編集中の項目を取得するには、getEditingPath() を使います。
オーバーライド:
クラス TreeUI 内の isEditing

stopEditing

public boolean stopEditing(JTree tree)
現在の編集セッションを中止します。ツリーが編集されていない場合、このメソッドは何も行いません。エディタが編集セッションの中止を許可する場合に true を返します。
オーバーライド:
クラス TreeUI 内の stopEditing

cancelEditing

public void cancelEditing(JTree tree)
現在の編集セッションを取り消します。
オーバーライド:
クラス TreeUI 内の cancelEditing

startEditingAtPath

public void startEditingAtPath(JTree tree,
                               TreePath path)
path の最後の項目を選択し、その項目の編集を試みます。CellEditor が選択された項目の編集を許可しない場合、編集は失敗します。
オーバーライド:
クラス TreeUI 内の startEditingAtPath

getEditingPath

public TreePath getEditingPath(JTree tree)
編集中の要素のパスを返します。
オーバーライド:
クラス TreeUI 内の getEditingPath

installUI

public void installUI(JComponent c)
オーバーライド:
クラス ComponentUI 内の installUI

prepareForUIInstall

protected void prepareForUIInstall()
tree インスタンス変数が設定されたあとに、デフォルトおよびリスナーがインストールされる前に呼び出されます。

completeUIInstall

protected void completeUIInstall()
すべてのデフォルトおよびリスナーがインストールされたあとに installUI から呼び出されます。

installDefaults

protected void installDefaults()

installListeners

protected void installListeners()

installKeyboardActions

protected void installKeyboardActions()

installComponents

protected void installComponents()
レンダリング区画である、ツリーのサブコンポーネントをインストールします。

createNodeDimensions

protected AbstractLayoutCache.NodeDimensions createNodeDimensions()
ツリーの指定されたノードのサイズを示すことができる NodeDimensions のインスタンスを生成します。

createPropertyChangeListener

protected PropertyChangeListener createPropertyChangeListener()
ツリーの変更に基づいて UI を更新するリスナーを作成します。

createMouseListener

protected MouseListener createMouseListener()
マウスイベントに基づいて選択を更新するリスナーを作成します。

createFocusListener

protected FocusListener createFocusListener()
フォーカスを失ったとき、および取得したときに表示を更新するリスナーを作成します。

createKeyListener

protected KeyListener createKeyListener()
ツリーからキーイベントを取得するリスナーを作成します。

createSelectionModelPropertyChangeListener

protected PropertyChangeListener createSelectionModelPropertyChangeListener()
選択モデルからプロパティ変更イベントを取得するリスナーを作成します。

createTreeSelectionListener

protected TreeSelectionListener createTreeSelectionListener()
選択変更メソッドに基づいて表示を更新するリスナーを作成します。

createCellEditorListener

protected CellEditorListener createCellEditorListener()
現在のエディタからのイベントを処理するリスナーを作成します。

createComponentListener

protected ComponentListener createComponentListener()
新しい ComponentHandler を作成し、それを返します。これは、大きなモデルでコンポーネントが移動したときに、validCachedPreferredSize を無効にするために使われます。

createTreeExpansionListener

protected TreeExpansionListener createTreeExpansionListener()
ノードの展開状態が変更されたときにツリーの状態を更新するオブジェクトを作成し、それを返します。

createLayoutCache

protected AbstractLayoutCache createLayoutCache()
ノードのサイズと展開状態を管理するオブジェクトを作成します。

createCellRendererPane

protected CellRendererPane createCellRendererPane()
レンダリングコンポーネントが配置されているレンダリング区画を返します。

createDefaultCellEditor

protected TreeCellEditor createDefaultCellEditor()
デフォルトのセルエディタを作成します。

createDefaultCellRenderer

protected TreeCellRenderer createDefaultCellRenderer()
各ノードを描画するために使われるデフォルトのセルレンダリングを返します。

createTreeModelListener

protected TreeModelListener createTreeModelListener()
モデルが変更されたときにツリーを更新できるリスナーを返します。

uninstallUI

public void uninstallUI(JComponent c)
オーバーライド:
クラス ComponentUI 内の uninstallUI

prepareForUIUninstall

protected void prepareForUIUninstall()

completeUIUninstall

protected void completeUIUninstall()

uninstallDefaults

protected void uninstallDefaults()

uninstallListeners

protected void uninstallListeners()

uninstallKeyboardActions

protected void uninstallKeyboardActions()

uninstallComponents

protected void uninstallComponents()
レンダリング区画をアンインストールします。

paint

public void paint(Graphics g,
                  JComponent c)
オーバーライド:
クラス ComponentUI 内の paint

paintHorizontalPartOfLeg

protected void paintHorizontalPartOfLeg(Graphics g,
                                        Rectangle clipBounds,
                                        Insets insets,
                                        Rectangle bounds,
                                        TreePath path,
                                        int row,
                                        boolean isExpanded,
                                        boolean hasBeenExpanded,
                                        boolean isLeaf)
脚の水平部分をペイントします。レシーバは、clipBoundsinsets を変更してはなりません。

注: ルートが可視でない場合、parentRow は -1 になります。


paintVerticalPartOfLeg

protected void paintVerticalPartOfLeg(Graphics g,
                                      Rectangle clipBounds,
                                      Insets insets,
                                      TreePath path)
脚の垂直部分をペイントします。レシーバは、clipBoundsinsets を変更してはなりません。


paintExpandControl

protected void paintExpandControl(Graphics g,
                                  Rectangle clipBounds,
                                  Insets insets,
                                  Rectangle bounds,
                                  TreePath path,
                                  int row,
                                  boolean isExpanded,
                                  boolean hasBeenExpanded,
                                  boolean isLeaf)
行の展開 (切り替え) 部分をペイントします。レシーバは、clipBoundsinsets を変更してはなりません。

paintRow

protected void paintRow(Graphics g,
                        Rectangle clipBounds,
                        Insets insets,
                        Rectangle bounds,
                        TreePath path,
                        int row,
                        boolean isExpanded,
                        boolean hasBeenExpanded,
                        boolean isLeaf)
行のレンダリング部分をペイントします。レシーバは、clipBoundsinsets を変更してはなりません。

shouldPaintExpandControl

protected boolean shouldPaintExpandControl(TreePath path,
                                           int row,
                                           boolean isExpanded,
                                           boolean hasBeenExpanded,
                                           boolean isLeaf)
指定された行で展開 (切り替え) コントロールが描画されなければならない場合に true を返します。

paintVerticalLine

protected void paintVerticalLine(Graphics g,
                                 JComponent c,
                                 int x,
                                 int top,
                                 int bottom)
垂直線をペイントします。

paintHorizontalLine

protected void paintHorizontalLine(Graphics g,
                                   JComponent c,
                                   int y,
                                   int left,
                                   int right)
水平線をペイントします。

getVerticalLegBuffer

protected int getVerticalLegBuffer()
ノード間の脚の垂直要素は、デフォルトでは親ノードの下端から始まります。このメソッドは、脚がそれより下で始まるようにします。

getHorizontalLegBuffer

protected int getHorizontalLegBuffer()
ノード間の脚の水平要素は、デフォルトでは子ノードの左側の右で始まります。このメソッドは、脚がそれより前で終わるようにします。

drawCentered

protected void drawCentered(Component c,
                            Graphics graphics,
                            Icon icon,
                            int x,
                            int y)

drawDashedHorizontalLine

protected void drawDashedHorizontalLine(Graphics g,
                                        int y,
                                        int x1,
                                        int x2)

drawDashedVerticalLine

protected void drawDashedVerticalLine(Graphics g,
                                      int x,
                                      int y1,
                                      int y2)

updateLayoutCacheExpandedNodes

protected void updateLayoutCacheExpandedNodes()
JTree で展開されているすべてのノードを LayoutCache で展開します。これにより、ルートパスを使って updateExpandedDescendants が呼び出されます。

updateExpandedDescendants

protected void updateExpandedDescendants(TreePath path)
ツリーから展開されている下位ノードを取得し、ツリー状態に転送することで、path 内のすべての下位ノードの展開状態を更新します。

getLastChildPath

protected TreePath getLastChildPath(TreePath parent)
parent の最後の子のパスを返します。

updateDepthOffset

protected void updateDepthOffset()
各深さのオフセットを更新します。

updateCellEditor

protected void updateCellEditor()
JTree が編集できるかどうかに応じて cellEditor を更新します。ツリーが編集できるが、cellEditor がない場合、基本的なセルエディタが使われます。

updateRenderer

protected void updateRenderer()
レンダリングが変更されたときにツリーからメッセージとして送られます。

configureLayoutCache

protected void configureLayoutCache()
Look & Feel を提供しているツリーに基づいて TreeState のインスタンスをリセットします。

updateSize

protected void updateSize()
キャッシュに格納されているサイズを無効とマークし、treeDidChange を使ってツリーにメッセージを送ります。

updateCachedPreferredSize

protected void updateCachedPreferredSize()
getPreferredSize() から返される preferredSize インスタンス変数を更新します。

サイズは、現在の AbstractLayoutCache から決まります。


pathWasExpanded

protected void pathWasExpanded(TreePath path)
VisibleTreeNode が展開されたあとに、VisibleTreeNode からメッセージとして送られます。

pathWasCollapsed

protected void pathWasCollapsed(TreePath path)
VisibleTreeNode が折りたたまれたあとに、VisibleTreeNode からメッセージとして送られます。

ensureRowsAreVisible

protected void ensureRowsAreVisible(int beginRow,
                                    int endRow)
beginRow と endRow によって識別されるすべての行が可視になります。

setPreferredMinSize

public void setPreferredMinSize(Dimension newSize)
適切な最小サイズを設定します。

getPreferredMinSize

public Dimension getPreferredMinSize()
適切な最小サイズを返します。

getPreferredSize

public Dimension getPreferredSize(JComponent c)
ツリーを正しく表示するために適切なサイズを返します。これは、getPreferredSize(c, false) のカバーメソッドです。
オーバーライド:
クラス ComponentUI 内の getPreferredSize

getPreferredSize

public Dimension getPreferredSize(JComponent c,
                                  boolean checkConsistancy)
c でツリーを表すための適切なサイズを返します。checkConsistancy が true の場合、まず checkConsistancy がメッセージとして送られます。

getMinimumSize

public Dimension getMinimumSize(JComponent c)
このコンポーネントの最小サイズを返します。これは適切な最小サイズまたは 0, 0 になります。
オーバーライド:
クラス ComponentUI 内の getMinimumSize

getMaximumSize

public Dimension getMaximumSize(JComponent c)
このコンポーネントの最大サイズを返します。これは、インスタンスが現在 JTree にある場合は適切なサイズになり、そうでない場合は 0, 0 になります。
オーバーライド:
クラス ComponentUI 内の getMaximumSize

completeEditing

protected void completeEditing()
編集セッションを中止するためにメッセージとして送られます。レシーバが Look & Feel を提供している UI が getInvokesStopCellEditing から true を返す場合、stopCellEditing が現在のエディタで呼び出されます。次に completeEditing が false または true でメッセージとして送られます。false は、中途の編集をすべて取り消します。

completeEditing

protected void completeEditing(boolean messageStop,
                               boolean messageCancel,
                               boolean messageTree)
編集セッションを中止します。messageStop が true の場合、stopEditing を使ってエディタにメッセージが送られ、messageCancel が true の場合、cancelEditing を使ってエディタにメッセージが送られます。messageTree が true の場合、valueForPathChanged を使って treeModel にメッセージが送られます。

startEditing

protected boolean startEditing(TreePath path,
                               MouseEvent event)
cellEditor がある場合に、shouldSelectCell が true を返したときにノードの編集を開始します。

このメソッドは、パスが有効であり、可視であると見なします。


checkForClickInExpandControl

protected void checkForClickInExpandControl(TreePath path,
                                            int mouseX,
                                            int mouseY)
mouseX および mouseYrow の展開または折りたたみに使われる領域にある場合、このメソッドは行の展開状態を切り替えます。

isLocationInExpandControl

protected boolean isLocationInExpandControl(TreePath path,
                                            int mouseX,
                                            int mouseY)
mouseX および mouseY がノードの展開または折りたたみに使われる行の領域にあり、row にあるノードが葉を表さない場合に true を返します。

handleExpandControlClick

protected void handleExpandControlClick(TreePath path,
                                        int mouseX,
                                        int mouseY)
ユーザが特定の行をクリックしたときにメッセージとして送られ、toggleExpandState を呼び出します。

toggleExpandState

protected void toggleExpandState(TreePath path)
path が展開されてない場合にそれを展開します。path が展開されている場合は行を折りたたみます。パスの展開時に JTree がスクロールする場合、できる限り多くの子が可視になるように ensureRowsAreVisible が呼び出されます。ensureRowsAreVisible は、path の可視部分の最下位までスクロールします。

isToggleSelectionEvent

protected boolean isToggleSelectionEvent(MouseEvent event)
true が返された場合、ノード上のマウスイベントに基づいてマウスの下の行だけが選択を切り替えられます。

isMultiSelectEvent

protected boolean isMultiSelectEvent(MouseEvent event)
true が返された場合、ノード上のマウスイベントがアンカーポイントから選択されます。

isToggleEvent

protected boolean isToggleEvent(MouseEvent event)
true が返された場合、マウスの下の行がイベントに基づいて切り替えられます。このメソッドは、checkForClickInExpandControl のあとに呼び出され、位置が展開 (切り替え) コントロールではないことを示します。

selectPathForEvent

protected void selectPathForEvent(TreePath path,
                                  MouseEvent event)
特定の行での MouseEvent に基づいて選択を更新するためにメッセージとして送られます。イベントが選択切り替えイベントの場合、行が選択または選択解除されます。イベントが複数選択イベントを示す場合、選択はアンカーポイントから更新されます。そうでない場合は行が選択され、イベントが切り替えイベントを示す場合は行が展開または折りたたまれます。

isLeaf

protected boolean isLeaf(int row)
戻り値:
row のノードが葉の場合は true

Java プラットフォーム 1.2

バグや機能要求の報告
新しい javadoc の表示についてのコメントやご提案
Java は、米国およびその他の国における米国 Sun Microsystems, Inc. の商標もしくは登録商標です。
Copyright 1993-1998 Sun Microsystems, Inc. 901 San Antonio Road,
Palo Alto, California, 94303, U.S.A. All Rights Reserved.