Browse Source

REPORT-16249 10OEM的启动页替换接口

bugfix/10.0
zack 6 years ago
parent
commit
c89f013405
  1. 33
      designer-base/src/main/java/com/fr/design/fun/OemProcessor.java
  2. 25
      designer-base/src/main/java/com/fr/design/fun/impl/AbstractOemProcessor.java
  3. 12
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java
  4. 7
      designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java
  5. 27
      designer-base/src/main/java/com/fr/start/OemActivator.java
  6. 18
      designer-base/src/main/java/com/fr/start/OemHandler.java
  7. 7
      designer-base/src/main/java/com/fr/start/OemImpl.java
  8. 10
      designer-realize/src/main/java/com/fr/start/module/PreStartActivator.java

33
designer-base/src/main/java/com/fr/design/fun/OemProcessor.java

@ -0,0 +1,33 @@
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 {
/**
* 启动动画,如果不替换则返回null
* @return
*/
SplashStrategy createSplashStrategy();
/**
* 替换标题图标--DesignerFrame.initTitleIcon
* 如果不替换则返回null
* @return
*/
List<BufferedImage> createTitleIcon();
/**
* 处理设计器菜单增删改
* @param menuDefs 已加载的菜单
* @return 新的菜单数组
*/
MenuDef[] dealWithMenuDef(MenuDef[] menuDefs);
}

25
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<BufferedImage> createTitleIcon() {
return null;
}
@Override
public SplashStrategy createSplashStrategy() {
return null;
}
}

12
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,14 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
try {
@SuppressWarnings("unchecked")
List<BufferedImage> image = ICODecoder.read(DesignerFrame.class
.getResourceAsStream("/com/fr/base/images/oem/logo.ico"));
OemProcessor oemProcessor = OemHandler.findOem();
List<BufferedImage> image;
if (oemProcessor != null && oemProcessor.createTitleIcon() != null) {
image = oemProcessor.createTitleIcon();
} else {
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);

7
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;
@ -64,6 +65,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 +202,11 @@ public abstract class ToolBarMenuDock {
};
this.menus = menus(plus);
OemProcessor oemProcessor = OemHandler.findOem();
if (oemProcessor != null) {
this.menus = oemProcessor.dealWithMenuDef(this.menus);
}
for (int i = 0; i < menus.length; i++) {
menus[i].setHasRecMenu(true);
UIMenu subMenu = menus[i].createJMenu();

27
designer-base/src/main/java/com/fr/start/OemActivator.java

@ -0,0 +1,27 @@
package com.fr.start;
import com.fr.design.fun.OemProcessor;
import com.fr.module.Activator;
import com.fr.module.extension.Prepare;
/**
* 设计器OEM注册
*/
public class OemActivator extends Activator implements Prepare {
@Override
public void start() {
}
@Override
public void stop() {
}
@Override
public void prepare() {
// 加入Oem
setSingleton(OemProcessor.class, new OemImpl());
}
}

18
designer-base/src/main/java/com/fr/start/OemHandler.java

@ -0,0 +1,18 @@
package com.fr.start;
import com.fr.design.fun.OemProcessor;
import com.fr.module.Module;
import com.fr.module.ModuleContext;
/**
* OEM处理中心
*/
public class OemHandler {
public static OemProcessor findOem() {
Module oemModule = ModuleContext.getModule(OemActivator.class);
if (oemModule != null) {
return oemModule.getSingleton(OemProcessor.class);
}
return null;
}
}

7
designer-base/src/main/java/com/fr/start/OemImpl.java

@ -0,0 +1,7 @@
package com.fr.start;
import com.fr.design.fun.impl.AbstractOemProcessor;
public class OemImpl extends AbstractOemProcessor{
}

10
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;
@ -123,7 +124,14 @@ public class PreStartActivator extends Activator {
service.shutdown();
}
private static SplashStrategy createSplash() {
private SplashStrategy createSplash() {
OemProcessor oemProcessor = getSingleton(OemProcessor.class);
if (oemProcessor != null) {
SplashStrategy splashStrategy = oemProcessor.createSplashStrategy();
if (splashStrategy != null) {
return splashStrategy;
}
}
// 这里可以开接口加载自定义启动画面
if (OperatingSystem.isWindows()) {
return new SplashFx();

Loading…
Cancel
Save