diff --git a/designer-base/src/main/java/com/fr/design/fun/OemProcessor.java b/designer-base/src/main/java/com/fr/design/fun/OemProcessor.java new file mode 100644 index 0000000000..44acc11902 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/fun/OemProcessor.java @@ -0,0 +1,38 @@ +package com.fr.design.fun; + +import com.fr.design.menu.MenuDef; +import com.fr.start.SplashStrategy; + +import java.awt.image.BufferedImage; +import java.util.List; + +/** + * 设计器Oem接口 + */ +public interface OemProcessor { + public static final String MARK_STRING = "OemProcessor"; + + /** + * 启动动画,如果不替换则返回null + * + * @return + */ + SplashStrategy createSplashStrategy(); + + /** + * 替换标题图标--DesignerFrame.initTitleIcon + * 如果不替换则返回null + * + * @return + */ + List createTitleIcon(); + + /** + * 处理设计器菜单(增删改) + * + * @param menuDefs 已加载的菜单 + * @return 新的菜单数组 + */ + MenuDef[] dealWithMenuDef(MenuDef[] menuDefs); + +} \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/fun/impl/AbstractOemProcessor.java b/designer-base/src/main/java/com/fr/design/fun/impl/AbstractOemProcessor.java new file mode 100644 index 0000000000..d49bfdf246 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/fun/impl/AbstractOemProcessor.java @@ -0,0 +1,25 @@ +package com.fr.design.fun.impl; + +import com.fr.design.fun.OemProcessor; +import com.fr.design.menu.MenuDef; +import com.fr.start.SplashStrategy; + +import java.awt.image.BufferedImage; +import java.util.List; + +public abstract class AbstractOemProcessor implements OemProcessor{ + @Override + public MenuDef[] dealWithMenuDef(MenuDef[] menuDefs) { + return menuDefs; + } + + @Override + public List createTitleIcon() { + return null; + } + + @Override + public SplashStrategy createSplashStrategy() { + return null; + } +} \ No newline at end of file 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 55e07cc1ce..04dab52b50 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 @@ -24,6 +24,7 @@ import com.fr.design.file.MutilTempalteTabPane; import com.fr.design.file.NewTemplatePane; import com.fr.design.file.SaveSomeTemplatePane; import com.fr.design.file.TemplateTreePane; +import com.fr.design.fun.OemProcessor; import com.fr.design.fun.TitlePlaceProcessor; import com.fr.design.fun.impl.AbstractTemplateTreeShortCutProvider; import com.fr.design.gui.ibutton.UIButton; @@ -57,6 +58,7 @@ import com.fr.stable.ProductConstants; import com.fr.stable.StringUtils; import com.fr.stable.image4j.codec.ico.ICODecoder; import com.fr.stable.project.ProjectConstants; +import com.fr.start.OemHandler; import com.fr.workspace.WorkContext; import com.fr.workspace.Workspace; import com.fr.workspace.connect.WorkspaceConnectionInfo; @@ -458,8 +460,19 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta try { @SuppressWarnings("unchecked") - List image = ICODecoder.read(DesignerFrame.class - .getResourceAsStream("/com/fr/base/images/oem/logo.ico")); + 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(DesignerFrame.class + .getResourceAsStream("/com/fr/base/images/oem/logo.ico")); + } this.setIconImages(image); } catch (IOException e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java b/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java index ff31f01564..2577b6bd02 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java @@ -38,6 +38,7 @@ import com.fr.design.actions.server.PlatformManagerAction; import com.fr.design.actions.server.PluginManagerAction; import com.fr.design.file.NewTemplatePane; import com.fr.design.fun.MenuHandler; +import com.fr.design.fun.OemProcessor; import com.fr.design.fun.TableDataPaneProcessor; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ilable.UILabel; @@ -56,6 +57,7 @@ import com.fr.design.remote.action.RemoteDesignAuthManagerAction; import com.fr.design.utils.ThemeUtils; import com.fr.general.ComparatorUtils; import com.fr.general.GeneralContext; +import com.fr.log.FineLoggerFactory; import com.fr.plugin.context.PluginContext; import com.fr.plugin.context.PluginRuntime; import com.fr.plugin.manage.PluginFilter; @@ -64,6 +66,7 @@ import com.fr.plugin.observer.PluginEventListener; import com.fr.plugin.observer.PluginEventType; import com.fr.stable.ArrayUtils; import com.fr.stable.StringUtils; +import com.fr.start.OemHandler; import com.fr.workspace.WorkContext; import javax.swing.JComponent; @@ -200,6 +203,18 @@ public abstract class ToolBarMenuDock { }; this.menus = menus(plus); + try { + OemProcessor oemProcessor = OemHandler.findOem(); + if (oemProcessor != null) { + this.menus = oemProcessor.dealWithMenuDef(this.menus); + if (this.menus == null) { + this.menus = menus(plus); + } + } + } catch (Throwable e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + this.menus = menus(plus); + } for (int i = 0; i < menus.length; i++) { menus[i].setHasRecMenu(true); UIMenu subMenu = menus[i].createJMenu(); diff --git a/designer-base/src/main/java/com/fr/start/OemHandler.java b/designer-base/src/main/java/com/fr/start/OemHandler.java new file mode 100644 index 0000000000..b127e07f43 --- /dev/null +++ b/designer-base/src/main/java/com/fr/start/OemHandler.java @@ -0,0 +1,14 @@ +package com.fr.start; + +import com.fr.design.fun.OemProcessor; +import com.fr.stable.bridge.StableFactory; + +/** + * OEM处理中心 + */ +public class OemHandler { + + public static OemProcessor findOem() { + return StableFactory.getMarkedInstanceObjectFromClass(OemProcessor.MARK_STRING, OemProcessor.class); + } +} \ No newline at end of file diff --git a/designer-realize/src/main/java/com/fr/start/module/PreStartActivator.java b/designer-realize/src/main/java/com/fr/start/module/PreStartActivator.java index 1dd95cf6ad..3c255c936d 100644 --- a/designer-realize/src/main/java/com/fr/start/module/PreStartActivator.java +++ b/designer-realize/src/main/java/com/fr/start/module/PreStartActivator.java @@ -2,6 +2,7 @@ package com.fr.start.module; import com.fr.design.DesignerEnvManager; import com.fr.design.RestartHelper; +import com.fr.design.fun.OemProcessor; import com.fr.design.mainframe.templateinfo.TemplateInfoCollector; import com.fr.design.utils.DesignUtils; import com.fr.design.utils.DesignerPort; @@ -14,6 +15,7 @@ import com.fr.stable.BuildContext; import com.fr.stable.OperatingSystem; import com.fr.stable.ProductConstants; import com.fr.stable.StableUtils; +import com.fr.start.OemHandler; import com.fr.start.SplashContext; import com.fr.start.SplashStrategy; import com.fr.start.fx.SplashFx; @@ -123,7 +125,19 @@ public class PreStartActivator extends Activator { service.shutdown(); } - private static SplashStrategy createSplash() { + private SplashStrategy createSplash() { + OemProcessor oemProcessor = OemHandler.findOem(); + if (oemProcessor != null) { + SplashStrategy splashStrategy = null; + try { + splashStrategy = oemProcessor.createSplashStrategy(); + } catch (Throwable e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + if (splashStrategy != null) { + return splashStrategy; + } + } // 这里可以开接口加载自定义启动画面 if (OperatingSystem.isWindows()) { return new SplashFx();