Browse Source

Merge pull request #164 in DESIGN/design from ~ZACK/design:release/10.0 to release/10.0

* commit 'a4767e2c42f3de8c3ad69666e87251070d992ae7':
  漏提交
  线程安全问题
  放到activitor里面
  REPORT-9077 设计器启动问题
  REPORT-9077 设计器数据集按钮没了
master
zack 6 years ago
parent
commit
3c6ada548a
  1. 10
      designer-base/src/com/fr/design/file/HistoryTemplateListPane.java
  2. 4
      designer-base/src/com/fr/design/gui/iprogressbar/ProgressDialog.java
  3. 8
      designer-base/src/com/fr/design/mainframe/DesignerFrameFileDealerPane.java
  4. 12
      designer-base/src/com/fr/design/mainframe/EastRegionContainerPane.java
  5. 22
      designer-base/src/com/fr/design/mainframe/loghandler/LogMessageBar.java
  6. 38
      designer-base/src/com/fr/start/BaseDesigner.java
  7. 8
      designer-realize/src/com/fr/design/mainframe/CellElementPropertyPane.java
  8. 58
      designer-realize/src/com/fr/start/module/DesignerModuleActivator.java
  9. 33
      designer-realize/src/com/fr/start/module/DesignerStartup.java

10
designer-base/src/com/fr/design/file/HistoryTemplateListPane.java

@ -43,18 +43,22 @@ public class HistoryTemplateListPane extends JPanel implements FileOperations, C
private JTemplate<?, ?> editingTemplate; private JTemplate<?, ?> editingTemplate;
private FileToolbarStateChangeListener toobarStateChangeListener; private FileToolbarStateChangeListener toobarStateChangeListener;
private static HistoryTemplateListPane THIS; private static volatile HistoryTemplateListPane THIS;
private UIList list; private UIList list;
public static final HistoryTemplateListPane getInstance() { public static final HistoryTemplateListPane getInstance() {
if (THIS == null) { if (THIS == null) {
THIS = new HistoryTemplateListPane(); synchronized (HistoryTemplateListPane.class) {
if (THIS == null) {
THIS = new HistoryTemplateListPane();
}
}
} }
return THIS; return THIS;
} }
public HistoryTemplateListPane() { private HistoryTemplateListPane() {
setLayout(new BorderLayout()); setLayout(new BorderLayout());
historyList = new ArrayList<JTemplate<?, ?>>(); historyList = new ArrayList<JTemplate<?, ?>>();
list = new UIList(new HistoryListDataMode()) { list = new UIList(new HistoryListDataMode()) {

4
designer-base/src/com/fr/design/gui/iprogressbar/ProgressDialog.java

@ -52,6 +52,7 @@ public class ProgressDialog extends UIDialog {
FRFont font = FRFont.getInstance().applySize(14).applyForeground(new ColorUIResource(333334)); FRFont font = FRFont.getInstance().applySize(14).applyForeground(new ColorUIResource(333334));
text.setFont(font); text.setFont(font);
panel.add(text, BorderLayout.SOUTH); panel.add(text, BorderLayout.SOUTH);
panel.setVisible(true);
centerDialog.getContentPane().add(panel); centerDialog.getContentPane().add(panel);
} }
@ -63,9 +64,8 @@ public class ProgressDialog extends UIDialog {
@Override @Override
public void setVisible(boolean b) { public void setVisible(boolean b) {
super.setVisible(b);
centerDialog.setVisible(b); centerDialog.setVisible(b);
centerDialog.setResizable(false); super.setVisible(b);
} }
public void setProgressValue(int value) { public void setProgressValue(int value) {

8
designer-base/src/com/fr/design/mainframe/DesignerFrameFileDealerPane.java

@ -53,7 +53,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
private static final String FILE = "file"; private static final String FILE = "file";
private static DesignerFrameFileDealerPane THIS; private static volatile DesignerFrameFileDealerPane THIS;
private CardLayout card; private CardLayout card;
@ -85,7 +85,11 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
public static final DesignerFrameFileDealerPane getInstance() { public static final DesignerFrameFileDealerPane getInstance() {
if (THIS == null) { if (THIS == null) {
THIS = new DesignerFrameFileDealerPane(); synchronized (DesignerFrameFileDealerPane.class) {
if (THIS == null) {
THIS = new DesignerFrameFileDealerPane();
}
}
} }
return THIS; return THIS;
} }

12
designer-base/src/com/fr/design/mainframe/EastRegionContainerPane.java

@ -30,7 +30,7 @@ import java.util.Map;
import java.util.Set; import java.util.Set;
public class EastRegionContainerPane extends UIEastResizableContainer { public class EastRegionContainerPane extends UIEastResizableContainer {
private static EastRegionContainerPane THIS; private static volatile EastRegionContainerPane THIS;
private Map<String, PropertyItem> propertyItemMap; private Map<String, PropertyItem> propertyItemMap;
private CardLayout propertyCard; private CardLayout propertyCard;
private JPanel leftPane; private JPanel leftPane;
@ -84,13 +84,17 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
*/ */
public static EastRegionContainerPane getInstance() { public static EastRegionContainerPane getInstance() {
if (THIS == null) { if (THIS == null) {
THIS = new EastRegionContainerPane(); synchronized (EastRegionContainerPane.class) {
THIS.setLastContainerWidth(DesignerEnvManager.getEnvManager().getLastEastRegionContainerWidth()); if (THIS == null) {
THIS = new EastRegionContainerPane();
THIS.setLastContainerWidth(DesignerEnvManager.getEnvManager().getLastEastRegionContainerWidth());
}
}
} }
return THIS; return THIS;
} }
public EastRegionContainerPane() { private EastRegionContainerPane() {
super(); super();
initPropertyItemList(); initPropertyItemList();
defaultPane = getDefaultPane(Inter.getLocText("FR-Designer_No_Settings_Available")); defaultPane = getDefaultPane(Inter.getLocText("FR-Designer_No_Settings_Available"));

22
designer-base/src/com/fr/design/mainframe/loghandler/LogMessageBar.java

@ -1,27 +1,29 @@
package com.fr.design.mainframe.loghandler; package com.fr.design.mainframe.loghandler;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import javax.swing.JFrame;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.general.Inter; import com.fr.general.Inter;
import javax.swing.JFrame;
import javax.swing.JPanel; import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
public class LogMessageBar extends JPanel { public class LogMessageBar extends JPanel {
private UILabel messageLabel; private UILabel messageLabel;
private int width = 600; private int width = 600;
public static LogMessageBar THIS; public static volatile LogMessageBar THIS;
private JFrame dlg = new LogDetailPane().showDialog(); private JFrame dlg = new LogDetailPane().showDialog();
public static LogMessageBar getInstance() { public static LogMessageBar getInstance() {
if (THIS == null) { if (THIS == null) {
THIS = new LogMessageBar(); synchronized (LogMessageBar.class) {
if (THIS == null) {
THIS = new LogMessageBar();
}
}
} }
return THIS; return THIS;
} }
@ -32,7 +34,7 @@ public class LogMessageBar extends JPanel {
return bar; return bar;
} }
public LogMessageBar() { private LogMessageBar() {
messageLabel = new UILabel(); messageLabel = new UILabel();
setLayout(new BorderLayout()); setLayout(new BorderLayout());
add(messageLabel, BorderLayout.CENTER); add(messageLabel, BorderLayout.CENTER);

38
designer-base/src/com/fr/start/BaseDesigner.java

@ -11,9 +11,6 @@ import com.fr.design.file.TemplateTreePane;
import com.fr.design.fun.DesignerStartOpenFileProcessor; import com.fr.design.fun.DesignerStartOpenFileProcessor;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.DesignerFrame; import com.fr.design.mainframe.DesignerFrame;
import com.fr.design.mainframe.EastRegionContainerPane;
import com.fr.design.mainframe.WestRegionContainerPane;
import com.fr.design.mainframe.loghandler.LogMessageBar;
import com.fr.design.mainframe.toolbar.ToolBarMenuDock; import com.fr.design.mainframe.toolbar.ToolBarMenuDock;
import com.fr.design.utils.DesignUtils; import com.fr.design.utils.DesignUtils;
import com.fr.event.EventDispatcher; import com.fr.event.EventDispatcher;
@ -29,8 +26,6 @@ import com.fr.stable.OperatingSystem;
import java.awt.Window; import java.awt.Window;
import java.io.File; import java.io.File;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
/** /**
* The main class of Report Designer. * The main class of Report Designer.
@ -49,44 +44,11 @@ public abstract class BaseDesigner extends ToolBarMenuDock {
EventDispatcher.fire(ModuleEvent.MajorModuleStarting, InterProviderFactory.getProvider().getLocText("FR-Designer_Initializing")); EventDispatcher.fire(ModuleEvent.MajorModuleStarting, InterProviderFactory.getProvider().getLocText("FR-Designer_Initializing"));
// 初始化look and feel.这个在预加载之前执行是因为lookAndFeel里的东西,预加载时也要用到 // 初始化look and feel.这个在预加载之前执行是因为lookAndFeel里的东西,预加载时也要用到
DesignUtils.initLookAndFeel(); DesignUtils.initLookAndFeel();
// 预加载一些耗时的单例面板
preLoadPane();
// 初始化Log Handler // 初始化Log Handler
DesignerEnvManager.loadLogSetting(); DesignerEnvManager.loadLogSetting();
createDesignerFrame(); createDesignerFrame();
} }
private void preLoadPane() {
ExecutorService service = Executors.newCachedThreadPool();
service.submit(new Runnable() {
@Override
public void run() {
LogMessageBar.getInstance();
}
});
service.submit(new Runnable() {
@Override
public void run() {
HistoryTemplateListPane.getInstance();
}
});
service.submit(new Runnable() {
@Override
public void run() {
WestRegionContainerPane.getInstance();
}
});
service.submit(new Runnable() {
@Override
public void run() {
EastRegionContainerPane.getInstance();
}
});
service.shutdown();
}
public void show(final String[] args) { public void show(final String[] args) {
collectUserInformation(); collectUserInformation();
DesignerContext.getDesignerFrame().getProgressDialog().setProgressValue(10); DesignerContext.getDesignerFrame().getProgressDialog().setProgressValue(10);

8
designer-realize/src/com/fr/design/mainframe/CellElementPropertyPane.java

@ -69,12 +69,16 @@ public class CellElementPropertyPane extends DockingView {
public synchronized static CellElementPropertyPane getInstance() { public synchronized static CellElementPropertyPane getInstance() {
if (singleton == null) { if (singleton == null) {
singleton = new CellElementPropertyPane(); synchronized (CellElementPropertyPane.class) {
if (singleton == null) {
singleton = new CellElementPropertyPane();
}
}
} }
return singleton; return singleton;
} }
private static CellElementPropertyPane singleton; private static volatile CellElementPropertyPane singleton;
private CellElementEditPane cellElementEditPane; private CellElementEditPane cellElementEditPane;

58
designer-realize/src/com/fr/start/module/DesignerModuleActivator.java

@ -51,9 +51,12 @@ import com.fr.design.javascript.ProcessTransitionAdapter;
import com.fr.design.mainframe.AbstractAppProvider; import com.fr.design.mainframe.AbstractAppProvider;
import com.fr.design.mainframe.App; import com.fr.design.mainframe.App;
import com.fr.design.mainframe.BaseJForm; import com.fr.design.mainframe.BaseJForm;
import com.fr.design.mainframe.CellElementPropertyPane;
import com.fr.design.mainframe.ChartPropertyPane; import com.fr.design.mainframe.ChartPropertyPane;
import com.fr.design.mainframe.DecodeDialog; import com.fr.design.mainframe.DecodeDialog;
import com.fr.design.mainframe.DesignerFrame; import com.fr.design.mainframe.DesignerFrame;
import com.fr.design.mainframe.DesignerFrameFileDealerPane;
import com.fr.design.mainframe.EastRegionContainerPane;
import com.fr.design.mainframe.ElementCaseThumbnail; import com.fr.design.mainframe.ElementCaseThumbnail;
import com.fr.design.mainframe.FormHierarchyTreePane; import com.fr.design.mainframe.FormHierarchyTreePane;
import com.fr.design.mainframe.InformationCollector; import com.fr.design.mainframe.InformationCollector;
@ -69,6 +72,7 @@ import com.fr.design.mainframe.form.FormECDesignerProvider;
import com.fr.design.mainframe.form.FormElementCaseDesigner; import com.fr.design.mainframe.form.FormElementCaseDesigner;
import com.fr.design.mainframe.form.FormReportComponentComposite; import com.fr.design.mainframe.form.FormReportComponentComposite;
import com.fr.design.mainframe.loghandler.DesignerLogImpl; import com.fr.design.mainframe.loghandler.DesignerLogImpl;
import com.fr.design.mainframe.loghandler.LogMessageBar;
import com.fr.design.module.ChartHyperlinkGroup; import com.fr.design.module.ChartHyperlinkGroup;
import com.fr.design.module.ChartPreStyleAction; import com.fr.design.module.ChartPreStyleAction;
import com.fr.design.module.DesignModuleFactory; import com.fr.design.module.DesignModuleFactory;
@ -81,6 +85,7 @@ import com.fr.file.FILE;
import com.fr.form.main.Form; import com.fr.form.main.Form;
import com.fr.form.stable.ElementCaseThumbnailProcessor; import com.fr.form.stable.ElementCaseThumbnailProcessor;
import com.fr.form.ui.ChartEditor; import com.fr.form.ui.ChartEditor;
import com.fr.form.ui.WidgetInfoConfig;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.general.ModuleContext; import com.fr.general.ModuleContext;
@ -137,8 +142,11 @@ import com.fr.van.chart.DownloadOnlineSourcesHelper;
import com.fr.van.chart.map.server.ChartMapEditorAction; import com.fr.van.chart.map.server.ChartMapEditorAction;
import com.fr.xml.ReportXMLUtils; import com.fr.xml.ReportXMLUtils;
import javax.swing.*; import javax.swing.JDialog;
import java.awt.*; import javax.swing.JPanel;
import javax.swing.SwingConstants;
import java.awt.BorderLayout;
import java.awt.Image;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
@ -148,6 +156,8 @@ import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import static com.fr.stable.module.Module.ENGINE_MODULE; import static com.fr.stable.module.Module.ENGINE_MODULE;
@ -204,6 +214,50 @@ public class DesignerModuleActivator extends Activator implements Prepare {
ExtraDesignClassManager.getInstance().getFeedback().didFeedback(); ExtraDesignClassManager.getInstance().getFeedback().didFeedback();
StableFactory.registerMarkedObject(LogProvider.MARK_STRING, DesignerLogImpl.getInstance()); StableFactory.registerMarkedObject(LogProvider.MARK_STRING, DesignerLogImpl.getInstance());
preLoadPane();
}
private static void preLoadPane() {
ExecutorService service = Executors.newCachedThreadPool();
service.submit(new Runnable() {
@Override
public void run() {
LogMessageBar.getInstance();
}
});
service.submit(new Runnable() {
@Override
public void run() {
HistoryTemplateListPane.getInstance();
}
});
service.submit(new Runnable() {
@Override
public void run() {
WidgetInfoConfig.getInstance();
}
});
service.submit(new Runnable() {
@Override
public void run() {
CellElementPropertyPane.getInstance();
}
});
service.submit(new Runnable() {
@Override
public void run() {
DesignerFrameFileDealerPane.getInstance();//这边会涉及到TemplateTreePane
}
});
service.submit(new Runnable() {
@Override
public void run() {
EastRegionContainerPane.getInstance();
}
});
service.shutdown();
} }
private static Class<?>[] actionsForInsertCellElement() { private static Class<?>[] actionsForInsertCellElement() {

33
designer-realize/src/com/fr/start/module/DesignerStartup.java

@ -1,15 +1,11 @@
package com.fr.start.module; package com.fr.start.module;
import com.fr.design.mainframe.CellElementPropertyPane;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.DesignerFrameFileDealerPane;
import com.fr.event.Event; import com.fr.event.Event;
import com.fr.event.Listener; import com.fr.event.Listener;
import com.fr.form.ui.WidgetInfoConfig;
import com.fr.module.Activator; import com.fr.module.Activator;
import com.fr.start.Designer; import com.fr.start.Designer;
import com.fr.start.EnvSwitcher; import com.fr.start.EnvSwitcher;
import com.fr.start.ServerStarter;
import com.fr.start.SplashContext; import com.fr.start.SplashContext;
import com.fr.startup.activators.BasicActivator; import com.fr.startup.activators.BasicActivator;
import com.fr.workspace.Workspace; import com.fr.workspace.Workspace;
@ -30,12 +26,12 @@ public class DesignerStartup extends Activator {
startSub(BasicActivator.class); startSub(BasicActivator.class);
final String[] args = getModule().upFindSingleton(StartupArgs.class).get(); final String[] args = getModule().upFindSingleton(StartupArgs.class).get();
final Designer designer = new Designer(args); final Designer designer = new Designer(args);
preLoadSomething();
//启动env //启动env
startSub(DesignerWorkspaceProvider.class); startSub(DesignerWorkspaceProvider.class);
startSub(EnvBasedModule.class); startSub(EnvBasedModule.class);
getRoot().getSingleton(EnvSwitcher.class).switch2LastEnv(); getRoot().getSingleton(EnvSwitcher.class).switch2LastEnv();
ExecutorService service = Executors.newSingleThreadExecutor(); ExecutorService service = Executors.newSingleThreadExecutor();
registerEnvListener();
service.submit(new Runnable() { service.submit(new Runnable() {
@Override @Override
public void run() { public void run() {
@ -44,7 +40,6 @@ public class DesignerStartup extends Activator {
} }
}); });
service.shutdown(); service.shutdown();
registerEnvListener();
DesignerContext.getDesignerFrame().setVisible(true); DesignerContext.getDesignerFrame().setVisible(true);
//启动画面结束 //启动画面结束
SplashContext.getInstance().hide(); SplashContext.getInstance().hide();
@ -53,32 +48,6 @@ public class DesignerStartup extends Activator {
startSub(StartFinishActivator.class); startSub(StartFinishActivator.class);
} }
/**
* 基础模块结束后可以提前加载一部分依赖基础模块(国际化,图标样式之类)的东西
*/
private void preLoadSomething(){
ExecutorService service = Executors.newCachedThreadPool();
service.submit(new Runnable() {
@Override
public void run() {
CellElementPropertyPane.getInstance();
}
});
service.submit(new Runnable() {
@Override
public void run() {
DesignerFrameFileDealerPane.getInstance();//这边会涉及到TemplateTreePane
}
});
service.submit(new Runnable() {
@Override
public void run() {
WidgetInfoConfig.getInstance();
}
});
service.shutdown();
}
/** /**
* 切换环境时重新启动所有相关模块 * 切换环境时重新启动所有相关模块
*/ */

Loading…
Cancel
Save