Changeset 2145 for trunk/java-client
- Timestamp:
- 2001-03-09T14:33:06+13:00 (23 years ago)
- Location:
- trunk/java-client/org/nzdl/gsdl
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/java-client/org/nzdl/gsdl/SimpleGraphicalClient/CSModel.java
r2143 r2145 22 22 import javax.swing.*; 23 23 24 25 24 // local libraries 26 25 27 26 import org.nzdl.gsdl.service.NzdlService; 28 27 import org.nzdl.gsdl.service.NzdlCollectionInfo; 29 28 /** 30 29 * Class … … 41 40 { 42 41 43 44 45 46 42 Vector collectionList; 43 String currentCollection; 44 ResultModel results; 45 NzdlService nzdl; 47 46 48 47 49 public CSModel(NzdlService newNzdl) 50 { 51 nzdl = newNzdl; 52 results = new ResultModel(); 53 collectionList = new Vector(); 54 currentCollection = ""; 55 } 56 57 58 public NzdlService getNzdlService() 59 { 60 return nzdl; 61 } 48 public CSModel(NzdlService newNzdl) 49 { 50 nzdl = newNzdl; 51 results = new ResultModel(); 52 collectionList = new Vector(); 53 currentCollection = ""; 54 initialiseCollection(); 55 } 56 57 58 public NzdlService getNzdlService() 59 { 60 return nzdl; 61 } 62 62 63 63 64 64 65 65 66 /* Result methods */66 /* Result methods */ 67 67 68 69 70 71 68 public ResultModel getResultsModel() 69 { 70 return results; 71 } 72 72 73 74 75 76 73 public void addResult(Result result) 74 { 75 results.add(result); 76 } 77 77 78 79 80 81 82 78 public void clearResults() 79 { 80 System.out.println("Clearing resultModel"); 81 results.clear(); 82 } 83 83 84 /* collectionList methods */84 /* collectionList methods */ 85 85 86 87 88 89 86 public Vector getCollectionList() 87 { 88 return collectionList; 89 } 90 90 91 92 93 94 91 public int getCollectionListSize() 92 { 93 return collectionList.size(); 94 } 95 95 96 97 98 99 96 public void addCollection(String collection) 97 { 98 collectionList.add(collection); 99 } 100 100 101 102 103 104 101 public void setCurrentCollection(String collection ) 102 { 103 currentCollection = collection; 104 } 105 105 106 107 108 109 106 public String getCurrentCollection() 107 { 108 return currentCollection; 109 } 110 110 111 public String getFirstCollection() 112 { 113 return (String)collectionList.get(0); 114 } 111 public String getFirstCollection() 112 { 113 return (String)collectionList.get(0); 114 } 115 /** 116 * 117 */ 118 public void initialiseCollection() 119 { 120 Set collectionSet = nzdl.getCollectionSet(); // set of strings of collection titles 121 TreeSet orderedCollectionSet = new TreeSet(collectionSet); 122 // TreeSet automatically puts strings in alphabetical order 123 System.out.println("Number of collections on the server: " + 124 orderedCollectionSet.size()); 125 Iterator collectionSetIterator = orderedCollectionSet.iterator(); 126 while (collectionSetIterator.hasNext() ) { 127 // object -> String 128 String collectionName = (String)collectionSetIterator.next(); 129 NzdlCollectionInfo info = nzdl.getCollectionInfo(collectionName); 130 //System.err.println(info); 131 if (info != null && 132 info.getBuildDate() != 0) { 133 addCollection(collectionName); 134 System.err.println("Adding " + collectionName + " to collection list..."); 135 } // end if 136 else { 137 System.err.println("Collection " + collectionName + " getBuildDate() returned 0"); 138 } // end else 139 } // end while 140 setCurrentCollection(getFirstCollection()); //assume at least one collection 141 142 } 115 143 116 144 -
trunk/java-client/org/nzdl/gsdl/SimpleGraphicalClient/SearchPanel.java
r2143 r2145 228 228 } //end while 229 229 // default to showing the top ranked document 230 resultsList.setSelectedIndex(0); 230 if (docIDs.size() > 0) 231 resultsList.setSelectedIndex(0); 231 232 } // end if 232 233 else { -
trunk/java-client/org/nzdl/gsdl/SimpleGraphicalClient/SimpleGraphicalClient.java
r2143 r2145 111 111 csModel = new CSModel(nzdl); 112 112 113 Set collectionSet = nzdl.getCollectionSet(); // set of strings of collection titles114 TreeSet orderedCollectionSet = new TreeSet(collectionSet);115 // TreeSet automatically puts strings in alphabetical order116 System.out.println("Number of collections on the server: " + orderedCollectionSet.size());117 Iterator collectionSetIterator = orderedCollectionSet.iterator();118 while (collectionSetIterator.hasNext() ) {119 String collectionName = (String)collectionSetIterator.next(); // object -> String120 if (nzdl.hasCollection(collectionName) && nzdl.pingCollection(collectionName) ) {121 csModel.addCollection(collectionName);122 System.out.println("Adding " + collectionName + " to collection list...");123 } // end if124 else {125 System.err.println("Collection " + collectionName + " wasn't added ");126 System.err.println("\t either pingCollection() or hasCollection() returned false");127 } // end else128 } // end while129 csModel.setCurrentCollection(csModel.getFirstCollection()); //assume at least one collection130 113 window = new CSFrame("Search via Corba", csModel); 131 114 Toolkit theKit = window.getToolkit(); // Get the window toolkit -
trunk/java-client/org/nzdl/gsdl/service/NzdlCollectionInfo.java
r2098 r2145 48 48 } 49 49 50 public String toString() { 51 StringBuffer buf = new StringBuffer(1000); 52 buf.append("coll name=\"").append(getName()); 53 buf.append("\" isPublic=").append(isPublic()); 54 buf.append(" isBeta=").append(isBeta()); 55 buf.append(" buildDate=").append(getBuildDate()); 56 buf.append(" numOfDocs=").append(getNumOfDocs()); 57 buf.append(" numOfWords=").append(getNumOfWords()); 58 buf.append(" numOfBytes=").append(getNumOfBytes()); 59 return buf.toString(); 60 } 61 50 62 /** */ 51 63 public void print() { … … 58 70 59 71 } 72 73 74 75 76 77 78 79
Note:
See TracChangeset
for help on using the changeset viewer.