xiaoxia 7 years ago
parent
commit
7a187cd182
  1. 6
      designer/src/com/fr/design/mainframe/alphafine/AlphaFineConstants.java
  2. 13
      designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java
  3. 12
      designer/src/com/fr/design/mainframe/alphafine/searchManager/PluginSearchManager.java

6
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/";
}

13
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<Image, Void>() {
@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) {

12
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);

Loading…
Cancel
Save