diff --git a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java index 01cc002f93..b422be44e8 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java @@ -745,13 +745,13 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta resetCombineUpTooBar(ad.resetUpToolBar(plus)); - // 颜色,字体那些按钮的工具栏 - if (toolbarComponent == null) { - toolbarPane.add(toolbarComponent = ad.resetToolBar(null, plus), BorderLayout.CENTER); - } else { - ad.resetToolBar(toolbarComponent, plus); + if (toolbarComponent != null) { + toolbarPane.remove(toolbarComponent); } + // 颜色,字体那些按钮的工具栏 + toolbarPane.add(toolbarComponent = ad.resetToolBar(toolbarComponent, plus), BorderLayout.CENTER); + this.checkToolbarMenuEnable(); this.validate(); layeredPane.repaint(); diff --git a/designer-base/src/main/java/com/fr/start/BaseDesigner.java b/designer-base/src/main/java/com/fr/start/BaseDesigner.java index 70399a2ac4..37c668971d 100644 --- a/designer-base/src/main/java/com/fr/start/BaseDesigner.java +++ b/designer-base/src/main/java/com/fr/start/BaseDesigner.java @@ -46,6 +46,7 @@ public abstract class BaseDesigner extends ToolBarMenuDock { } private void init() { + prepare(); // 初始化look and feel.这个在预加载之前执行是因为lookAndFeel里的东西,预加载时也要用到 DesignUtils.initLookAndFeel(); // 初始化Log Handler @@ -53,14 +54,10 @@ public abstract class BaseDesigner extends ToolBarMenuDock { createDesignerFrame(); } - public void show() { - UIUtil.invokeLaterIfNeeded(new Runnable() { - @Override - public void run() { - refreshTemplateTree(); - } - }); - + /** + * 准备一些订阅 + */ + private void prepare() { EventDispatcher.listen(DesignerLaunchStatus.DESIGNER_INIT_COMPLETE, new Listener() { @Override public void on(Event event, Null param) { @@ -83,6 +80,15 @@ public abstract class BaseDesigner extends ToolBarMenuDock { }); } + public void show() { + UIUtil.invokeLaterIfNeeded(new Runnable() { + @Override + public void run() { + refreshTemplateTree(); + } + }); + } + private void refreshTemplateTree() { //TODO: 2019-06-14 这里有啥作用? DesignerContext.getDesignerFrame().refreshEnv(); diff --git a/designer-base/src/main/java/com/fr/start/server/ServerTray.java b/designer-base/src/main/java/com/fr/start/server/ServerTray.java index f6dede2955..2b3713c0f7 100644 --- a/designer-base/src/main/java/com/fr/start/server/ServerTray.java +++ b/designer-base/src/main/java/com/fr/start/server/ServerTray.java @@ -1,6 +1,7 @@ package com.fr.start.server; import com.fr.base.BaseUtils; +import com.fr.design.ui.util.UIUtil; import com.fr.event.Event; import com.fr.event.EventDispatcher; import com.fr.event.ListenerAdaptor; @@ -85,6 +86,7 @@ public class ServerTray { //创建退出菜单监听器 ActionListener exitListener = new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { exit(); @@ -177,7 +179,13 @@ public class ServerTray { } public static void init() { - if (INSTANCE == null) - INSTANCE = new ServerTray(); + UIUtil.invokeLaterIfNeeded(new Runnable() { + @Override + public void run() { + if (INSTANCE == null) { + INSTANCE = new ServerTray(); + } + } + }); } } \ No newline at end of file diff --git a/designer-realize/src/main/java/com/fr/start/common/SplashWindow.java b/designer-realize/src/main/java/com/fr/start/common/SplashWindow.java index 58a27dd7f5..951fba3266 100644 --- a/designer-realize/src/main/java/com/fr/start/common/SplashWindow.java +++ b/designer-realize/src/main/java/com/fr/start/common/SplashWindow.java @@ -1,11 +1,19 @@ package com.fr.start.common; +import com.fr.base.BaseUtils; +import com.fr.design.fun.OemProcessor; import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.log.FineLoggerFactory; +import com.fr.stable.image4j.codec.ico.ICODecoder; import com.fr.stable.os.OperatingSystem; +import com.fr.start.OemHandler; import com.sun.awt.AWTUtilities; import javax.swing.*; import java.awt.*; +import java.awt.image.*; +import java.io.IOException; +import java.util.List; /** * 启动画面窗口 @@ -22,6 +30,8 @@ public class SplashWindow extends JFrame { // alex:必须设置这个属性为true,才可以用透明背景 System.setProperty("sun.java2d.noddraw", "true"); + initTitleIcon(); + //slash pane this.splash = new SplashPane(); @@ -41,6 +51,32 @@ public class SplashWindow extends JFrame { GUICoreUtils.centerWindow(this); } + /** + * 设置任务栏图标,主要用于Windows + */ + @SuppressWarnings("unchecked") + private void initTitleIcon() { + try { + OemProcessor oemProcessor = OemHandler.findOem(); + List image = null; + if (oemProcessor != null) { + try { + image = oemProcessor.createTitleIcon(); + } catch (Throwable e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + } + if (image == null) { + image = ICODecoder.read(SplashWindow.class + .getResourceAsStream("/com/fr/base/images/oem/logo.ico")); + } + this.setIconImages(image); + } catch (IOException e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + this.setIconImage(BaseUtils.readImage("/com/fr/base/images/oem/logo.png")); + } + } + /** * 注销窗口 */ @@ -61,10 +97,4 @@ public class SplashWindow extends JFrame { void updateThanksLog(String text) { splash.updateThanksLog(text); } - - - public static void main(String[] args) { - SplashWindow splashWindow = new SplashWindow(); - splashWindow.setVisible(true); - } }