diff --git a/designer-base/src/main/java/com/fr/design/mainframe/guide/base/GuideView.java b/designer-base/src/main/java/com/fr/design/mainframe/guide/base/GuideView.java index 7e141d7d5..f8b93e34c 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/guide/base/GuideView.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/guide/base/GuideView.java @@ -40,7 +40,6 @@ public class GuideView extends JDialog { this.setSize(window.getSize()); this.setLayout(FRGUIPaneFactory.createBorderLayout()); setBg(); - this.setGlassPane(new GuideLoadingGlassPane()); DesignerContext.getDesignerFrame().addWindowListener(new WindowAdapter() { @Override @@ -106,12 +105,16 @@ public class GuideView extends JDialog { } public void showLoading() { + this.setGlassPane(GuideLoadingGlassPane.getInstance()); + GuideLoadingGlassPane.getInstance().startLoading(); updateGuideViewLocation(); this.setVisible(true); + this.invalidate(); this.getGlassPane().setVisible(true); } public void hideLoading() { + GuideLoadingGlassPane.getInstance().stopLoading(); this.getGlassPane().setVisible(false); repaint(); SwingUtilities.invokeLater(new Runnable() { diff --git a/designer-base/src/main/java/com/fr/design/mainframe/guide/ui/GuideCompleteDialog.java b/designer-base/src/main/java/com/fr/design/mainframe/guide/ui/GuideCompleteDialog.java index af1854d7a..b90c5718c 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/guide/ui/GuideCompleteDialog.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/guide/ui/GuideCompleteDialog.java @@ -78,7 +78,7 @@ public class GuideCompleteDialog extends JDialog { title.setForeground(FONT_COLOR); textArea = new UITextPane(); - changeLineSpacing(textArea, 0.19f,false); + changeLineSpacing(textArea, 0.15f,false); textArea.setEnabled(false); textArea.setOpaque(false); textArea.setFont(CONTENT_FONT); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/guide/ui/GuideLoadingGlassPane.java b/designer-base/src/main/java/com/fr/design/mainframe/guide/ui/GuideLoadingGlassPane.java index 64017dfb7..47a10d0be 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/guide/ui/GuideLoadingGlassPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/guide/ui/GuideLoadingGlassPane.java @@ -9,11 +9,11 @@ import javax.swing.SwingConstants; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; +import java.awt.Font; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; public class GuideLoadingGlassPane extends JPanel { - private static final String loadingImagePath = "/com/fr/design/mainframe/guide/loading.gif"; private static GuideLoadingGlassPane loadingPane; public static GuideLoadingGlassPane getInstance() { @@ -32,16 +32,15 @@ public class GuideLoadingGlassPane extends JPanel { public void initComponent() { JPanel loadingView = FRGUIPaneFactory.createBorderLayout_S_Pane(); loadingView.setOpaque(false); - loadingView.setPreferredSize(new Dimension(130, 120)); + loadingView.setPreferredSize(new Dimension(150, 90)); JPanel imageContainer = FRGUIPaneFactory.createCenterFlowInnerContainer_S_Pane(); imageContainer.setOpaque(false); - ImagePanel imagePanel = new ImagePanel(loadingImagePath); - imagePanel.setOpaque(false); - imagePanel.setPreferredSize(new Dimension(84, 84)); - imageContainer.add(imagePanel); + + imageContainer.add(GuideLoadingPane.getInstance()); UILabel hintLabel = new UILabel(Toolkit.i18nText("Fine-Design_Guide_Loading_Wait")); + hintLabel.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 14)); hintLabel.setHorizontalAlignment(SwingConstants.CENTER); hintLabel.setForeground(Color.WHITE); @@ -50,4 +49,12 @@ public class GuideLoadingGlassPane extends JPanel { this.add(loadingView, new GridBagConstraints()); } + + public void startLoading() { + GuideLoadingPane.getInstance().start(); + } + + public void stopLoading() { + GuideLoadingPane.getInstance().stop(); + } } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/guide/ui/GuideLoadingPane.java b/designer-base/src/main/java/com/fr/design/mainframe/guide/ui/GuideLoadingPane.java new file mode 100644 index 000000000..0a290c784 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/guide/ui/GuideLoadingPane.java @@ -0,0 +1,98 @@ +package com.fr.design.mainframe.guide.ui; + +import javax.swing.JPanel; +import javax.swing.Timer; +import java.awt.AlphaComposite; +import java.awt.BasicStroke; +import java.awt.Color; +import java.awt.Composite; +import java.awt.Dimension; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Image; +import java.awt.Point; +import java.awt.RenderingHints; +import java.awt.Stroke; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +/** + * Created by kerry on 2020-10-23 + */ +public class GuideLoadingPane extends JPanel { + private static final BasicStroke STROKE = new BasicStroke(4); + private static final int FPS = 30; + private static final int START_ANGLE = 90; + private static GuideLoadingPane imagePanel; + private Image image; + private int angle; + private Timer timer; + + public static GuideLoadingPane getInstance() { + if (imagePanel == null) { + imagePanel = new GuideLoadingPane(); + } + return imagePanel; + } + + public GuideLoadingPane() { + this.setOpaque(false); + this.setPreferredSize(new Dimension(50, 50)); + timer = new Timer(1000 / FPS, new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + repaint(); + angle -= 180 / FPS; // 5 degrees per 100 ms = 50 degrees/second + if (angle > -270) { + angle += 2 * 360; + } + } + }); + } + + public void start() { + angle = START_ANGLE; + timer.start(); + } + + public void stop() { + timer.stop(); + } + + @Override + public void paintComponent(Graphics g) { + super.paintComponent(g); + Graphics2D g2 = (Graphics2D) g; + g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); + + Composite oldComposite = g2.getComposite(); + Stroke oldStroke = g2.getStroke(); + + g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER)); + + int d = Math.min(getWidth(), getHeight()); + int r = d / 2; + Point circlePoint = new Point(getWidth() / 2, getHeight() / 2); + + g2.setColor(Color.WHITE); + g2.fillOval(circlePoint.x - r, circlePoint.y - r, d, d); + + g2.setColor(Color.BLACK); + int waitCircleD = d / 10; + int waitCircleR = waitCircleD / 2; + + g2.fillOval(circlePoint.x - r / 3 - waitCircleR, circlePoint.y - waitCircleR, waitCircleD, waitCircleD); + g2.fillOval(circlePoint.x - waitCircleR, circlePoint.y - waitCircleR, waitCircleD, waitCircleD); + g2.fillOval(circlePoint.x + r / 3 - waitCircleR, circlePoint.y - waitCircleR, waitCircleD, waitCircleD); + + + g2.setStroke(STROKE); + g2.setColor(Color.decode("#419BF9")); + + int lineWidth = (int) STROKE.getLineWidth(); + g2.drawArc(circlePoint.x - r + lineWidth / 2 , circlePoint.y - r + lineWidth / 2, d - lineWidth, d - lineWidth, angle, -90); + + g2.setStroke(oldStroke); + g2.setComposite(oldComposite); + } +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/guide/ui/GuideManageDialog.java b/designer-base/src/main/java/com/fr/design/mainframe/guide/ui/GuideManageDialog.java index 98ea4c3c6..ca53613c4 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/guide/ui/GuideManageDialog.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/guide/ui/GuideManageDialog.java @@ -1,6 +1,7 @@ package com.fr.design.mainframe.guide.ui; +import com.fr.base.svg.IconUtils; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.ilable.UILabel; @@ -14,7 +15,6 @@ 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; import javax.swing.BorderFactory; import javax.swing.Icon; @@ -31,9 +31,9 @@ import java.awt.event.ActionListener; public class GuideManageDialog extends JDialog { private static final int DEFAULT_HEIGHT = 400; private static final int DEFAULT_WIDTH = 600; - private static final Icon GROUP_COMPLETE_NONE = IOUtils.readIcon("/com/fr/design/mainframe/guide/complete_none.png"); - private static final Icon GROUP_COMPLETE_SOME = IOUtils.readIcon("/com/fr/design/mainframe/guide/complete_some.png"); - private static final Icon GROUP_COMPLETE_ALL = IOUtils.readIcon("/com/fr/design/mainframe/guide/complete_all.png"); + private static final Icon GROUP_COMPLETE_NONE = IconUtils.readIcon("/com/fr/design/mainframe/guide/complete_none.svg"); + private static final Icon GROUP_COMPLETE_SOME = IconUtils.readIcon("/com/fr/design/mainframe/guide/complete_some.svg"); + private static final Icon GROUP_COMPLETE_ALL = IconUtils.readIcon("/com/fr/design/mainframe/guide/complete_all.svg"); private static final Color BORDER_COLOR = new Color(224, 224, 225); private static final Color UNCOMPLETE_FONT_COLOR = new Color(51, 51, 52); private static final Color COMPLETE_FONT_COLOR = new Color(51,51,52,128); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/guide/ui/ImagePanel.java b/designer-base/src/main/java/com/fr/design/mainframe/guide/ui/ImagePanel.java deleted file mode 100644 index deaf97417..000000000 --- a/designer-base/src/main/java/com/fr/design/mainframe/guide/ui/ImagePanel.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.fr.design.mainframe.guide.ui; - -import javax.swing.JPanel; -import java.awt.Graphics; -import java.awt.Image; -import java.awt.Toolkit; - -/** - * Created by kerry on 2020-10-23 - */ -public class ImagePanel extends JPanel { - - - private Image image; - - public ImagePanel(String imagePath) { - image = Toolkit.getDefaultToolkit().createImage(ImagePanel.class - .getResource(imagePath)); - } - - @Override - public void paintComponent(Graphics g) { - super.paintComponent(g); - if (image != null) { - g.drawImage(image, 0, 0, getWidth(), getHeight(), this); - } - } -} diff --git a/designer-base/src/main/resources/com/fr/design/mainframe/guide/complete_all.png b/designer-base/src/main/resources/com/fr/design/mainframe/guide/complete_all.png deleted file mode 100644 index c696cba4d..000000000 Binary files a/designer-base/src/main/resources/com/fr/design/mainframe/guide/complete_all.png and /dev/null differ diff --git a/designer-base/src/main/resources/com/fr/design/mainframe/guide/complete_all.svg b/designer-base/src/main/resources/com/fr/design/mainframe/guide/complete_all.svg new file mode 100644 index 000000000..f609eb9e5 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/mainframe/guide/complete_all.svg @@ -0,0 +1,18 @@ + + + 编组 7备份 4 + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/mainframe/guide/complete_none.png b/designer-base/src/main/resources/com/fr/design/mainframe/guide/complete_none.png deleted file mode 100644 index 4c6c6f2bb..000000000 Binary files a/designer-base/src/main/resources/com/fr/design/mainframe/guide/complete_none.png and /dev/null differ diff --git a/designer-base/src/main/resources/com/fr/design/mainframe/guide/complete_none.svg b/designer-base/src/main/resources/com/fr/design/mainframe/guide/complete_none.svg new file mode 100644 index 000000000..0e945f5a8 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/mainframe/guide/complete_none.svg @@ -0,0 +1,24 @@ + + + 编组 7备份 5 + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/mainframe/guide/complete_some.png b/designer-base/src/main/resources/com/fr/design/mainframe/guide/complete_some.png deleted file mode 100644 index b3443318b..000000000 Binary files a/designer-base/src/main/resources/com/fr/design/mainframe/guide/complete_some.png and /dev/null differ diff --git a/designer-base/src/main/resources/com/fr/design/mainframe/guide/complete_some.svg b/designer-base/src/main/resources/com/fr/design/mainframe/guide/complete_some.svg new file mode 100644 index 000000000..9cff96f2a --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/mainframe/guide/complete_some.svg @@ -0,0 +1,30 @@ + + + 编组 7备份 4 + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/GuideCreateUtils.java b/designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/GuideCreateUtils.java index 864459276..39c6b5574 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/GuideCreateUtils.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/GuideCreateUtils.java @@ -31,6 +31,7 @@ import javax.swing.JComponent; import javax.swing.JDialog; import javax.swing.JOptionPane; import javax.swing.JRootPane; +import javax.swing.JScrollPane; import javax.swing.SwingUtilities; import javax.swing.UIManager; import java.awt.BorderLayout; @@ -231,7 +232,7 @@ public class GuideCreateUtils { int returnVal = FineJOptionPane.showConfirmDialog( DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Guide_Option_Confirm_Not_Login"), - Toolkit.i18nText("Fine-Design_Basic_Confirm"), + Toolkit.i18nText("Fine-Design_Basic_Alert"), JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE); if (returnVal == JOptionPane.YES_OPTION) { @@ -243,16 +244,16 @@ public class GuideCreateUtils { FineJOptionPane.showMessageDialog( DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Guide_Option_Warning_Need_Network"), - Toolkit.i18nText("Fine-Design_Basic_Confirm"), + Toolkit.i18nText("Fine-Design_Basic_Alert"), JOptionPane.WARNING_MESSAGE); } public static void showNoFileAuthAlert() { FineJOptionPane.showMessageDialog( DesignerContext.getDesignerFrame(), - Toolkit.i18nText("Fine-Design_Basic_Warning_Template_Do_Not_Exsit"), - Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"), - JOptionPane.INFORMATION_MESSAGE + Toolkit.i18nText("Fine-Design_Guide_Option_Warning_No_Directory_Auth"), + Toolkit.i18nText("Fine-Design_Basic_Alert"), + JOptionPane.WARNING_MESSAGE ); } @@ -292,4 +293,14 @@ public class GuideCreateUtils { return dialog; } + public static JScrollPane getParentScrollPane(Component component) { + if (component.getParent() == null) { + return null; + } + if (component.getParent() instanceof JScrollPane) { + return (JScrollPane) component.getParent(); + } + return getParentScrollPane(component.getParent()); + } + } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/layout/ChangeLayoutComponentGuide.java b/designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/layout/ChangeLayoutComponentGuide.java index 6bf82065f..2058bf958 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/layout/ChangeLayoutComponentGuide.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/layout/ChangeLayoutComponentGuide.java @@ -35,10 +35,9 @@ public class ChangeLayoutComponentGuide { public static Guide createGuide() { GuideScene scene = createScene(); scene.nextScene(createScene2()) - .nextScene(createScene3()) .nextScene(GuideSceneHelper.createFormDesignerBodyDisplayScene()) - .nextScene(createScene4()) - .nextScene(createScene5()); + .nextScene(createScene3()) + .nextScene(createScene4()); Guide guide = GuideBuilder.newInstance() .setID(GuideIds.Guide.F001002) @@ -83,21 +82,6 @@ public class ChangeLayoutComponentGuide { } private static GuideScene createScene2() { - DisplayScene scene = new DisplayScene(); - scene.registerLifecycle(new GuideSceneLifecycleAdaptor() { - @Override - public boolean prepared() { - scene.addCustomTarget( - GuideCreateUtils.createTarget(switchButton.getComponentPopupMenu()), - GuideCreateUtils.getRelativeBounds(switchButton.getComponentPopupMenu(), switchButton,0, -switchButton.getComponentPopupMenu().getHeight()) - ); - return true; - } - }); - return scene; - } - - private static GuideScene createScene3() { ClickScene scene = new ClickScene(); scene.registerLifecycle(new GuideSceneLifecycleAdaptor() { @Override @@ -117,7 +101,7 @@ public class ChangeLayoutComponentGuide { return scene; } - private static GuideScene createScene4() { + private static GuideScene createScene3() { DragScene scene = new DragScene(); scene.registerLifecycle(new GuideSceneLifecycleAdaptor() { @Override @@ -158,7 +142,7 @@ public class ChangeLayoutComponentGuide { return scene; } - private static GuideScene createScene5() { + private static GuideScene createScene4() { DisplayScene scene = new DisplayScene(); scene.registerLifecycle(new GuideSceneLifecycleAdaptor() { @Override diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/layout/UseLayoutAndComponentGuide.java b/designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/layout/UseLayoutAndComponentGuide.java index 6d67f3b93..0a8c3abae 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/layout/UseLayoutAndComponentGuide.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/layout/UseLayoutAndComponentGuide.java @@ -1,18 +1,24 @@ package com.fr.design.mainframe.guide.creator.layout; +import com.fr.base.theme.FormTheme; +import com.fr.base.theme.FormThemeConfig; import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XOccupiedLayout; import com.fr.design.dialog.UIDialog; import com.fr.design.gui.imenu.UIHeadMenu; import com.fr.design.i18n.Toolkit; +import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.EastRegionContainerPane; import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.FormWidgetDetailPane; +import com.fr.design.mainframe.JForm; +import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.NorthRegionContainerPane; import com.fr.design.mainframe.guide.GuideIds; import com.fr.design.mainframe.guide.base.Guide; import com.fr.design.mainframe.guide.base.GuideBuilder; import com.fr.design.mainframe.guide.base.GuideLifecycleAdaptor; +import com.fr.design.mainframe.guide.base.GuideManager; import com.fr.design.mainframe.guide.creator.GuideCreateUtils; import com.fr.design.mainframe.guide.creator.GuideSceneHelper; import com.fr.design.mainframe.guide.scene.ClickScene; @@ -24,6 +30,7 @@ import com.fr.design.mainframe.guide.tip.GuideTip; import com.fr.design.mainframe.share.ui.block.LocalWidgetBlock; import com.fr.design.mainframe.share.ui.local.LocalWidgetRepoPane; import com.fr.design.mainframe.share.util.InstallComponentHelper; +import com.fr.design.mainframe.theme.AsyncThemeFetcher; import com.fr.design.utils.ComponentUtils; import com.fr.design.widget.ui.designer.NewFormPane; import com.fr.design.widget.ui.designer.PredefinedLayoutPane; @@ -47,6 +54,7 @@ public class UseLayoutAndComponentGuide { private static final String RESOURCE_PATH = "/com/fr/report/guide/component"; private static UIHeadMenu fileHeadMenu; private static NewFormPane newFormPane; + private static String defaultThemeName; public static Guide createGuide() { GuideScene scene = createScene(); @@ -71,9 +79,23 @@ public class UseLayoutAndComponentGuide { @Override public boolean prepared() { preloadShareComponent(); - Component component = ComponentUtils.findComponentByName(NorthRegionContainerPane.getInstance(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_File")); - fileHeadMenu = ((UIHeadMenu) component); - return true; + List themeNames = FormThemeConfig.getInstance().getThemeNames(); + if (themeNames.size() > 0) { + defaultThemeName = themeNames.get(Math.max(themeNames.size() - 2, 0)); + AsyncThemeFetcher asyncThemeFetcher = new AsyncThemeFetcher<>(1, FormThemeConfig.getInstance()); + asyncThemeFetcher.submit(defaultThemeName, new AsyncThemeFetcher.AsyncThemeFetchCallbackAdapter(){ + @Override + public void afterCachedFetch(FormTheme theme) { + Component component = ComponentUtils.findComponentByName(NorthRegionContainerPane.getInstance(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_File")); + fileHeadMenu = ((UIHeadMenu) component); + asyncThemeFetcher.shutdown(); + GuideManager.getInstance().getCurrentGuide().start(); + } + }); + } else { + GuideManager.getInstance().getCurrentGuide().terminate(); + } + return false; } @Override @@ -134,7 +156,7 @@ public class UseLayoutAndComponentGuide { scene.showScene(); GuideCreateUtils.TIMER.purge(); } - }, 100); + }, 300); return false; } }); @@ -176,6 +198,15 @@ public class UseLayoutAndComponentGuide { public boolean onComplete() { newFormPane.createLayoutForm(); newFormPane.getWindow().dispose(); + FormTheme defaultTheme = FormThemeConfig.getInstance().cachedFetch(defaultThemeName); + if (defaultTheme != null) { + JTemplate newTemplate = DesignerContext.getDesignerFrame().getSelectedJTemplate(); + if (newTemplate instanceof JForm) { + JForm jForm = (JForm) newTemplate; + jForm.setTemplateTheme(defaultTheme); + } + + } return true; } }); diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/theme/DownloadComponentPackageGuide.java b/designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/theme/DownloadComponentPackageGuide.java index 68de9ef8f..3b6e86a8f 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/theme/DownloadComponentPackageGuide.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/theme/DownloadComponentPackageGuide.java @@ -43,6 +43,7 @@ import javax.swing.JPopupMenu; import javax.swing.JScrollPane; import javax.swing.SwingUtilities; import java.awt.Component; +import java.awt.Dimension; import java.awt.Point; import java.awt.event.ContainerAdapter; import java.awt.event.ContainerEvent; @@ -62,7 +63,6 @@ public class DownloadComponentPackageGuide { .nextScene(createScene3()) .nextScene(createScene4()) .nextScene(createScene5()) - .nextScene(createScene6()) .nextScene(GuideSceneHelper.createFormDesignerBodyDisplayScene()); Guide guide = GuideBuilder.newInstance() @@ -93,7 +93,7 @@ public class DownloadComponentPackageGuide { } boolean loadWidgetSuccess = OnlineWidgetRepoPane.loadWidgets(); if (loadWidgetSuccess) { - filePath = GuideCreateUtils.openGuideFile("/com/fr/report/guide/template", "layout_recommend", ".frm"); + filePath = GuideCreateUtils.openGuideFile("/com/fr/report/guide/template", "download_theme", ".frm"); if (filePath == null) { GuideCreateUtils.showNoFileAuthAlert(); GuideManager.getInstance().getCurrentGuide().terminate(); @@ -189,7 +189,7 @@ public class DownloadComponentPackageGuide { if (onlineWidgetPackageBlock == null) { GuideManager.getInstance().getCurrentGuide().terminate(); } else { - JScrollPane scrollPane = getParentScrollPane(onlineWidgetPackageBlock); + JScrollPane scrollPane = GuideCreateUtils.getParentScrollPane(onlineWidgetPackageBlock); scrollPane.getVerticalScrollBar().setValue(onlineWidgetPackageBlock.getY()); SwingUtilities.invokeLater(new Runnable() { @Override @@ -207,24 +207,6 @@ public class DownloadComponentPackageGuide { } private static GuideScene createScene3() { - DisplayScene scene = new DisplayScene(); - scene.registerLifecycle(new GuideSceneLifecycleAdaptor() { - @Override - public boolean prepared() { - scene.addTarget(onlineWidgetPackageBlock); - JPopupMenu popupMenu = onlineWidgetPackageBlock.getRightClickPopupMenu(); - Point location = getPopupMenuLocation(); - scene.addCustomTarget( - GuideCreateUtils.createTarget(popupMenu), - GuideCreateUtils.getRelativeBounds(popupMenu, onlineWidgetPackageBlock, location.x, location.y) - ); - return true; - } - }); - return scene; - } - - private static GuideScene createScene4() { ClickScene scene = new ClickScene(); scene.registerLifecycle(new GuideSceneLifecycleAdaptor() { @Override @@ -260,7 +242,7 @@ public class DownloadComponentPackageGuide { return scene; } - private static GuideScene createScene5() { + private static GuideScene createScene4() { DisplayScene scene = new DisplayScene(); scene.registerLifecycle(new GuideSceneLifecycleAdaptor() { @Override @@ -272,14 +254,14 @@ public class DownloadComponentPackageGuide { scene.showScene(); GuideCreateUtils.TIMER.purge(); } - }, 100); + }, 300); return false; } }); return scene; } - private static GuideScene createScene6() { + private static GuideScene createScene5() { ClickScene scene = new ClickScene(); scene.registerLifecycle(new GuideSceneLifecycleAdaptor() { @Override @@ -305,7 +287,8 @@ public class DownloadComponentPackageGuide { private static Point getPopupMenuLocation() { JPopupMenu popupMenu = onlineWidgetPackageBlock.getRightClickPopupMenu(); - return new Point((onlineWidgetPackageBlock.getWidth() - popupMenu.getWidth()) / 2, (onlineWidgetPackageBlock.getHeight()- popupMenu.getHeight()) / 2); + Dimension preferredSize = popupMenu.getPreferredSize(); + return new Point((onlineWidgetPackageBlock.getWidth() - preferredSize.width) / 2, (onlineWidgetPackageBlock.getHeight()- preferredSize.height) / 2); } private static void closeConfirmDialog() { @@ -313,15 +296,4 @@ public class DownloadComponentPackageGuide { themeConfirmDialog.dispose(); } } - - private static JScrollPane getParentScrollPane(Component component) { - if (component.getParent() == null) { - return null; - } - if (component.getParent() instanceof JScrollPane) { - return (JScrollPane) component.getParent(); - } - return getParentScrollPane(component.getParent()); - } - } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/theme/ThemeToggleGuide.java b/designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/theme/ThemeToggleGuide.java index 07fb60041..a61c592a3 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/theme/ThemeToggleGuide.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/guide/creator/theme/ThemeToggleGuide.java @@ -28,6 +28,7 @@ import com.fr.design.mainframe.theme.TemplateThemeGridPagesPane; import com.fr.design.mainframe.theme.dialog.TemplateThemeUsingDialog; import com.fr.design.utils.ComponentUtils; +import javax.swing.JScrollPane; import javax.swing.SwingUtilities; import java.awt.Component; import java.util.List; @@ -35,7 +36,6 @@ import java.util.TimerTask; public class ThemeToggleGuide { private static final int PAGE_THEME_COUNT = 9; - private static final int DEFAULT_THEME_INDEX = 4; private static TemplateThemeUsingDialog themeDialog; private static String TARGET_XCREATOR_NAME = "chart00"; private static String filePath; @@ -64,11 +64,11 @@ public class ThemeToggleGuide { @Override public boolean prepared() { List themeNames = FormThemeConfig.getInstance().getThemeNames(); - themeLoadCount = Math.min(themeNames.size(), PAGE_THEME_COUNT); + themeLoadCount = themeNames.size(); if (themeLoadCount == 0) { GuideManager.getInstance().getCurrentGuide().terminate(); } - selectedThemeIndex = Math.min(themeLoadCount - 1, DEFAULT_THEME_INDEX); + selectedThemeIndex = Math.max(themeLoadCount - 5, 0); int lazyCount = themeLoadCount; AsyncThemeFetcher asyncThemeFetcher = new AsyncThemeFetcher<>(PAGE_THEME_COUNT, FormThemeConfig.getInstance()); for (int index = 0; index < lazyCount; index++) { @@ -141,7 +141,7 @@ public class ThemeToggleGuide { scene.showScene(); GuideCreateUtils.TIMER.purge(); } - },100); + },300); return false; } }); @@ -230,7 +230,11 @@ public class ThemeToggleGuide { if (themeDialog == null) { themeDialog = new TemplateThemeUsingDialog(); } + String name = FormThemeConfig.getInstance().getThemeNames().get(selectedThemeIndex); + Component component = ComponentUtils.findComponentByName(themeDialog.getContentPane(), name); + JScrollPane scrollPane = GuideCreateUtils.getParentScrollPane(component); GuideCreateUtils.showDialogWithoutModal(themeDialog); + scrollPane.getVerticalScrollBar().setValue(component.getY()); } private static void closeTemplateThemeUsingDialog() { diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/guide/entry/GuideEntryHint.java b/designer-realize/src/main/java/com/fr/design/mainframe/guide/entry/GuideEntryHint.java index c1e361ec2..c1775f718 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/guide/entry/GuideEntryHint.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/guide/entry/GuideEntryHint.java @@ -58,6 +58,6 @@ public class GuideEntryHint { 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); + return new Point(point.x - 187,point.y + size.height + 5); } }