From b4c2e8e05159264e5e81508791a85ad5c44e2340 Mon Sep 17 00:00:00 2001 From: zack Date: Thu, 7 Jun 2018 08:53:57 +0800 Subject: [PATCH 1/6] =?UTF-8?q?REPORT-8515=20=E8=AE=BE=E8=AE=A1=E5=99=A8?= =?UTF-8?q?=E5=90=AF=E5=8A=A8=E9=80=9F=E5=BA=A6=E4=BC=98=E5=8C=96,?= =?UTF-8?q?=E9=98=BF=E5=B0=94=E6=B3=95=E8=8C=83=E7=9A=84searchtext?= =?UTF-8?q?=E6=B3=A8=E5=86=8C=E6=94=BE=E5=88=B0=E7=8B=AC=E7=AB=8B=E7=BA=BF?= =?UTF-8?q?=E7=A8=8B=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/actions/UpdateAction.java | 37 ++++++++++++++++--- .../design/actions/file/PreferenceAction.java | 2 +- .../help/alphafine/AlphaFineAction.java | 2 +- .../actions/server/ConnectionListAction.java | 2 +- .../actions/server/FunctionManagerAction.java | 2 +- .../toolbar/UpdateActionManager.java | 32 ++++++++++++++++ .../fr/design/module/ChartPreStyleAction.java | 5 +-- .../insert/cell/DSColumnCellAction.java | 2 +- .../report/ReportEngineAttrAction.java | 2 +- .../report/ReportExportAttrAction.java | 2 +- .../report/ReportMobileAttrAction.java | 5 +-- .../actions/report/ReportPageAttrAction.java | 11 +++--- .../actions/report/ReportPageSetupAction.java | 2 +- .../report/ReportPrintSettingAction.java | 3 +- .../actions/report/ReportWatermarkAction.java | 2 +- .../actions/report/ReportWebAttrAction.java | 2 +- .../actions/report/ReportWriteAttrAction.java | 2 +- .../server/ServerConfigManagerAction.java | 2 +- .../actions/server/StyleListAction.java | 2 +- .../com/fr/design/report/LayerReportPane.java | 30 ++++++++------- .../design/webattr/ReportWriteAttrPane.java | 3 ++ 21 files changed, 105 insertions(+), 47 deletions(-) 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; } From fe5a53124899398a6d47f56ca4f1df91c68cfdac Mon Sep 17 00:00:00 2001 From: kerry Date: Thu, 7 Jun 2018 09:29:31 +0800 Subject: [PATCH 2/6] =?UTF-8?q?REPORT-8526=2010.0=E5=AE=9A=E4=B9=89?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E8=BF=9E=E6=8E=A5=E8=B6=85=E8=BF=87=E4=B8=89?= =?UTF-8?q?=E4=B8=AA=E6=97=A0=E6=B3=95=E4=BF=9D=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data/datapane/connect/ConnectionListPane.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/designer-base/src/com/fr/design/data/datapane/connect/ConnectionListPane.java b/designer-base/src/com/fr/design/data/datapane/connect/ConnectionListPane.java index 956625f13a..9efcd3a706 100644 --- a/designer-base/src/com/fr/design/data/datapane/connect/ConnectionListPane.java +++ b/designer-base/src/com/fr/design/data/datapane/connect/ConnectionListPane.java @@ -1,5 +1,6 @@ package com.fr.design.data.datapane.connect; +import com.fr.config.utils.UniqueKey; import com.fr.data.impl.Connection; import com.fr.data.impl.JDBCDatabaseConnection; import com.fr.data.impl.JNDIDatabaseConnection; @@ -12,6 +13,7 @@ import com.fr.file.ConnectionConfig; import com.fr.general.ComparatorUtils; import com.fr.general.Inter; import com.fr.general.NameObject; +import com.fr.log.FineLoggerFactory; import com.fr.stable.ArrayUtils; import com.fr.stable.Nameable; import com.fr.stable.StringUtils; @@ -154,7 +156,15 @@ public class ConnectionListPane extends JListControlPane implements ConnectionSh for (int i = 0; i < res_array.length; i++) { NameObject nameObject = res_array[i]; - connectionConfig.addConnection(nameObject.getName(), (Connection) nameObject.getObject()); + if(nameObject.getObject() instanceof UniqueKey){ + try{ + Connection cloneConnection = (Connection)((UniqueKey)nameObject.getObject()).clone(); + connectionConfig.addConnection(nameObject.getName(), cloneConnection); + }catch (Exception e){ + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + } + } } } \ No newline at end of file From 72d747331f287b2c9a9e7d26d13a47141e3895e0 Mon Sep 17 00:00:00 2001 From: richie Date: Thu, 7 Jun 2018 09:41:09 +0800 Subject: [PATCH 3/6] =?UTF-8?q?=E6=97=A0JIRA=E4=BB=BB=E5=8A=A1=20=E8=BF=9C?= =?UTF-8?q?=E7=A8=8B=E8=B0=83=E7=94=A8=E6=9C=8D=E5=8A=A1=E5=99=A8=E7=9A=84?= =?UTF-8?q?=E5=90=84=E7=A7=8D=E9=85=8D=E7=BD=AE=E5=86=99=E5=85=A5=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer-base/src/com/fr/env/RemoteEnv.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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 From 5b0616e32e54a5f29ae9a6fb0a0d535932583ab0 Mon Sep 17 00:00:00 2001 From: kerry Date: Thu, 7 Jun 2018 09:45:43 +0800 Subject: [PATCH 4/6] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E4=B8=8A=E4=BC=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/actions/server/ConnectionListAction.java | 3 ++- .../data/datapane/connect/ConnectionListPane.java | 12 +----------- 2 files changed, 3 insertions(+), 12 deletions(-) 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..c43d7a7742 100644 --- a/designer-base/src/com/fr/design/actions/server/ConnectionListAction.java +++ b/designer-base/src/com/fr/design/actions/server/ConnectionListAction.java @@ -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 clone = datasourceManager.mirror(); + populate(clone); } protected void renameConnection(String oldName, String newName) { diff --git a/designer-base/src/com/fr/design/data/datapane/connect/ConnectionListPane.java b/designer-base/src/com/fr/design/data/datapane/connect/ConnectionListPane.java index 9efcd3a706..956625f13a 100644 --- a/designer-base/src/com/fr/design/data/datapane/connect/ConnectionListPane.java +++ b/designer-base/src/com/fr/design/data/datapane/connect/ConnectionListPane.java @@ -1,6 +1,5 @@ package com.fr.design.data.datapane.connect; -import com.fr.config.utils.UniqueKey; import com.fr.data.impl.Connection; import com.fr.data.impl.JDBCDatabaseConnection; import com.fr.data.impl.JNDIDatabaseConnection; @@ -13,7 +12,6 @@ import com.fr.file.ConnectionConfig; import com.fr.general.ComparatorUtils; import com.fr.general.Inter; import com.fr.general.NameObject; -import com.fr.log.FineLoggerFactory; import com.fr.stable.ArrayUtils; import com.fr.stable.Nameable; import com.fr.stable.StringUtils; @@ -156,15 +154,7 @@ public class ConnectionListPane extends JListControlPane implements ConnectionSh for (int i = 0; i < res_array.length; i++) { NameObject nameObject = res_array[i]; - if(nameObject.getObject() instanceof UniqueKey){ - try{ - Connection cloneConnection = (Connection)((UniqueKey)nameObject.getObject()).clone(); - connectionConfig.addConnection(nameObject.getName(), cloneConnection); - }catch (Exception e){ - FineLoggerFactory.getLogger().error(e.getMessage(), e); - } - } - + connectionConfig.addConnection(nameObject.getName(), (Connection) nameObject.getObject()); } } } \ No newline at end of file From 6c703d6b94f39e6b2c6307a7e04e0f4d035a9621 Mon Sep 17 00:00:00 2001 From: kerry Date: Thu, 7 Jun 2018 09:46:29 +0800 Subject: [PATCH 5/6] =?UTF-8?q?=E5=8F=98=E9=87=8F=E5=90=8D=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/actions/server/ConnectionListAction.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 c43d7a7742..c69ffc5b02 100644 --- a/designer-base/src/com/fr/design/actions/server/ConnectionListAction.java +++ b/designer-base/src/com/fr/design/actions/server/ConnectionListAction.java @@ -63,8 +63,8 @@ public class ConnectionListAction extends UpdateAction { final ConnectionConfig datasourceManager = ConnectionConfig.getInstance(); final ConnectionManagerPane databaseManagerPane = new ConnectionManagerPane() { public void complete() { - ConnectionConfig clone = datasourceManager.mirror(); - populate(clone); + ConnectionConfig connectionConfig = datasourceManager.mirror(); + populate(connectionConfig); } protected void renameConnection(String oldName, String newName) { From d1bac490e2cbc8738fc432ac402c1f3c0ad932ae Mon Sep 17 00:00:00 2001 From: vito Date: Thu, 7 Jun 2018 10:05:21 +0800 Subject: [PATCH 6/6] =?UTF-8?q?REPORT-8393=20=E7=9B=91=E5=90=AC=E6=94=BE?= =?UTF-8?q?=E5=90=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/com/fr/start/SplashContext.java | 15 ++++++----- .../src/com/fr/start/fx/SplashFx.java | 19 +++----------- .../src/com/fr/start/fx/SplashFxWindow.java | 25 ++++++++++++++++--- 3 files changed, 32 insertions(+), 27 deletions(-) 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); + } + } + }); + } }