From 05451d24a6422e6600dd2333774e0a44fecd064d Mon Sep 17 00:00:00 2001 From: plough Date: Mon, 24 Jul 2017 10:52:44 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-3163=20=E5=90=88=E4=BD=9C=E5=BC=80?= =?UTF-8?q?=E5=8F=919.0=E8=AE=BE=E8=AE=A1=E5=99=A8=3D>=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E9=9D=A2=E6=9D=BF=E5=BC=B9=E5=87=BA=E7=BC=96=E8=BE=91=E6=A1=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/gui/controlpane/UIControlPane.java | 5 ++++- .../fr/design/gui/controlpane/UIListControlPane.java | 11 ++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/designer_base/src/com/fr/design/gui/controlpane/UIControlPane.java b/designer_base/src/com/fr/design/gui/controlpane/UIControlPane.java index b21b740f5a..4de5f5d86b 100644 --- a/designer_base/src/com/fr/design/gui/controlpane/UIControlPane.java +++ b/designer_base/src/com/fr/design/gui/controlpane/UIControlPane.java @@ -236,14 +236,17 @@ public abstract class UIControlPane extends BasicPane implements UnrepeatedNameH // 点击"编辑"按钮,弹出面板 protected class PopupEditPane extends JPopupMenu { private JComponent contentPane; + private static final int WIDTH = 460; + private static final int HEIGHT = 500; // private PopupToolPane popupToolPane; - private int fixedHeight; +// private int fixedHeight; PopupEditPane(JComponent pane) { contentPane = pane; this.setLayout(new BorderLayout()); this.add(contentPane, BorderLayout.CENTER); this.setOpaque(false); + contentPane.setPreferredSize(new Dimension(WIDTH, HEIGHT)); // fixedHeight = getPreferredSize().height - contentPane.getPreferredSize().height; // updateSize(); } diff --git a/designer_base/src/com/fr/design/gui/controlpane/UIListControlPane.java b/designer_base/src/com/fr/design/gui/controlpane/UIListControlPane.java index 878668f0d0..a6131b3ed5 100644 --- a/designer_base/src/com/fr/design/gui/controlpane/UIListControlPane.java +++ b/designer_base/src/com/fr/design/gui/controlpane/UIListControlPane.java @@ -47,6 +47,7 @@ import java.util.Comparator; public abstract class UIListControlPane extends UIControlPane { public static final String LIST_NAME = "UIControl_List"; + private static final int EDIT_RANGE = 20; // 编辑按钮的x坐标范围 protected UINameEdList nameableList; protected int editingIndex; @@ -356,6 +357,11 @@ public abstract class UIListControlPane extends UIControlPane { } } + private void popupEditPane() { + GUICoreUtils.showPopupMenu(popupEditPane, this, + - popupEditPane.getPreferredSize().width, nameableList.getSelectedIndex() * EDIT_RANGE); + } + /** * 增加项的UpdateAction */ @@ -638,11 +644,14 @@ public abstract class UIListControlPane extends UIControlPane { public void mouseReleased(MouseEvent evt) { nameableList.stopEditing(); if (evt.getClickCount() >= 2 - && SwingUtilities.isLeftMouseButton(evt)) { + && SwingUtilities.isLeftMouseButton(evt) && evt.getX() > EDIT_RANGE) { editingIndex = nameableList.getSelectedIndex(); selectedName = nameableList.getNameAt(editingIndex); nameableList.editItemAt(nameableList.getSelectedIndex()); + } else if (SwingUtilities.isLeftMouseButton(evt) && evt.getX() <= EDIT_RANGE) { + popupEditPane(); } + // peter:处理右键的弹出菜单 if (!SwingUtilities.isRightMouseButton(evt)) { return;