Browse Source
Merge in DESIGN/design from ~VITO/c-design:release/11.0 to release/11.0 * commit '08cf5012c634b51e7366a809acea1e120b6f8fdf': 无jira任务 代码规范 REPORT-93559 补充兼容插件接口release/11.0
vito-刘恒霖
1 year ago
5 changed files with 156 additions and 4 deletions
@ -0,0 +1,55 @@
|
||||
package com.fr.design.ui.compatible; |
||||
|
||||
import com.fr.design.jxbrowser.JxUIPane; |
||||
import com.fr.design.ui.ModernUIPane; |
||||
import com.teamdev.jxbrowser.browser.callback.InjectJsCallback; |
||||
import com.teamdev.jxbrowser.chromium.events.LoadListener; |
||||
import com.teamdev.jxbrowser.chromium.events.ScriptContextListener; |
||||
import com.teamdev.jxbrowser.event.Observer; |
||||
|
||||
/** |
||||
* 封装jxbrwoser v6/v7的构建方式的差异 |
||||
* |
||||
* @author hades |
||||
* @see {@link JxUIPane} |
||||
* @since 10.0 |
||||
* Created on 2021/6/13 |
||||
* @deprecated 6在下个版本弃用 |
||||
*/ |
||||
@Deprecated |
||||
public interface BuilderDiff<T> { |
||||
|
||||
/** |
||||
* v6准备工作 |
||||
* |
||||
* @param contextListener 上下文监听器 |
||||
* @return 构造器 |
||||
*/ |
||||
ModernUIPane.Builder<T> prepareForV6(ScriptContextListener contextListener); |
||||
|
||||
/** |
||||
* v6准备工作 |
||||
* |
||||
* @param loadListener 加载监听器 |
||||
* @return 构造器 |
||||
*/ |
||||
ModernUIPane.Builder<T> prepareForV6(LoadListener loadListener); |
||||
|
||||
/** |
||||
* v7准备工作 |
||||
* |
||||
* @param callback 注入js回调器 |
||||
* @return 构造器 |
||||
*/ |
||||
ModernUIPane.Builder<T> prepareForV7(InjectJsCallback callback); |
||||
|
||||
/** |
||||
* v7准备工作 |
||||
* |
||||
* @param event 事件 |
||||
* @param listener 监听器 |
||||
* @return 构造器 |
||||
*/ |
||||
ModernUIPane.Builder<T> prepareForV7(Class event, Observer listener); |
||||
|
||||
} |
@ -0,0 +1,45 @@
|
||||
package com.fr.design.ui.compatible; |
||||
|
||||
import com.fr.design.jxbrowser.JxUIPane; |
||||
import com.fr.design.ui.ModernUIPane; |
||||
|
||||
/** |
||||
* 根据版本选择构造器 |
||||
* |
||||
* @author hades |
||||
* @see {@link JxUIPane} |
||||
* @since 10.0 |
||||
* Created on 2021/6/13 |
||||
* @deprecated 6在下个版本弃用 |
||||
*/ |
||||
public class ModernUIPaneFactory { |
||||
|
||||
/** |
||||
* 获取一个 JxBrowser pane 的构造器 |
||||
* |
||||
* @param <T> 参数 |
||||
* @return 构造器 |
||||
*/ |
||||
public static <T> ModernUIPane.Builder<T> modernUIPaneBuilder() { |
||||
if (isV7()) { |
||||
return new JxUIPane.Builder<>(); |
||||
} else { |
||||
return new ModernUIPane.Builder<>(); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 判断 JxBrowser 版本是否在7或之上 |
||||
* |
||||
* @return 是否7或之上 |
||||
*/ |
||||
public static boolean isV7() { |
||||
boolean jxBrowserV7 = true; |
||||
try { |
||||
Class.forName("com.teamdev.jxbrowser.net.Scheme"); |
||||
} catch (ClassNotFoundException e) { |
||||
jxBrowserV7 = false; |
||||
} |
||||
return jxBrowserV7; |
||||
} |
||||
} |
Loading…
Reference in new issue