| |||||||||
摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 |
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
层次数据结构的基本 L&F。
嵌套类摘要 | |
---|---|
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 用于处理 end/home 动作。 |
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 编辑时设置为 false,shouldSelectCell() 返回 true 表示应该在编辑前选中节点,在 completeEditing 中使用该字段。 |
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 和 mouseY 位于 row 的展开/折叠区域内,则此方法将切换行。 |
protected void | completeEditing() 传递消息以停止编辑会话。 |
protected void | completeEditing(boolean messageStop, boolean messageCancel, boolean messageTree) 停止编辑会话。 |
protected void | completeUIInstall() 在安装所有默认值/侦听器之后根据 installUI 调用。 |
protected void | completeUIUninstall() |
protected void | configureLayoutCache() 基于为其提供外观的树重置 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() 创建并返回在节点展开状态更改时负责更新 treestate 的对象。 |
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,可以为树渲染器,也可以为 defaultCellRenderer,无论哪个都不为 null。 |
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) 返回此组件的最大大小,如果实例当前位于 JTree 中或 0, 0 处,则该大小将为首选大小。 |
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) 返回首选大小以正确显示树,这是一种 getPreferredSize(c, false) 的替代方法。 |
Dimension | getPreferredSize(JComponent c, boolean checkConsistancy) 返回首选大小以表示 c 中的树。 |
int | getRightChildIndent() |
int | getRowCount(JTree tree) 返回将显示的行数。 |
int | getRowForPath(JTree tree, TreePath 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) 配置指定组件,使其适合外观。 |
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) 绘制 row 的展开(切换)部分。 |
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) 绘制支路 (leg) 的水平部分。 |
protected void | paintRow(Graphics g, Rectangle clipBounds, Insets insets, Rectangle bounds, TreePath path, int row, boolean isExpanded, boolean hasBeenExpanded, boolean isLeaf) 绘制 row 的渲染器部分。 |
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 后,从其传递消息。 |
protected void | pathWasExpanded(TreePath path) 在展开 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) 选择路径中的最后一个项并尝试对其进行编辑。 |
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() 更新 preferredSize 实例变量,该变量从 getPreferredSize() 返回。 |
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
- 上一次选中行的索引。