From 7a187cd18290f4f28ed15e8b6b3e818ff246421f Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Mon, 15 May 2017 17:24:25 +0800 Subject: [PATCH] rt --- .../mainframe/alphafine/AlphaFineConstants.java | 6 ++++-- .../alphafine/component/AlphaFineDialog.java | 13 +++++++------ .../searchManager/PluginSearchManager.java | 12 +++++++++--- 3 files changed, 20 insertions(+), 11 deletions(-) diff --git a/designer/src/com/fr/design/mainframe/alphafine/AlphaFineConstants.java b/designer/src/com/fr/design/mainframe/alphafine/AlphaFineConstants.java index dd4aadcbc..2ca448178 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/AlphaFineConstants.java +++ b/designer/src/com/fr/design/mainframe/alphafine/AlphaFineConstants.java @@ -72,13 +72,15 @@ public class AlphaFineConstants { public static final String PLUGIN_SEARCH_URL = SiteCenter.getInstance().acquireUrlByKind("plugin.searchAPI"); - public static final String PLUGIN_IMAGE_URL = "http://shop.finereport.com/plugin/"; + public static final String PLUGIN_URL = "http://shop.finereport.com/plugin/"; - public static final String REUSE_IMAGE_URL = "http://shop.finereport.com/reuse/"; + public static final String REUSE_URL = "http://shop.finereport.com/reuse/"; public static final String DOCUMENT_DOC_URL = "http://help.finereport.com/doc-view-"; public static final String DOCUMENT_SEARCH_URL = "http://help.finereport.com/?api-search-title-"; + public static final String PLUGIN_IMAGE_URL = "http://shopres.finereport.com/"; + } diff --git a/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java b/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java index 3598bb5c7..8fd84be96 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java +++ b/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java @@ -44,7 +44,6 @@ import java.io.*; import java.net.URI; import java.net.URISyntaxException; import java.net.URL; -import java.net.URLEncoder; import java.util.concurrent.ExecutionException; /** @@ -363,17 +362,19 @@ public class AlphaFineDialog extends UIDialog { this.searchWorker = new SwingWorker() { @Override protected Image doInBackground() throws Exception { - BufferedImage bufferedImage = ImageIO.read(new URL(URLEncoder.encode(((PluginModel) selectedValue).getImageUrl()))); + BufferedImage bufferedImage = ImageIO.read(new URL(((PluginModel) selectedValue).getImageUrl())); return bufferedImage; } @Override protected void done() { try { - rightSearchResultPane.removeAll(); - rightSearchResultPane.add(new PluginPreviewPane(((PluginModel) selectedValue).getName(), get(), ((PluginModel) selectedValue).getVersion(), ((PluginModel) selectedValue).getJartime(), ((PluginModel) selectedValue).getType(), ((PluginModel) selectedValue).getPrice())); - validate(); - repaint(); + if (!isCancelled()) { + rightSearchResultPane.removeAll(); + rightSearchResultPane.add(new PluginPreviewPane(((PluginModel) selectedValue).getName(), get(), ((PluginModel) selectedValue).getVersion(), ((PluginModel) selectedValue).getJartime(), ((PluginModel) selectedValue).getType(), ((PluginModel) selectedValue).getPrice())); + validate(); + repaint(); + } } catch (InterruptedException e) { FRLogger.getLogger().error(e.getMessage()); } catch (ExecutionException e) { diff --git a/designer/src/com/fr/design/mainframe/alphafine/searchManager/PluginSearchManager.java b/designer/src/com/fr/design/mainframe/alphafine/searchManager/PluginSearchManager.java index b43317f06..5e5410a79 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/searchManager/PluginSearchManager.java +++ b/designer/src/com/fr/design/mainframe/alphafine/searchManager/PluginSearchManager.java @@ -14,6 +14,7 @@ import com.fr.json.JSONArray; import com.fr.json.JSONException; import com.fr.json.JSONObject; +import java.io.UnsupportedEncodingException; import java.net.URLEncoder; /** @@ -80,8 +81,13 @@ public class PluginSearchManager implements AlphaFineSearchProcessor { JSONObject object = jsonArray.getJSONObject(i); String name = (String) object.get("name"); String content = ((String) object.get("description")); - String pluginUrl = AlphaFineConstants.REUSE_IMAGE_URL + object.get("id"); - String imageUrl = ((String) object.get("pic")); + String pluginUrl = AlphaFineConstants.REUSE_URL + object.get("id"); + String imageUrl = null; + try { + imageUrl = AlphaFineConstants.PLUGIN_IMAGE_URL + URLEncoder.encode(object.get("pic").toString().substring(AlphaFineConstants.PLUGIN_IMAGE_URL.length()), "utf8"); + } catch (UnsupportedEncodingException e) { + FRLogger.getLogger().error(e.getMessage()); + } String version = null; String jartime = null; CellType type = CellType.REUSE; @@ -90,7 +96,7 @@ public class PluginSearchManager implements AlphaFineSearchProcessor { version = (String) object.get("version"); jartime = (String) object.get("jartime"); type = CellType.PLUGIN; - pluginUrl = AlphaFineConstants.PLUGIN_IMAGE_URL + object.get("id"); + pluginUrl = AlphaFineConstants.PLUGIN_URL + object.get("id"); } int price = (int) object.get("price"); return new PluginModel(name, content, pluginUrl, imageUrl, version, jartime, type, price);