From 16b92e158f07afc8016cf579595b51b276482e0b Mon Sep 17 00:00:00 2001 From: vito Date: Wed, 13 Jul 2016 16:43:14 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E6=89=93=E5=BC=80=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E7=95=8C=E9=9D=A2=E6=8C=87=E5=AE=9A=E6=90=9C=E7=B4=A2?= =?UTF-8?q?=E5=85=B3=E9=94=AE=E8=AF=8D=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/com/fr/design/extra/PluginWebBridge.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/designer_base/src/com/fr/design/extra/PluginWebBridge.java b/designer_base/src/com/fr/design/extra/PluginWebBridge.java index 156627b6b..70366d2b7 100644 --- a/designer_base/src/com/fr/design/extra/PluginWebBridge.java +++ b/designer_base/src/com/fr/design/extra/PluginWebBridge.java @@ -35,6 +35,7 @@ public class PluginWebBridge { private static PluginWebBridge helper; private UIDialog uiDialog; + private String showKeyword; public static PluginWebBridge getHelper() { if (helper != null) { @@ -59,6 +60,14 @@ public class PluginWebBridge { private PluginWebBridge() { } + public String getShowKeyword() { + return showKeyword; + } + + public void setShowKeyword(String showKeyWord) { + this.showKeyword = showKeyWord; + } + public void setEngine(WebEngine webEngine) { this.webEngine = webEngine; } From 5e7272212e39367ebb0699532d7c2dc717a6195e Mon Sep 17 00:00:00 2001 From: vito Date: Wed, 13 Jul 2016 16:54:45 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E8=AE=BE=E8=AE=A1=E5=99=A8=E5=95=86?= =?UTF-8?q?=E5=BA=97=E4=BB=A5=E5=85=B3=E9=94=AE=E8=AF=8D=E6=89=93=E5=BC=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer_base/src/com/fr/design/extra/PluginManagerPane.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/designer_base/src/com/fr/design/extra/PluginManagerPane.java b/designer_base/src/com/fr/design/extra/PluginManagerPane.java index 36948fe36..a449044be 100644 --- a/designer_base/src/com/fr/design/extra/PluginManagerPane.java +++ b/designer_base/src/com/fr/design/extra/PluginManagerPane.java @@ -66,6 +66,11 @@ public class PluginManagerPane extends BasicPane { initTraditionalStore(); } } + + public PluginManagerPane(String keyword){ + this(); + PluginWebBridge.getHelper().setShowKeyword(keyword); + } private void addPane(String installHome) { PluginWebPane webPane = new PluginWebPane(new File(installHome).getAbsolutePath()); From c7cc2bc67bd83a96fd534c09974c6721eeba5bab Mon Sep 17 00:00:00 2001 From: vito Date: Wed, 13 Jul 2016 16:56:46 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/com/fr/design/extra/PluginManagerPane.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/designer_base/src/com/fr/design/extra/PluginManagerPane.java b/designer_base/src/com/fr/design/extra/PluginManagerPane.java index a449044be..d479a5028 100644 --- a/designer_base/src/com/fr/design/extra/PluginManagerPane.java +++ b/designer_base/src/com/fr/design/extra/PluginManagerPane.java @@ -66,7 +66,11 @@ public class PluginManagerPane extends BasicPane { initTraditionalStore(); } } - + + /** + * 以关键词打开设计器商店 + * @param keyword 关键词 + */ public PluginManagerPane(String keyword){ this(); PluginWebBridge.getHelper().setShowKeyword(keyword); From 8cf0a2224abc05dd291f46a21be8e5af5aeb7a9c Mon Sep 17 00:00:00 2001 From: vito Date: Mon, 1 Aug 2016 16:47:35 +0800 Subject: [PATCH 4/4] =?UTF-8?q?new=EF=BC=9A=E8=AE=BE=E8=AE=A1=E5=99=A8?= =?UTF-8?q?=E5=95=86=E5=BA=97=E6=89=93=E5=BC=80=E5=8A=A8=E4=BD=9C=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/extra/PluginManagerPane.java | 5 +- .../com/fr/design/extra/PluginWebBridge.java | 77 ++++++++++++++++--- 2 files changed, 71 insertions(+), 11 deletions(-) diff --git a/designer_base/src/com/fr/design/extra/PluginManagerPane.java b/designer_base/src/com/fr/design/extra/PluginManagerPane.java index d479a5028..64ceea369 100644 --- a/designer_base/src/com/fr/design/extra/PluginManagerPane.java +++ b/designer_base/src/com/fr/design/extra/PluginManagerPane.java @@ -69,11 +69,12 @@ public class PluginManagerPane extends BasicPane { /** * 以关键词打开设计器商店 + * * @param keyword 关键词 */ - public PluginManagerPane(String keyword){ + public PluginManagerPane(String keyword) { this(); - PluginWebBridge.getHelper().setShowKeyword(keyword); + PluginWebBridge.getHelper().openWithSearch(keyword); } private void addPane(String installHome) { diff --git a/designer_base/src/com/fr/design/extra/PluginWebBridge.java b/designer_base/src/com/fr/design/extra/PluginWebBridge.java index 70366d2b7..144f913da 100644 --- a/designer_base/src/com/fr/design/extra/PluginWebBridge.java +++ b/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.general.FRLogger; import com.fr.general.Inter; -import com.fr.general.SiteCenter; import com.fr.plugin.Plugin; import com.fr.plugin.PluginLicense; import com.fr.plugin.PluginLicenseManager; @@ -18,13 +17,14 @@ import javafx.scene.web.WebEngine; import javafx.stage.FileChooser; import javafx.stage.Stage; import netscape.javascript.JSObject; +import org.json.JSONObject; import javax.swing.*; import java.awt.*; import java.io.File; import java.io.IOException; import java.net.URI; -import java.util.ArrayList; +import java.util.*; import java.util.List; /** @@ -35,7 +35,26 @@ public class PluginWebBridge { private static PluginWebBridge helper; private UIDialog uiDialog; - private String showKeyword; + private ACTIONS action; + private String ACTION = "action"; + private String KEYWORD = "keyword"; + private Map config; + + /** + * 动作枚举 + */ + public enum ACTIONS { + SEARCH("search"); + private String context; + + ACTIONS(String context) { + this.context = context; + } + + public String getContext() { + return context; + } + } public static PluginWebBridge getHelper() { if (helper != null) { @@ -60,12 +79,52 @@ public class 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 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 config) { + this.action = action; + this.config = config; + } + + /** + * 清楚打开动作 + */ + public void clearRunConfig() { + this.action = null; + this.config = null; + } + + /** + * 打开时搜索 + * + * @param keyword 关键词 + */ + public void openWithSearch(String keyword) { + HashMap map = new HashMap(2); + map.put(KEYWORD, keyword); + setRunConfig(ACTIONS.SEARCH, map); } public void setEngine(WebEngine webEngine) { @@ -212,7 +271,7 @@ public class PluginWebBridge { * * @return 已安装的插件授权对象 */ - public PluginLicense getPluginLicenseByID(String pluginID ) { + public PluginLicense getPluginLicenseByID(String pluginID) { return PluginLicenseManager.getInstance().getPluginLicenseByID(pluginID); } @@ -305,7 +364,7 @@ public class PluginWebBridge { /** * 在本地浏览器里打开url * tips:重载的时候,需要给js调用的方法需要放在前面,否则可能不会被调用(此乃坑) - * 所以最好的是不要重载在js可以访问的接口文件中 + * 所以最好的是不要重载在js可以访问的接口文件中 * * @param url 要打开的地址 */