Browse Source

Pull request #6060: REPORT-57813 修改部分门槛用例发现的问题

Merge in DESIGN/design from ~TOMMY/design:feature/x to feature/x

* commit 'd664ad5a1e74768de4c67ec2c1761f98cbe6dab1':
  REPORT-57813 遗漏代码
  REPORT-57813 部分门槛问题
  REPORT-57813 修改部分门槛用例发现的问题
research/11.0
Tommy 3 years ago
parent
commit
c41bb1c3fc
  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. 154
      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. 13
      designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/GuideCreateUtils.java
  15. 26
      designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/GuideSceneHelper.java
  16. 3
      designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/layout/UseLayoutAndComponentGuide.java
  17. 79
      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.scene.GuideScene;
import com.fr.design.mainframe.guide.ui.GuideCompleteDialog;
import com.fr.design.mainframe.guide.ui.GuideManageDialog;
import com.fr.stable.StringUtils;
import javax.swing.SwingUtilities;
@ -94,6 +95,10 @@ public class Guide {
* 开启引导流程
*/
public void go() {
// 同时只能启动一个引导
if (GuideManager.getInstance().getCurrentGuide() != null) {
return;
}
try {
if (lifecycle != null && !lifecycle.prepared()) {
return;
@ -131,8 +136,9 @@ public class Guide {
}
setComplete(true);
GuideCollector.getInstance().saveInfo();
end();
guideView.dismissGuide();
GuideCompleteDialog.getInstance().showDialog(getName());
end();
}
public void terminate() {
@ -148,6 +154,7 @@ public class Guide {
if (lifecycle != null) {
lifecycle.onEnd();
}
GuideManageDialog.getInstance().showDialog();
}
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;
public class GuideManager {
private Guide currentGuide;
private List<GuideGroup> guideGroupList;
private static GuideManager guideManager;
private Guide currentGuide;
private List<GuideVersion> guideVersionList;
public static GuideManager getInstance() {
if (guideManager == null) {
guideManager = new GuideManager();
@ -19,7 +20,7 @@ public class GuideManager {
}
public GuideManager() {
guideGroupList = new ArrayList<>();
guideVersionList = new ArrayList<>();
}
public Guide getCurrentGuide() {
@ -30,57 +31,77 @@ public class GuideManager {
this.currentGuide = currentGuide;
}
public void addGuideGroup(GuideGroup guideGroup) {
this.guideGroupList.add(guideGroup);
public void addGuideGroup(String version, GuideGroup 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) {
for (GuideGroup group : guideGroupList) {
if (StringUtils.equals(groupId, group.getID())) {
group.addGuide(guide);
}
GuideGroup guideGroup = getGuideGroup(groupId);
if (guideGroup != null) {
guideGroup.addGuide(guide);
}
}
public List<GuideGroup> getGuideGroupList() {
return guideGroupList;
public List<GuideVersion> getGuideVersionList() {
return guideVersionList;
}
public List<Guide> getAllGuide() {
List<Guide> guideList = new ArrayList<>();
for (GuideGroup group : getGuideGroupList()) {
for (Guide guide : group.getGuideList()) {
guideList.add(guide);
for (GuideVersion version : guideVersionList) {
for (GuideGroup group : version.getGuideGroupList()) {
for (Guide guide : group.getGuideList()) {
guideList.add(guide);
}
}
}
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) {
for (GuideGroup group : getGuideGroupList()) {
if (StringUtils.equals(groupId, group.getID())) {
return group;
for (GuideVersion version : guideVersionList) {
for (GuideGroup group : version.getGuideGroupList()) {
if (StringUtils.equals(groupId, group.getID())) {
return group;
}
}
}
return null;
}
public Guide getGuide(String guideId) {
for (GuideGroup group : getGuideGroupList()) {
for (Guide guide : group.getGuideList()) {
if (StringUtils.equals(guideId, guide.getID())) {
return guide;
for (GuideVersion version : guideVersionList) {
for (GuideGroup group : version.getGuideGroupList()) {
for (Guide guide : group.getGuideList()) {
if (StringUtils.equals(guideId, guide.getID())) {
return guide;
}
}
}
}
return null;
}
public void completeAll() {
for (GuideGroup group : getGuideGroupList()) {
for (Guide guide : group.getGuideList()) {
guide.setComplete(true);
for (GuideVersion version : guideVersionList) {
for (GuideGroup group : version.getGuideGroupList()) {
for (Guide guide : group.getGuideList()) {
guide.setComplete(true);
}
}
}
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.GuideScene;
import javax.swing.JWindow;
import javax.swing.JDialog;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Window;
import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.ComponentListener;
import java.awt.event.WindowEvent;
import java.awt.event.WindowFocusListener;
public class GuideView extends JWindow{
public class GuideView extends JDialog {
private static GuideView guideView;
private Guide invoker;
private GuideScene scene;
@ -33,54 +32,43 @@ public class GuideView extends JWindow{
public GuideView(Window window) {
super(window);
this.setUndecorated(true);
this.window = window;
this.modalColor = Color.BLACK;
this.modalOpacity = 0.6f;
this.modalOpacity = 0.4f;
this.setPreferredSize(window.getSize());
this.setSize(window.getSize());
this.setLayout(FRGUIPaneFactory.createBorderLayout());
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) {
this(DesignerContext.getDesignerFrame());
this(window);
this.invoker = guide;
}
@ -107,6 +95,8 @@ public class GuideView extends JWindow{
}
public void showGuide() {
window.addComponentListener(componentListener);
window.addWindowFocusListener(windowFocusListener);
this.setLocationRelativeTo(window);
this.setSize(window.getSize());
this.setLocation(window.getLocation());
@ -119,10 +109,12 @@ public class GuideView extends JWindow{
}
public void dismissGuide() {
window.removeComponentListener(componentListener);
window.removeWindowFocusListener(windowFocusListener);
this.getLayeredPane().removeAll();
revalidate();
repaint();
this.setVisible(false);
setVisible(false);
}
@Override

154
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.SwingUtilities;
import java.awt.AWTException;
import java.awt.AlphaComposite;
import java.awt.Color;
import java.awt.Component;
import java.awt.Composite;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.Window;
@ -27,6 +31,9 @@ import java.util.ArrayList;
import java.util.List;
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 SceneFilter sceneFilter;
private GuideSceneLifecycle lifecycle;
@ -34,12 +41,15 @@ public abstract class AbstractGuideScene extends JPanel implements GuideScene {
private List<Component> targetList;
private List<Component> highlightList;
private Component nextButton;
private List<Point[]> pointsList;
public AbstractGuideScene() {
this.setLayout(null);
this.setOpaque(false);
targetList = new ArrayList<>();
highlightList = new ArrayList<>();
pointsList = new ArrayList<>();
}
/**
@ -62,26 +72,16 @@ public abstract class AbstractGuideScene extends JPanel implements GuideScene {
if (component instanceof JComponent) {
JComponent jComponent = (JComponent) component;
image = ScreenImage.createImage(jComponent);
} else if (component instanceof Window){
Window window = (Window) component;
window.toFront();
window.requestFocus();
image = ScreenImage.createImage(component);
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
container.toFront();
container.requestFocus();
}
});
} else {
image = captureImage(component);
showContainer();
}
targetList.add(component);
highlightList.add(getTargetComponentWithImage(image, rectangle));
return true;
} catch (AWTException e) {
e.printStackTrace();
GuideManager.getInstance().getCurrentGuide().terminate();
return false;
}
}
@ -94,12 +94,12 @@ public abstract class AbstractGuideScene extends JPanel implements GuideScene {
public boolean addTarget(Rectangle rectangle) {
try {
targetList.add(null);
container.setVisible(false);
BufferedImage image = captureImage(rectangle);
highlightList.add(getTargetComponentWithImage(image, rectangle));
return true;
} catch (AWTException e) {
e.printStackTrace();
GuideManager.getInstance().getCurrentGuide().terminate();
return false;
}
}
@ -116,6 +116,8 @@ public abstract class AbstractGuideScene extends JPanel implements GuideScene {
return false;
}
Point point = SwingUtilities.convertPoint(component,0,0, container.getRootPane());
origin = origin.intersection(new Rectangle(0,0,component.getWidth(), component.getHeight()));
Rectangle rectangle = new Rectangle(point.x + origin.x, point.y + origin.y, origin.width, origin.height);
BufferedImage image;
@ -131,6 +133,7 @@ public abstract class AbstractGuideScene extends JPanel implements GuideScene {
return true;
} catch (AWTException e) {
e.printStackTrace();
GuideManager.getInstance().getCurrentGuide().terminate();
return false;
}
}
@ -184,6 +187,7 @@ public abstract class AbstractGuideScene extends JPanel implements GuideScene {
showContainer();
return image;
}
private void showContainer() {
SwingUtilities.invokeLater(new Runnable() {
@Override
@ -249,6 +253,10 @@ public abstract class AbstractGuideScene extends JPanel implements GuideScene {
this.add(tip.getTip());
}
public void addLineArrow(Point... points) {
pointsList.add(points);
}
public void setContainer(GuideView container) {
this.container = container;
}
@ -271,6 +279,7 @@ public abstract class AbstractGuideScene extends JPanel implements GuideScene {
@Override
public void start() {
clear();
showContainer();
if (lifecycle != null && !lifecycle.prepared()) {
return;
}
@ -310,26 +319,26 @@ public abstract class AbstractGuideScene extends JPanel implements GuideScene {
public void complete() {
container.getLayeredPane().remove(this);
container.repaint();
if (lifecycle != null) {
lifecycle.onComplete();
}
if (sceneFilter != null) {
nextScene = sceneFilter.getFilterScene();
}
if (nextScene != null) {
if (nextScene instanceof AbstractGuideScene) {
((AbstractGuideScene) nextScene).setContainer(container);
}
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
if (lifecycle != null) {
lifecycle.onComplete();
}
if (sceneFilter != null) {
nextScene = sceneFilter.getFilterScene();
}
if (nextScene != null) {
if (nextScene instanceof AbstractGuideScene) {
((AbstractGuideScene) nextScene).setContainer(container);
}
nextScene.start();
} else {
GuideManager.getInstance().getCurrentGuide().complete();
}
});
} else {
GuideManager.getInstance().getCurrentGuide().complete();
}
}
});
}
@Override
@ -383,4 +392,87 @@ public abstract class AbstractGuideScene extends JPanel implements GuideScene {
invalidate();
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;
import com.fr.design.mainframe.guide.base.GuideManager;
import java.awt.Component;
import java.awt.Point;
import java.awt.Rectangle;
@ -87,4 +89,13 @@ public class ClickScene extends AbstractGuideScene{
.getWhen(), e.getModifiers(), e.getX(),
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;
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.GuideManager;
import com.fr.design.mainframe.guide.ui.bubble.Bubble;
import com.fr.design.mainframe.guide.ui.bubble.BubbleWithClose;
import javax.swing.JComponent;
import javax.swing.JOptionPane;
import java.awt.Point;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
@ -28,7 +33,16 @@ public class BubbleTip implements GuideTip {
public void actionPerformed(ActionEvent e) {
Guide currentGuide = GuideManager.getInstance().getCurrentGuide();
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);
setSize(DIALOG_WIDTH, DIALOG_HEIGHT);
setUndecorated(true);
setModal(true);
setLocationRelativeTo(window);
this.setContentPane(getContentPane());
}
@ -94,7 +95,6 @@ public class GuideCompleteDialog extends JDialog {
public void actionPerformed(ActionEvent e) {
setVisible(false);
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.GuideGroup;
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.utils.gui.GUICoreUtils;
import com.fr.general.IOUtils;
@ -56,6 +57,7 @@ public class GuideManageDialog extends JDialog {
private void initComponent() {
this.setTitle(Toolkit.i18nText("Fine-Design_Guide_Manager_Dialog_Title"));
setResizable(false);
setModal(true);
setLayout(FRGUIPaneFactory.createBorderLayout());
setSize(DEFAULT_WIDTH, DEFAULT_HEIGHT);
GUICoreUtils.centerWindow(this);
@ -71,6 +73,15 @@ public class GuideManageDialog extends JDialog {
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) {
@ -213,13 +224,9 @@ public class GuideManageDialog extends JDialog {
private void resetScrollContent() {
scrollContent.removeAll();
JPanel expandContent = FRGUIPaneFactory.createVerticalFlowLayout_Pane(true, VerticalFlowLayout.TOP, 0, 5);
for (GuideGroup guideGroup : GuideManager.getInstance().getGuideGroupList()) {
JPanel guideGroupCard = createGuideGroupCard(guideGroup);
expandContent.add(guideGroupCard);
for (GuideVersion guideVersion : GuideManager.getInstance().getGuideVersionList()) {
scrollContent.add(createGuideVersionPane(guideVersion));
}
ExpandPane expandPane = new ExpandPane(Toolkit.i18nText("Fine-Design_Guide_Manager_Dialog_Version_Title", "11.0.0"), expandContent);
scrollContent.add(expandPane);
revalidate();
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);
Graphics2D g2d = image.createGraphics();
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.fillRect(0, 0, region.width, region.height);
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() {
@Override
public void doOk() {
if (selectedLayoutPane != null) {
NewFormPane.this.newForm(selectedLayoutPane.getTemplatePath());
}
createLayoutForm();
}
@Override
@ -85,6 +83,12 @@ public class NewFormPane extends BasicPane {
dialog.setResizable(false);
}
public void createLayoutForm() {
if (selectedLayoutPane != null) {
NewFormPane.this.newForm(selectedLayoutPane.getTemplatePath());
}
}
@Override
protected String title4PopupWindow() {
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;
public class GuideIds {
public static class GuideVersion {
public static final String V11_0_0 = "11.0.0";
}
public static class GuideGroup {
public static final String F01 = "F01";
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() {
GuideManager.getInstance().addGuideGroup(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.F01, Toolkit.i18nText("Fine-Design_Guide_Group_F01_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() {

13
designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/GuideCreateUtils.java

@ -3,7 +3,6 @@ package com.fr.design.mainframe.guide.creator;
import com.fr.design.designer.beans.models.AddingModel;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.designer.creator.XOccupiedLayout;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.FormCreatorDropTarget;
@ -18,17 +17,15 @@ import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils;
import com.fr.stable.project.ProjectConstants;
import com.fr.workspace.WorkContext;
import sun.java2d.xr.XcbRequestCounter;
import javax.swing.ImageIcon;
import javax.swing.JComponent;
import javax.swing.JDialog;
import javax.swing.JPopupMenu;
import javax.swing.SwingUtilities;
import java.awt.Component;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.event.MouseEvent;
import java.awt.image.BufferedImage;
import java.io.InputStream;
import java.util.UUID;
@ -42,7 +39,7 @@ public class GuideCreateUtils {
public static Rectangle getXCreatorBoundsRelative2FormDesigner(XCreator xCreator) {
FormDesigner designer = getFormDesigner();
Point point = SwingUtilities.convertPoint(xCreator, 0, 0, designer.getRootComponent());
return new Rectangle(point.x + designer.getPaintX(), point.y + designer.getPaintY(), xCreator.getWidth(), xCreator.getHeight());
return new Rectangle(point.x + designer.getPaintX() - designer.getHorizontalScaleValue(), point.y + designer.getPaintY(), xCreator.getWidth(), xCreator.getHeight());
}
public static XCreator getXCreatorFormDesigner(String name) {
@ -115,4 +112,10 @@ public class GuideCreateUtils {
public static void deleteGuideFile(String filePath) {
WorkContext.getWorkResource().delete(filePath);
}
public static void openDialogWithoutModal(JDialog dialog) {
dialog.setModal(false);
dialog.setVisible(true);
}
}

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

@ -1,6 +1,7 @@
package com.fr.design.mainframe.guide.creator;
import com.fr.design.actions.file.WebPreviewUtils;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.gui.ibutton.UIPreviewButton;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.CenterRegionContainerPane;
@ -11,6 +12,7 @@ import com.fr.design.mainframe.guide.scene.ClickScene;
import com.fr.design.mainframe.guide.scene.DisplayScene;
import com.fr.design.mainframe.guide.scene.GuideScene;
import com.fr.design.mainframe.guide.scene.GuideSceneLifecycleAdaptor;
import com.fr.design.mainframe.guide.tip.BubbleTip;
import com.fr.design.mainframe.guide.tip.GuideTip;
import com.fr.design.utils.ComponentUtils;
@ -60,4 +62,28 @@ public class GuideSceneHelper {
});
return scene;
}
public static GuideScene createSelectXCretorClickScene(String widgetName) {
ClickScene scene = new ClickScene();
scene.registerLifecycle(new GuideSceneLifecycleAdaptor() {
@Override
public boolean prepared() {
XCreator xCreator = GuideCreateUtils.getXCreatorFormDesigner(widgetName);
scene.addClickTarget(GuideCreateUtils.getFormDesigner(), GuideCreateUtils.getXCreatorBoundsRelative2FormDesigner(xCreator), ClickScene.ClickType.LEFT);
scene.addBubbleTip(Toolkit.i18nText("Fine-Design_Guide_Scene_Base_Tip_Select_Widget"), BubbleTip.Direction.BOTTOM);
return super.prepared();
}
@Override
public void onComplete() {
super.onComplete();
FormDesigner designer = GuideCreateUtils.getFormDesigner();
XCreator xCreator = GuideCreateUtils.getXCreatorFormDesigner(widgetName);
designer.getSelectionModel().reset();
designer.getSelectionModel().selectACreator(xCreator);
}
});
return scene;
}
}

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() {
Component component = ComponentUtils.findComponentByName(newFormPane.getWindow().getContentPane(), UIDialog.OK_BUTTON);
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);
}
return super.prepared();
@ -153,6 +153,7 @@ public class UseLayoutAndComponentGuide {
@Override
public void onComplete() {
newFormPane.createLayoutForm();
newFormPane.getWindow().dispose();
}
});

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

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

Loading…
Cancel
Save