Browse Source

REPORT-57813 修改部分门槛用例发现的问题

research/11.0
kuangshuai 3 years ago
parent
commit
dbf6e41c51
  1. 9
      designer-base/src/main/java/com/fr/design/mainframe/guide/base/Guide.java
  2. 71
      designer-base/src/main/java/com/fr/design/mainframe/guide/base/GuideManager.java
  3. 29
      designer-base/src/main/java/com/fr/design/mainframe/guide/base/GuideVersion.java
  4. 80
      designer-base/src/main/java/com/fr/design/mainframe/guide/base/GuideView.java
  5. 147
      designer-base/src/main/java/com/fr/design/mainframe/guide/scene/AbstractGuideScene.java
  6. 11
      designer-base/src/main/java/com/fr/design/mainframe/guide/scene/ClickScene.java
  7. 16
      designer-base/src/main/java/com/fr/design/mainframe/guide/tip/BubbleTip.java
  8. 2
      designer-base/src/main/java/com/fr/design/mainframe/guide/ui/GuideCompleteDialog.java
  9. 19
      designer-base/src/main/java/com/fr/design/mainframe/guide/ui/GuideManageDialog.java
  10. 2
      designer-base/src/main/java/com/fr/design/mainframe/guide/utils/ScreenImage.java
  11. 10
      designer-form/src/main/java/com/fr/design/widget/ui/designer/NewFormPane.java
  12. 4
      designer-realize/src/main/java/com/fr/design/mainframe/guide/GuideIds.java
  13. 4
      designer-realize/src/main/java/com/fr/design/mainframe/guide/GuideRegister.java
  14. 3
      designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/layout/UseLayoutAndComponentGuide.java
  15. 70
      designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/theme/ThemeToggleGuide.java

9
designer-base/src/main/java/com/fr/design/mainframe/guide/base/Guide.java

@ -3,6 +3,7 @@ package com.fr.design.mainframe.guide.base;
import com.fr.design.mainframe.guide.collect.GuideCollector; import com.fr.design.mainframe.guide.collect.GuideCollector;
import com.fr.design.mainframe.guide.scene.GuideScene; import com.fr.design.mainframe.guide.scene.GuideScene;
import com.fr.design.mainframe.guide.ui.GuideCompleteDialog; import com.fr.design.mainframe.guide.ui.GuideCompleteDialog;
import com.fr.design.mainframe.guide.ui.GuideManageDialog;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
@ -94,6 +95,10 @@ public class Guide {
* 开启引导流程 * 开启引导流程
*/ */
public void go() { public void go() {
// 同时只能启动一个引导
if (GuideManager.getInstance().getCurrentGuide() != null) {
return;
}
try { try {
if (lifecycle != null && !lifecycle.prepared()) { if (lifecycle != null && !lifecycle.prepared()) {
return; return;
@ -131,8 +136,9 @@ public class Guide {
} }
setComplete(true); setComplete(true);
GuideCollector.getInstance().saveInfo(); GuideCollector.getInstance().saveInfo();
end(); guideView.dismissGuide();
GuideCompleteDialog.getInstance().showDialog(getName()); GuideCompleteDialog.getInstance().showDialog(getName());
end();
} }
public void terminate() { public void terminate() {
@ -148,6 +154,7 @@ public class Guide {
if (lifecycle != null) { if (lifecycle != null) {
lifecycle.onEnd(); lifecycle.onEnd();
} }
GuideManageDialog.getInstance().showDialog();
} }
public void registerLifecycle(GuideLifecycle lifecycle) { public void registerLifecycle(GuideLifecycle lifecycle) {

71
designer-base/src/main/java/com/fr/design/mainframe/guide/base/GuideManager.java

@ -7,10 +7,11 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
public class GuideManager { public class GuideManager {
private Guide currentGuide;
private List<GuideGroup> guideGroupList;
private static GuideManager guideManager; private static GuideManager guideManager;
private Guide currentGuide;
private List<GuideVersion> guideVersionList;
public static GuideManager getInstance() { public static GuideManager getInstance() {
if (guideManager == null) { if (guideManager == null) {
guideManager = new GuideManager(); guideManager = new GuideManager();
@ -19,7 +20,7 @@ public class GuideManager {
} }
public GuideManager() { public GuideManager() {
guideGroupList = new ArrayList<>(); guideVersionList = new ArrayList<>();
} }
public Guide getCurrentGuide() { public Guide getCurrentGuide() {
@ -30,57 +31,77 @@ public class GuideManager {
this.currentGuide = currentGuide; this.currentGuide = currentGuide;
} }
public void addGuideGroup(GuideGroup guideGroup) { public void addGuideGroup(String version, GuideGroup guideGroup) {
this.guideGroupList.add(guideGroup); GuideVersion guideVersion = getGuideVersion(version);
if (guideVersion == null) {
guideVersion = new GuideVersion(version);
guideVersionList.add(guideVersion);
}
guideVersion.addGuideGroup(guideGroup);
} }
public void addGuide(String groupId, Guide guide) { public void addGuide(String groupId, Guide guide) {
for (GuideGroup group : guideGroupList) { GuideGroup guideGroup = getGuideGroup(groupId);
if (StringUtils.equals(groupId, group.getID())) { if (guideGroup != null) {
group.addGuide(guide); guideGroup.addGuide(guide);
}
} }
} }
public List<GuideGroup> getGuideGroupList() { public List<GuideVersion> getGuideVersionList() {
return guideGroupList; return guideVersionList;
} }
public List<Guide> getAllGuide() { public List<Guide> getAllGuide() {
List<Guide> guideList = new ArrayList<>(); List<Guide> guideList = new ArrayList<>();
for (GuideGroup group : getGuideGroupList()) { for (GuideVersion version : guideVersionList) {
for (Guide guide : group.getGuideList()) { for (GuideGroup group : version.getGuideGroupList()) {
guideList.add(guide); for (Guide guide : group.getGuideList()) {
guideList.add(guide);
}
} }
} }
return guideList; return guideList;
} }
public GuideVersion getGuideVersion(String version) {
for (GuideVersion guideVersion : guideVersionList) {
if (StringUtils.equals(version, guideVersion.getVersion())) {
return guideVersion;
}
}
return null;
}
public GuideGroup getGuideGroup(String groupId) { public GuideGroup getGuideGroup(String groupId) {
for (GuideGroup group : getGuideGroupList()) { for (GuideVersion version : guideVersionList) {
if (StringUtils.equals(groupId, group.getID())) { for (GuideGroup group : version.getGuideGroupList()) {
return group; if (StringUtils.equals(groupId, group.getID())) {
return group;
}
} }
} }
return null; return null;
} }
public Guide getGuide(String guideId) { public Guide getGuide(String guideId) {
for (GuideGroup group : getGuideGroupList()) { for (GuideVersion version : guideVersionList) {
for (Guide guide : group.getGuideList()) { for (GuideGroup group : version.getGuideGroupList()) {
if (StringUtils.equals(guideId, guide.getID())) { for (Guide guide : group.getGuideList()) {
return guide; if (StringUtils.equals(guideId, guide.getID())) {
return guide;
}
} }
} }
} }
return null; return null;
} }
public void completeAll() { public void completeAll() {
for (GuideGroup group : getGuideGroupList()) { for (GuideVersion version : guideVersionList) {
for (Guide guide : group.getGuideList()) { for (GuideGroup group : version.getGuideGroupList()) {
guide.setComplete(true); for (Guide guide : group.getGuideList()) {
guide.setComplete(true);
}
} }
} }
GuideCollector.getInstance().saveInfo(); GuideCollector.getInstance().saveInfo();

29
designer-base/src/main/java/com/fr/design/mainframe/guide/base/GuideVersion.java

@ -0,0 +1,29 @@
package com.fr.design.mainframe.guide.base;
import java.util.ArrayList;
import java.util.List;
public class GuideVersion {
private String version;
private List<GuideGroup> guideGroupList;
public GuideVersion(String version) {
guideGroupList = new ArrayList<>();
this.version = version;
}
public String getVersion() {
return version;
}
public void setVersion(String version) {
this.version = version;
}
public List<GuideGroup> getGuideGroupList() {
return guideGroupList;
}
public void addGuideGroup(GuideGroup guideGroup) {
guideGroupList.add(guideGroup);
}
}

80
designer-base/src/main/java/com/fr/design/mainframe/guide/base/GuideView.java

@ -5,18 +5,17 @@ import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.guide.scene.AbstractGuideScene; import com.fr.design.mainframe.guide.scene.AbstractGuideScene;
import com.fr.design.mainframe.guide.scene.GuideScene; import com.fr.design.mainframe.guide.scene.GuideScene;
import javax.swing.JWindow; import javax.swing.JDialog;
import java.awt.Color; import java.awt.Color;
import java.awt.Graphics; import java.awt.Graphics;
import java.awt.Window; import java.awt.Window;
import java.awt.event.ComponentAdapter; import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentEvent; import java.awt.event.ComponentEvent;
import java.awt.event.MouseAdapter; import java.awt.event.ComponentListener;
import java.awt.event.MouseEvent;
import java.awt.event.WindowEvent; import java.awt.event.WindowEvent;
import java.awt.event.WindowFocusListener; import java.awt.event.WindowFocusListener;
public class GuideView extends JWindow{ public class GuideView extends JDialog {
private static GuideView guideView; private static GuideView guideView;
private Guide invoker; private Guide invoker;
private GuideScene scene; private GuideScene scene;
@ -33,54 +32,43 @@ public class GuideView extends JWindow{
public GuideView(Window window) { public GuideView(Window window) {
super(window); super(window);
this.setUndecorated(true);
this.window = window; this.window = window;
this.modalColor = Color.BLACK; this.modalColor = Color.BLACK;
this.modalOpacity = 0.6f; this.modalOpacity = 0.4f;
this.setPreferredSize(window.getSize()); this.setPreferredSize(window.getSize());
this.setSize(window.getSize()); this.setSize(window.getSize());
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
setBg(); setBg();
window.addComponentListener(new ComponentAdapter() {
@Override
public void componentResized(ComponentEvent e) {
setLocationRelativeTo(window);
}
@Override
public void componentMoved(ComponentEvent e) {
setLocation(window.getLocation());
}
});
window.addWindowFocusListener(new WindowFocusListener() {
@Override
public void windowGainedFocus(WindowEvent e) {
requestFocus();
setLocationRelativeTo(window);
}
@Override
public void windowLostFocus(WindowEvent e) {
}
});
this.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
if (scene == null) {
invoker.terminate();
}
if (scene instanceof AbstractGuideScene && invoker != null) {
if (((AbstractGuideScene) scene).getHighlightList().size() == 0) {
invoker.terminate();
}
}
}
});
} }
private WindowFocusListener windowFocusListener = new WindowFocusListener() {
@Override
public void windowGainedFocus(WindowEvent e) {
requestFocus();
setLocationRelativeTo(window);
}
@Override
public void windowLostFocus(WindowEvent e) {
}
};
private ComponentListener componentListener = new ComponentAdapter() {
@Override
public void componentResized(ComponentEvent e) {
setLocationRelativeTo(window);
}
@Override
public void componentMoved(ComponentEvent e) {
setLocation(window.getLocation());
}
};
public GuideView(Window window, Guide guide) { public GuideView(Window window, Guide guide) {
this(DesignerContext.getDesignerFrame()); this(window);
this.invoker = guide; this.invoker = guide;
} }
@ -107,6 +95,8 @@ public class GuideView extends JWindow{
} }
public void showGuide() { public void showGuide() {
window.addComponentListener(componentListener);
window.addWindowFocusListener(windowFocusListener);
this.setLocationRelativeTo(window); this.setLocationRelativeTo(window);
this.setSize(window.getSize()); this.setSize(window.getSize());
this.setLocation(window.getLocation()); this.setLocation(window.getLocation());
@ -119,10 +109,12 @@ public class GuideView extends JWindow{
} }
public void dismissGuide() { public void dismissGuide() {
window.removeComponentListener(componentListener);
window.removeWindowFocusListener(windowFocusListener);
this.getLayeredPane().removeAll(); this.getLayeredPane().removeAll();
revalidate(); revalidate();
repaint(); repaint();
this.setVisible(false); setVisible(false);
} }
@Override @Override

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

@ -14,9 +14,13 @@ import javax.swing.JComponent;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
import java.awt.AWTException; import java.awt.AWTException;
import java.awt.AlphaComposite;
import java.awt.Color; import java.awt.Color;
import java.awt.Component; import java.awt.Component;
import java.awt.Composite;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Point; import java.awt.Point;
import java.awt.Rectangle; import java.awt.Rectangle;
import java.awt.Window; import java.awt.Window;
@ -27,6 +31,9 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
public abstract class AbstractGuideScene extends JPanel implements GuideScene { public abstract class AbstractGuideScene extends JPanel implements GuideScene {
private static final int DEFAULT_ARROW_HEIGHT = 12;
private static final int DEFAULT_ARROW_WIDTH = 18;
private GuideScene nextScene; private GuideScene nextScene;
private SceneFilter sceneFilter; private SceneFilter sceneFilter;
private GuideSceneLifecycle lifecycle; private GuideSceneLifecycle lifecycle;
@ -34,12 +41,15 @@ public abstract class AbstractGuideScene extends JPanel implements GuideScene {
private List<Component> targetList; private List<Component> targetList;
private List<Component> highlightList; private List<Component> highlightList;
private Component nextButton; private Component nextButton;
private List<Point[]> pointsList;
public AbstractGuideScene() { public AbstractGuideScene() {
this.setLayout(null); this.setLayout(null);
this.setOpaque(false); this.setOpaque(false);
targetList = new ArrayList<>(); targetList = new ArrayList<>();
highlightList = new ArrayList<>(); highlightList = new ArrayList<>();
pointsList = new ArrayList<>();
} }
/** /**
@ -65,15 +75,8 @@ public abstract class AbstractGuideScene extends JPanel implements GuideScene {
} else if (component instanceof Window){ } else if (component instanceof Window){
Window window = (Window) component; Window window = (Window) component;
window.toFront(); window.toFront();
window.requestFocus();
image = ScreenImage.createImage(component); image = ScreenImage.createImage(component);
SwingUtilities.invokeLater(new Runnable() { showContainer();
@Override
public void run() {
container.toFront();
container.requestFocus();
}
});
} else { } else {
image = captureImage(component); image = captureImage(component);
} }
@ -82,6 +85,7 @@ public abstract class AbstractGuideScene extends JPanel implements GuideScene {
return true; return true;
} catch (AWTException e) { } catch (AWTException e) {
e.printStackTrace(); e.printStackTrace();
GuideManager.getInstance().getCurrentGuide().terminate();
return false; return false;
} }
} }
@ -100,6 +104,7 @@ public abstract class AbstractGuideScene extends JPanel implements GuideScene {
return true; return true;
} catch (AWTException e) { } catch (AWTException e) {
e.printStackTrace(); e.printStackTrace();
GuideManager.getInstance().getCurrentGuide().terminate();
return false; return false;
} }
} }
@ -131,6 +136,7 @@ public abstract class AbstractGuideScene extends JPanel implements GuideScene {
return true; return true;
} catch (AWTException e) { } catch (AWTException e) {
e.printStackTrace(); e.printStackTrace();
GuideManager.getInstance().getCurrentGuide().terminate();
return false; return false;
} }
} }
@ -184,6 +190,7 @@ public abstract class AbstractGuideScene extends JPanel implements GuideScene {
showContainer(); showContainer();
return image; return image;
} }
private void showContainer() { private void showContainer() {
SwingUtilities.invokeLater(new Runnable() { SwingUtilities.invokeLater(new Runnable() {
@Override @Override
@ -249,6 +256,10 @@ public abstract class AbstractGuideScene extends JPanel implements GuideScene {
this.add(tip.getTip()); this.add(tip.getTip());
} }
public void addLineArrow(Point... points) {
pointsList.add(points);
}
public void setContainer(GuideView container) { public void setContainer(GuideView container) {
this.container = container; this.container = container;
} }
@ -271,6 +282,7 @@ public abstract class AbstractGuideScene extends JPanel implements GuideScene {
@Override @Override
public void start() { public void start() {
clear(); clear();
showContainer();
if (lifecycle != null && !lifecycle.prepared()) { if (lifecycle != null && !lifecycle.prepared()) {
return; return;
} }
@ -310,26 +322,26 @@ public abstract class AbstractGuideScene extends JPanel implements GuideScene {
public void complete() { public void complete() {
container.getLayeredPane().remove(this); container.getLayeredPane().remove(this);
container.repaint(); container.repaint();
SwingUtilities.invokeLater(new Runnable() {
if (lifecycle != null) { @Override
lifecycle.onComplete(); public void run() {
} if (lifecycle != null) {
if (sceneFilter != null) { lifecycle.onComplete();
nextScene = sceneFilter.getFilterScene(); }
} if (sceneFilter != null) {
if (nextScene != null) { nextScene = sceneFilter.getFilterScene();
if (nextScene instanceof AbstractGuideScene) { }
((AbstractGuideScene) nextScene).setContainer(container); if (nextScene != null) {
} if (nextScene instanceof AbstractGuideScene) {
SwingUtilities.invokeLater(new Runnable() { ((AbstractGuideScene) nextScene).setContainer(container);
@Override }
public void run() {
nextScene.start(); nextScene.start();
} else {
GuideManager.getInstance().getCurrentGuide().complete();
} }
});
} else { }
GuideManager.getInstance().getCurrentGuide().complete(); });
}
} }
@Override @Override
@ -383,4 +395,87 @@ public abstract class AbstractGuideScene extends JPanel implements GuideScene {
invalidate(); invalidate();
repaint(); repaint();
} }
@Override
public void paint(Graphics g) {
super.paint(g);
if (pointsList.isEmpty()) {
return;
}
Graphics2D g2d = (Graphics2D) g;
Composite oldComposite = g2d.getComposite();
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER));
g2d.setColor(Color.WHITE);
for (Point[] points : pointsList) {
if (points.length <= 1) {
continue;
}
Point startPoint = points[0];
Point endPoint = startPoint;
for (int index = 1; index < points.length; index++) {
startPoint = endPoint;
endPoint = points[index];
g2d.drawLine(startPoint.x, startPoint.y, endPoint.x, endPoint.y);
}
drawArrow(g2d, startPoint, endPoint);
}
g2d.setComposite(oldComposite);
}
/**
* 根据最后两点坐标计算出三角箭头的三个点坐标绘制箭头
* 这里实现以终点坐标为坐标轴圆点计算
* @param start 起始点坐标
* @param end 重点坐标
*/
private void drawArrow(Graphics2D g2d, Point start, Point end) {
try{
double dealtPointX = start.x - end.x;
double dealtPointY = -(start.y - end.y);
double pointDistance = calDistance(dealtPointX, dealtPointY);
double triangleHeight = Math.min(DEFAULT_ARROW_HEIGHT, pointDistance);
double triangleWidth = triangleHeight * (DEFAULT_ARROW_WIDTH / 2) / DEFAULT_ARROW_WIDTH;
if (triangleHeight < 1 || triangleWidth < 1 || pointDistance < 1) {
return;
}
double pointAngle;
double abs = 1;
if (dealtPointX == 0) {
pointAngle = Math.PI / 2;
} else {
pointAngle = Math.atan(dealtPointY / dealtPointX);
}
if (dealtPointY < 0) {
pointAngle += Math.PI;
abs = -1;
}
double deltaAngle = Math.atan(triangleWidth / triangleHeight);
double triangleDistance = calDistance(triangleWidth, triangleHeight);
Point p1 =calPoint(end, triangleDistance, pointAngle - deltaAngle, abs);
Point p2 = calPoint(end, triangleDistance, pointAngle + deltaAngle, abs);
int xPoints[] = {end.x, p1.x, p2.x};
int yPoints[] = {end.y, p1.y, p2.y};
g2d.fillPolygon(xPoints, yPoints, 3);
} catch (Exception e) {
e.printStackTrace();
GuideManager.getInstance().getCurrentGuide().terminate();
}
}
private double calDistance(double x, double y) {
return Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2));
}
private Point calPoint(Point relativePoint, double distance, double angle, double abs) {
int x = (int)(relativePoint.x + abs * distance * Math.cos(angle));
int y = (int)(relativePoint.y - abs * distance * Math.sin(angle));
return new Point(x, y);
}
} }

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

@ -1,5 +1,7 @@
package com.fr.design.mainframe.guide.scene; package com.fr.design.mainframe.guide.scene;
import com.fr.design.mainframe.guide.base.GuideManager;
import java.awt.Component; import java.awt.Component;
import java.awt.Point; import java.awt.Point;
import java.awt.Rectangle; import java.awt.Rectangle;
@ -87,4 +89,13 @@ public class ClickScene extends AbstractGuideScene{
.getWhen(), e.getModifiers(), e.getX(), .getWhen(), e.getModifiers(), e.getX(),
e.getY(), e.getClickCount(), e.isPopupTrigger())); e.getY(), e.getClickCount(), e.isPopupTrigger()));
} }
@Override
public void showScene() {
super.showScene();
// 交互类的 scene 如果没有高亮内容块载,需要及时终止Guide,否则就没法去掉模态框影响到设计器主功能的使用了
if (this.getComponentCount() == 0) {
GuideManager.getInstance().getCurrentGuide().terminate();
}
}
} }

16
designer-base/src/main/java/com/fr/design/mainframe/guide/tip/BubbleTip.java

@ -1,11 +1,16 @@
package com.fr.design.mainframe.guide.tip; package com.fr.design.mainframe.guide.tip;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.DesignerFrame;
import com.fr.design.mainframe.guide.base.Guide; import com.fr.design.mainframe.guide.base.Guide;
import com.fr.design.mainframe.guide.base.GuideManager; import com.fr.design.mainframe.guide.base.GuideManager;
import com.fr.design.mainframe.guide.ui.bubble.Bubble; import com.fr.design.mainframe.guide.ui.bubble.Bubble;
import com.fr.design.mainframe.guide.ui.bubble.BubbleWithClose; import com.fr.design.mainframe.guide.ui.bubble.BubbleWithClose;
import javax.swing.JComponent; import javax.swing.JComponent;
import javax.swing.JOptionPane;
import java.awt.Point; import java.awt.Point;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
@ -28,7 +33,16 @@ public class BubbleTip implements GuideTip {
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
Guide currentGuide = GuideManager.getInstance().getCurrentGuide(); Guide currentGuide = GuideManager.getInstance().getCurrentGuide();
if (currentGuide != null) { if (currentGuide != null) {
currentGuide.terminate();
int returnVal = FineJOptionPane.showConfirmDialog(
currentGuide.getGuideView(),
"确认退出当前教学引导?",
Toolkit.i18nText("Fine-Design_Basic_Confirm"),
JOptionPane.YES_NO_OPTION,
JOptionPane.QUESTION_MESSAGE);
if (returnVal == JOptionPane.YES_OPTION) {
currentGuide.terminate();
}
} }
} }
}); });

2
designer-base/src/main/java/com/fr/design/mainframe/guide/ui/GuideCompleteDialog.java

@ -46,6 +46,7 @@ public class GuideCompleteDialog extends JDialog {
super(window); super(window);
setSize(DIALOG_WIDTH, DIALOG_HEIGHT); setSize(DIALOG_WIDTH, DIALOG_HEIGHT);
setUndecorated(true); setUndecorated(true);
setModal(true);
setLocationRelativeTo(window); setLocationRelativeTo(window);
this.setContentPane(getContentPane()); this.setContentPane(getContentPane());
} }
@ -94,7 +95,6 @@ public class GuideCompleteDialog extends JDialog {
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
setVisible(false); setVisible(false);
dispose(); dispose();
GuideManageDialog.getInstance().showDialog();
} }
}); });

19
designer-base/src/main/java/com/fr/design/mainframe/guide/ui/GuideManageDialog.java

@ -11,6 +11,7 @@ import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.guide.base.Guide; import com.fr.design.mainframe.guide.base.Guide;
import com.fr.design.mainframe.guide.base.GuideGroup; import com.fr.design.mainframe.guide.base.GuideGroup;
import com.fr.design.mainframe.guide.base.GuideManager; import com.fr.design.mainframe.guide.base.GuideManager;
import com.fr.design.mainframe.guide.base.GuideVersion;
import com.fr.design.mainframe.guide.collect.GuideCollector; import com.fr.design.mainframe.guide.collect.GuideCollector;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
@ -56,6 +57,7 @@ public class GuideManageDialog extends JDialog {
private void initComponent() { private void initComponent() {
this.setTitle(Toolkit.i18nText("Fine-Design_Guide_Manager_Dialog_Title")); this.setTitle(Toolkit.i18nText("Fine-Design_Guide_Manager_Dialog_Title"));
setResizable(false); setResizable(false);
setModal(true);
setLayout(FRGUIPaneFactory.createBorderLayout()); setLayout(FRGUIPaneFactory.createBorderLayout());
setSize(DEFAULT_WIDTH, DEFAULT_HEIGHT); setSize(DEFAULT_WIDTH, DEFAULT_HEIGHT);
GUICoreUtils.centerWindow(this); GUICoreUtils.centerWindow(this);
@ -71,6 +73,15 @@ public class GuideManageDialog extends JDialog {
return scrollPane; return scrollPane;
} }
private JPanel createGuideVersionPane(GuideVersion guideVersion) {
JPanel expandContent = FRGUIPaneFactory.createVerticalFlowLayout_Pane(true, VerticalFlowLayout.TOP, 0, 5);
for (GuideGroup guideGroup : guideVersion.getGuideGroupList()) {
JPanel guideGroupCard = createGuideGroupCard(guideGroup);
expandContent.add(guideGroupCard);
}
ExpandPane expandPane = new ExpandPane(Toolkit.i18nText("Fine-Design_Guide_Manager_Dialog_Version_Title", guideVersion.getVersion()), expandContent);
return expandPane;
}
private JPanel createGuideGroupCard(GuideGroup guideGroup) { private JPanel createGuideGroupCard(GuideGroup guideGroup) {
@ -213,13 +224,9 @@ public class GuideManageDialog extends JDialog {
private void resetScrollContent() { private void resetScrollContent() {
scrollContent.removeAll(); scrollContent.removeAll();
JPanel expandContent = FRGUIPaneFactory.createVerticalFlowLayout_Pane(true, VerticalFlowLayout.TOP, 0, 5); for (GuideVersion guideVersion : GuideManager.getInstance().getGuideVersionList()) {
for (GuideGroup guideGroup : GuideManager.getInstance().getGuideGroupList()) { scrollContent.add(createGuideVersionPane(guideVersion));
JPanel guideGroupCard = createGuideGroupCard(guideGroup);
expandContent.add(guideGroupCard);
} }
ExpandPane expandPane = new ExpandPane(Toolkit.i18nText("Fine-Design_Guide_Manager_Dialog_Version_Title", "11.0.0"), expandContent);
scrollContent.add(expandPane);
revalidate(); revalidate();
repaint(); repaint();
} }

2
designer-base/src/main/java/com/fr/design/mainframe/guide/utils/ScreenImage.java

@ -61,7 +61,7 @@ public class ScreenImage {
BufferedImage image = new BufferedImage(region.width, region.height, BufferedImage.TYPE_INT_RGB); BufferedImage image = new BufferedImage(region.width, region.height, BufferedImage.TYPE_INT_RGB);
Graphics2D g2d = image.createGraphics(); Graphics2D g2d = image.createGraphics();
g2d.drawImage(createImage(component), 0, 0, null); g2d.drawImage(createImage(component), 0, 0, null);
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.5f)); g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.4f));
g2d.setColor(Color.BLACK); g2d.setColor(Color.BLACK);
g2d.fillRect(0, 0, region.width, region.height); g2d.fillRect(0, 0, region.width, region.height);
g2d.dispose(); g2d.dispose();

10
designer-form/src/main/java/com/fr/design/widget/ui/designer/NewFormPane.java

@ -69,9 +69,7 @@ public class NewFormPane extends BasicPane {
dialog.addDialogActionListener(new DialogActionListener() { dialog.addDialogActionListener(new DialogActionListener() {
@Override @Override
public void doOk() { public void doOk() {
if (selectedLayoutPane != null) { createLayoutForm();
NewFormPane.this.newForm(selectedLayoutPane.getTemplatePath());
}
} }
@Override @Override
@ -85,6 +83,12 @@ public class NewFormPane extends BasicPane {
dialog.setResizable(false); dialog.setResizable(false);
} }
public void createLayoutForm() {
if (selectedLayoutPane != null) {
NewFormPane.this.newForm(selectedLayoutPane.getTemplatePath());
}
}
@Override @Override
protected String title4PopupWindow() { protected String title4PopupWindow() {
return Toolkit.i18nText("Fine-Design_New_Template"); return Toolkit.i18nText("Fine-Design_New_Template");

4
designer-realize/src/main/java/com/fr/design/mainframe/guide/GuideIds.java

@ -1,6 +1,10 @@
package com.fr.design.mainframe.guide; package com.fr.design.mainframe.guide;
public class GuideIds { public class GuideIds {
public static class GuideVersion {
public static final String V11_0_0 = "11.0.0";
}
public static class GuideGroup { public static class GuideGroup {
public static final String F01 = "F01"; public static final String F01 = "F01";
public static final String F02 = "F02"; public static final String F02 = "F02";

4
designer-realize/src/main/java/com/fr/design/mainframe/guide/GuideRegister.java

@ -17,8 +17,8 @@ public class GuideRegister {
} }
private static void registerGroup() { private static void registerGroup() {
GuideManager.getInstance().addGuideGroup(new GuideGroup(GuideIds.GuideGroup.F01, Toolkit.i18nText("Fine-Design_Guide_Group_F01_Name"))); GuideManager.getInstance().addGuideGroup(GuideIds.GuideVersion.V11_0_0, new GuideGroup(GuideIds.GuideGroup.F01, Toolkit.i18nText("Fine-Design_Guide_Group_F01_Name")));
GuideManager.getInstance().addGuideGroup(new GuideGroup(GuideIds.GuideGroup.F02, Toolkit.i18nText("Fine-Design_Guide_Group_F02_Name"))); GuideManager.getInstance().addGuideGroup(GuideIds.GuideVersion.V11_0_0, new GuideGroup(GuideIds.GuideGroup.F02, Toolkit.i18nText("Fine-Design_Guide_Group_F02_Name")));
} }
private static void registerGuide() { private static void registerGuide() {

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

@ -145,7 +145,7 @@ public class UseLayoutAndComponentGuide {
public boolean prepared() { public boolean prepared() {
Component component = ComponentUtils.findComponentByName(newFormPane.getWindow().getContentPane(), UIDialog.OK_BUTTON); Component component = ComponentUtils.findComponentByName(newFormPane.getWindow().getContentPane(), UIDialog.OK_BUTTON);
if (component != null) { if (component != null) {
scene.addClickTarget(component, ClickScene.ClickType.LEFT, true); scene.addClickTarget(component, ClickScene.ClickType.LEFT);
scene.addBubbleTip(Toolkit.i18nText("Fine-Design_Guide_Scene_F001001_Tip_Click_Confirm"), GuideTip.Direction.TOP); scene.addBubbleTip(Toolkit.i18nText("Fine-Design_Guide_Scene_F001001_Tip_Click_Confirm"), GuideTip.Direction.TOP);
} }
return super.prepared(); return super.prepared();
@ -153,6 +153,7 @@ public class UseLayoutAndComponentGuide {
@Override @Override
public void onComplete() { public void onComplete() {
newFormPane.createLayoutForm();
newFormPane.getWindow().dispose(); newFormPane.getWindow().dispose();
} }
}); });

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

@ -53,8 +53,10 @@ public class ThemeToggleGuide {
scene1.nextScene(createScene2()) scene1.nextScene(createScene2())
.nextScene(createScene3()) .nextScene(createScene3())
.nextScene(createScene4()) .nextScene(createScene4())
.nextScene(GuideSceneHelper.createFormDesignerBodyDisplayScene())
.nextScene(createScene5()) .nextScene(createScene5())
.nextScene(createScene6()) .nextScene(createScene6())
.nextScene(GuideSceneHelper.createFormDesignerBodyDisplayScene())
.nextScene(GuideSceneHelper.createPreviewClickScene()); .nextScene(GuideSceneHelper.createPreviewClickScene());
Guide guide = GuideBuilder.newInstance() Guide guide = GuideBuilder.newInstance()
@ -115,11 +117,6 @@ public class ThemeToggleGuide {
return true; return true;
} }
public void onShow() {
GuideManager.getInstance().getCurrentGuide().getGuideView().toFront(); // brings to front without needing to setAlwaysOnTop
GuideManager.getInstance().getCurrentGuide().getGuideView().requestFocus();
}
@Override @Override
public void onComplete() { public void onComplete() {
@ -164,22 +161,23 @@ public class ThemeToggleGuide {
} }
private static GuideScene createScene5() { private static GuideScene createScene5() {
DisplayScene scene = new DisplayScene(); ClickScene scene = new ClickScene();
scene.registerLifecycle(new GuideSceneLifecycleAdaptor() { scene.registerLifecycle(new GuideSceneLifecycleAdaptor() {
@Override @Override
public boolean prepared() { public boolean prepared() {
JForm jForm = (JForm) DesignerContext.getDesignerFrame().getSelectedJTemplate(); XCreator xCreator = GuideCreateUtils.getXCreatorFormDesigner("chart00");
scene.addTarget(jForm.getFormDesign()); scene.addClickTarget(GuideCreateUtils.getFormDesigner(), GuideCreateUtils.getXCreatorBoundsRelative2FormDesigner(xCreator), ClickScene.ClickType.LEFT);
return true; scene.addBubbleTip("选择此模板", BubbleTip.Direction.BOTTOM);
return super.prepared();
} }
@Override @Override
public void onShow() { public void onComplete() {
JForm jForm = (JForm) DesignerContext.getDesignerFrame().getSelectedJTemplate(); super.onComplete();
FormDesigner designer = jForm.getFormDesign(); FormDesigner designer = GuideCreateUtils.getFormDesigner();
XCreator xCreator = (XCreator) designer.getRootComponent().getComponent(0); XCreator xCreator = GuideCreateUtils.getXCreatorFormDesigner("chart00");
jForm.getFormDesign().getSelectionModel().reset(); designer.getSelectionModel().reset();
jForm.getFormDesign().getSelectionModel().selectACreator(xCreator); designer.getSelectionModel().selectACreator(xCreator);
} }
}); });
return scene; return scene;
@ -191,26 +189,27 @@ public class ThemeToggleGuide {
scene.registerLifecycle(new GuideSceneLifecycleAdaptor() { scene.registerLifecycle(new GuideSceneLifecycleAdaptor() {
@Override @Override
public boolean prepared() { public boolean prepared() {
JForm jForm = (JForm) DesignerContext.getDesignerFrame().getSelectedJTemplate(); new Timer().schedule(new TimerTask() {
FormDesigner designer = jForm.getFormDesign(); @Override
XCreator xCreator = (XCreator) designer.getRootComponent().getComponent(0); public void run() {
scene.addTarget(designer, GuideCreateUtils.getXCreatorBoundsRelative2FormDesigner(xCreator)); Component target2 = ComponentUtils.findComponentByClass(EastRegionContainerPane.getInstance(), FollowingThemePane.class);
target2 = ComponentUtils.findComponentByClass(target2, UIButtonGroup.class);
Component target2 = ComponentUtils.findComponentByClass(EastRegionContainerPane.getInstance(), FollowingThemePane.class); if (target2 != null) {
target2 = ComponentUtils.findComponentByClass(target2, UIButtonGroup.class); uiButtonGroup[0] = (UIButtonGroup) target2;
if (target2 != null) { target2 = ((UIButtonGroup) target2).getButton(0);
uiButtonGroup[0] = (UIButtonGroup) target2; scene.addClickTarget(target2, ClickScene.ClickType.LEFT);
target2 = ((UIButtonGroup) target2).getButton(0); scene.addBubbleTip(
scene.addClickTarget(target2, ClickScene.ClickType.LEFT); Toolkit.i18nText("Fine-Design_Guide_Scene_F002001_Tip_Toggle_Follow_Theme"),
scene.addBubbleTip( Toolkit.i18nText("Fine-Design_Guide_Scene_F002001_Tip_Toggle_Follow_Theme_Description"),
Toolkit.i18nText("Fine-Design_Guide_Scene_F002001_Tip_Toggle_Follow_Theme"), GuideTip.Direction.BOTTOM,
Toolkit.i18nText("Fine-Design_Guide_Scene_F002001_Tip_Toggle_Follow_Theme_Description"), 0.5f,
GuideTip.Direction.BOTTOM, 0.8f
0.5f, );
0.8f scene.showScene();
); }
} }
return true; },1000);
return false;
} }
@Override @Override
@ -232,6 +231,5 @@ public class ThemeToggleGuide {
if (!themeDialog.isVisible()) { if (!themeDialog.isVisible()) {
themeDialog.setVisible(true); themeDialog.setVisible(true);
} }
themeDialog.requestFocus();
} }
} }

Loading…
Cancel
Save