JavaTM Platform
Standard Ed. 6

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

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


入れ子のクラスの概要
 class BasicTreeUI.CellEditorHandler
          セル編集イベントの取得と、それに応じてツリーの更新を行うリスナーです。
 class BasicTreeUI.ComponentHandler
          必要であれば、スクロール時に適切なサイズを更新します。
 class BasicTreeUI.FocusHandler
          フォーカスを失ったとき、または取得したときに、リード選択行をペイントし直します。
 class BasicTreeUI.KeyHandler
          複数のキーが押されるイベントを取得し、適切にイベントを生成するために使用されます。
 class BasicTreeUI.MouseHandler
          マウスイベントに基づいて選択を更新する TreeMouseListener です。
 class BasicTreeUI.MouseInputHandler
          MouseInputHandler は、構築に使用される送信先でマウスから指が放れるまで、すべてのマウスイベント (マウス動作イベントを含む) を渡す処理をします。
 class BasicTreeUI.NodeDimensionsHandler
          ノードのサイズを取得するクラスであり、メソッドは BasicTreeUI メソッドに転送されます。
 class BasicTreeUI.PropertyChangeHandler
          ツリーの PropertyChangeListener です。
 class BasicTreeUI.SelectionModelPropertyChangeHandler
          TreeSelectionModel のリスナーであり、モデルのプロパティーが変更された場合に行の選択をリセットします。
 class BasicTreeUI.TreeCancelEditingAction
          アクションが実行されたときに cancelEditing を呼び出す ActionListener です。
 class BasicTreeUI.TreeExpansionHandler
          ノードの展開または折りたたみに応じて TreeState を更新します。
 class BasicTreeUI.TreeHomeAction
          TreeHomeAction は、終了またはホームアクションを処理するために使用されます。
 class BasicTreeUI.TreeIncrementAction
          TreeIncrementAction は、上下のアクションを処理するために使われます。
 class BasicTreeUI.TreeModelHandler
          すべての TreeModel イベントを TreeState に転送します。
 class BasicTreeUI.TreePageAction
          TreePageAction は、ページアップとページダウンのイベントを処理します。
 class BasicTreeUI.TreeSelectionHandler
          選択モデルの変更を待機し、変更があった場合に表示を更新します。
 class BasicTreeUI.TreeToggleAction
          最初に選択された行で、展開状態が切り替えられます。
 class BasicTreeUI.TreeTraverseAction
          TreeTraverseAction は、左または右キーのために使用されるアクションです。
 
フィールドの概要
protected  TreeCellEditor cellEditor
          ツリーのエディタです。
protected  Icon collapsedIcon
           
protected  boolean createdCellEditor
          現在ツリーにあるエディタがこのインスタンスによって作成された場合に true に設定されます。
protected  boolean createdRenderer
          現在ツリーにあるレンダリングがこのインスタンスによって作成された場合に true に設定されます。
protected  TreeCellRenderer currentCellRenderer
          実際のセルの描画を行うために使われているレンダリングです。
protected  int depthOffset
          x 位置を正確に計算するための深さのオフセットの量です。
protected  Hashtable<TreePath,Boolean> 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 によって識別されるすべての行が可視になります。
 int getBaseline(JComponent c, int width, int height)
          ベースラインを返します。
 Component.BaselineResizeBehavior getBaselineResizeBehavior(JComponent c)
          コンポーネントのサイズが変化するにつれてベースラインが変化する方法の列挙を返します。
protected  TreeCellEditor getCellEditor()
           
protected  TreeCellRenderer getCellRenderer()
          ツリーレンダリングまたは defaultCellRenderer (null でない方) になる、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)
          パスの最後の項目が描画されるラベル部分を囲む Rectangle を返します。
 TreePath getPathForRow(JTree tree, int row)
          渡された 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  int getRowX(int row, int depth)
          x 軸に沿って特定の行を描画する位置を返します。
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)
          Look & Feel に適した、指定されたコンポーネントを構成します。
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)
          Look &Feel に適した、指定されたコンポーネントをペイントします。
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)
          treeState に転送される、行の高さを設定します。
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)
          パスが展開されてない場合は展開し、行が展開されている場合は折りたたみます。
protected  void uninstallComponents()
          レンダリング区画をアンインストールします。
protected  void uninstallDefaults()
           
protected  void uninstallKeyboardActions()
           
protected  void uninstallListeners()
           
 void uninstallUI(JComponent c)
          installUI 時に、指定されたコンポーネントで構成された内容を取り消します。
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 に設定されます。これは、completeEditing で使用され、ノードが編集前に選択されなければならないことを意味しています。


rendererPane

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


preferredSize

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


validCachedPreferredSize

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


treeState

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


drawingCache

protected Hashtable<TreePath,Boolean> 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()
ツリーレンダリングまたは defaultCellRenderer (null でない方) になる、currentCellRenderer を返します。


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)
パスの最後の項目が描画されるラベル部分を囲む Rectangle を返します。パスのコンポーネントのどれかが現在有効な場合は、null が返されます。

定義:
クラス TreeUI 内の getPathBounds

getPathForRow

public TreePath getPathForRow(JTree tree,
                              int row)
渡された row のパスを返します。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 の記述:
Look & Feel に適した、指定されたコンポーネントを構成します。このメソッドは、ComponentUI インスタンスが、指定されたコンポーネントの UI 委譲としてインストールされているときに呼び出されます。このメソッドは、次を含む Look & Feel 用のコンポーネントを完全に構成する必要があります。
  1. カラー、フォント、ボーダー、アイコン、不透明さなどすべてのデフォルトプロパティーの値をコンポーネントにインストールする。可能な場合は、クライアントプログラムによって初期化されたプロパティーの値をオーバーライドしてはならない
  2. 必要に応じて、コンポーネントに LayoutManager をインストールする
  3. 必要なサブコンポーネントを、コンポーネントに作成または追加する
  4. イベントリスナーを、コンポーネントに作成またはインストールする
  5. コンポーネントのプロパティーの変更を適切に検出し、応答するために、PropertyChangeListener をコンポーネントに作成またはインストールする
  6. キーボード UI (ニーモニック、トラバーサルなど) を、コンポーネントにインストールする
  7. 適切なインスタンスのデータを初期化する

オーバーライド:
クラス ComponentUI 内の installUI
パラメータ:
c - UI 委譲がインストールされているコンポーネント
関連項目:
ComponentUI.uninstallUI(javax.swing.JComponent), JComponent.setUI(javax.swing.plaf.ComponentUI), JComponent.updateUI()

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 の記述:
installUI 時に、指定されたコンポーネントで構成された内容を取り消します。このメソッドは、指定されたコンポーネントの UI 委譲としての UIComponent インスタンスが削除されているときに呼び出されます。このメソッドは、installUI によって実行された構成を元に戻す必要があります。この場合、JComponent インスタンスをクリーンな状態 (余分なリスナーや、Look & Feel 固有のプロパティーオブジェクトが残らないように) にするよう十分注意してください。手順には次のものがあります。
  1. UI として設定されたすべてのボーダーを、コンポーネントから削除する
  2. UI として設定されたすべてのレイアウトマネージャーを、コンポーネントから削除する
  3. UI として追加されたすべてのサブコンポーネントを、コンポーネントから削除する
  4. UI として追加されたすべてのイベント/リスナーを、コンポーネントから削除する
  5. UI としてインストールされたすべてのキーボード UI を、コンポーネントから削除する
  6. GC 用に割り当てられたすべてのインスタンスのデータオブジェクトを無効にする

オーバーライド:
クラス ComponentUI 内の uninstallUI
パラメータ:
c - この UI 委譲を削除するコンポーネント。 この引数は通常無視されるが、 UI オブジェクトに状態がなく、複数のコンポーネントに共有されている場合は 使用されることがある
関連項目:
ComponentUI.installUI(javax.swing.JComponent), JComponent.updateUI()

prepareForUIUninstall

protected void prepareForUIUninstall()

completeUIUninstall

protected void completeUIUninstall()

uninstallDefaults

protected void uninstallDefaults()

uninstallListeners

protected void uninstallListeners()

uninstallKeyboardActions

protected void uninstallKeyboardActions()

uninstallComponents

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


getBaseline

public int getBaseline(JComponent c,
                       int width,
                       int height)
ベースラインを返します。

オーバーライド:
クラス ComponentUI 内の getBaseline
パラメータ:
c - 要求される JComponent ベースライン
width - ベースラインを取得する幅
height - ベースラインを取得する高さ
戻り値:
ベースラインまたは 0 より小さい値 (適切なベースラインがないことを示す)
例外:
NullPointerException - cnull の場合
IllegalArgumentException - 幅または高さが 0 より小さい場合
導入されたバージョン:
1.6
関連項目:
JComponent.getBaseline(int, int)

getBaselineResizeBehavior

public Component.BaselineResizeBehavior getBaselineResizeBehavior(JComponent c)
コンポーネントのサイズが変化するにつれてベースラインが変化する方法の列挙を返します。

オーバーライド:
クラス ComponentUI 内の getBaselineResizeBehavior
パラメータ:
c - ベースラインのサイズ変更の動作を返す JComponent
戻り値:
コンポーネントのサイズが変化するにつれてベースラインが変化する方法の列挙
例外:
NullPointerException - cnull の場合
導入されたバージョン:
1.6
関連項目:
JComponent.getBaseline(int, int)

paint

public void paint(Graphics g,
                  JComponent c)
クラス ComponentUI の記述:
Look &Feel に適した、指定されたコンポーネントをペイントします。このメソッドは ComponentUI.update メソッドから、指定されたコンポーネントがペイントされるときに呼び出されます。サブクラスは、このメソッドをオーバーライドして、指定された Graphics オブジェクトを使ってコンポーネントの内容を描画する必要があります。

オーバーライド:
クラス ComponentUI 内の paint
パラメータ:
g - ペイント対象の Graphics コンテキスト
c - ペイントされるコンポーネント。 この引数は通常無視されるが、 UI オブジェクトに状態がなく、複数のコンポーネントに共有されている場合は 使用されることがある
関連項目:
ComponentUI.update(java.awt.Graphics, javax.swing.JComponent)

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)

getRowX

protected int getRowX(int row,
                      int depth)
x 軸に沿って特定の行を描画する位置を返します。戻り値には、JTree で指定されたインセット値は一切含まれません。このメソッドでは、行または深さの有効性は確認しないため、行または深さがツリーのそれと一致しない場合でも、正しいと見なされて、例外をスローしません。

パラメータ:
row - x 位置を返す行
depth - 行の深さ
戻り値:
指定された行をインデントする量
導入されたバージョン:
1.5

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 から決定されます。右から左方向の場合、適切なサイズは幅から最小の x 位置を引いた値になります。


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
パラメータ:
c - 適切なサイズを照会されるコンポーネント。 この引数は通常無視されるが、 UI オブジェクトに状態がなく、複数のコンポーネントに共有されている場合は 使用されることがある
関連項目:
JComponent.getPreferredSize(), LayoutManager.preferredLayoutSize(java.awt.Container)

getPreferredSize

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


getMinimumSize

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

オーバーライド:
クラス ComponentUI 内の getMinimumSize
パラメータ:
c - 最小サイズを照会されるコンポーネント。 この引数は通常無視されるが、 UI オブジェクトに状態がなく、複数のコンポーネントに共有されている場合は 使用されることがある
戻り値:
Dimension オブジェクト、または null
関連項目:
JComponent.getMinimumSize(), LayoutManager.minimumLayoutSize(java.awt.Container), ComponentUI.getPreferredSize(javax.swing.JComponent)

getMaximumSize

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

オーバーライド:
クラス ComponentUI 内の getMaximumSize
パラメータ:
c - 最大サイズを照会されるコンポーネント。 この引数は通常無視されるが、 UI オブジェクトに状態がなく、複数のコンポーネントに共有されている場合は 使用されることがある
戻り値:
Dimension オブジェクト、または null
関連項目:
JComponent.getMaximumSize(), LayoutManager2.maximumLayoutSize(java.awt.Container)

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)
パスが展開されてない場合は展開し、行が展開されている場合は折りたたみます。パスの展開時に 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

JavaTM Platform
Standard Ed. 6

バグの報告と機能のリクエスト
さらに詳しい API リファレンスおよび開発者ドキュメントについては、Java SE 開発者用ドキュメントを参照してください。開発者向けの詳細な解説、概念の概要、用語の定義、バグの回避策、およびコード実例が含まれています。

Copyright 2009 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Documentation Redistribution Policy も参照してください。