Browse Source

new:设计器商店打开动作接口

master
vito 9 years ago
parent
commit
8cf0a2224a
  1. 5
      designer_base/src/com/fr/design/extra/PluginManagerPane.java
  2. 75
      designer_base/src/com/fr/design/extra/PluginWebBridge.java

5
designer_base/src/com/fr/design/extra/PluginManagerPane.java

@ -69,11 +69,12 @@ public class PluginManagerPane extends BasicPane {
/** /**
* 以关键词打开设计器商店 * 以关键词打开设计器商店
*
* @param keyword 关键词 * @param keyword 关键词
*/ */
public PluginManagerPane(String keyword){ public PluginManagerPane(String keyword) {
this(); this();
PluginWebBridge.getHelper().setShowKeyword(keyword); PluginWebBridge.getHelper().openWithSearch(keyword);
} }
private void addPane(String installHome) { private void addPane(String installHome) {

75
designer_base/src/com/fr/design/extra/PluginWebBridge.java

@ -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,7 +35,26 @@ public class PluginWebBridge {
private static PluginWebBridge helper; private static PluginWebBridge helper;
private UIDialog uiDialog; private UIDialog uiDialog;
private String showKeyword; 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) {
@ -60,12 +79,52 @@ public class PluginWebBridge {
private PluginWebBridge() { private PluginWebBridge() {
} }
public String getShowKeyword() { /**
return showKeyword; * 获取打开动作配置
*
* @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;
} }
public void setShowKeyword(String showKeyWord) { /**
this.showKeyword = showKeyWord; * 配置打开动作
*
* @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) {
@ -212,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);
} }

Loading…
Cancel
Save