From e8b6186b864dfe4e18efcebb86fddc132723c861 Mon Sep 17 00:00:00 2001 From: Harrison Date: Wed, 17 Aug 2022 10:41:52 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-76068=E3=80=90=E8=BF=AD=E4=BB=A3?= =?UTF-8?q?=E3=80=91=E3=80=90=E8=B5=B7=E5=A7=8B=E9=A1=B5=E3=80=91=E5=9F=8B?= =?UTF-8?q?=E7=82=B9=E6=B2=A1=E8=AE=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/startup/ui/StartupPageWindow.java | 8 +++- .../startup/ui/StartupPageWorkspacePanel.java | 47 ++++++++++++------- .../DesignerStartupPageActivator.java | 5 +- 3 files changed, 39 insertions(+), 21 deletions(-) diff --git a/designer-base/src/main/java/com/fr/startup/ui/StartupPageWindow.java b/designer-base/src/main/java/com/fr/startup/ui/StartupPageWindow.java index b73d13d9f9..1e5481cc26 100644 --- a/designer-base/src/main/java/com/fr/startup/ui/StartupPageWindow.java +++ b/designer-base/src/main/java/com/fr/startup/ui/StartupPageWindow.java @@ -333,8 +333,7 @@ public class StartupPageWindow extends JFrame { @Override public void mouseClicked(MouseEvent e) { - DesignerEnvManager.getEnvManager().setLastOpenFile(recentFile); - pageModel.getOpenLastTemplateRunnable().run(); + doOpenLastTemplateAction(recentFile, pageModel); } }); Dimension preferredSize = recentItemPanel.getPreferredSize(); @@ -366,4 +365,9 @@ public class StartupPageWindow extends JFrame { return FRGUIPaneFactory.createCenterLayout(centerBody); } + private void doOpenLastTemplateAction(String recentFile, StartupPageModel pageModel) { + + DesignerEnvManager.getEnvManager().setLastOpenFile(recentFile); + pageModel.getOpenLastTemplateRunnable().run(); + } } diff --git a/designer-base/src/main/java/com/fr/startup/ui/StartupPageWorkspacePanel.java b/designer-base/src/main/java/com/fr/startup/ui/StartupPageWorkspacePanel.java index 5251509d3c..e7d58a766f 100644 --- a/designer-base/src/main/java/com/fr/startup/ui/StartupPageWorkspacePanel.java +++ b/designer-base/src/main/java/com/fr/startup/ui/StartupPageWorkspacePanel.java @@ -194,17 +194,7 @@ public class StartupPageWorkspacePanel extends JPanel { @Override public void mousePressed(MouseEvent e) { - if (showMore) { - fontLabel.setText(Toolkit.i18nText("Fine-Design_Startup_Page_Collapse_Workspace")); - iconLabel.setIcon(IconUtils.readIcon("/com/fr/design/startup/show_less.svg")); - showMoreContent(); - showMore = !showMore; - } else { - fontLabel.setText(Toolkit.i18nText("Fine-Design_Startup_Page_Expand_All")); - iconLabel.setIcon(IconUtils.readIcon("/com/fr/design/startup/show_more.svg")); - showLessContent(); - showMore = !showMore; - } + doShowAllAction(fontLabel, iconLabel); } }); tailPanel.add(showAllPanel); @@ -382,13 +372,10 @@ public class StartupPageWorkspacePanel extends JPanel { int clickCount = e.getClickCount(); if (clickCount == DOUBLE_CLICK_COUNT) { - pageModel.setSelectWorkspaceInfo(workspaceInfo); - openEmptyTemplateRunnable.run(); + doOpenEmptyTemplate(workspaceInfo); return; } - // selectWorkspaceRunnable - pageModel.setSelectWorkspaceInfo(workspaceInfo); - selectWorkspaceRunnable.run(); + doSwitchWorkspace(workspaceInfo); } }; @@ -415,7 +402,7 @@ public class StartupPageWorkspacePanel extends JPanel { @Override public void mousePressed(MouseEvent e) { - openEmptyTemplateRunnable.run(); + doOpenEmptyTemplate(workspaceInfo); } }); descPanel.add(arrowLabel, BorderLayout.EAST); @@ -515,4 +502,30 @@ public class StartupPageWorkspacePanel extends JPanel { this.selectWorkspaceRunnable = selectWorkspaceRunnable; } + private void doOpenEmptyTemplate(StartupWorkspaceBean workspaceInfo) { + + pageModel.setSelectWorkspaceInfo(workspaceInfo); + openEmptyTemplateRunnable.run(); + } + + private void doSwitchWorkspace(StartupWorkspaceBean workspaceInfo) { + // selectWorkspaceRunnable + pageModel.setSelectWorkspaceInfo(workspaceInfo); + selectWorkspaceRunnable.run(); + } + + private void doShowAllAction(UILabel fontLabel, UILabel iconLabel) { + + if (showMore) { + fontLabel.setText(Toolkit.i18nText("Fine-Design_Startup_Page_Collapse_Workspace")); + iconLabel.setIcon(IconUtils.readIcon("/com/fr/design/startup/show_less.svg")); + showMoreContent(); + showMore = !showMore; + } else { + fontLabel.setText(Toolkit.i18nText("Fine-Design_Startup_Page_Expand_All")); + iconLabel.setIcon(IconUtils.readIcon("/com/fr/design/startup/show_more.svg")); + showLessContent(); + showMore = !showMore; + } + } } diff --git a/designer-realize/src/main/java/com/fr/start/module/optimized/DesignerStartupPageActivator.java b/designer-realize/src/main/java/com/fr/start/module/optimized/DesignerStartupPageActivator.java index 1f7ba51136..9e590a3e1d 100644 --- a/designer-realize/src/main/java/com/fr/start/module/optimized/DesignerStartupPageActivator.java +++ b/designer-realize/src/main/java/com/fr/start/module/optimized/DesignerStartupPageActivator.java @@ -139,8 +139,9 @@ public class DesignerStartupPageActivator extends Activator { } private void recordStartupEnd(StopWatch stopWatch) { - - DesignerMetrics designerMetrics = DesignerStartupContext.getInstance().getDesignerMetrics(); + + DesignerStartupContext context = DesignerStartupContext.getInstance(); + DesignerMetrics designerMetrics = context.getDesignerMetrics(); DesignerStartupModel model = designerMetrics.getModel(); model.setStartingTime(stopWatch.getTime(TimeUnit.MILLISECONDS)); model.fill();