Browse Source

REPORT-60919 && REPORT-60899 引导页优化解决弹窗类的引导快速点击发生异常的问题

bugfix/11.0
kuangshuai 3 years ago
parent
commit
364b073c28
  1. 11
      designer-base/src/main/java/com/fr/design/mainframe/guide/scene/AbstractGuideScene.java
  2. 55
      designer-base/src/main/java/com/fr/design/mainframe/guide/scene/ClickScene.java
  3. 2
      designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/GuideSceneHelper.java
  4. 7
      designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/layout/ChangeLayoutComponentGuide.java
  5. 22
      designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/layout/UseLayoutAndComponentGuide.java
  6. 2
      designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/theme/DownloadComponentPackageGuide.java
  7. 3
      designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/theme/ThemeToggleGuide.java

11
designer-base/src/main/java/com/fr/design/mainframe/guide/scene/AbstractGuideScene.java

@ -307,9 +307,6 @@ public abstract class AbstractGuideScene extends JPanel implements GuideScene {
nextButton.setBounds((getSceneWidth() - 60) / 2, getSceneHeight() - 100, 60, 30);
add(nextButton);
}
container.revalidate();
container.repaint();
}
showContainer();
if (lifecycle != null) {
@ -319,9 +316,7 @@ public abstract class AbstractGuideScene extends JPanel implements GuideScene {
@Override
public void complete() {
container.getLayeredPane().remove(this);
container.repaint();
clear();
if (lifecycle != null && !lifecycle.onComplete()) {
return;
}
@ -386,14 +381,16 @@ public abstract class AbstractGuideScene extends JPanel implements GuideScene {
return container.getLayeredPane().getHeight();
}
private void clear() {
public void clear() {
targetList = new ArrayList<>();
highlightList = new ArrayList<>();
this.nextButton = null;
if (this.getComponentCount() > 0) {
this.removeAll();
invalidate();
repaint();
}
}
@Override
public void paint(Graphics g) {

55
designer-base/src/main/java/com/fr/design/mainframe/guide/scene/ClickScene.java

@ -1,13 +1,15 @@
package com.fr.design.mainframe.guide.scene;
import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.mainframe.guide.base.GuideManager;
import javax.swing.AbstractButton;
import javax.swing.ButtonModel;
import javax.swing.SwingUtilities;
import java.awt.Component;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
@ -58,50 +60,61 @@ public class ClickScene extends AbstractGuideScene{
public void mouseClicked(MouseEvent e) {
if (e.getButton() == MouseEvent.BUTTON1) {
if ((e.getClickCount() == 1 && clickType == ClickType.LEFT) || (e.getClickCount() == 2 && clickType == ClickType.LEFT_DOUBLE)) {
if (isDispatch) {
redispatchMouseEvent(e, target);
}
complete();
dealWithDispatchLeftClick(target, e, isDispatch);
}
} else if (e.getButton() == MouseEvent.BUTTON3 && clickType == ClickType.RIGHT) {
clear();
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
if (isDispatch) {
redispatchMouseEvent(e, target);
}
complete();
}
});
}
@Override
public void mousePressed(MouseEvent e) {
if (isDispatch) {
if (target instanceof AbstractButton) {
AbstractButton b = (AbstractButton) target;
b.setFocusable(false);
}
redispatchMouseEvent(e, target);
}
}
@Override
public void mouseReleased(MouseEvent e) {
public void mousePressed(MouseEvent e) {
if ((target instanceof AbstractButton) && (target.getParent() instanceof UIButtonGroup)) {
if (isDispatch) {
redispatchMouseEvent(e, target);
}
}
@Override
public void mouseEntered(MouseEvent e) {
if (isDispatch) {
redispatchMouseEvent(e, target);
}
});
}
private void dealWithDispatchLeftClick(Component target, MouseEvent e, boolean isDispatch) {
clear();
SwingUtilities.invokeLater(new Runnable() {
@Override
public void mouseExited(MouseEvent e) {
public void run() {
if (isDispatch) {
if (target instanceof AbstractButton) {
AbstractButton button = (AbstractButton) target;
ActionListener[] actionListeners= button.getActionListeners();
for(int i = 0; i < actionListeners.length; i++) {
ActionListener actionListener = actionListeners[i];
actionListener.actionPerformed(new ActionEvent(
button,
ActionEvent.ACTION_PERFORMED,
button.getActionCommand(),
e.getWhen(),
e.getModifiers()
));
}
} else {
redispatchMouseEvent(e, target);
}
}
complete();
}
});
}
@ -114,7 +127,7 @@ public class ClickScene extends AbstractGuideScene{
@Override
public void showScene() {
// 交互类的 scene 如果没有高亮内容块载,需要及时终止Guide,否则就没法去掉模态框影响到设计器主功能的使用了
if (this.getComponentCount() == 0) {
if (this.getComponentCount() == 0 && getHighlightList().isEmpty()) {
GuideManager.getInstance().getCurrentGuide().terminate();
} else {
super.showScene();

2
designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/GuideSceneHelper.java

@ -19,8 +19,6 @@ import com.fr.design.utils.ComponentUtils;
import com.fr.design.worker.save.CallbackSaveWorker;
import com.fr.design.worker.save.EmptyCallBackSaveWorker;
import java.awt.Window;
public class GuideSceneHelper {
public static GuideScene createFormDesignerBodyDisplayScene() {
DisplayScene scene = new DisplayScene();

7
designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/layout/ChangeLayoutComponentGuide.java

@ -98,9 +98,6 @@ public class ChangeLayoutComponentGuide {
@Override
public boolean prepared() {
switchButton.getComponentPopupMenu().setVisible(true);
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
scene.addCustomTarget(
GuideCreateUtils.createModalTarget(switchButton.getComponentPopupMenu()),
GuideCreateUtils.getRelativeBounds(switchButton.getComponentPopupMenu(), switchButton,0, -switchButton.getComponentPopupMenu().getHeight())
@ -109,9 +106,7 @@ public class ChangeLayoutComponentGuide {
scene.addBubbleTip(Toolkit.i18nText("Fine-Design_Guide_Scene_F001002_Tip_Select_Fix_layout"), null, GuideTip.Direction.RIGHT, 0.5f, 0.8f);
switchButton.getComponentPopupMenu().setVisible(false);
scene.showScene();
}
});
return false;
return true;
}
});
return scene;

22
designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/layout/UseLayoutAndComponentGuide.java

@ -32,6 +32,7 @@ import com.fr.form.share.group.DefaultShareGroup;
import com.fr.form.share.group.DefaultShareGroupManager;
import com.fr.stable.StringUtils;
import javax.swing.JComponent;
import java.awt.Component;
import java.util.ArrayList;
import java.util.List;
@ -72,15 +73,11 @@ public class UseLayoutAndComponentGuide {
preloadShareComponent();
Component component = ComponentUtils.findComponentByName(NorthRegionContainerPane.getInstance(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_File"));
fileHeadMenu = ((UIHeadMenu) component);
fileHeadMenu.setSelected(true);
fileHeadMenu.getPopupMenu().show(fileHeadMenu, 0, fileHeadMenu.getHeight());
return true;
}
@Override
public void onEnd() {
fileHeadMenu.setSelected(false);
fileHeadMenu.getPopupMenu().setVisible(false);
if (newFormPane != null) {
newFormPane.getWindow().dispose();
}
@ -101,18 +98,18 @@ public class UseLayoutAndComponentGuide {
GuideCreateUtils.createModalTarget(fileHeadMenu.getPopupMenu()),
GuideCreateUtils.getRelativeBounds(fileHeadMenu.getPopupMenu(), fileHeadMenu, 0 , fileHeadMenu.getHeight())
);
scene.addClickTarget(fileHeadMenu.getMenuComponent(2), ClickScene.ClickType.LEFT);
scene.addBubbleTip(Toolkit.i18nText("Fine-Design_Guide_Scene_F001001_Tip_New_Form"), GuideTip.Direction.BOTTOM);
scene.addCustomClickTarget(
GuideCreateUtils.createTarget((JComponent) fileHeadMenu.getMenuComponent(2)),
GuideCreateUtils.getRelativeBounds(fileHeadMenu.getMenuComponent(2), fileHeadMenu, 0,fileHeadMenu.getHeight() + fileHeadMenu.getMenuComponent(2).getY()),
ClickScene.ClickType.LEFT
);
scene.addBubbleTip(Toolkit.i18nText("Fine-Design_Guide_Scene_F001001_Tip_New_Form") + "测试文本测试文本测试文本测试文本测试文本", GuideTip.Direction.BOTTOM);
scene.showScene();
return true;
}
@Override
public void onShow() {
fileHeadMenu.setSelected(false);
fileHeadMenu.getPopupMenu().setVisible(false);
}
@Override
public boolean onComplete() {
@ -124,6 +121,7 @@ public class UseLayoutAndComponentGuide {
return scene;
}
public static GuideScene createScene2() {
DisplayScene scene = new DisplayScene();
scene.registerLifecycle(new GuideSceneLifecycleAdaptor() {
@ -136,7 +134,7 @@ public class UseLayoutAndComponentGuide {
scene.showScene();
GuideCreateUtils.TIMER.purge();
}
}, 300);
}, 100);
return false;
}
});

2
designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/theme/DownloadComponentPackageGuide.java

@ -247,7 +247,7 @@ public class DownloadComponentPackageGuide {
scene.showScene();
GuideCreateUtils.TIMER.purge();
}
}, 300);
}, 100);
return false;
}
});

3
designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/theme/ThemeToggleGuide.java

@ -105,7 +105,7 @@ public class ThemeToggleGuide {
scene.showScene();
GuideCreateUtils.TIMER.purge();
}
},300);
},100);
return false;
}
});
@ -183,6 +183,7 @@ public class ThemeToggleGuide {
if (uiButtonGroup[0] != null) {
uiButtonGroup[0].setSelectedIndex(0);
}
GuideCreateUtils.getFormDesigner().repaint();
return true;
}
});

Loading…
Cancel
Save