Browse Source

REPORT-1220 修复表单界面的图表和控件悬浮面板点击其他位置不消失的问题

master
vito 8 years ago
parent
commit
2a79bb30da
  1. 21
      designer_form/src/com/fr/design/mainframe/FormParaWidgetPane.java

21
designer_form/src/com/fr/design/mainframe/FormParaWidgetPane.java

@ -18,7 +18,6 @@ import com.fr.form.ui.*;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.OperatingSystem;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;
@ -314,6 +313,7 @@ public class FormParaWidgetPane extends JPanel{
this.setEnabled(designer.getParaComponent() == null); this.setEnabled(designer.getParaComponent() == null);
} }
} }
public void mouseDragged(MouseEvent e) { public void mouseDragged(MouseEvent e) {
if (designer.getParaComponent() != null) { if (designer.getParaComponent() != null) {
return; return;
@ -348,6 +348,7 @@ public class FormParaWidgetPane extends JPanel{
/** /**
* 响应界面改变事件 * 响应界面改变事件
*
* @param evt 事件 * @param evt 事件
*/ */
public void fireCreatorModified(DesignerEvent evt) { public void fireCreatorModified(DesignerEvent evt) {
@ -356,7 +357,6 @@ public class FormParaWidgetPane extends JPanel{
} }
private class PopUpWindow extends JWindow { private class PopUpWindow extends JWindow {
private JPanel northPane; private JPanel northPane;
private String typeName; private String typeName;
@ -376,21 +376,18 @@ public class FormParaWidgetPane extends JPanel{
public void eventDispatched(AWTEvent event) { public void eventDispatched(AWTEvent event) {
if (event instanceof MouseEvent) { if (event instanceof MouseEvent) {
MouseEvent mv = (MouseEvent) event; MouseEvent mv = (MouseEvent) event;
Point point = mv.getLocationOnScreen(); if (mv.getClickCount() > 0) {
double endX = PopUpWindow.this.getX() + northPane.getWidth() + LineWidth; Point point = new Point((int) (mv.getLocationOnScreen().getX()), (int) mv.getLocationOnScreen().getY());
double startX = endX - BarWidth; // 直接contains在mac下,点击内部也会消失
double startY = PopUpWindow.this.getY() + northPane.getY(); Dimension d = PopUpWindow.this.getSize();
double endY = startY + northPane.getHeight(); Point p = PopUpWindow.this.getLocation();
boolean dragBar = startX < point.getX() && endX > point.getX() && endY > point.getY(); Rectangle rect = new Rectangle(p, d);
if (!dragBar && mv.getClickCount() > 0 && mv.getID() != MouseEvent.MOUSE_RELEASED) { if (!rect.contains(point)) {
if(!ComparatorUtils.equals(mv.getSource(), PopUpWindow.this)) {
if (!OperatingSystem.isMacOS()) {
PopUpWindow.this.setVisible(false); PopUpWindow.this.setVisible(false);
} }
} }
} }
} }
}
}; };

Loading…
Cancel
Save