Browse Source

Pull request #6501: CHART-21418 fix bugs

Merge in DESIGN/design from ~ZHENG/c-design:release/10.0 to release/10.0

* commit '4ea706cf0c63fbafbca0cef02c7cc514d77e8e04':
  update
  代码质量:每个实例各自监听插件事件
  REPORT-61610 fix:插件重新加载 图表配置界面报错 A.class can not cast to A.class
  CHART-21418 fix:第二次修改 区分弹框在上面还是下面 如果在上面 则是从displayComponent下面离开 隐藏弹框
zheng-1641779399395
zheng 3 years ago
parent
commit
7bfe41a0fb
  1. 22
      designer-base/src/main/java/com/fr/design/style/AbstractSelectBox.java
  2. 25
      designer-chart/src/main/java/com/fr/design/mainframe/ChartPropertyPane.java

22
designer-base/src/main/java/com/fr/design/style/AbstractSelectBox.java

@ -10,6 +10,7 @@ import com.fr.stable.Constants;
import javax.swing.AbstractButton;
import javax.swing.JPanel;
import javax.swing.JWindow;
import javax.swing.border.AbstractBorder;
import javax.swing.event.AncestorEvent;
import javax.swing.event.AncestorListener;
@ -20,6 +21,7 @@ import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Insets;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.RenderingHints;
import java.awt.event.MouseAdapter;
@ -99,9 +101,25 @@ public abstract class AbstractSelectBox<T> extends AbstractPopBox implements Mou
displayComponent.addMouseListener(new MouseAdapter() {
@Override
public void mouseExited(MouseEvent e) {
if (!isPopupVisible()) {
//如果弹出框==null 或者 弹出框不可见 直接return
return;
}
Point popMenuP = getControlWindow().getLocation();
Point displayComponentP = displayComponent.getLocationOnScreen();
if (popMenuP.getX() < displayComponentP.getX() - 1) {
//如果 弹出框横向超出屏幕 往左调整了 和displayComponent横向错开 就不处理了
return;
}
Rectangle rectangle = displayComponent.getBounds();
if (e.getY() < rectangle.y) {
//如果是从displayComponent上面离开的,隐藏弹出界面。
boolean bottomPopAndExitTop = displayComponentP.getY() < popMenuP.getY() && e.getY() <= rectangle.y;
boolean topPopAndExitBottom = displayComponentP.getY() > popMenuP.getY() && e.getY() >= rectangle.y + rectangle.getHeight();
boolean exitLeftOrRight = rectangle.x > e.getX() || rectangle.x + rectangle.getWidth() < e.getX();
if (bottomPopAndExitTop || topPopAndExitBottom || exitLeftOrRight) {
//弹出框在displayComponent下面 且 鼠标是从displayComponent上面离开的,隐藏弹出界面。
//弹出框在displayComponent上面 且 鼠标是从displayComponent下面离开的,隐藏弹出界面。
//鼠标从displayComponent左边 或者 右边 离开,隐藏弹出界面。
hidePopupMenu();
}

25
designer-chart/src/main/java/com/fr/design/mainframe/ChartPropertyPane.java

@ -16,6 +16,13 @@ import com.fr.design.gui.chart.ChartEditPaneProvider;
import com.fr.design.gui.frpane.UITitlePanel;
import com.fr.design.mainframe.chart.ChartEditPane;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.GeneralContext;
import com.fr.plugin.context.PluginContext;
import com.fr.plugin.injectable.PluginModule;
import com.fr.plugin.manage.PluginFilter;
import com.fr.plugin.observer.PluginEvent;
import com.fr.plugin.observer.PluginEventListener;
import com.fr.plugin.observer.PluginEventType;
import com.fr.stable.AssistUtils;
import javax.swing.BorderFactory;
@ -41,6 +48,7 @@ public class ChartPropertyPane extends BaseChartPropertyPane {
private ChartPropertyPane() {
initComponent();
addListener();
}
protected void initComponent() {
@ -48,6 +56,23 @@ public class ChartPropertyPane extends BaseChartPropertyPane {
this.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
}
private void addListener() {
GeneralContext.listenPlugin(PluginEventType.AfterRun, new PluginEventListener() {
@Override
public void on(PluginEvent event) {
//禁用启用图表插件 这边id置空。这样展示图表配置属性不管和上一个id是否一样 都新建chartEditPane
currentID = null;
}
}, new PluginFilter() {
@Override
public boolean accept(PluginContext context) {
return context.contain(PluginModule.ExtraChartDesign);
}
});
}
@Override
public void updateChartEditPane(String plotID) {
if (!AssistUtils.equals(currentID, plotID)) {

Loading…
Cancel
Save