Browse Source

REPORT-8515 设计器启动优化,独立线程打开模板

master
zack 7 years ago
parent
commit
e7f6457438
  1. 36
      designer-base/src/com/fr/design/mainframe/DesignerFrame.java
  2. 28
      designer-base/src/com/fr/start/BaseDesigner.java

36
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);

28
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;
}

Loading…
Cancel
Save