Browse Source

REPORT-3163 合作开发9.0设计器=>列表面板弹出编辑框

master
plough 7 years ago
parent
commit
05451d24a6
  1. 5
      designer_base/src/com/fr/design/gui/controlpane/UIControlPane.java
  2. 11
      designer_base/src/com/fr/design/gui/controlpane/UIListControlPane.java

5
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();
}

11
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;

Loading…
Cancel
Save