|
|
@ -6,7 +6,6 @@ import com.fr.design.dialog.UIDialog; |
|
|
|
import com.fr.design.extra.exe.*; |
|
|
|
import com.fr.design.extra.exe.*; |
|
|
|
import com.fr.general.FRLogger; |
|
|
|
import com.fr.general.FRLogger; |
|
|
|
import com.fr.general.Inter; |
|
|
|
import com.fr.general.Inter; |
|
|
|
import com.fr.general.SiteCenter; |
|
|
|
|
|
|
|
import com.fr.plugin.Plugin; |
|
|
|
import com.fr.plugin.Plugin; |
|
|
|
import com.fr.plugin.PluginLicense; |
|
|
|
import com.fr.plugin.PluginLicense; |
|
|
|
import com.fr.plugin.PluginLicenseManager; |
|
|
|
import com.fr.plugin.PluginLicenseManager; |
|
|
@ -18,13 +17,14 @@ import javafx.scene.web.WebEngine; |
|
|
|
import javafx.stage.FileChooser; |
|
|
|
import javafx.stage.FileChooser; |
|
|
|
import javafx.stage.Stage; |
|
|
|
import javafx.stage.Stage; |
|
|
|
import netscape.javascript.JSObject; |
|
|
|
import netscape.javascript.JSObject; |
|
|
|
|
|
|
|
import org.json.JSONObject; |
|
|
|
|
|
|
|
|
|
|
|
import javax.swing.*; |
|
|
|
import javax.swing.*; |
|
|
|
import java.awt.*; |
|
|
|
import java.awt.*; |
|
|
|
import java.io.File; |
|
|
|
import java.io.File; |
|
|
|
import java.io.IOException; |
|
|
|
import java.io.IOException; |
|
|
|
import java.net.URI; |
|
|
|
import java.net.URI; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.*; |
|
|
|
import java.util.List; |
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -35,6 +35,26 @@ public class PluginWebBridge { |
|
|
|
private static PluginWebBridge helper; |
|
|
|
private static PluginWebBridge helper; |
|
|
|
|
|
|
|
|
|
|
|
private UIDialog uiDialog; |
|
|
|
private UIDialog uiDialog; |
|
|
|
|
|
|
|
private ACTIONS action; |
|
|
|
|
|
|
|
private String ACTION = "action"; |
|
|
|
|
|
|
|
private String KEYWORD = "keyword"; |
|
|
|
|
|
|
|
private Map<String, Object> config; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 动作枚举 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
public enum ACTIONS { |
|
|
|
|
|
|
|
SEARCH("search"); |
|
|
|
|
|
|
|
private String context; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ACTIONS(String context) { |
|
|
|
|
|
|
|
this.context = context; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public String getContext() { |
|
|
|
|
|
|
|
return context; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static PluginWebBridge getHelper() { |
|
|
|
public static PluginWebBridge getHelper() { |
|
|
|
if (helper != null) { |
|
|
|
if (helper != null) { |
|
|
@ -59,6 +79,54 @@ public class PluginWebBridge { |
|
|
|
private PluginWebBridge() { |
|
|
|
private PluginWebBridge() { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 获取打开动作配置 |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @return 配置信息 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
public String getRunConfig() { |
|
|
|
|
|
|
|
if (action != null) { |
|
|
|
|
|
|
|
JSONObject jsonObject = new JSONObject(); |
|
|
|
|
|
|
|
jsonObject.put(ACTION, action.getContext()); |
|
|
|
|
|
|
|
Set<String> keySet = config.keySet(); |
|
|
|
|
|
|
|
for (String key : keySet) { |
|
|
|
|
|
|
|
jsonObject.put(key, config.get(key).toString()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return jsonObject.toString(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return StringUtils.EMPTY; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 配置打开动作 |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @param action 动作 |
|
|
|
|
|
|
|
* @param config 参数 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
public void setRunConfig(ACTIONS action, Map<String, Object> config) { |
|
|
|
|
|
|
|
this.action = action; |
|
|
|
|
|
|
|
this.config = config; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 清楚打开动作 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
public void clearRunConfig() { |
|
|
|
|
|
|
|
this.action = null; |
|
|
|
|
|
|
|
this.config = null; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 打开时搜索 |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @param keyword 关键词 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
public void openWithSearch(String keyword) { |
|
|
|
|
|
|
|
HashMap<String, Object> map = new HashMap<String, Object>(2); |
|
|
|
|
|
|
|
map.put(KEYWORD, keyword); |
|
|
|
|
|
|
|
setRunConfig(ACTIONS.SEARCH, map); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void setEngine(WebEngine webEngine) { |
|
|
|
public void setEngine(WebEngine webEngine) { |
|
|
|
this.webEngine = webEngine; |
|
|
|
this.webEngine = webEngine; |
|
|
|
} |
|
|
|
} |
|
|
@ -203,7 +271,7 @@ public class PluginWebBridge { |
|
|
|
* |
|
|
|
* |
|
|
|
* @return 已安装的插件授权对象 |
|
|
|
* @return 已安装的插件授权对象 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public PluginLicense getPluginLicenseByID(String pluginID ) { |
|
|
|
public PluginLicense getPluginLicenseByID(String pluginID) { |
|
|
|
return PluginLicenseManager.getInstance().getPluginLicenseByID(pluginID); |
|
|
|
return PluginLicenseManager.getInstance().getPluginLicenseByID(pluginID); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|