Browse Source

REPORT-60513 功能入口提示增加遮罩

research/11.0
kuangshuai 3 years ago
parent
commit
a32e451dee
  1. 47
      designer-base/src/main/java/com/fr/design/mainframe/guide/ui/BubbleHintDialog.java
  2. 63
      designer-realize/src/main/java/com/fr/design/mainframe/guide/entry/GuideEntryHint.java
  3. 7
      designer-realize/src/main/java/com/fr/design/mainframe/guide/entry/GuideEntryPane.java

47
designer-base/src/main/java/com/fr/design/mainframe/guide/ui/BubbleHintDialog.java

@ -1,47 +0,0 @@
package com.fr.design.mainframe.guide.ui;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.DesignerFrame;
import com.fr.design.mainframe.guide.collect.GuideCollector;
import javax.swing.JDialog;
import java.awt.Color;
import java.awt.Point;
import java.awt.Window;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class BubbleHintDialog extends JDialog {
private static final int DIALOG_WIDTH = 220;
private static final int DIALOG_HEIGHT = 140;
private static BubbleHintDialog dialog;
public static BubbleHintDialog getInstance(){
if (dialog == null) {
dialog = new BubbleHintDialog(DesignerContext.getDesignerFrame());
}
return dialog;
}
public BubbleHintDialog(Window parent) {
super(parent);
setUndecorated(true);
this.setBackground(new Color(0,0,0,0));
setSize(DIALOG_WIDTH, DIALOG_HEIGHT);
BubbleHint bubbleHint = new BubbleHint();
bubbleHint.addConfirmAction(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
setVisible(false);
dispose();
GuideCollector.getInstance().setShowHint(true);
}
});
this.setContentPane(bubbleHint);
}
public void showDialog(Point location) {
dialog.setLocation(location);
dialog.setVisible(true);
}
}

63
designer-realize/src/main/java/com/fr/design/mainframe/guide/entry/GuideEntryHint.java

@ -0,0 +1,63 @@
package com.fr.design.mainframe.guide.entry;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.guide.base.GuideView;
import com.fr.design.mainframe.guide.collect.GuideCollector;
import com.fr.design.mainframe.guide.scene.AbstractGuideScene;
import com.fr.design.mainframe.guide.scene.GuideSceneLifecycleAdaptor;
import com.fr.design.mainframe.guide.ui.BubbleHint;
import javax.swing.SwingUtilities;
import java.awt.Dimension;
import java.awt.Point;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class GuideEntryHint {
private static GuideEntryHint hint;
private GuideView guideView;
public static GuideEntryHint getInstance() {
if (hint == null) {
hint = new GuideEntryHint();
}
return hint;
}
public GuideEntryHint() {
AbstractGuideScene scene = new AbstractGuideScene(){};
BubbleHint bubbleHint = new BubbleHint();
guideView = new GuideView(DesignerContext.getDesignerFrame());
bubbleHint.addConfirmAction(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
GuideCollector.getInstance().setShowHint(true);
guideView.dismissGuide();
}
});
scene.registerLifecycle(new GuideSceneLifecycleAdaptor() {
@Override
public boolean prepared() {
scene.addTarget(GuideEntryPane.getGuideEntryPane());
scene.addCustomTarget(bubbleHint, getBubbleLocation());
return true;
}
});
guideView.setScene(scene);
}
public void show() {
if (!guideView.isVisible()) {
guideView.showGuide();
}
}
private Point getBubbleLocation() {
Point point = SwingUtilities.convertPoint(GuideEntryPane.getGuideEntryPane(),0,0, guideView.getRootPane());
Dimension size = GuideEntryPane.getGuideEntryPane().getSize();
return new Point(point.x - 187,point.y + size.height);
}
}

7
designer-realize/src/main/java/com/fr/design/mainframe/guide/entry/GuideEntryPane.java

@ -5,7 +5,6 @@ import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.guide.collect.GuideCollector;
import com.fr.design.mainframe.guide.ui.BubbleHintDialog;
import com.fr.design.mainframe.guide.ui.GuideManageDialog;
import com.fr.general.IOUtils;
@ -13,7 +12,6 @@ import javax.swing.event.AncestorEvent;
import javax.swing.event.AncestorListener;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.Point;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
@ -53,10 +51,7 @@ public class GuideEntryPane extends BasicPane {
@Override
public void ancestorAdded(AncestorEvent event) {
if (!GuideCollector.getInstance().isShowHint()) {
BubbleHintDialog dialog = BubbleHintDialog.getInstance();
Point point = getLocationOnScreen();
Dimension size = getSize();
dialog.showDialog(new Point(point.x - 187,point.y + size.height));
GuideEntryHint.getInstance().show();
}
}

Loading…
Cancel
Save