|
|
|
@ -50,6 +50,7 @@ import java.util.ArrayList;
|
|
|
|
|
import java.util.Collections; |
|
|
|
|
import java.util.Comparator; |
|
|
|
|
import java.util.List; |
|
|
|
|
import java.util.concurrent.ExecutionException; |
|
|
|
|
import javax.swing.BorderFactory; |
|
|
|
|
import javax.swing.DefaultListCellRenderer; |
|
|
|
|
import javax.swing.DefaultListModel; |
|
|
|
@ -59,6 +60,7 @@ import javax.swing.JPanel;
|
|
|
|
|
import javax.swing.JPopupMenu; |
|
|
|
|
import javax.swing.JScrollPane; |
|
|
|
|
import javax.swing.JTree; |
|
|
|
|
import javax.swing.SwingWorker; |
|
|
|
|
import javax.swing.event.ListSelectionEvent; |
|
|
|
|
import javax.swing.event.ListSelectionListener; |
|
|
|
|
import javax.swing.event.TreeSelectionEvent; |
|
|
|
@ -352,27 +354,51 @@ public class JSContentWithDescriptionPane extends JSContentPane implements KeyLi
|
|
|
|
|
private void doHelpDocumentSearch() { |
|
|
|
|
Object value = interfaceNameList.getSelectedValue(); |
|
|
|
|
if (value != null) { |
|
|
|
|
String url = CloudCenter.getInstance().acquireUrlByKind("af.doc_search", DOCUMENT_SEARCH_URL) + value.toString(); |
|
|
|
|
try { |
|
|
|
|
String result = HttpToolbox.get(url); |
|
|
|
|
JSONObject jsonObject = new JSONObject(result); |
|
|
|
|
JSONArray jsonArray = jsonObject.optJSONArray("list"); |
|
|
|
|
if (jsonArray != null) { |
|
|
|
|
DefaultListModel helpDOCModel = (DefaultListModel) helpDOCList.getModel(); |
|
|
|
|
helpDOCModel.clear(); |
|
|
|
|
for (int i = 0; i < jsonArray.length(); i++) { |
|
|
|
|
JSONObject resultJSONObject = jsonArray.optJSONObject(i); |
|
|
|
|
String docURL = resultJSONObject.optString("url"); |
|
|
|
|
String name = resultJSONObject.optString("title").trim(); |
|
|
|
|
HelpDocument helpDocument = new HelpDocument(docURL, name); |
|
|
|
|
helpDOCModel.addElement(helpDocument); |
|
|
|
|
new SwingWorker<List<HelpDocument>, Void>() { |
|
|
|
|
@Override |
|
|
|
|
protected List<HelpDocument> doInBackground() throws Exception { |
|
|
|
|
List<HelpDocument> helpDocuments = new ArrayList<>(); |
|
|
|
|
updateHelpDocuments(value, helpDocuments); |
|
|
|
|
return helpDocuments; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
protected void done() { |
|
|
|
|
try { |
|
|
|
|
List<HelpDocument> helpDocuments = get(); |
|
|
|
|
DefaultListModel helpDOCModel = (DefaultListModel) helpDOCList.getModel(); |
|
|
|
|
helpDOCModel.clear(); |
|
|
|
|
for (HelpDocument helpDocument : helpDocuments) { |
|
|
|
|
helpDOCModel.addElement(helpDocument); |
|
|
|
|
} |
|
|
|
|
} catch (InterruptedException | ExecutionException e) { |
|
|
|
|
e.printStackTrace(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} catch (JSONException e) { |
|
|
|
|
FineLoggerFactory.getLogger().debug(e.getMessage(), e); |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
FineLoggerFactory.getLogger().error(e.getMessage(), e); |
|
|
|
|
|
|
|
|
|
}.execute(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void updateHelpDocuments(Object value, List<HelpDocument> helpDocuments) { |
|
|
|
|
String url = CloudCenter.getInstance().acquireUrlByKind("af.doc_search", DOCUMENT_SEARCH_URL) + value.toString(); |
|
|
|
|
try { |
|
|
|
|
String result = HttpToolbox.get(url); |
|
|
|
|
JSONObject jsonObject = new JSONObject(result); |
|
|
|
|
JSONArray jsonArray = jsonObject.optJSONArray("list"); |
|
|
|
|
if (jsonArray != null) { |
|
|
|
|
for (int i = 0; i < jsonArray.length(); i++) { |
|
|
|
|
JSONObject resultJSONObject = jsonArray.optJSONObject(i); |
|
|
|
|
String docURL = resultJSONObject.optString("url"); |
|
|
|
|
String name = resultJSONObject.optString("title").trim(); |
|
|
|
|
HelpDocument helpDocument = new HelpDocument(docURL, name); |
|
|
|
|
helpDocuments.add(helpDocument); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} catch (JSONException e) { |
|
|
|
|
FineLoggerFactory.getLogger().debug(e.getMessage(), e); |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
FineLoggerFactory.getLogger().error(e.getMessage(), e); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|