diff --git a/designer-base/src/com/fr/design/actions/UpdateAction.java b/designer-base/src/com/fr/design/actions/UpdateAction.java index d8b9f5385f..b0803635c9 100644 --- a/designer-base/src/com/fr/design/actions/UpdateAction.java +++ b/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,10 +476,13 @@ 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; + } /** * 获取搜索匹配字符串 diff --git a/designer-base/src/com/fr/design/actions/file/PreferenceAction.java b/designer-base/src/com/fr/design/actions/file/PreferenceAction.java index 0ad0a6c2f9..eb652abb81 100644 --- a/designer-base/src/com/fr/design/actions/file/PreferenceAction.java +++ b/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()); } /** diff --git a/designer-base/src/com/fr/design/actions/help/alphafine/AlphaFineAction.java b/designer-base/src/com/fr/design/actions/help/alphafine/AlphaFineAction.java index 221354108f..dda1fb68bc 100644 --- a/designer-base/src/com/fr/design/actions/help/alphafine/AlphaFineAction.java +++ b/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() { diff --git a/designer-base/src/com/fr/design/actions/server/ConnectionListAction.java b/designer-base/src/com/fr/design/actions/server/ConnectionListAction.java index 6fbad6de4d..c208bb9f67 100644 --- a/designer-base/src/com/fr/design/actions/server/ConnectionListAction.java +++ b/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() { diff --git a/designer-base/src/com/fr/design/actions/server/FunctionManagerAction.java b/designer-base/src/com/fr/design/actions/server/FunctionManagerAction.java index 3358e2cc42..375f264da2 100644 --- a/designer-base/src/com/fr/design/actions/server/FunctionManagerAction.java +++ b/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()); } /** diff --git a/designer-base/src/com/fr/design/mainframe/toolbar/UpdateActionManager.java b/designer-base/src/com/fr/design/mainframe/toolbar/UpdateActionManager.java index a5651cfbeb..d5527b31c9 100644 --- a/designer-base/src/com/fr/design/mainframe/toolbar/UpdateActionManager.java +++ b/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 updateActions; + private ExecutorService threadPoolExecutor = new ThreadPoolExecutor( + 1, 1, + 0L, TimeUnit.MILLISECONDS, + new LinkedBlockingQueue(), + 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); + } + } + }); + } } \ No newline at end of file diff --git a/designer-chart/src/com/fr/design/module/ChartPreStyleAction.java b/designer-chart/src/com/fr/design/module/ChartPreStyleAction.java index 171b6f0bb4..c56e257f89 100644 --- a/designer-chart/src/com/fr/design/module/ChartPreStyleAction.java +++ b/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()); } /** diff --git a/designer-realize/src/com/fr/design/actions/insert/cell/DSColumnCellAction.java b/designer-realize/src/com/fr/design/actions/insert/cell/DSColumnCellAction.java index 932dbbce9b..af0fd6bab2 100644 --- a/designer-realize/src/com/fr/design/actions/insert/cell/DSColumnCellAction.java +++ b/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() { diff --git a/designer-realize/src/com/fr/design/actions/report/ReportEngineAttrAction.java b/designer-realize/src/com/fr/design/actions/report/ReportEngineAttrAction.java index 9b2d21b190..1ee65b9286 100644 --- a/designer-realize/src/com/fr/design/actions/report/ReportEngineAttrAction.java +++ b/designer-realize/src/com/fr/design/actions/report/ReportEngineAttrAction.java @@ -18,7 +18,7 @@ public class ReportEngineAttrAction extends ReportComponentAction { this.initComponents(); } + public LayerReportPane() { + this(null); + } + protected void initComponents() { this.setLayout(FRGUIPaneFactory.createBorderLayout()); JPanel outlayerReportPane = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText(new String[]{"Report_Engine", "Attribute"})); diff --git a/designer-realize/src/com/fr/design/webattr/ReportWriteAttrPane.java b/designer-realize/src/com/fr/design/webattr/ReportWriteAttrPane.java index 0cd939e66f..48a62660c3 100644 --- a/designer-realize/src/com/fr/design/webattr/ReportWriteAttrPane.java +++ b/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; }