From c76ae5431e2aba130b21b7870a56595e41b8f7d6 Mon Sep 17 00:00:00 2001 From: "John.Ying" Date: Mon, 29 Aug 2022 12:31:51 +0800 Subject: [PATCH 1/6] =?UTF-8?q?REPORT-79108=20=E8=BF=9C=E7=A8=8B=E7=9A=84?= =?UTF-8?q?=E6=97=B6=E5=80=99=EF=BC=8C=E5=AF=BC=E5=87=BA=E5=8D=A1=E9=A1=BF?= =?UTF-8?q?=E8=AE=B0=E5=BD=95=E5=88=B0=E6=8A=A5=E8=A1=A8=E5=B7=A5=E4=BD=9C?= =?UTF-8?q?=E7=9B=AE=E5=BD=95=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/carton/FeedbackToolboxDialog.java | 102 ++++++++++++++---- 1 file changed, 82 insertions(+), 20 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/carton/FeedbackToolboxDialog.java b/designer-base/src/main/java/com/fr/design/carton/FeedbackToolboxDialog.java index e05d3626a1..f9aee284e2 100644 --- a/designer-base/src/main/java/com/fr/design/carton/FeedbackToolboxDialog.java +++ b/designer-base/src/main/java/com/fr/design/carton/FeedbackToolboxDialog.java @@ -21,13 +21,26 @@ import com.fr.general.GeneralUtils; import com.fr.log.FineLoggerFactory; import com.fr.stable.StableUtils; import com.fr.stable.StringUtils; +import com.fr.workspace.WorkContext; -import javax.swing.*; -import java.awt.*; +import javax.swing.BorderFactory; +import javax.swing.JDialog; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.UIManager; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Component; +import java.awt.Cursor; +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.Frame; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.event.WindowEvent; +import java.io.ByteArrayOutputStream; import java.io.File; +import java.io.FileInputStream; import java.text.ParseException; import java.util.List; @@ -44,6 +57,7 @@ public class FeedbackToolboxDialog extends JDialog { private final Color lineColor = new Color(192, 192, 192, 120); private JPanel body = null; private static final String WORK_SPACE_PATH = "reportlets"; + private static final int BUFFER_SIZE = 2 * 1024; public FeedbackToolboxDialog(Frame owner) { super(owner, Toolkit.i18nText("Fine-Design_Basic_Carton_Feedback_ToolBox")); @@ -93,7 +107,7 @@ public class FeedbackToolboxDialog extends JDialog { exportLogLabel.setForeground(UIConstants.FLESH_BLUE); exportLogLabel.addMouseListener(new MouseAdapter() { @Override - public void mousePressed(MouseEvent e) { + public void mouseClicked(MouseEvent e) { if (exportLogLabel.isEnabled()) { exportLogFile(); } @@ -127,24 +141,10 @@ public class FeedbackToolboxDialog extends JDialog { //selectDate 2002-03-09例子 String[] split = selectDate.split("-"); int month = Integer.parseInt(split[1]); - File sourceFile = new File(StableUtils.pathJoin(SwitchForSwingChecker.JOURNAL_FILE_PATH, split[0], "month-" + month, selectDate)); + String sourceFilePath = StableUtils.pathJoin(SwitchForSwingChecker.JOURNAL_FILE_PATH, split[0], "month-" + month, selectDate); + File sourceFile = new File(sourceFilePath); if (sourceFile.exists()) { - File[] files = sourceFile.listFiles(); - if (files != null) { - try { - if (path.startsWith(WORK_SPACE_PATH)) { - String curEnvName = DesignerEnvManager.getEnvManager().getCurEnvName(); - DesignerWorkspaceInfo workspaceInfo = DesignerEnvManager.getEnvManager().getWorkspaceInfo(curEnvName); - String workspaceInfoPath = workspaceInfo.getPath(); - path = new StringBuilder(workspaceInfoPath).append(path.substring(10)).toString(); - } - LogZipUtils.compress(files, path, false); - FineJOptionPane.showMessageDialog(null, Toolkit.i18nText("Fine-Design_Report_Exported_Successfully")); - } catch (Exception exception) { - FineJOptionPane.showMessageDialog(null, Toolkit.i18nText("Fine-Design_Report_Export_Failed"), UIManager.getString("OptionPane.messageDialogTitle"), JOptionPane.ERROR_MESSAGE); - FineLoggerFactory.getLogger().error("export file fail", exception); - } - } + exportCartonLog(sourceFile, path, sourceFilePath); } fileChooserPane.removeAllFilter(); } @@ -333,4 +333,66 @@ public class FeedbackToolboxDialog extends JDialog { uploadButton.setEnabled(flag); exportLogLabel.setEnabled(flag); } + + /** + * 导出卡顿日志到本地或远程服务器WEB-INF下 + * + * @param sourceFile 导出的卡顿日志所在文件夹 + * @param path 文件需要导出到的路径 + * @param sourceFilePath 导出的卡顿日志所在文件夹的路径 + */ + private void exportCartonLog(File sourceFile, String path, String sourceFilePath) { + File[] files = sourceFile.listFiles(); + if (files != null) { + try { + if (path.startsWith(WORK_SPACE_PATH)) { + if (WorkContext.getCurrent().isLocal()) { + String curEnvName = DesignerEnvManager.getEnvManager().getCurEnvName(); + DesignerWorkspaceInfo workspaceInfo = DesignerEnvManager.getEnvManager().getWorkspaceInfo(curEnvName); + String workspaceInfoPath = workspaceInfo.getPath(); + path = StableUtils.pathJoin(workspaceInfoPath, path); + LogZipUtils.compress(files, path, false); + } else { + String sourceFilePathZip = sourceFilePath + ".zip"; + LogZipUtils.compress(files, sourceFilePathZip, false); + byte[] bytesByFile = getBytesByFile(sourceFilePathZip); + WorkContext.getWorkResource().write(path, bytesByFile); + LogZipUtils.delDir(sourceFilePathZip); + } + } else { + LogZipUtils.compress(files, path, false); + } + FineJOptionPane.showMessageDialog(null, Toolkit.i18nText("Fine-Design_Report_Exported_Successfully")); + } catch (Exception exception) { + FineJOptionPane.showMessageDialog(null, Toolkit.i18nText("Fine-Design_Report_Export_Failed"), UIManager.getString("OptionPane.messageDialogTitle"), JOptionPane.ERROR_MESSAGE); + FineLoggerFactory.getLogger().error("export file fail", exception); + } + } + } + /** + * 根据文件地址将文件转换成byte[] + * + * @param pathStr 本地文件目录 + * @return 本地文件转成的byte[] + */ + public static byte[] getBytesByFile(String pathStr) { + File file = new File(pathStr); + try { + FileInputStream fis = new FileInputStream(file); + ByteArrayOutputStream bos = new ByteArrayOutputStream(BUFFER_SIZE); + byte[] b = new byte[BUFFER_SIZE]; + int n; + while ((n = fis.read(b)) != -1) { + bos.write(b, 0, n); + } + fis.close(); + byte[] data = bos.toByteArray(); + bos.close(); + return data; + } catch (Exception e) { + FineLoggerFactory.getLogger().error("reading local file fail", e); + } + return null; + } + } From c4c8125cfa8d4a841f1021ea1209ede2ce7bc3cb Mon Sep 17 00:00:00 2001 From: pengda Date: Mon, 29 Aug 2022 15:57:13 +0800 Subject: [PATCH 2/6] =?UTF-8?q?KERNEL-12469=20js=E5=BC=95=E6=93=8Ej2v8?= =?UTF-8?q?=E5=89=A5=E7=A6=BB=E6=88=90=E7=8B=AC=E7=AB=8B=E6=8F=92=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../beautify/JavaScriptFormatHelper.java | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/javascript/beautify/JavaScriptFormatHelper.java b/designer-base/src/main/java/com/fr/design/javascript/beautify/JavaScriptFormatHelper.java index 8e794f1924..e787fd132f 100644 --- a/designer-base/src/main/java/com/fr/design/javascript/beautify/JavaScriptFormatHelper.java +++ b/designer-base/src/main/java/com/fr/design/javascript/beautify/JavaScriptFormatHelper.java @@ -1,16 +1,6 @@ package com.fr.design.javascript.beautify; -import com.eclipsesource.v8.V8; -import com.eclipsesource.v8.V8Array; -import com.eclipsesource.v8.V8Object; -import com.eclipsesource.v8.utils.V8ObjectUtils; -import com.fr.general.IOUtils; -import com.fr.log.FineLoggerFactory; -import com.fr.stable.EncodeConstants; - -import java.io.InputStream; -import java.io.UnsupportedEncodingException; public class JavaScriptFormatHelper { @@ -33,7 +23,7 @@ public class JavaScriptFormatHelper { * @see JSBeautify */ public static String beautify(String jsCode, BeautifyOption option) { - InputStream resourceAsStream = IOUtils.readResource("com/fr/design/javascript/beautify/beautify.js"); + /* InputStream resourceAsStream = IOUtils.readResource("com/fr/design/javascript/beautify/beautify.js"); String result = jsCode; V8 v8 = V8.createV8Runtime(); try { @@ -49,8 +39,8 @@ public class JavaScriptFormatHelper { FineLoggerFactory.getLogger().error(e.getMessage(), e); } finally { v8.release(true); - } - return result; + }*/ + return jsCode; } public static void main(String[] args) { From 4010d3692b58c155031aafee000c686459b074df Mon Sep 17 00:00:00 2001 From: "John.Ying" Date: Mon, 29 Aug 2022 16:57:33 +0800 Subject: [PATCH 3/6] =?UTF-8?q?REPORT-79108=20=E5=AF=BC=E5=87=BA=E5=8D=A1?= =?UTF-8?q?=E9=A1=BF=E6=97=A5=E5=BF=97=E9=BB=98=E8=AE=A4=E9=80=89=E6=8B=A9?= =?UTF-8?q?=E6=A1=8C=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/carton/FeedbackToolboxDialog.java | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/carton/FeedbackToolboxDialog.java b/designer-base/src/main/java/com/fr/design/carton/FeedbackToolboxDialog.java index f9aee284e2..5e0e2e559a 100644 --- a/designer-base/src/main/java/com/fr/design/carton/FeedbackToolboxDialog.java +++ b/designer-base/src/main/java/com/fr/design/carton/FeedbackToolboxDialog.java @@ -16,18 +16,23 @@ import com.fr.design.utils.gui.GUICoreUtils; import com.fr.env.detect.ui.EnvDetectorDialog; import com.fr.file.FILE; import com.fr.file.FILEChooserPane; +import com.fr.file.FILEFactory; +import com.fr.file.FileFILE; import com.fr.file.filter.ChooseFileFilter; import com.fr.general.GeneralUtils; +import com.fr.io.repository.base.fs.FileSystemRepository; import com.fr.log.FineLoggerFactory; import com.fr.stable.StableUtils; import com.fr.stable.StringUtils; import com.fr.workspace.WorkContext; +import javax.annotation.Nullable; import javax.swing.BorderFactory; import javax.swing.JDialog; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.UIManager; +import javax.swing.filechooser.FileSystemView; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Component; @@ -43,7 +48,7 @@ import java.io.File; import java.io.FileInputStream; import java.text.ParseException; import java.util.List; - +import java.util.Objects; public class FeedbackToolboxDialog extends JDialog { @@ -134,6 +139,9 @@ public class FeedbackToolboxDialog extends JDialog { fileChooserPane.setFileNameTextField(fileName.toString(), " "); fileChooserPane.removeAllFilter(); fileChooserPane.addChooseFILEFilter(new ChooseFileFilter("zip", Toolkit.i18nText("Fine-Design_Basic_Carton_Compile_File"))); + //默认选择桌面 + FILE desktop = FILEFactory.createFILE(FILEFactory.FILE_PREFIX + FileSystemView.getFileSystemView().getHomeDirectory().getPath()); + fileChooserPane.setCurrentDirectory(desktop); int chooseResult = fileChooserPane.showSaveDialog(DesignerContext.getDesignerFrame()); if (chooseResult == 0) { FILE selectedFile = fileChooserPane.getSelectedFILE(); @@ -343,7 +351,7 @@ public class FeedbackToolboxDialog extends JDialog { */ private void exportCartonLog(File sourceFile, String path, String sourceFilePath) { File[] files = sourceFile.listFiles(); - if (files != null) { + if (!Objects.isNull(files)) { try { if (path.startsWith(WORK_SPACE_PATH)) { if (WorkContext.getCurrent().isLocal()) { @@ -362,20 +370,22 @@ public class FeedbackToolboxDialog extends JDialog { } else { LogZipUtils.compress(files, path, false); } - FineJOptionPane.showMessageDialog(null, Toolkit.i18nText("Fine-Design_Report_Exported_Successfully")); + FineJOptionPane.showMessageDialog(this, Toolkit.i18nText("Fine-Design_Report_Exported_Successfully")); } catch (Exception exception) { - FineJOptionPane.showMessageDialog(null, Toolkit.i18nText("Fine-Design_Report_Export_Failed"), UIManager.getString("OptionPane.messageDialogTitle"), JOptionPane.ERROR_MESSAGE); + FineJOptionPane.showMessageDialog(this, Toolkit.i18nText("Fine-Design_Report_Export_Failed"), UIManager.getString("OptionPane.messageDialogTitle"), JOptionPane.ERROR_MESSAGE); FineLoggerFactory.getLogger().error("export file fail", exception); } } } + /** * 根据文件地址将文件转换成byte[] * * @param pathStr 本地文件目录 * @return 本地文件转成的byte[] */ - public static byte[] getBytesByFile(String pathStr) { + @Nullable + private static byte[] getBytesByFile(String pathStr) { File file = new File(pathStr); try { FileInputStream fis = new FileInputStream(file); From e33e766ff8d5276a6e9cd290d0ea5c356dfda09b Mon Sep 17 00:00:00 2001 From: "John.Ying" Date: Mon, 29 Aug 2022 18:23:12 +0800 Subject: [PATCH 4/6] =?UTF-8?q?REPORT-79108=20=E5=BC=95=E9=94=99=E7=B1=BB?= =?UTF-8?q?=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/carton/FeedbackToolboxDialog.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/carton/FeedbackToolboxDialog.java b/designer-base/src/main/java/com/fr/design/carton/FeedbackToolboxDialog.java index 5e0e2e559a..c7192eb099 100644 --- a/designer-base/src/main/java/com/fr/design/carton/FeedbackToolboxDialog.java +++ b/designer-base/src/main/java/com/fr/design/carton/FeedbackToolboxDialog.java @@ -17,16 +17,15 @@ import com.fr.env.detect.ui.EnvDetectorDialog; import com.fr.file.FILE; import com.fr.file.FILEChooserPane; import com.fr.file.FILEFactory; -import com.fr.file.FileFILE; import com.fr.file.filter.ChooseFileFilter; import com.fr.general.GeneralUtils; -import com.fr.io.repository.base.fs.FileSystemRepository; import com.fr.log.FineLoggerFactory; import com.fr.stable.StableUtils; import com.fr.stable.StringUtils; +import org.jetbrains.annotations.Nullable; import com.fr.workspace.WorkContext; -import javax.annotation.Nullable; + import javax.swing.BorderFactory; import javax.swing.JDialog; import javax.swing.JOptionPane; From a7efa6d3a4f02ec11e6b8083ab70d5ccbe829f9d Mon Sep 17 00:00:00 2001 From: Harrison Date: Mon, 29 Aug 2022 21:10:29 +0800 Subject: [PATCH 5/6] =?UTF-8?q?REPORT-79026=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=91F0028?= =?UTF-8?q?=E3=80=81F0022=E9=83=A8=E5=88=86=E5=9C=BA=E6=99=AF=E8=AE=B0?= =?UTF-8?q?=E5=BD=95=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/startup/metric/DesignerStartupModel.java | 5 +++-- .../module/optimized/DesignerStartupPageActivator.java | 9 ++++++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/designer-base/src/main/java/com/fr/startup/metric/DesignerStartupModel.java b/designer-base/src/main/java/com/fr/startup/metric/DesignerStartupModel.java index 9c0c07315d..5ed94d82eb 100644 --- a/designer-base/src/main/java/com/fr/startup/metric/DesignerStartupModel.java +++ b/designer-base/src/main/java/com/fr/startup/metric/DesignerStartupModel.java @@ -6,7 +6,7 @@ import com.fr.plugin.context.PluginContext; import com.fr.plugin.manage.PluginManager; import com.fr.stable.os.AbstractOperatingSystem; import com.fr.stable.os.OperatingSystem; -import com.fr.start.common.DesignerStartupConfig; +import com.fr.start.common.DesignerStartupContext; import com.fr.workspace.WorkContext; import java.lang.management.ManagementFactory; @@ -117,7 +117,8 @@ public class DesignerStartupModel { private void fillMode() { - this.setMode(DesignerStartupConfig.getInstance().isEnabled() ? 0 : 1); + // 这里需要使用 showStartupPage , 表示是否存在启动页 + this.setMode(DesignerStartupContext.getInstance().isShowStartupPage() ? 0 : 1); } public void fill() { 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 568b512938..ccae1a19a6 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 @@ -47,10 +47,17 @@ public class DesignerStartupPageActivator extends Activator { if (context.isShowStartupPage()) { showDesignerStartupPage(context); } else { - DesignerStartupPageUtil.enterWorkspace(); + startNonStartupPage(); } } + private void startNonStartupPage() { + + StopWatch recorder = DesignerStartupContext.getRecorder(); + DesignerStartupPageUtil.enterWorkspace(); + recordStartupEnd(recorder); + } + private void showDesignerStartupPage(DesignerStartupContext context) { // 启动页关闭 From 41df0ed095acb1344d7a7587517e304c668ed27e Mon Sep 17 00:00:00 2001 From: kerry Date: Tue, 30 Aug 2022 11:20:27 +0800 Subject: [PATCH 6/6] =?UTF-8?q?REPORT-73421=20=E6=A8=A1=E6=9D=BFweb?= =?UTF-8?q?=E5=B1=9E=E6=80=A7-=E5=A1=AB=E6=8A=A5=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE-=E5=A1=AB=E6=8A=A5=E5=BD=93=E5=89=8D?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E8=A1=8C=E8=83=8C=E6=99=AF=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=20=E7=9A=84=E5=8F=96=E8=89=B2=E5=99=A8=E4=B8=AD=20=E6=9C=AA?= =?UTF-8?q?=E9=80=82=E9=85=8D=20=E4=B8=BB=E9=A2=98=E8=89=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/design/webattr/WriteWebSettingPane.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/webattr/WriteWebSettingPane.java b/designer-realize/src/main/java/com/fr/design/webattr/WriteWebSettingPane.java index 527acb4c49..dd93281acd 100644 --- a/designer-realize/src/main/java/com/fr/design/webattr/WriteWebSettingPane.java +++ b/designer-realize/src/main/java/com/fr/design/webattr/WriteWebSettingPane.java @@ -4,7 +4,6 @@ import com.fr.base.BaseUtils; import com.fr.design.ExtraDesignClassManager; import com.fr.design.gui.core.WidgetOption; import com.fr.design.gui.ibutton.UIColorButton; -import com.fr.design.gui.ibutton.UINoThemeColorButton; import com.fr.design.gui.ibutton.UIRadioButton; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.ilable.UILabel; @@ -45,7 +44,7 @@ public class WriteWebSettingPane extends WebSettingPane { protected JPanel createOtherSetPane() { colorBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Set_Background_Of_Current_Row") + ":"); colorBox.setSelected(true); - colorButton = new UINoThemeColorButton(BaseUtils.readIcon("/com/fr/design/images/gui/color/background.png")); + colorButton = new UIColorButton(BaseUtils.readIcon("/com/fr/design/images/gui/color/background.png")); colorBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { colorButton.setEnabled(colorBox.isSelected());