From f2c35e950082e243fe5ae6d2457f67caffa28ddc Mon Sep 17 00:00:00 2001 From: Fangjie Hu Date: Thu, 8 Dec 2016 11:20:49 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8B=E6=8B=89=E6=A0=91=E8=87=AA=E5=AE=9A?= =?UTF-8?q?=E4=B9=89=E6=98=AF=E5=90=A6=E5=8F=AF=E9=80=89=E6=8B=A9=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/gui/icombobox/FRTreeComboBox.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/designer_base/src/com/fr/design/gui/icombobox/FRTreeComboBox.java b/designer_base/src/com/fr/design/gui/icombobox/FRTreeComboBox.java index a609422292..ed8ffb16c7 100644 --- a/designer_base/src/com/fr/design/gui/icombobox/FRTreeComboBox.java +++ b/designer_base/src/com/fr/design/gui/icombobox/FRTreeComboBox.java @@ -91,6 +91,15 @@ public class FRTreeComboBox extends UIComboBox { return this.tree; } + /** + * 自定义那些那些node可以选中,默认情况下所有node节点都可以选中 + * @param node + * @return + */ + protected boolean customSelectable(DefaultMutableTreeNode node){ + return true; + } + public void setTree(JTree tree) { this.tree = tree; if (tree != null) { @@ -403,6 +412,12 @@ public class FRTreeComboBox extends UIComboBox { if (comboBox.onlyLeafSelectable && !node.isLeaf()) { return; } + + //自定义node是否可选择 + if (!comboBox.customSelectable(node)){ + return; + } + comboBox.setSelectedItem(treePath); togglePopup(); MenuSelectionManager.defaultManager().clearSelectedPath();