forked from fanruan/design
Hades
4 years ago
8 changed files with 127 additions and 3 deletions
@ -0,0 +1,31 @@
|
||||
package com.fr.design.fun; |
||||
|
||||
/** |
||||
* 设计器生命周期接口 |
||||
* |
||||
* @author hades |
||||
* @version 10.0 |
||||
* Created by hades on 2021/1/26 |
||||
*/ |
||||
public interface DesignerLifecycleMonitor { |
||||
|
||||
String MARK_STRING = "DesignerLifecycleMonitor"; |
||||
|
||||
int CURRENT_LEVEL = 1; |
||||
|
||||
/** |
||||
* 设计器启动之前 |
||||
*/ |
||||
void beforeStart(); |
||||
|
||||
/** |
||||
* 设计器启动完成 界面出现之后 |
||||
*/ |
||||
void afterStart(); |
||||
|
||||
/** |
||||
* 设计器关闭退出之前 |
||||
*/ |
||||
void beforeStop(); |
||||
|
||||
} |
@ -0,0 +1,31 @@
|
||||
package com.fr.design.fun; |
||||
|
||||
/** |
||||
* 设计器所有端口获取 |
||||
* |
||||
* @author hades |
||||
* @version 10.0 |
||||
* Created by hades on 2021/1/18 |
||||
*/ |
||||
public interface DesignerPortProvider { |
||||
|
||||
String MARK_STRING = "DesignerPortProvider"; |
||||
|
||||
int CURRENT_LEVEL = 1; |
||||
|
||||
|
||||
/** |
||||
* 设计器自身端口 |
||||
* |
||||
* @return |
||||
*/ |
||||
int messagePort(); |
||||
|
||||
/** |
||||
* 内置服务器端口 |
||||
* |
||||
* @return |
||||
*/ |
||||
int embeddedServerPort(); |
||||
|
||||
} |
@ -0,0 +1,47 @@
|
||||
package com.fr.design.monitor; |
||||
|
||||
import com.fr.design.fun.DesignerLifecycleMonitor; |
||||
import com.fr.stable.bridge.StableFactory; |
||||
|
||||
/** |
||||
* @author hades |
||||
* @version 10.0 |
||||
* Created by hades on 2021/1/27 |
||||
*/ |
||||
public class DesignerLifecycleMonitorContext { |
||||
|
||||
private static DesignerLifecycleMonitor monitor; |
||||
|
||||
static { |
||||
DesignerLifecycleMonitor designerLifecycleMonitor = StableFactory.getMarkedInstanceObjectFromClass(DesignerLifecycleMonitor.MARK_STRING, DesignerLifecycleMonitor.class); |
||||
if (designerLifecycleMonitor != null) { |
||||
monitor = designerLifecycleMonitor; |
||||
} else { |
||||
monitor = new EmptyDesignerLifecycleMonitor(); |
||||
} |
||||
} |
||||
|
||||
public static DesignerLifecycleMonitor getMonitor() { |
||||
return monitor; |
||||
} |
||||
|
||||
static class EmptyDesignerLifecycleMonitor implements DesignerLifecycleMonitor { |
||||
|
||||
@Override |
||||
public void beforeStart() { |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public void afterStart() { |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public void beforeStop() { |
||||
|
||||
} |
||||
} |
||||
|
||||
|
||||
} |
Loading…
Reference in new issue