Browse Source

Merge pull request #92 in DESIGN/design from ~ZACK/design:feature/10.0 to feature/10.0

* commit 'b4c2e8e05159264e5e81508791a85ad5c44e2340':
  REPORT-8515 设计器启动速度优化,阿尔法范的searchtext注册放到独立线程处理
master
superman 7 years ago
parent
commit
bea4123a61
  1. 35
      designer-base/src/com/fr/design/actions/UpdateAction.java
  2. 2
      designer-base/src/com/fr/design/actions/file/PreferenceAction.java
  3. 2
      designer-base/src/com/fr/design/actions/help/alphafine/AlphaFineAction.java
  4. 2
      designer-base/src/com/fr/design/actions/server/ConnectionListAction.java
  5. 2
      designer-base/src/com/fr/design/actions/server/FunctionManagerAction.java
  6. 32
      designer-base/src/com/fr/design/mainframe/toolbar/UpdateActionManager.java
  7. 5
      designer-chart/src/com/fr/design/module/ChartPreStyleAction.java
  8. 2
      designer-realize/src/com/fr/design/actions/insert/cell/DSColumnCellAction.java
  9. 2
      designer-realize/src/com/fr/design/actions/report/ReportEngineAttrAction.java
  10. 2
      designer-realize/src/com/fr/design/actions/report/ReportExportAttrAction.java
  11. 5
      designer-realize/src/com/fr/design/actions/report/ReportMobileAttrAction.java
  12. 11
      designer-realize/src/com/fr/design/actions/report/ReportPageAttrAction.java
  13. 2
      designer-realize/src/com/fr/design/actions/report/ReportPageSetupAction.java
  14. 3
      designer-realize/src/com/fr/design/actions/report/ReportPrintSettingAction.java
  15. 2
      designer-realize/src/com/fr/design/actions/report/ReportWatermarkAction.java
  16. 2
      designer-realize/src/com/fr/design/actions/report/ReportWebAttrAction.java
  17. 2
      designer-realize/src/com/fr/design/actions/report/ReportWriteAttrAction.java
  18. 2
      designer-realize/src/com/fr/design/actions/server/ServerConfigManagerAction.java
  19. 2
      designer-realize/src/com/fr/design/actions/server/StyleListAction.java
  20. 30
      designer-realize/src/com/fr/design/report/LayerReportPane.java
  21. 3
      designer-realize/src/com/fr/design/webattr/ReportWriteAttrPane.java

35
designer-base/src/com/fr/design/actions/UpdateAction.java

@ -9,7 +9,11 @@ import com.fr.base.Style;
import com.fr.design.actions.core.ActionFactory;
import com.fr.design.constants.UIConstants;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.imenu.*;
import com.fr.design.gui.imenu.UICheckBoxMenuItem;
import com.fr.design.gui.imenu.UIMenuEastAttrItem;
import com.fr.design.gui.imenu.UIMenuItem;
import com.fr.design.gui.imenu.UIPopupEastAttrMenu;
import com.fr.design.mainframe.toolbar.UpdateActionManager;
import com.fr.design.menu.ShortCut;
import com.fr.design.selection.SelectionListener;
import com.fr.general.ComparatorUtils;
@ -17,10 +21,28 @@ import com.fr.stable.StringUtils;
import com.fr.stable.pinyin.PinyinFormat;
import com.fr.stable.pinyin.PinyinHelper;
import javax.swing.*;
import javax.swing.AbstractButton;
import javax.swing.Action;
import javax.swing.Icon;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import javax.swing.JRadioButton;
import javax.swing.JScrollPane;
import javax.swing.JTabbedPane;
import javax.swing.JToolBar;
import javax.swing.KeyStroke;
import javax.swing.border.Border;
import javax.swing.border.TitledBorder;
import java.awt.*;
import java.awt.AWTEvent;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.event.ComponentEvent;
import java.beans.PropertyChangeListener;
import java.util.HashMap;
@ -454,9 +476,12 @@ public abstract class UpdateAction extends ShortCut implements Action {
return menuItem;
}
public void setSearchText(JPanel panel) {
this.searchText = getComponentTexts(panel, "_", new StringBuffer(), new StringBuffer(), new StringBuffer());
public void generateAndSetSearchText(String paneClass) {
UpdateActionManager.getUpdateActionManager().dealWithSearchText(paneClass, this);
}
public void setSearchText(String text) {
this.searchText = text;
}
/**

2
designer-base/src/com/fr/design/actions/file/PreferenceAction.java

@ -18,7 +18,7 @@ public class PreferenceAction extends UpdateAction {
this.setMenuKeySet(KeySetUtils.PREFERENCE);
this.setName(getMenuKeySet().getMenuKeySetName() + "...");
this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSearchText(new PreferencePane());
this.generateAndSetSearchText(PreferencePane.class.getName());
}
/**

2
designer-base/src/com/fr/design/actions/help/alphafine/AlphaFineAction.java

@ -23,7 +23,7 @@ public class AlphaFineAction extends UpdateAction {
this.setName(getMenuKeySet().getMenuName());
this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(IOUtils.readIcon("/com/fr/design/mainframe/alphafine/images/smallsearch.png"));
this.setSearchText(new AlphaFineConfigPane());
this.generateAndSetSearchText(AlphaFineConfigPane.class.getName());
}
public static final MenuKeySet ALPHAFINE = new MenuKeySet() {

2
designer-base/src/com/fr/design/actions/server/ConnectionListAction.java

@ -33,7 +33,7 @@ public class ConnectionListAction extends UpdateAction {
this.setName(getMenuKeySet().getMenuKeySetName());
this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(IOUtils.readIcon("/com/fr/design/images/m_web/connection.png"));
this.setSearchText(new DatabaseConnectionPane.JDBC());
this.generateAndSetSearchText(DatabaseConnectionPane.JDBC.class.getName());
}
public static final MenuKeySet DEFINE_DATA_CONNECTION = new MenuKeySet() {

2
designer-base/src/com/fr/design/actions/server/FunctionManagerAction.java

@ -30,7 +30,7 @@ public class FunctionManagerAction extends UpdateAction {
this.setName(getMenuKeySet().getMenuKeySetName()+"...");
this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(IOUtils.readIcon("/com/fr/design/images/m_web/function.png"));
this.setSearchText(new FunctionManagerPane());
this.generateAndSetSearchText(FunctionManagerPane.class.getName());
}
/**

32
designer-base/src/com/fr/design/mainframe/toolbar/UpdateActionManager.java

@ -1,9 +1,18 @@
package com.fr.design.mainframe.toolbar;
import com.fr.design.actions.UpdateAction;
import com.fr.design.gui.frpane.LoadingBasicPane;
import com.fr.design.utils.concurrent.ThreadFactoryBuilder;
import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.StableUtils;
import javax.swing.JPanel;
import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
/**
* Created by XiaXiang on 2017/4/13.
@ -11,6 +20,11 @@ import java.util.List;
public class UpdateActionManager {
private static UpdateActionManager updateActionManager = null;
private List<UpdateActionModel> updateActions;
private ExecutorService threadPoolExecutor = new ThreadPoolExecutor(
1, 1,
0L, TimeUnit.MILLISECONDS,
new LinkedBlockingQueue<Runnable>(),
new ThreadFactoryBuilder().setNameFormat("alphafine-thread-%s").build());//目前测下来一个线程慢慢做处理总共大概也只要两秒,暂时就这样
public synchronized static UpdateActionManager getUpdateActionManager() {
if (updateActionManager == null) {
@ -41,4 +55,22 @@ public class UpdateActionManager {
}
return null;
}
public synchronized void dealWithSearchText(final String paneClass, final UpdateAction updateAction) {
threadPoolExecutor.execute(new Runnable() {
@Override
public void run() {
JPanel panel = null;
try {
panel = (JPanel) StableUtils.classForName(paneClass).newInstance();
if (panel instanceof LoadingBasicPane) {
panel = ((LoadingBasicPane) panel).getAllComponents();
}
updateAction.setSearchText(updateAction.getComponentTexts(panel, "_", new StringBuffer(), new StringBuffer(), new StringBuffer()));
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
});
}
}

5
designer-chart/src/com/fr/design/module/ChartPreStyleAction.java

@ -1,6 +1,5 @@
package com.fr.design.module;
import com.fr.base.BaseUtils;
import com.fr.base.ChartPreStyleManagerProvider;
import com.fr.base.ChartPreStyleServerManager;
import com.fr.design.actions.UpdateAction;
@ -12,7 +11,7 @@ import com.fr.design.menu.MenuKeySet;
import com.fr.general.IOUtils;
import com.fr.general.Inter;
import javax.swing.*;
import javax.swing.KeyStroke;
import java.awt.event.ActionEvent;
/**
@ -27,7 +26,7 @@ public class ChartPreStyleAction extends UpdateAction {
this.setName(getMenuKeySet().getMenuKeySetName()+ "...");
this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(IOUtils.readIcon("com/fr/design/images/chart/ChartType.png"));
this.setSearchText(new ChartPreStyleManagerPane());
this.generateAndSetSearchText(ChartPreStyleManagerPane.class.getName());
}
/**

2
designer-realize/src/com/fr/design/actions/insert/cell/DSColumnCellAction.java

@ -15,7 +15,7 @@ public class DSColumnCellAction extends AbstractCellAction implements WorkBookSu
public DSColumnCellAction(ElementCasePane t) {
super(t);
initAction();
this.setSearchText(new DSColumnPane());
this.generateAndSetSearchText(DSColumnPane.class.getName());
}
private void initAction() {

2
designer-realize/src/com/fr/design/actions/report/ReportEngineAttrAction.java

@ -18,7 +18,7 @@ public class ReportEngineAttrAction extends ReportComponentAction<WorkSheetDesig
this.setName(getMenuKeySet().getMenuKeySetName() + "...");
this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(IOUtils.readIcon("/com/fr/design/images/m_report/reportEngineAttr.png"));
this.setSearchText(new LayerReportPane(null));
this.generateAndSetSearchText(LayerReportPane.class.getName());
}

2
designer-realize/src/com/fr/design/actions/report/ReportExportAttrAction.java

@ -19,7 +19,7 @@ public class ReportExportAttrAction extends JWorkBookAction {
this.setName(getMenuKeySet().getMenuKeySetName()+"...");
this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(IOUtils.readIcon("/com/fr/design/images/m_report/exportAttr.png"));
this.setSearchText(new ReportExportAttrPane());
this.generateAndSetSearchText(ReportExportAttrPane.class.getName());
}
/**

5
designer-realize/src/com/fr/design/actions/report/ReportMobileAttrAction.java

@ -1,6 +1,5 @@
package com.fr.design.actions.report;
import com.fr.base.BaseUtils;
import com.fr.design.actions.JWorkBookAction;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter;
@ -16,7 +15,7 @@ import com.fr.report.mobile.ElementCaseMobileAttr;
import com.fr.stable.ReportFunctionProcessor;
import com.fr.stable.fun.FunctionProcessor;
import javax.swing.*;
import javax.swing.KeyStroke;
import java.awt.event.ActionEvent;
/**
@ -32,7 +31,7 @@ public class ReportMobileAttrAction extends JWorkBookAction{
this.setName(getMenuKeySet().getMenuKeySetName() + "...");
this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(IOUtils.readIcon("/com/fr/design/images/m_report/mobile.png"));
this.setSearchText(new ReportMobileAttrPane());
this.generateAndSetSearchText(ReportMobileAttrPane.class.getName());
}
/**

11
designer-realize/src/com/fr/design/actions/report/ReportPageAttrAction.java

@ -3,18 +3,17 @@
*/
package com.fr.design.actions.report;
import javax.swing.SwingUtilities;
import com.fr.base.BaseUtils;
import com.fr.design.actions.ReportComponentAction;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.mainframe.WorkSheetDesigner;
import com.fr.design.menu.KeySetUtils;
import com.fr.design.report.freeze.RepeatAndFreezeSettingPane;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.general.IOUtils;
import com.fr.report.worksheet.WorkSheet;
import javax.swing.SwingUtilities;
/**
* @author richer
* @since 6.5.5
@ -29,7 +28,7 @@ public class ReportPageAttrAction extends ReportComponentAction<WorkSheetDesigne
this.setName(getMenuKeySet().getMenuKeySetName() + "...");
this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(IOUtils.readIcon("/com/fr/design/images/m_file/pageSetup.png"));
this.setSearchText(new RepeatAndFreezeSettingPane());
this.generateAndSetSearchText(RepeatAndFreezeSettingPane.class.getName());
}
/**

2
designer-realize/src/com/fr/design/actions/report/ReportPageSetupAction.java

@ -28,7 +28,7 @@ public class ReportPageSetupAction extends ReportComponentAction<ReportComponent
this.setName(getMenuKeySet().getMenuKeySetName()+"...");
this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(IOUtils.readIcon("/com/fr/design/images/m_file/pageSetup.png"));
this.setSearchText(new PageSetupPane());
this.generateAndSetSearchText(PageSetupPane.class.getName());
}
/**

3
designer-realize/src/com/fr/design/actions/report/ReportPrintSettingAction.java

@ -11,7 +11,6 @@ import com.fr.design.menu.MenuKeySet;
import com.fr.design.webattr.printsettings.ReportPrintSettingPane;
import com.fr.general.IOUtils;
import com.fr.general.Inter;
import com.fr.main.TemplateWorkBook;
import com.fr.main.impl.WorkBook;
import com.fr.report.core.ReportUtils;
@ -29,7 +28,7 @@ public class ReportPrintSettingAction extends JWorkBookAction {
this.setName(getMenuKeySet().getMenuKeySetName() + "...");
this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(IOUtils.readIcon(IconManager.PRINT.getPath()));
this.setSearchText(new ReportPrintSettingPane());
this.setSearchText(ReportPrintSettingPane.class.getName());
}
/**

2
designer-realize/src/com/fr/design/actions/report/ReportWatermarkAction.java

@ -26,7 +26,7 @@ public class ReportWatermarkAction extends JWorkBookAction {
this.setName(getMenuKeySet().getMenuKeySetName() + "...");
this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_report/watermark.png"));
this.setSearchText(new WatermarkPane());
this.generateAndSetSearchText(WatermarkPane.class.getName());
}
@Override

2
designer-realize/src/com/fr/design/actions/report/ReportWebAttrAction.java

@ -30,7 +30,7 @@ public class ReportWebAttrAction extends JWorkBookAction {
this.setName(getMenuKeySet().getMenuKeySetName()+"...");
this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(IOUtils.readIcon("/com/fr/design/images/m_report/webreportattribute.png"));
this.setSearchText(new ReportWebAttrPane().getAllComponents());
this.generateAndSetSearchText(ReportWebAttrPane.class.getName());
}
/**

2
designer-realize/src/com/fr/design/actions/report/ReportWriteAttrAction.java

@ -21,7 +21,7 @@ public class ReportWriteAttrAction extends ReportComponentAction<WorkSheetDesign
this.setName(getMenuKeySet().getMenuKeySetName() + "...");
this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(IOUtils.readIcon("/com/fr/design/images/m_report/reportWriteAttr.png"));
this.setSearchText(new ReportWriteAttrPane(null).getAllComponents());
this.generateAndSetSearchText(ReportWriteAttrPane.class.getName());
}

2
designer-realize/src/com/fr/design/actions/server/ServerConfigManagerAction.java

@ -29,7 +29,7 @@ public class ServerConfigManagerAction extends UpdateAction {
this.setName(getMenuKeySet().getMenuKeySetName() + "...");
this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(IOUtils.readIcon("/com/fr/design/images/m_web/edit.png"));
this.setSearchText(new EditReportServerParameterPane().getAllComponents());
this.generateAndSetSearchText(EditReportServerParameterPane.class.getName());
}
/**

2
designer-realize/src/com/fr/design/actions/server/StyleListAction.java

@ -26,7 +26,7 @@ public class StyleListAction extends UpdateAction {
this.setName(getMenuKeySet().getMenuKeySetName()+ "...");
this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(IOUtils.readIcon("/com/fr/design/images/m_web/style.png"));
this.setSearchText(new StyleManagerPane());
this.generateAndSetSearchText(StyleManagerPane.class.getName());
}
/**

30
designer-realize/src/com/fr/design/report/LayerReportPane.java

@ -1,31 +1,29 @@
package com.fr.design.report;
import java.awt.CardLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import com.fr.design.gui.ilable.FRExplainLabel;
import com.fr.design.gui.ilable.UILabel;
import javax.swing.BorderFactory;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.editor.editor.IntegerEditor;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.FRExplainLabel;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.editor.editor.IntegerEditor;
import com.fr.general.Inter;
import com.fr.report.core.ReportUtils;
import com.fr.report.stable.LayerReportAttr;
import com.fr.report.worksheet.WorkSheet;
import com.fr.stable.ProductConstants;
import javax.swing.BorderFactory;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import java.awt.CardLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
/**
*
* @editor zhou
@ -45,6 +43,10 @@ public class LayerReportPane extends BasicBeanPane<LayerReportAttr> {
this.initComponents();
}
public LayerReportPane() {
this(null);
}
protected void initComponents() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
JPanel outlayerReportPane = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText(new String[]{"Report_Engine", "Attribute"}));

3
designer-realize/src/com/fr/design/webattr/ReportWriteAttrPane.java

@ -20,6 +20,9 @@ public class ReportWriteAttrPane extends LoadingBasicPane {
private VerifierListPane verifierListPane;
private WriteShortCutsPane writeShortCutsPane;
private ElementCasePane ePane;
public ReportWriteAttrPane(){
this(null);
}
public ReportWriteAttrPane(ElementCasePane ePane){
this.ePane = ePane;
}

Loading…
Cancel
Save