|
|
|
@ -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,20 +354,45 @@ public class JSContentWithDescriptionPane extends JSContentPane implements KeyLi
|
|
|
|
|
private void doHelpDocumentSearch() { |
|
|
|
|
Object value = interfaceNameList.getSelectedValue(); |
|
|
|
|
if (value != null) { |
|
|
|
|
new SwingWorker<List<HelpDocument>, Void>() { |
|
|
|
|
@Override |
|
|
|
|
protected List<HelpDocument> doInBackground() { |
|
|
|
|
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) { |
|
|
|
|
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) { |
|
|
|
|
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); |
|
|
|
|
helpDocuments.add(helpDocument); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} catch (JSONException e) { |
|
|
|
@ -374,7 +401,6 @@ public class JSContentWithDescriptionPane extends JSContentPane implements KeyLi
|
|
|
|
|
FineLoggerFactory.getLogger().error(e.getMessage(), e); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void initHelpDocumentPane(JPanel descriptionAndDocumentPanel) { |
|
|
|
|
card = new CardLayout(); |
|
|
|
|