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..e14b22b6d5 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() { @@ -63,7 +63,8 @@ public class ConnectionListAction extends UpdateAction { final ConnectionConfig datasourceManager = ConnectionConfig.getInstance(); final ConnectionManagerPane databaseManagerPane = new ConnectionManagerPane() { public void complete() { - populate(datasourceManager); + ConnectionConfig connectionConfig = datasourceManager.mirror(); + populate(connectionConfig); } protected void renameConnection(String oldName, String newName) { 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-base/src/com/fr/env/RemoteEnv.java b/designer-base/src/com/fr/env/RemoteEnv.java index 3bbb181048..c52890ecbe 100644 --- a/designer-base/src/com/fr/env/RemoteEnv.java +++ b/designer-base/src/com/fr/env/RemoteEnv.java @@ -4,8 +4,9 @@ import com.fr.base.EnvException; import com.fr.base.TableData; import com.fr.base.operator.file.FileOperator; import com.fr.base.remote.RemoteDeziConstants; +import com.fr.common.rpc.RemoteCallServerConfig; import com.fr.common.rpc.netty.MessageSendExecutor; -import com.fr.common.rpc.serialize.RpcSerializeProtocol; +import com.fr.common.rpc.serialize.SerializeProtocol; import com.fr.core.env.EnvConstants; import com.fr.core.env.EnvContext; import com.fr.core.env.resource.RemoteEnvConfig; @@ -95,7 +96,7 @@ public class RemoteEnv extends AbstractEnv implements DesignAuthorityConfigurabl @Override public void connect() { // FIXME:richie ip地址属于测试的,带实际修改为RemoteEnv配置的地址 - MessageSendExecutor.getInstance().setRpcServerLoader("127.0.0.1:" + 33999, RpcSerializeProtocol.KRYOSERIALIZE); + MessageSendExecutor.getInstance().setRpcServerLoader("127.0.0.1", RemoteCallServerConfig.getInstance().getPort(), RemoteCallServerConfig.getInstance().getSerializeProtocol()); } @Override 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; } diff --git a/designer-realize/src/com/fr/start/SplashContext.java b/designer-realize/src/com/fr/start/SplashContext.java index e5021b2b3d..9ba4a72b14 100644 --- a/designer-realize/src/com/fr/start/SplashContext.java +++ b/designer-realize/src/com/fr/start/SplashContext.java @@ -34,7 +34,7 @@ public class SplashContext { private static final String GUEST = getRandomUser(); private ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1); - + private Listener listener; @@ -43,7 +43,7 @@ public class SplashContext { } private SplashContext() { - + } /** @@ -57,18 +57,18 @@ public class SplashContext { * 展示启动动画 */ public void show() { + splashStrategy.show(); //监听 initListener(); - splashStrategy.show(); } /** * 隐藏启动动画 */ public void hide() { + splashStrategy.hide(); //取消监听 EventDispatcher.stopListen(listener); - splashStrategy.hide(); // 窗口关闭后取消定时获取模块信息的timer scheduler.shutdown(); // 一次性 @@ -83,19 +83,18 @@ public class SplashContext { updateModuleLog(moduleID.isEmpty() ? StringUtils.EMPTY : moduleID + loading[loadingIndex % 3]); } }, 0, 300, TimeUnit.MILLISECONDS); - + listener = new Listener() { - + @Override public void on(Event event, String i18n) { - + showThanks(); moduleID = i18n; loadingIndex++; updateModuleLog(moduleID.isEmpty() ? StringUtils.EMPTY : moduleID + loading[loadingIndex % 3]); } }; EventDispatcher.listen(ModuleEvent.MajorModuleStarting, listener); - showThanks(); } private void updateModuleLog(String text) { diff --git a/designer-realize/src/com/fr/start/fx/SplashFx.java b/designer-realize/src/com/fr/start/fx/SplashFx.java index b69de89468..7970e204fa 100644 --- a/designer-realize/src/com/fr/start/fx/SplashFx.java +++ b/designer-realize/src/com/fr/start/fx/SplashFx.java @@ -18,7 +18,7 @@ import java.util.concurrent.Executors; */ public class SplashFx implements SplashStrategy { - private SplashFxWindow test; + private SplashFxWindow fxWindow; private static final ExecutorService SERVICE = Executors.newSingleThreadExecutor(); @Override @@ -29,7 +29,7 @@ public class SplashFx implements SplashStrategy { Application.launch(SplashFxWindow.class); } }); - test = SplashFxWindow.waitForStartUpTest(); + fxWindow = SplashFxWindow.waitForStartUpTest(); } @Override @@ -39,22 +39,11 @@ public class SplashFx implements SplashStrategy { @Override public void updateModuleLog(final String text) { - Platform.runLater(new Runnable() { - @Override - public void run() { - test.updateModuleInfo(text); - } - }); - + fxWindow.updateModuleInfo(text); } @Override public void updateThanksLog(final String text) { - Platform.runLater(new Runnable() { - @Override - public void run() { - test.updateThanks(text); - } - }); + fxWindow.updateThanks(text); } } diff --git a/designer-realize/src/com/fr/start/fx/SplashFxWindow.java b/designer-realize/src/com/fr/start/fx/SplashFxWindow.java index f048cebd50..486ba69b60 100644 --- a/designer-realize/src/com/fr/start/fx/SplashFxWindow.java +++ b/designer-realize/src/com/fr/start/fx/SplashFxWindow.java @@ -4,6 +4,7 @@ import com.bulenkov.iconloader.util.JBUI; import com.fr.base.FRContext; import com.fr.stable.OperatingSystem; import javafx.application.Application; +import javafx.application.Platform; import javafx.scene.Scene; import javafx.scene.image.Image; import javafx.scene.image.ImageView; @@ -119,8 +120,16 @@ public class SplashFxWindow extends Application { * * @param s 文字 */ - public void updateModuleInfo(String s) { - moduleInfo.setText(s); + public void updateModuleInfo(final String s) { + Platform.runLater(new Runnable() { + @Override + public void run() { + if (moduleInfo != null) { + moduleInfo.setText(s); + } + } + }); + } /** @@ -128,7 +137,15 @@ public class SplashFxWindow extends Application { * * @param s 文字 */ - public void updateThanks(String s) { - thanks.setText(s); + public void updateThanks(final String s) { + Platform.runLater(new Runnable() { + @Override + public void run() { + if (thanks != null) { + thanks.setText(s); + } + } + }); + } }