diff --git a/designer-base/src/main/java/com/fr/design/fun/DesignerTransform.java b/designer-base/src/main/java/com/fr/design/fun/DesignerTransform.java new file mode 100644 index 0000000000..cb408e6fe2 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/fun/DesignerTransform.java @@ -0,0 +1,23 @@ +package com.fr.design.fun; + +import com.fr.stable.fun.mark.Mutable; +import com.fr.start.BaseDesigner; + +/** + * 设计器启动类替换接口 + * + * @author hades + * @version 10.0 + * Created by hades on 2020/5/7 + */ + +public interface DesignerTransform extends Mutable { + + String MARK_STRING = "DesignerTransform"; + + int CURRENT_LEVEL = 1; + + + Class transform(); + +} diff --git a/designer-base/src/main/java/com/fr/design/fun/impl/AbstractDesignerTransform.java b/designer-base/src/main/java/com/fr/design/fun/impl/AbstractDesignerTransform.java new file mode 100644 index 0000000000..0f4d44d2d6 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/fun/impl/AbstractDesignerTransform.java @@ -0,0 +1,23 @@ +package com.fr.design.fun.impl; + +import com.fr.design.fun.DesignerTransform; +import com.fr.stable.fun.mark.API; + +/** + * @author hades + * @version 10.0 + * Created by hades on 2020/5/7 + */ +@API(level = DesignerTransform.CURRENT_LEVEL) +public abstract class AbstractDesignerTransform implements DesignerTransform { + + @Override + public String mark4Provider() { + return getClass().getName(); + } + + @Override + public int currentAPILevel() { + return CURRENT_LEVEL; + } +} diff --git a/designer-realize/src/main/java/com/fr/start/DesignerInitial.java b/designer-realize/src/main/java/com/fr/start/DesignerInitial.java index 856208f400..5df71cdbf9 100644 --- a/designer-realize/src/main/java/com/fr/start/DesignerInitial.java +++ b/designer-realize/src/main/java/com/fr/start/DesignerInitial.java @@ -1,12 +1,15 @@ package com.fr.start; import com.fr.design.constants.DesignerLaunchStatus; +import com.fr.design.fun.DesignerTransform; import com.fr.design.mainframe.DesignerContext; import com.fr.design.ui.util.UIUtil; import com.fr.event.Event; import com.fr.event.EventDispatcher; import com.fr.event.Listener; import com.fr.event.Null; +import com.fr.invoke.Reflect; +import com.fr.stable.bridge.StableFactory; /** * Created by juhaoyu on 2019-06-14. @@ -14,13 +17,18 @@ import com.fr.event.Null; */ public class DesignerInitial { - private static volatile MainDesigner designer; + private static volatile BaseDesigner designer; public static void init(final String... args) { UIUtil.invokeLaterIfNeeded(new Runnable() { @Override public void run() { - designer = new MainDesigner(args); + DesignerTransform transform = StableFactory.getMarkedInstanceObjectFromClass(DesignerTransform.MARK_STRING, DesignerTransform.class); + if (transform != null) { + designer = Reflect.on(transform.transform()).create(args).get(); + } else { + designer = new MainDesigner(args); + } } }); }