From e7f6457438ffbcdca7be3b6d64af685d04c87811 Mon Sep 17 00:00:00 2001 From: zack Date: Fri, 8 Jun 2018 10:25:01 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-8515=20=E8=AE=BE=E8=AE=A1=E5=99=A8?= =?UTF-8?q?=E5=90=AF=E5=8A=A8=E4=BC=98=E5=8C=96,=E7=8B=AC=E7=AB=8B?= =?UTF-8?q?=E7=BA=BF=E7=A8=8B=E6=89=93=E5=BC=80=E6=A8=A1=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/mainframe/DesignerFrame.java | 36 +++++++++++++------ .../src/com/fr/start/BaseDesigner.java | 28 +++++++++------ 2 files changed, 43 insertions(+), 21 deletions(-) diff --git a/designer-base/src/com/fr/design/mainframe/DesignerFrame.java b/designer-base/src/com/fr/design/mainframe/DesignerFrame.java index 628bf85710..fd879b7dea 100644 --- a/designer-base/src/com/fr/design/mainframe/DesignerFrame.java +++ b/designer-base/src/com/fr/design/mainframe/DesignerFrame.java @@ -4,7 +4,6 @@ package com.fr.design.mainframe; import com.fr.base.BaseUtils; -import com.fr.base.Env; import com.fr.base.FRContext; import com.fr.core.env.EnvConfig; import com.fr.core.env.EnvContext; @@ -37,15 +36,14 @@ import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus; import com.fr.design.menu.MenuManager; import com.fr.design.utils.DesignUtils; import com.fr.design.utils.gui.GUICoreUtils; -import com.fr.event.EventDispatcher; import com.fr.file.FILE; import com.fr.file.FILEFactory; import com.fr.file.FileFILE; import com.fr.file.FileNodeFILE; import com.fr.general.ComparatorUtils; -import com.fr.log.FineLoggerFactory; import com.fr.general.GeneralContext; import com.fr.general.Inter; +import com.fr.log.FineLoggerFactory; import com.fr.plugin.context.PluginContext; import com.fr.plugin.injectable.PluginModule; import com.fr.plugin.manage.PluginFilter; @@ -58,9 +56,23 @@ import com.fr.stable.StableUtils; import com.fr.stable.image4j.codec.ico.ICODecoder; import com.fr.stable.project.ProjectConstants; -import javax.swing.*; +import javax.swing.Icon; +import javax.swing.JComponent; +import javax.swing.JFrame; +import javax.swing.JLayeredPane; +import javax.swing.JMenuBar; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.WindowConstants; import javax.swing.border.MatteBorder; -import java.awt.*; +import java.awt.BorderLayout; +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.Graphics; +import java.awt.Insets; +import java.awt.Point; +import java.awt.Rectangle; +import java.awt.Toolkit; import java.awt.datatransfer.DataFlavor; import java.awt.datatransfer.Transferable; import java.awt.dnd.DnDConstants; @@ -84,9 +96,6 @@ import java.util.ArrayList; import java.util.Iterator; import java.util.List; -import static com.fr.core.env.EnvEvent.AFTER_SIGN_OUT; -import static com.fr.core.env.EnvEvent.BEFORE_SIGN_OUT; - public class DesignerFrame extends JFrame implements JTemplateActionListener, TargetModifiedListener { public static final String DESIGNER_FRAME_NAME = "designer_frame"; public static final Dimension MIN_SIZE = new Dimension(100, 100); @@ -130,9 +139,6 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta private WindowAdapter windowAdapter = new WindowAdapter() { public void windowOpened(WindowEvent e) { - HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().setComposite(); - reCalculateFrameSize(); - HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().doResize(); } @@ -265,6 +271,14 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta } } }); + this.addDesignerOpenedListener(new DesignerOpenedListener() { + @Override + public void designerOpened() { + HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().setComposite(); + reCalculateFrameSize(); + HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().doResize(); + } + }); this.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); this.setVisible(false); this.setExtendedState(JFrame.MAXIMIZED_BOTH); diff --git a/designer-base/src/com/fr/start/BaseDesigner.java b/designer-base/src/com/fr/start/BaseDesigner.java index 2a5f0af50a..6648d9c7a6 100644 --- a/designer-base/src/com/fr/start/BaseDesigner.java +++ b/designer-base/src/com/fr/start/BaseDesigner.java @@ -23,11 +23,13 @@ import com.fr.log.FineLoggerFactory; import com.fr.module.ModuleEvent; import com.fr.stable.OperatingSystem; -import java.awt.*; +import java.awt.Window; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.io.File; import java.lang.reflect.Method; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; /** * The main class of Report Designer. @@ -51,14 +53,21 @@ public abstract class BaseDesigner extends ToolBarMenuDock { DesignerEnvManager.loadLogSetting(); createDesignerFrame(); } - - public void show(String[] args) { - - collectUserInformation(); - showDesignerFrame(args, DesignerContext.getDesignerFrame(), false); - for (int i = 0; !TemplateTreePane.getInstance().getTemplateFileTree().isTemplateShowing() && i < LOAD_TREE_MAXNUM; i++) { - TemplateTreePane.getInstance().getTemplateFileTree().refresh(); - } + + public void show(final String[] args) { + ExecutorService executorService = Executors.newSingleThreadExecutor(); + executorService.submit(new Runnable() { + @Override + public void run() { + collectUserInformation(); + showDesignerFrame(args, DesignerContext.getDesignerFrame(), false); + for (int i = 0; !TemplateTreePane.getInstance().getTemplateFileTree().isTemplateShowing() && i < LOAD_TREE_MAXNUM; i++) { + TemplateTreePane.getInstance().getTemplateFileTree().refresh(); + } + } + }); + executorService.shutdown(); + DesignerContext.getDesignerFrame().setVisible(true); } @@ -134,7 +143,6 @@ public abstract class BaseDesigner extends ToolBarMenuDock { df.getSelectedJTemplate().requestGridFocus(); } }); - df.setVisible(true); return isException; }