Browse Source

Pull request #2092: REPORT-37289 【10.0.9冒烟】frm模板tab,在设计器内进行多次来回点击切换,发现会偶然的点击失效或卡顿

Merge in DESIGN/design from ~HADES/design:release/10.0 to release/10.0

* commit '71078002fe599dbe0aa27437af47d90683b4dd64':
  REPORT-37289  处理下npe
  REPORT-37289 【10.0.9冒烟】frm模板tab,在设计器内进行多次来回点击切换,发现会偶然的点击失效或卡顿
feature/big-screen
Hades 4 years ago
parent
commit
72b903f8ce
  1. 12
      designer-form/src/main/java/com/fr/design/mainframe/EditingMouseListener.java
  2. 4
      designer-form/src/main/java/com/fr/design/parameter/ParameterPropertyPane.java

12
designer-form/src/main/java/com/fr/design/mainframe/EditingMouseListener.java

@ -79,6 +79,9 @@ public class EditingMouseListener extends MouseInputAdapter {
//备份开始拖动的位置和大小
private Rectangle dragBackupBounds;
private int pressX;
private int pressY;
/**
* 获取最小移动距离
*
@ -141,6 +144,8 @@ public class EditingMouseListener extends MouseInputAdapter {
public void mousePressed(MouseEvent e) {
int oldX = e.getX();
int oldY = e.getY();
pressX = oldX;
pressY = oldY;
offsetEventPoint(e);
if (!stopEditing()) {
return;
@ -189,6 +194,7 @@ public class EditingMouseListener extends MouseInputAdapter {
* @param e 鼠标事件
*/
public void mouseReleased(MouseEvent e) {
MouseEvent transEvent = new MouseEvent(e.getComponent(), MouseEvent.MOUSE_CLICKED, e.getWhen(), e.getModifiers(), e.getX(), e.getY(), e.getXOnScreen(), e.getYOnScreen(), e.getClickCount(), e.isPopupTrigger(), e.getButton());
int oldX = e.getX();
int oldY = e.getY();
offsetEventPoint(e);
@ -213,6 +219,12 @@ public class EditingMouseListener extends MouseInputAdapter {
lastPressEvent = null;
lastXCreator = null;
e.translatePoint(oldX - e.getX(), oldY - e.getY());
if (pressX != oldX || pressY != oldY) {
// click只有在mouseReleased和mousePressed前后x/y坐标相等时才会被触发在mouseReleased之后
// 但是当使用者来回点击切换时 存在mouseReleased和mousePressed前后x/y坐标不相等的情况 即鼠标按下去的位置和鼠标释放的位置不相等 存在偏移
// 当这种偏移很小时 看起来就好像是点击了 实际上是手抖了或者鼠标轻微滑动了 所以这里对这种情况要有容错处理
mouseClicked(transEvent);
}
}
private void mouseDraggingRelease(MouseEvent e) {

4
designer-form/src/main/java/com/fr/design/parameter/ParameterPropertyPane.java

@ -1,5 +1,6 @@
package com.fr.design.parameter;
import com.fr.base.Parameter;
import com.fr.design.constants.UIConstants;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XWParameterLayout;
@ -124,7 +125,8 @@ public class ParameterPropertyPane extends JPanel{
hideInJForm = jt instanceof JForm &&
!(creator instanceof XWParameterLayout || creator.getParent() instanceof XWParameterLayout);
} catch (NullPointerException ex) {
hideInJForm = toolbarPane.updateBean().length <= 0;
Parameter[] parameters = toolbarPane.updateBean();
hideInJForm = parameters == null || parameters.length <= 0;
}
if (isVisible && toolbarPane.hasSelectedLabelItem() && !hideInJForm) {
addParaPane.setVisible(true);

Loading…
Cancel
Save