Changeset 8344
- Timestamp:
- 2004-10-15T14:46:31+13:00 (20 years ago)
- Location:
- trunk
- Files:
-
- 36 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/greenstone3-extensions/vishnu/src/vishnu/builder/CollectionBuilder.java
r8290 r8344 7 7 { 8 8 //String site; 9 String collID ; // directory name10 String collHome ; // full path to collections directory11 String collName ;12 String collDesc ;13 String indexer ;14 boolean use_views ;9 String collID = null; // directory name 10 String collHome = null; // full path to collections directory 11 String collName = null; // descriptive name 12 String collDesc = null; // descriptive description :-) 13 String indexer = null; // mg or lucene 14 boolean use_views = false; 15 15 long numDocs=0; 16 16 Vector views = null; 17 17 private static void usage() 18 18 { 19 System.out.println("java vishnu.builder.CollectionBuilder\n -collsHome (directory where collections live) \n -collection (directory name of collection)\n -name (descriptive name for collection) \n -description (collection description)\n -index (\"mg\" or \"luc\")\n [-use_views ]");19 System.out.println("java vishnu.builder.CollectionBuilder\n -collsHome (directory where collections live) \n -collection (directory name of collection)\n -name (descriptive name for collection) \n -description (collection description)\n -index (\"mg\" or \"luc\")\n [-use_views ]"); 20 20 } 21 21 … … 36 36 int a = 0; 37 37 while( a < args.length ){ 38 //if( args[a].equals("-gHome") )39 // gHome = args[++a];40 38 if (args[a].equals("-collsHome")) 41 39 collsHome = args[++a]; … … 68 66 } 69 67 String coll_home = collsHome + collID + File.separator; 70 //CollectionBuilder cb = new CollectionBuilder(site,collName,gHome,indexer);71 CollectionBuilder cb = new CollectionBuilder(coll_home, collID, collName,collDesc, indexer, use_views);68 69 CollectionBuilder cb = new CollectionBuilder(coll_home, collID, collName, collDesc, indexer, use_views); 72 70 } 73 71 … … 83 81 this.use_views = use_views; 84 82 83 if (use_views) { 84 views = new Vector(); 85 } 85 86 if (!setupCollection()) { 86 87 System.err.println("Couldn't setup the collection. Quitting build"); … … 88 89 } 89 90 90 91 91 /**** get text annotation ****/ 92 92 … … 106 106 private boolean setupCollection() 107 107 { 108 // create the index directory 108 // check the import directory 109 File import_dir = new File(collHome + "import"); 110 if (!import_dir.isDirectory()) { 111 System.err.println("the import directory "+import_dir.getPath()+" doesn't exist. Quitting build"); 112 return false; 113 } 114 115 116 // create the building directory 109 117 try { 110 118 File index_dir = new File(collHome + "building"); … … 113 121 } else if (!index_dir.isDirectory()) { 114 122 // index is present but is not a directory 115 System.err.println("Trying to create building dir but a file already exists at "+index_dir. toString());123 System.err.println("Trying to create building dir but a file already exists at "+index_dir.getPath()); 116 124 return false; 117 125 } … … 121 129 } 122 130 131 // create the view list 132 if (use_views) { 133 // create a new view for each sub directory in import 134 File [] sub_dirs = import_dir.listFiles(); 135 for (int i=0; i<sub_dirs.length; i++) { 136 if (sub_dirs[i].isDirectory()) { 137 views.add(sub_dirs[i].getName()); 138 } 139 } 140 if (views.size()==0) { 141 // we haven't found any subdirectories 142 System.err.println("no sub directories were found in the import dorectory ("+import_dir.getPath()+"), not using views"); 143 use_views = false; 144 145 } 146 } 123 147 return true; 124 148 } … … 146 170 buffer.append("\" size=\""); 147 171 buffer.append(String.valueOf(numDocs)); 148 buffer.append("\" />");172 buffer.append("\">\n"); 149 173 150 174 // add in views 151 175 if (use_views) { 152 153 } 176 buffer.append("<viewList>\n"); 177 for (int i=0; i<views.size(); i++) { 178 buffer.append("<view name=\""); 179 buffer.append(views.get(i)); 180 buffer.append("\"/>"); 181 } 182 buffer.append("\n</viewList>\n"); 183 } 184 buffer.append("</collection>\n"); 185 154 186 out.print(buffer.toString()); 155 187 out.close(); … … 159 191 } 160 192 161 // private void printConfig()162 // {163 164 // String index_type="";165 // if (indexer.equals("luc")) {166 // index_type = "LUCENE";167 // } else if (indexer.equals("mg")) {168 // index_type = "MG";169 // }170 // /**** print buildConfig.xml ****/171 // try{172 // File target = new File(collHome + "building" + File.separator + "buildConfig.xml");173 // FileWriter fw = new FileWriter(target);174 // PrintWriter out = new PrintWriter(fw,true);175 176 // String str = "<buildConfig>\n";177 // str += "<metadataList/>\n";178 // //str += "<metadata name=\"numDocs\">" + String.valueOf(numDocs) + "</metadata>\n";179 // //str += "<metadata name=\"buildType\">" + indexer + "</metadata>\n";180 // //str += "</metadataList>\n";181 // str += "<serviceRackList>\n";182 // str += "<serviceRack name=\"Visualizer\">\n";183 // str += "<engineType name=\""+index_type+"\"/>\n";184 // str += "</serviceRack>\n";185 // str += "</serviceRackList>\n";186 // str += "</buildConfig>\n";187 // out.print(str);188 // out.close();189 // } catch (IOException e){ System.out.println("Error " + e.toString());}190 // }191 192 193 193 194 private void CKIndexing() 194 195 { 195 //CKWrapper ckw = new CKWrapper();196 196 CKIndexer cki = new CKIndexer(); 197 cki.setCollectionName(collID); 197 198 String in = collHome + "import"+File.separator; 198 199 String out = collHome + "building"+File.separator+"ck_index"+File.separator; 199 200 cki.setCollectionName(collID); 201 cki.setOutputDirectory(out); 202 cki.setInputDirectory(in); 203 cki.startIndexing(); 200 if (use_views) { 201 for (int i=0; i<views.size(); i++) { 202 String view = (String)views.get(i); 203 System.out.println("calculating candidate keywords for view "+view); 204 cki.setOutputDirectory(out+view+File.separator); 205 cki.setInputDirectory(in+view+File.separator); 206 cki.startIndexing(); 207 } 208 } else { 209 System.out.println("calculating candidate keywords"); 210 // just do the import dir as a whole 211 cki.setOutputDirectory(out); 212 cki.setInputDirectory(in); 213 cki.startIndexing(); 214 } 204 215 } 205 216 … … 210 221 String in = collHome + "import"+File.separator; 211 222 String out = collHome + "building"+File.separator + indexer + "_index"+File.separator; 212 213 if( indexer.equals("luc") ){ 214 LuceneWrapper luc = new LuceneWrapper(); 215 luc.setOutputDirectory(out); 216 luc.setInputDirectory(in); 217 luc.startIndexing(); 218 } 219 else if( indexer.equals("mg") ){ 220 MGWrapper mg = new MGWrapper(); 221 mg.setCollectionName(collID); 222 mg.setOutputDirectory(out); 223 mg.setInputDirectory(in); 224 mg.startIndexing(); 225 } 223 Indexer the_indexer; 224 if (indexer.equals("luc") ) { 225 the_indexer = new LuceneWrapper(); 226 } else { 227 the_indexer = new MGWrapper(); 228 } 229 the_indexer.setCollectionName(collID); 230 231 if (use_views) { 232 for (int i=0; i<views.size(); i++) { 233 String view = (String)views.get(i); 234 System.out.println("indexing the text for view "+view); 235 the_indexer.setOutputDirectory(out+view+File.separator); 236 the_indexer.setInputDirectory(in+view+File.separator); 237 the_indexer.startIndexing(); 238 } 239 240 } else { 241 System.out.println("indexing the text"); 242 the_indexer.setOutputDirectory(out); 243 the_indexer.setInputDirectory(in); 244 the_indexer.startIndexing(); 245 } 246 226 247 } 227 248 } -
trunk/greenstone3-extensions/vishnu/src/vishnu/datablock/Collection.java
r8189 r8344 10 10 public int size; 11 11 public String engine; 12 13 public Collection(String di, String n, String d, int s, String e) 12 public String [] views; 13 14 public Collection(String di, String n, String d, int s, String e, String [] v) 14 15 { 15 16 dir = di; … … 18 19 size = s; 19 20 engine = e; 21 views = v; 20 22 } 21 23 } -
trunk/greenstone3-extensions/vishnu/src/vishnu/server/CKServer.java
r8286 r8344 31 31 private Vector descriptions; 32 32 33 public CKServer(String collection_home ) {33 public CKServer(String collection_home, String view) { 34 34 35 35 this.index_directory = collection_home; … … 38 38 } 39 39 this.index_directory += "index" + File.separator + "ck_index" + File.separator; 40 if (view != null) { 41 this.index_directory += view + File.separator; 42 } 40 43 41 44 loadIndices(); … … 51 54 termFreq = (Vector)getObject(this.index_directory + FILE_TERM_FREQ); 52 55 } catch (Exception e) { 53 System.err.println("C ouldn't load up ck index data: "+e);56 System.err.println("CKServer Error: Couldn't load up ck index data: "+e); 54 57 } 55 58 } … … 239 242 int wordCount = KDMatrix[0].length; 240 243 int docHits = KDMatrix.length; 241 244 System.err.println("getClusters: word count = "+wordCount+", docHits = "+docHits); 242 245 int clusterNum = docHits>20?10:docHits; 243 246 … … 249 252 centroids= clustering.getCentroids(); 250 253 251 Sammon map = new Sammon(centroids);252 Point2D [] sammon = map.getMapping();253 254 // what are these for?? 255 //Sammon map = new Sammon(centroids); 256 //Point2D [] sammon = map.getMapping(); 254 257 return clusters; 255 258 } … … 280 283 public Point2D[] getSammonMap(double[][] centroids) 281 284 { 285 if (centroids == null) { 286 return null; 287 } 282 288 Sammon sammon = new Sammon(centroids); 283 289 Point2D[] p = sammon.getMapping(); -
trunk/greenstone3-extensions/vishnu/src/vishnu/server/CKTester.java
r8286 r8344 23 23 String coll = args[1]; 24 24 String vis_home = args[2]; 25 25 String view = null; 26 if (args.length >= 4) { 27 view = args[3]; 28 } 26 29 27 30 /**** read in ck words, doc freq and term freq ****/ … … 30 33 ObjectInputStream in = null; 31 34 32 String root = vis_home + "/collections/" + coll + "/index/ck_index/"; 33 35 String root = vis_home; 36 if (!root.endsWith(File.separator)) { 37 root += File.separator; 38 } 39 root += "collections" + File.separator+ coll + File.separator + "index" + File.separator + "ck_index" + File.separator; 40 if (view != null) { 41 root += view+File.separator; 42 } 34 43 String fileDocFreq = "doc_freq"; 35 44 String fileTermFreq = "term_freq"; 36 45 String fileCKWords = "ck_words"; 37 46 38 float[] docFreq = (float[])getObject(root + "/" +fileDocFreq);39 String[] ck_words = (String[])getObject(root + "/" +fileCKWords);40 Vector termFreq = (Vector)getObject(root + "/" +fileTermFreq);47 float[] docFreq = (float[])getObject(root+fileDocFreq); 48 String[] ck_words = (String[])getObject(root + fileCKWords); 49 Vector termFreq = (Vector)getObject(root + fileTermFreq); 41 50 42 51 43 52 /**** get relevant docs ****/ 44 53 45 LUCSearcher lus = new LUCSearcher(coll ); //should be fullpath54 LUCSearcher lus = new LUCSearcher(coll, view); // coll should be fullpath 46 55 //lus.setRootDirectory(vis_home); 47 56 lus.search(query); -
trunk/greenstone3-extensions/vishnu/src/vishnu/server/Search/LUCSearcher.java
r8189 r8344 51 51 private Hashtable ht; 52 52 53 public LUCSearcher(String coll_home )53 public LUCSearcher(String coll_home, String view) 54 54 { 55 55 collection_home = coll_home; … … 59 59 index_dir = collection_home + File.separator + "index" + 60 60 File.separator + "luc_index" + File.separator; 61 if (view != null) { 62 index_dir += view + File.separator; 63 } 61 64 } 62 65 -
trunk/greenstone3-extensions/vishnu/src/vishnu/server/Search/MGSearcher.java
r8189 r8344 36 36 private MGWrapper mg_src; 37 37 38 public MGSearcher(String coll_home, String coll_name )38 public MGSearcher(String coll_home, String coll_name, String view) 39 39 { 40 40 collection_home = coll_home; … … 44 44 collection_name = coll_name; 45 45 mg_src = new MGWrapper(); 46 mg_index_path = "index"+File.separator+"mg_index"+ File.separator+collection_name+File.separator+collection_name; 46 mg_index_path = "index"+File.separator+"mg_index"+ File.separator; 47 if (view != null) { 48 mg_index_path += view + File.separator; 49 } 50 mg_index_path += collection_name+File.separator+collection_name; 47 51 mg_src.setIndex(mg_index_path); 48 52 } -
trunk/greenstone3-extensions/vishnu/src/vishnu/server/VisServlet.java
r8287 r8344 20 20 21 21 import vishnu.server.Search.*; 22 import vishnu.datablock.*; 23 import vishnu.util.XMLUtil; 24 22 25 import java.io.*; 23 import vishnu.datablock.*;24 26 import javax.servlet.*; 25 27 import javax.servlet.http.*; … … 107 109 String query = (String)q.elementAt(1); 108 110 String collection = (String)q.elementAt(2); 111 String view = null; 112 if (q.size() == 4) { 113 view = (String)q.elementAt(3); 114 } 115 if (view != null && view.equals("")) { 116 view = null; 117 } 109 118 System.out.println("Requesting..." + collection); 110 119 … … 119 128 SearchInterface search_engine = null; 120 129 if( engine.equals("MG") ){ 121 search_engine = new MGSearcher(collection_home, collection );130 search_engine = new MGSearcher(collection_home, collection, view); 122 131 } else if( engine.equals("LUCENE") ){ 123 search_engine = new LUCSearcher(collection_home );132 search_engine = new LUCSearcher(collection_home, view); 124 133 } 125 134 … … 128 137 descriptions = search_engine.getDocDescriptions(); 129 138 System.out.println(docNums.size() + " documents in VisServlet"); 130 DataBlock data = generateDataBlock(collection_home, docNums, descriptions);139 DataBlock data = generateDataBlock(collection_home, view, docNums, descriptions); 131 140 if (data != null) { 132 141 response.addElement(data); … … 142 151 String docNum = (String)q.elementAt(1); 143 152 String collection = (String)q.elementAt(2); 153 String view = null; 154 if (q.size() == 4) { 155 view = (String)q.elementAt(3); 156 } 157 if (view != null && view.equals("")) { 158 view = null; 159 } 144 160 String engine; 145 161 String collection_home = COLLS_HOME+collection+File.separator; … … 153 169 SearchInterface search_engine = null; 154 170 if( engine.equals("MG") ){ 155 search_engine = new MGSearcher(collection_home, collection );171 search_engine = new MGSearcher(collection_home, collection, view); 156 172 } else if( engine.equals("LUCENE") ){ 157 search_engine = new LUCSearcher(collection_home );173 search_engine = new LUCSearcher(collection_home, view); 158 174 } 159 175 System.err.println("Searching for doc "+docNum); … … 175 191 private Vector activateCollections() 176 192 { 193 System.err.println("activating collections"); 177 194 Vector colls = new Vector(); 178 195 collH = new Hashtable(); … … 195 212 // ignore this collection 196 213 continue; 214 } else { 215 System.err.println("Trying to init collection "+f.getName()); 197 216 } 198 217 try { … … 201 220 doc = doc_build.parse(config_file); 202 221 } catch (Exception e) { 203 System.err.println("Error parsing config file "+config_file.getPath()+", ignoring this collec iton");222 System.err.println("Error parsing config file "+config_file.getPath()+", ignoring this collection"); 204 223 continue; 205 224 } … … 210 229 int size = Integer.parseInt(root.getAttribute("size")); 211 230 String coll_id = f.getName(); 212 Collection c = new Collection(coll_id,name,desc,size,engine); 231 Element view_elem = (Element)XMLUtil.getChildByTagName(root, "viewList"); 232 String [] views = null; 233 if (view_elem != null) { 234 NodeList view_list = view_elem.getElementsByTagName("view"); 235 int num_views = view_list.getLength(); 236 if (num_views > 0) { 237 views = new String[num_views]; 238 for (int j=0; j<num_views; j++) { 239 String v = ((Element)view_list.item(j)).getAttribute("name"); 240 views[j]=v; 241 } 242 } 243 } 244 Collection c = new Collection(coll_id,name,desc,size,engine,views); 213 245 System.out.println("Hashing.." + coll_id); 214 246 colls.addElement(c); … … 220 252 } 221 253 222 private DataBlock generateDataBlock(String collection_home, Vector docNums, Vector descriptions) { 223 254 private DataBlock generateDataBlock(String collection_home, String view, Vector docNums, Vector descriptions) { 255 256 if (docNums.size()==0) { 257 return null; 258 } 224 259 DataBlock data = new DataBlock(); 225 260 226 CKServer ck_server = new CKServer(collection_home );261 CKServer ck_server = new CKServer(collection_home, view); 227 262 228 263 /**** set data fields one by one and pass one what ever gets assembled ****/ … … 281 316 } catch (Exception e) { 282 317 System.err.println("VisServlet: computing clustering Error: "+e); 318 e.printStackTrace(); 283 319 } 284 320 ck_server = null; -
trunk/greenstone3-extensions/vishnu/src/vishnu/testvis/object/DataManager.java
r8284 r8344 20 20 private CacheManager cache = null; 21 21 public Vector collections; 22 public Collection currentCollection ;23 22 public Collection currentCollection = null; 23 public String currentView = null; 24 24 /** Labels for the clusters needed by tree map, 25 25 * generated in this class */ … … 294 294 //GSDLEngine theEngine = new GSDLEngine(displayFrame); 295 295 System.out.println("Searching for " + queryStr); 296 297 DataBlock db = theEngine.getData(queryStr, currentCollection.dir); 296 DataBlock db = theEngine.getData(queryStr, currentCollection.dir, currentView); 298 297 299 298 if( db == null ) return 0; … … 351 350 theEngine.setDisplay(displayFrame); 352 351 //GSDLEngine engine = new GSDLEngine(displayFrame); 353 Vector document = theEngine.getDocument(Long.toString(docNum),currentCollection.dir );352 Vector document = theEngine.getDocument(Long.toString(docNum),currentCollection.dir, currentView); 354 353 355 354 // Fetch theFetch = new Fetch(displayFrame); -
trunk/greenstone3-extensions/vishnu/src/vishnu/testvis/object/Engine.java
r8189 r8344 39 39 } 40 40 41 public DataBlock getData(String query, String collection )41 public DataBlock getData(String query, String collection, String view) 42 42 { 43 43 DataBlock data = null; … … 46 46 q.addElement(query); 47 47 q.addElement(collection); 48 q.addElement(view); 48 49 49 50 … … 52 53 sendObject(con,q); 53 54 Vector v = (Vector)receiveObject(con); 54 if( v == null ) System.out.println("Null result"); 55 else 56 data = (DataBlock)v.elementAt(0); 57 } catch( Exception ex) {System.out.println(ex);} 55 if( v == null || v.size()==0 ) { 56 System.out.println("Engine.getData: Null or empty result"); 57 } else { 58 data = (DataBlock)v.elementAt(0); 59 } 60 } catch( Exception ex) { 61 System.out.println("Engine.getData: "+ex); 62 } 58 63 59 64 return data; … … 61 66 62 67 63 public Vector getDocument(String id, String collection )68 public Vector getDocument(String id, String collection, String view) 64 69 { 65 70 Vector q = new Vector(); … … 68 73 q.addElement(id); 69 74 q.addElement(collection); 75 q.addElement(view); 70 76 71 77 try{ -
trunk/greenstone3-extensions/vishnu/src/vishnu/testvis/object/GSDLEngine.java
r8284 r8344 28 28 } 29 29 30 public DataBlock getData(String query_term, String collection ) {30 public DataBlock getData(String query_term, String collection, String view) { 31 31 32 32 33 33 String query = servlet+"&type=search&q="+query_term; 34 if (view != null) { 35 query += "&view="+view; 36 } 34 37 System.out.println("sending query: " + query_term); 35 38 DataBlock db = null; … … 63 66 } 64 67 65 public Vector getDocument(String id, String collection ) {68 public Vector getDocument(String id, String collection, String view) { 66 69 String query = servlet+"&type=fetch&d="+id; 70 if (view != null) { 71 query += "&view="+view; 72 } 67 73 System.out.println("sending fetch: " + id); 68 74 Vector doc; -
trunk/greenstone3-extensions/vishnu/src/vishnu/testvis/visual/Vishnu.java
r8189 r8344 36 36 public JTextField searchBox = null; 37 37 public JComboBox collCombo = null; 38 public JComboBox viewCombo = null; 38 39 protected int largeFont = 16; 39 40 40 41 public String query = null; 41 42 public String coll = null; 42 43 public String view = null; 44 43 45 public String server_address = null; 44 46 … … 49 51 query = getParameter("query"); 50 52 coll = getParameter("collection"); 53 view = getParameter("view"); 51 54 String library = getParameter("library"); 52 55 String viscgi = getParameter("viscgi"); … … 108 111 109 112 Collection current_collection=null; 113 String current_view = null; 110 114 if( coll == null || coll.equals("") || coll.equals("null") ) { 111 115 current_collection = ((Collection)dataManager.collections.elementAt(0)); 112 116 coll = current_collection.dir; 113 117 } else { 118 // try to find the one specified in the parameters 114 119 for( int i = 0; i < dataManager.collections.size(); i++ ){ 115 120 Collection c = (Collection)dataManager.collections.elementAt(i); 116 121 if( c.dir.equals(coll) ){ 117 122 current_collection = c; 123 current_view = view; // use the one from the parameters 118 124 break; 119 125 } … … 125 131 coll = current_collection.dir; 126 132 } 127 133 if (current_view == null) { 134 if (current_collection.views != null) { 135 current_view = (String)current_collection.views[0]; 136 } 137 } 128 138 dataManager.currentCollection = current_collection; 139 dataManager.currentView = current_view; 140 this.view = current_view; 129 141 dataManager.requestCollection(); 130 142 System.out.println("Requesting collection " + current_collection.name); 131 143 collCombo.setSelectedItem(current_collection); 144 if (current_view != null) { 145 viewCombo.setSelectedItem(current_view); 146 147 } 148 132 149 } 133 150 … … 172 189 collCombo.hidePopup(); 173 190 coll = dataManager.currentCollection.dir; 191 if (dataManager.currentCollection.views != null) { 192 viewCombo.setModel(new DefaultComboBoxModel(dataManager.currentCollection.views)); 193 viewCombo.setEnabled(true); 194 view = (String)viewCombo.getItemAt(0); 195 dataManager.currentView = view; 196 197 } else { 198 viewCombo.setModel(new DefaultComboBoxModel()); 199 viewCombo.setEnabled(false); 200 view = null; 201 dataManager.currentView = view; 202 } 174 203 dataManager.requestCollection(); 204 175 205 update(); 176 206 … … 188 218 }); 189 219 190 191 220 JLabel collLabel = new JLabel(); 192 221 collLabel.setFont(new java.awt.Font("Monospaced", 0, largeFont)); … … 196 225 collPanel.add(collLabel, BorderLayout.WEST); 197 226 collPanel.add(collCombo, BorderLayout.CENTER); 227 228 JPanel viewPanel = new JPanel(); 229 viewPanel.setLayout(new BorderLayout(5,5)); 230 viewPanel.setBackground(SystemColor.control); 231 232 viewCombo = new JComboBox(); 233 viewCombo.setEnabled(false); 234 235 JLabel viewLabel = new JLabel(); 236 viewLabel.setFont(new java.awt.Font("Monospaced", 0, largeFont)); 237 viewLabel.setForeground(Color.black); 238 viewLabel.setText("View:"); 239 240 viewPanel.add(viewLabel, BorderLayout.WEST); 241 viewPanel.add(viewCombo, BorderLayout.CENTER); 198 242 199 243 JPanel topPanel = new JPanel(); … … 245 289 pane.add(topPanel, BorderLayout.NORTH); 246 290 247 topPanel.add(collPanel, BorderLayout.WEST); 291 JPanel boxesPanel = new JPanel(); 292 boxesPanel.setLayout(new BorderLayout(5,5)); 293 boxesPanel.setBackground(SystemColor.control); 294 boxesPanel.add(collPanel, BorderLayout.WEST); 295 boxesPanel.add(viewPanel, BorderLayout.EAST); 296 297 topPanel.add(boxesPanel, BorderLayout.WEST); 248 298 topPanel.add(searchPanel, BorderLayout.CENTER); 249 299 topPanel.add(findButton, BorderLayout.EAST); … … 274 324 query = text.trim(); 275 325 326 String view1 = null; 327 if (viewCombo.isEnabled()) { 328 view1 = (String)viewCombo.getSelectedItem(); 329 } 330 if (!view1.equals(this.view)) { 331 this.view = view1; 332 dataManager.currentView = view1; 333 dataManager.requestCollection(); // resets previous data 334 } 276 335 setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); 277 336 -
trunk/greenstone3-extensions/vishnu/src/vishnu/testvis/visual/VishnuSingle.java
r8189 r8344 22 22 protected void initCollections() { 23 23 // put in a dummy Collection 24 Collection c = new Collection(coll, coll, coll, 0, coll );24 Collection c = new Collection(coll, coll, coll, 0, coll, null); 25 25 dataManager.currentCollection = c; 26 26 -
trunk/gsdl3/extensions/vishnu/src/vishnu/builder/CollectionBuilder.java
r8290 r8344 7 7 { 8 8 //String site; 9 String collID ; // directory name10 String collHome ; // full path to collections directory11 String collName ;12 String collDesc ;13 String indexer ;14 boolean use_views ;9 String collID = null; // directory name 10 String collHome = null; // full path to collections directory 11 String collName = null; // descriptive name 12 String collDesc = null; // descriptive description :-) 13 String indexer = null; // mg or lucene 14 boolean use_views = false; 15 15 long numDocs=0; 16 16 Vector views = null; 17 17 private static void usage() 18 18 { 19 System.out.println("java vishnu.builder.CollectionBuilder\n -collsHome (directory where collections live) \n -collection (directory name of collection)\n -name (descriptive name for collection) \n -description (collection description)\n -index (\"mg\" or \"luc\")\n [-use_views ]");19 System.out.println("java vishnu.builder.CollectionBuilder\n -collsHome (directory where collections live) \n -collection (directory name of collection)\n -name (descriptive name for collection) \n -description (collection description)\n -index (\"mg\" or \"luc\")\n [-use_views ]"); 20 20 } 21 21 … … 36 36 int a = 0; 37 37 while( a < args.length ){ 38 //if( args[a].equals("-gHome") )39 // gHome = args[++a];40 38 if (args[a].equals("-collsHome")) 41 39 collsHome = args[++a]; … … 68 66 } 69 67 String coll_home = collsHome + collID + File.separator; 70 //CollectionBuilder cb = new CollectionBuilder(site,collName,gHome,indexer);71 CollectionBuilder cb = new CollectionBuilder(coll_home, collID, collName,collDesc, indexer, use_views);68 69 CollectionBuilder cb = new CollectionBuilder(coll_home, collID, collName, collDesc, indexer, use_views); 72 70 } 73 71 … … 83 81 this.use_views = use_views; 84 82 83 if (use_views) { 84 views = new Vector(); 85 } 85 86 if (!setupCollection()) { 86 87 System.err.println("Couldn't setup the collection. Quitting build"); … … 88 89 } 89 90 90 91 91 /**** get text annotation ****/ 92 92 … … 106 106 private boolean setupCollection() 107 107 { 108 // create the index directory 108 // check the import directory 109 File import_dir = new File(collHome + "import"); 110 if (!import_dir.isDirectory()) { 111 System.err.println("the import directory "+import_dir.getPath()+" doesn't exist. Quitting build"); 112 return false; 113 } 114 115 116 // create the building directory 109 117 try { 110 118 File index_dir = new File(collHome + "building"); … … 113 121 } else if (!index_dir.isDirectory()) { 114 122 // index is present but is not a directory 115 System.err.println("Trying to create building dir but a file already exists at "+index_dir. toString());123 System.err.println("Trying to create building dir but a file already exists at "+index_dir.getPath()); 116 124 return false; 117 125 } … … 121 129 } 122 130 131 // create the view list 132 if (use_views) { 133 // create a new view for each sub directory in import 134 File [] sub_dirs = import_dir.listFiles(); 135 for (int i=0; i<sub_dirs.length; i++) { 136 if (sub_dirs[i].isDirectory()) { 137 views.add(sub_dirs[i].getName()); 138 } 139 } 140 if (views.size()==0) { 141 // we haven't found any subdirectories 142 System.err.println("no sub directories were found in the import dorectory ("+import_dir.getPath()+"), not using views"); 143 use_views = false; 144 145 } 146 } 123 147 return true; 124 148 } … … 146 170 buffer.append("\" size=\""); 147 171 buffer.append(String.valueOf(numDocs)); 148 buffer.append("\" />");172 buffer.append("\">\n"); 149 173 150 174 // add in views 151 175 if (use_views) { 152 153 } 176 buffer.append("<viewList>\n"); 177 for (int i=0; i<views.size(); i++) { 178 buffer.append("<view name=\""); 179 buffer.append(views.get(i)); 180 buffer.append("\"/>"); 181 } 182 buffer.append("\n</viewList>\n"); 183 } 184 buffer.append("</collection>\n"); 185 154 186 out.print(buffer.toString()); 155 187 out.close(); … … 159 191 } 160 192 161 // private void printConfig()162 // {163 164 // String index_type="";165 // if (indexer.equals("luc")) {166 // index_type = "LUCENE";167 // } else if (indexer.equals("mg")) {168 // index_type = "MG";169 // }170 // /**** print buildConfig.xml ****/171 // try{172 // File target = new File(collHome + "building" + File.separator + "buildConfig.xml");173 // FileWriter fw = new FileWriter(target);174 // PrintWriter out = new PrintWriter(fw,true);175 176 // String str = "<buildConfig>\n";177 // str += "<metadataList/>\n";178 // //str += "<metadata name=\"numDocs\">" + String.valueOf(numDocs) + "</metadata>\n";179 // //str += "<metadata name=\"buildType\">" + indexer + "</metadata>\n";180 // //str += "</metadataList>\n";181 // str += "<serviceRackList>\n";182 // str += "<serviceRack name=\"Visualizer\">\n";183 // str += "<engineType name=\""+index_type+"\"/>\n";184 // str += "</serviceRack>\n";185 // str += "</serviceRackList>\n";186 // str += "</buildConfig>\n";187 // out.print(str);188 // out.close();189 // } catch (IOException e){ System.out.println("Error " + e.toString());}190 // }191 192 193 193 194 private void CKIndexing() 194 195 { 195 //CKWrapper ckw = new CKWrapper();196 196 CKIndexer cki = new CKIndexer(); 197 cki.setCollectionName(collID); 197 198 String in = collHome + "import"+File.separator; 198 199 String out = collHome + "building"+File.separator+"ck_index"+File.separator; 199 200 cki.setCollectionName(collID); 201 cki.setOutputDirectory(out); 202 cki.setInputDirectory(in); 203 cki.startIndexing(); 200 if (use_views) { 201 for (int i=0; i<views.size(); i++) { 202 String view = (String)views.get(i); 203 System.out.println("calculating candidate keywords for view "+view); 204 cki.setOutputDirectory(out+view+File.separator); 205 cki.setInputDirectory(in+view+File.separator); 206 cki.startIndexing(); 207 } 208 } else { 209 System.out.println("calculating candidate keywords"); 210 // just do the import dir as a whole 211 cki.setOutputDirectory(out); 212 cki.setInputDirectory(in); 213 cki.startIndexing(); 214 } 204 215 } 205 216 … … 210 221 String in = collHome + "import"+File.separator; 211 222 String out = collHome + "building"+File.separator + indexer + "_index"+File.separator; 212 213 if( indexer.equals("luc") ){ 214 LuceneWrapper luc = new LuceneWrapper(); 215 luc.setOutputDirectory(out); 216 luc.setInputDirectory(in); 217 luc.startIndexing(); 218 } 219 else if( indexer.equals("mg") ){ 220 MGWrapper mg = new MGWrapper(); 221 mg.setCollectionName(collID); 222 mg.setOutputDirectory(out); 223 mg.setInputDirectory(in); 224 mg.startIndexing(); 225 } 223 Indexer the_indexer; 224 if (indexer.equals("luc") ) { 225 the_indexer = new LuceneWrapper(); 226 } else { 227 the_indexer = new MGWrapper(); 228 } 229 the_indexer.setCollectionName(collID); 230 231 if (use_views) { 232 for (int i=0; i<views.size(); i++) { 233 String view = (String)views.get(i); 234 System.out.println("indexing the text for view "+view); 235 the_indexer.setOutputDirectory(out+view+File.separator); 236 the_indexer.setInputDirectory(in+view+File.separator); 237 the_indexer.startIndexing(); 238 } 239 240 } else { 241 System.out.println("indexing the text"); 242 the_indexer.setOutputDirectory(out); 243 the_indexer.setInputDirectory(in); 244 the_indexer.startIndexing(); 245 } 246 226 247 } 227 248 } -
trunk/gsdl3/extensions/vishnu/src/vishnu/datablock/Collection.java
r8189 r8344 10 10 public int size; 11 11 public String engine; 12 13 public Collection(String di, String n, String d, int s, String e) 12 public String [] views; 13 14 public Collection(String di, String n, String d, int s, String e, String [] v) 14 15 { 15 16 dir = di; … … 18 19 size = s; 19 20 engine = e; 21 views = v; 20 22 } 21 23 } -
trunk/gsdl3/extensions/vishnu/src/vishnu/server/CKServer.java
r8286 r8344 31 31 private Vector descriptions; 32 32 33 public CKServer(String collection_home ) {33 public CKServer(String collection_home, String view) { 34 34 35 35 this.index_directory = collection_home; … … 38 38 } 39 39 this.index_directory += "index" + File.separator + "ck_index" + File.separator; 40 if (view != null) { 41 this.index_directory += view + File.separator; 42 } 40 43 41 44 loadIndices(); … … 51 54 termFreq = (Vector)getObject(this.index_directory + FILE_TERM_FREQ); 52 55 } catch (Exception e) { 53 System.err.println("C ouldn't load up ck index data: "+e);56 System.err.println("CKServer Error: Couldn't load up ck index data: "+e); 54 57 } 55 58 } … … 239 242 int wordCount = KDMatrix[0].length; 240 243 int docHits = KDMatrix.length; 241 244 System.err.println("getClusters: word count = "+wordCount+", docHits = "+docHits); 242 245 int clusterNum = docHits>20?10:docHits; 243 246 … … 249 252 centroids= clustering.getCentroids(); 250 253 251 Sammon map = new Sammon(centroids);252 Point2D [] sammon = map.getMapping();253 254 // what are these for?? 255 //Sammon map = new Sammon(centroids); 256 //Point2D [] sammon = map.getMapping(); 254 257 return clusters; 255 258 } … … 280 283 public Point2D[] getSammonMap(double[][] centroids) 281 284 { 285 if (centroids == null) { 286 return null; 287 } 282 288 Sammon sammon = new Sammon(centroids); 283 289 Point2D[] p = sammon.getMapping(); -
trunk/gsdl3/extensions/vishnu/src/vishnu/server/CKTester.java
r8286 r8344 23 23 String coll = args[1]; 24 24 String vis_home = args[2]; 25 25 String view = null; 26 if (args.length >= 4) { 27 view = args[3]; 28 } 26 29 27 30 /**** read in ck words, doc freq and term freq ****/ … … 30 33 ObjectInputStream in = null; 31 34 32 String root = vis_home + "/collections/" + coll + "/index/ck_index/"; 33 35 String root = vis_home; 36 if (!root.endsWith(File.separator)) { 37 root += File.separator; 38 } 39 root += "collections" + File.separator+ coll + File.separator + "index" + File.separator + "ck_index" + File.separator; 40 if (view != null) { 41 root += view+File.separator; 42 } 34 43 String fileDocFreq = "doc_freq"; 35 44 String fileTermFreq = "term_freq"; 36 45 String fileCKWords = "ck_words"; 37 46 38 float[] docFreq = (float[])getObject(root + "/" +fileDocFreq);39 String[] ck_words = (String[])getObject(root + "/" +fileCKWords);40 Vector termFreq = (Vector)getObject(root + "/" +fileTermFreq);47 float[] docFreq = (float[])getObject(root+fileDocFreq); 48 String[] ck_words = (String[])getObject(root + fileCKWords); 49 Vector termFreq = (Vector)getObject(root + fileTermFreq); 41 50 42 51 43 52 /**** get relevant docs ****/ 44 53 45 LUCSearcher lus = new LUCSearcher(coll ); //should be fullpath54 LUCSearcher lus = new LUCSearcher(coll, view); // coll should be fullpath 46 55 //lus.setRootDirectory(vis_home); 47 56 lus.search(query); -
trunk/gsdl3/extensions/vishnu/src/vishnu/server/Search/LUCSearcher.java
r8189 r8344 51 51 private Hashtable ht; 52 52 53 public LUCSearcher(String coll_home )53 public LUCSearcher(String coll_home, String view) 54 54 { 55 55 collection_home = coll_home; … … 59 59 index_dir = collection_home + File.separator + "index" + 60 60 File.separator + "luc_index" + File.separator; 61 if (view != null) { 62 index_dir += view + File.separator; 63 } 61 64 } 62 65 -
trunk/gsdl3/extensions/vishnu/src/vishnu/server/Search/MGSearcher.java
r8189 r8344 36 36 private MGWrapper mg_src; 37 37 38 public MGSearcher(String coll_home, String coll_name )38 public MGSearcher(String coll_home, String coll_name, String view) 39 39 { 40 40 collection_home = coll_home; … … 44 44 collection_name = coll_name; 45 45 mg_src = new MGWrapper(); 46 mg_index_path = "index"+File.separator+"mg_index"+ File.separator+collection_name+File.separator+collection_name; 46 mg_index_path = "index"+File.separator+"mg_index"+ File.separator; 47 if (view != null) { 48 mg_index_path += view + File.separator; 49 } 50 mg_index_path += collection_name+File.separator+collection_name; 47 51 mg_src.setIndex(mg_index_path); 48 52 } -
trunk/gsdl3/extensions/vishnu/src/vishnu/server/VisServlet.java
r8287 r8344 20 20 21 21 import vishnu.server.Search.*; 22 import vishnu.datablock.*; 23 import vishnu.util.XMLUtil; 24 22 25 import java.io.*; 23 import vishnu.datablock.*;24 26 import javax.servlet.*; 25 27 import javax.servlet.http.*; … … 107 109 String query = (String)q.elementAt(1); 108 110 String collection = (String)q.elementAt(2); 111 String view = null; 112 if (q.size() == 4) { 113 view = (String)q.elementAt(3); 114 } 115 if (view != null && view.equals("")) { 116 view = null; 117 } 109 118 System.out.println("Requesting..." + collection); 110 119 … … 119 128 SearchInterface search_engine = null; 120 129 if( engine.equals("MG") ){ 121 search_engine = new MGSearcher(collection_home, collection );130 search_engine = new MGSearcher(collection_home, collection, view); 122 131 } else if( engine.equals("LUCENE") ){ 123 search_engine = new LUCSearcher(collection_home );132 search_engine = new LUCSearcher(collection_home, view); 124 133 } 125 134 … … 128 137 descriptions = search_engine.getDocDescriptions(); 129 138 System.out.println(docNums.size() + " documents in VisServlet"); 130 DataBlock data = generateDataBlock(collection_home, docNums, descriptions);139 DataBlock data = generateDataBlock(collection_home, view, docNums, descriptions); 131 140 if (data != null) { 132 141 response.addElement(data); … … 142 151 String docNum = (String)q.elementAt(1); 143 152 String collection = (String)q.elementAt(2); 153 String view = null; 154 if (q.size() == 4) { 155 view = (String)q.elementAt(3); 156 } 157 if (view != null && view.equals("")) { 158 view = null; 159 } 144 160 String engine; 145 161 String collection_home = COLLS_HOME+collection+File.separator; … … 153 169 SearchInterface search_engine = null; 154 170 if( engine.equals("MG") ){ 155 search_engine = new MGSearcher(collection_home, collection );171 search_engine = new MGSearcher(collection_home, collection, view); 156 172 } else if( engine.equals("LUCENE") ){ 157 search_engine = new LUCSearcher(collection_home );173 search_engine = new LUCSearcher(collection_home, view); 158 174 } 159 175 System.err.println("Searching for doc "+docNum); … … 175 191 private Vector activateCollections() 176 192 { 193 System.err.println("activating collections"); 177 194 Vector colls = new Vector(); 178 195 collH = new Hashtable(); … … 195 212 // ignore this collection 196 213 continue; 214 } else { 215 System.err.println("Trying to init collection "+f.getName()); 197 216 } 198 217 try { … … 201 220 doc = doc_build.parse(config_file); 202 221 } catch (Exception e) { 203 System.err.println("Error parsing config file "+config_file.getPath()+", ignoring this collec iton");222 System.err.println("Error parsing config file "+config_file.getPath()+", ignoring this collection"); 204 223 continue; 205 224 } … … 210 229 int size = Integer.parseInt(root.getAttribute("size")); 211 230 String coll_id = f.getName(); 212 Collection c = new Collection(coll_id,name,desc,size,engine); 231 Element view_elem = (Element)XMLUtil.getChildByTagName(root, "viewList"); 232 String [] views = null; 233 if (view_elem != null) { 234 NodeList view_list = view_elem.getElementsByTagName("view"); 235 int num_views = view_list.getLength(); 236 if (num_views > 0) { 237 views = new String[num_views]; 238 for (int j=0; j<num_views; j++) { 239 String v = ((Element)view_list.item(j)).getAttribute("name"); 240 views[j]=v; 241 } 242 } 243 } 244 Collection c = new Collection(coll_id,name,desc,size,engine,views); 213 245 System.out.println("Hashing.." + coll_id); 214 246 colls.addElement(c); … … 220 252 } 221 253 222 private DataBlock generateDataBlock(String collection_home, Vector docNums, Vector descriptions) { 223 254 private DataBlock generateDataBlock(String collection_home, String view, Vector docNums, Vector descriptions) { 255 256 if (docNums.size()==0) { 257 return null; 258 } 224 259 DataBlock data = new DataBlock(); 225 260 226 CKServer ck_server = new CKServer(collection_home );261 CKServer ck_server = new CKServer(collection_home, view); 227 262 228 263 /**** set data fields one by one and pass one what ever gets assembled ****/ … … 281 316 } catch (Exception e) { 282 317 System.err.println("VisServlet: computing clustering Error: "+e); 318 e.printStackTrace(); 283 319 } 284 320 ck_server = null; -
trunk/gsdl3/extensions/vishnu/src/vishnu/testvis/object/DataManager.java
r8284 r8344 20 20 private CacheManager cache = null; 21 21 public Vector collections; 22 public Collection currentCollection ;23 22 public Collection currentCollection = null; 23 public String currentView = null; 24 24 /** Labels for the clusters needed by tree map, 25 25 * generated in this class */ … … 294 294 //GSDLEngine theEngine = new GSDLEngine(displayFrame); 295 295 System.out.println("Searching for " + queryStr); 296 297 DataBlock db = theEngine.getData(queryStr, currentCollection.dir); 296 DataBlock db = theEngine.getData(queryStr, currentCollection.dir, currentView); 298 297 299 298 if( db == null ) return 0; … … 351 350 theEngine.setDisplay(displayFrame); 352 351 //GSDLEngine engine = new GSDLEngine(displayFrame); 353 Vector document = theEngine.getDocument(Long.toString(docNum),currentCollection.dir );352 Vector document = theEngine.getDocument(Long.toString(docNum),currentCollection.dir, currentView); 354 353 355 354 // Fetch theFetch = new Fetch(displayFrame); -
trunk/gsdl3/extensions/vishnu/src/vishnu/testvis/object/Engine.java
r8189 r8344 39 39 } 40 40 41 public DataBlock getData(String query, String collection )41 public DataBlock getData(String query, String collection, String view) 42 42 { 43 43 DataBlock data = null; … … 46 46 q.addElement(query); 47 47 q.addElement(collection); 48 q.addElement(view); 48 49 49 50 … … 52 53 sendObject(con,q); 53 54 Vector v = (Vector)receiveObject(con); 54 if( v == null ) System.out.println("Null result"); 55 else 56 data = (DataBlock)v.elementAt(0); 57 } catch( Exception ex) {System.out.println(ex);} 55 if( v == null || v.size()==0 ) { 56 System.out.println("Engine.getData: Null or empty result"); 57 } else { 58 data = (DataBlock)v.elementAt(0); 59 } 60 } catch( Exception ex) { 61 System.out.println("Engine.getData: "+ex); 62 } 58 63 59 64 return data; … … 61 66 62 67 63 public Vector getDocument(String id, String collection )68 public Vector getDocument(String id, String collection, String view) 64 69 { 65 70 Vector q = new Vector(); … … 68 73 q.addElement(id); 69 74 q.addElement(collection); 75 q.addElement(view); 70 76 71 77 try{ -
trunk/gsdl3/extensions/vishnu/src/vishnu/testvis/object/GSDLEngine.java
r8284 r8344 28 28 } 29 29 30 public DataBlock getData(String query_term, String collection ) {30 public DataBlock getData(String query_term, String collection, String view) { 31 31 32 32 33 33 String query = servlet+"&type=search&q="+query_term; 34 if (view != null) { 35 query += "&view="+view; 36 } 34 37 System.out.println("sending query: " + query_term); 35 38 DataBlock db = null; … … 63 66 } 64 67 65 public Vector getDocument(String id, String collection ) {68 public Vector getDocument(String id, String collection, String view) { 66 69 String query = servlet+"&type=fetch&d="+id; 70 if (view != null) { 71 query += "&view="+view; 72 } 67 73 System.out.println("sending fetch: " + id); 68 74 Vector doc; -
trunk/gsdl3/extensions/vishnu/src/vishnu/testvis/visual/Vishnu.java
r8189 r8344 36 36 public JTextField searchBox = null; 37 37 public JComboBox collCombo = null; 38 public JComboBox viewCombo = null; 38 39 protected int largeFont = 16; 39 40 40 41 public String query = null; 41 42 public String coll = null; 42 43 public String view = null; 44 43 45 public String server_address = null; 44 46 … … 49 51 query = getParameter("query"); 50 52 coll = getParameter("collection"); 53 view = getParameter("view"); 51 54 String library = getParameter("library"); 52 55 String viscgi = getParameter("viscgi"); … … 108 111 109 112 Collection current_collection=null; 113 String current_view = null; 110 114 if( coll == null || coll.equals("") || coll.equals("null") ) { 111 115 current_collection = ((Collection)dataManager.collections.elementAt(0)); 112 116 coll = current_collection.dir; 113 117 } else { 118 // try to find the one specified in the parameters 114 119 for( int i = 0; i < dataManager.collections.size(); i++ ){ 115 120 Collection c = (Collection)dataManager.collections.elementAt(i); 116 121 if( c.dir.equals(coll) ){ 117 122 current_collection = c; 123 current_view = view; // use the one from the parameters 118 124 break; 119 125 } … … 125 131 coll = current_collection.dir; 126 132 } 127 133 if (current_view == null) { 134 if (current_collection.views != null) { 135 current_view = (String)current_collection.views[0]; 136 } 137 } 128 138 dataManager.currentCollection = current_collection; 139 dataManager.currentView = current_view; 140 this.view = current_view; 129 141 dataManager.requestCollection(); 130 142 System.out.println("Requesting collection " + current_collection.name); 131 143 collCombo.setSelectedItem(current_collection); 144 if (current_view != null) { 145 viewCombo.setSelectedItem(current_view); 146 147 } 148 132 149 } 133 150 … … 172 189 collCombo.hidePopup(); 173 190 coll = dataManager.currentCollection.dir; 191 if (dataManager.currentCollection.views != null) { 192 viewCombo.setModel(new DefaultComboBoxModel(dataManager.currentCollection.views)); 193 viewCombo.setEnabled(true); 194 view = (String)viewCombo.getItemAt(0); 195 dataManager.currentView = view; 196 197 } else { 198 viewCombo.setModel(new DefaultComboBoxModel()); 199 viewCombo.setEnabled(false); 200 view = null; 201 dataManager.currentView = view; 202 } 174 203 dataManager.requestCollection(); 204 175 205 update(); 176 206 … … 188 218 }); 189 219 190 191 220 JLabel collLabel = new JLabel(); 192 221 collLabel.setFont(new java.awt.Font("Monospaced", 0, largeFont)); … … 196 225 collPanel.add(collLabel, BorderLayout.WEST); 197 226 collPanel.add(collCombo, BorderLayout.CENTER); 227 228 JPanel viewPanel = new JPanel(); 229 viewPanel.setLayout(new BorderLayout(5,5)); 230 viewPanel.setBackground(SystemColor.control); 231 232 viewCombo = new JComboBox(); 233 viewCombo.setEnabled(false); 234 235 JLabel viewLabel = new JLabel(); 236 viewLabel.setFont(new java.awt.Font("Monospaced", 0, largeFont)); 237 viewLabel.setForeground(Color.black); 238 viewLabel.setText("View:"); 239 240 viewPanel.add(viewLabel, BorderLayout.WEST); 241 viewPanel.add(viewCombo, BorderLayout.CENTER); 198 242 199 243 JPanel topPanel = new JPanel(); … … 245 289 pane.add(topPanel, BorderLayout.NORTH); 246 290 247 topPanel.add(collPanel, BorderLayout.WEST); 291 JPanel boxesPanel = new JPanel(); 292 boxesPanel.setLayout(new BorderLayout(5,5)); 293 boxesPanel.setBackground(SystemColor.control); 294 boxesPanel.add(collPanel, BorderLayout.WEST); 295 boxesPanel.add(viewPanel, BorderLayout.EAST); 296 297 topPanel.add(boxesPanel, BorderLayout.WEST); 248 298 topPanel.add(searchPanel, BorderLayout.CENTER); 249 299 topPanel.add(findButton, BorderLayout.EAST); … … 274 324 query = text.trim(); 275 325 326 String view1 = null; 327 if (viewCombo.isEnabled()) { 328 view1 = (String)viewCombo.getSelectedItem(); 329 } 330 if (!view1.equals(this.view)) { 331 this.view = view1; 332 dataManager.currentView = view1; 333 dataManager.requestCollection(); // resets previous data 334 } 276 335 setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); 277 336 -
trunk/gsdl3/extensions/vishnu/src/vishnu/testvis/visual/VishnuSingle.java
r8189 r8344 22 22 protected void initCollections() { 23 23 // put in a dummy Collection 24 Collection c = new Collection(coll, coll, coll, 0, coll );24 Collection c = new Collection(coll, coll, coll, 0, coll, null); 25 25 dataManager.currentCollection = c; 26 26 -
trunk/gsdl3/packages/vishnu/src/vishnu/builder/CollectionBuilder.java
r8290 r8344 7 7 { 8 8 //String site; 9 String collID ; // directory name10 String collHome ; // full path to collections directory11 String collName ;12 String collDesc ;13 String indexer ;14 boolean use_views ;9 String collID = null; // directory name 10 String collHome = null; // full path to collections directory 11 String collName = null; // descriptive name 12 String collDesc = null; // descriptive description :-) 13 String indexer = null; // mg or lucene 14 boolean use_views = false; 15 15 long numDocs=0; 16 16 Vector views = null; 17 17 private static void usage() 18 18 { 19 System.out.println("java vishnu.builder.CollectionBuilder\n -collsHome (directory where collections live) \n -collection (directory name of collection)\n -name (descriptive name for collection) \n -description (collection description)\n -index (\"mg\" or \"luc\")\n [-use_views ]");19 System.out.println("java vishnu.builder.CollectionBuilder\n -collsHome (directory where collections live) \n -collection (directory name of collection)\n -name (descriptive name for collection) \n -description (collection description)\n -index (\"mg\" or \"luc\")\n [-use_views ]"); 20 20 } 21 21 … … 36 36 int a = 0; 37 37 while( a < args.length ){ 38 //if( args[a].equals("-gHome") )39 // gHome = args[++a];40 38 if (args[a].equals("-collsHome")) 41 39 collsHome = args[++a]; … … 68 66 } 69 67 String coll_home = collsHome + collID + File.separator; 70 //CollectionBuilder cb = new CollectionBuilder(site,collName,gHome,indexer);71 CollectionBuilder cb = new CollectionBuilder(coll_home, collID, collName,collDesc, indexer, use_views);68 69 CollectionBuilder cb = new CollectionBuilder(coll_home, collID, collName, collDesc, indexer, use_views); 72 70 } 73 71 … … 83 81 this.use_views = use_views; 84 82 83 if (use_views) { 84 views = new Vector(); 85 } 85 86 if (!setupCollection()) { 86 87 System.err.println("Couldn't setup the collection. Quitting build"); … … 88 89 } 89 90 90 91 91 /**** get text annotation ****/ 92 92 … … 106 106 private boolean setupCollection() 107 107 { 108 // create the index directory 108 // check the import directory 109 File import_dir = new File(collHome + "import"); 110 if (!import_dir.isDirectory()) { 111 System.err.println("the import directory "+import_dir.getPath()+" doesn't exist. Quitting build"); 112 return false; 113 } 114 115 116 // create the building directory 109 117 try { 110 118 File index_dir = new File(collHome + "building"); … … 113 121 } else if (!index_dir.isDirectory()) { 114 122 // index is present but is not a directory 115 System.err.println("Trying to create building dir but a file already exists at "+index_dir. toString());123 System.err.println("Trying to create building dir but a file already exists at "+index_dir.getPath()); 116 124 return false; 117 125 } … … 121 129 } 122 130 131 // create the view list 132 if (use_views) { 133 // create a new view for each sub directory in import 134 File [] sub_dirs = import_dir.listFiles(); 135 for (int i=0; i<sub_dirs.length; i++) { 136 if (sub_dirs[i].isDirectory()) { 137 views.add(sub_dirs[i].getName()); 138 } 139 } 140 if (views.size()==0) { 141 // we haven't found any subdirectories 142 System.err.println("no sub directories were found in the import dorectory ("+import_dir.getPath()+"), not using views"); 143 use_views = false; 144 145 } 146 } 123 147 return true; 124 148 } … … 146 170 buffer.append("\" size=\""); 147 171 buffer.append(String.valueOf(numDocs)); 148 buffer.append("\" />");172 buffer.append("\">\n"); 149 173 150 174 // add in views 151 175 if (use_views) { 152 153 } 176 buffer.append("<viewList>\n"); 177 for (int i=0; i<views.size(); i++) { 178 buffer.append("<view name=\""); 179 buffer.append(views.get(i)); 180 buffer.append("\"/>"); 181 } 182 buffer.append("\n</viewList>\n"); 183 } 184 buffer.append("</collection>\n"); 185 154 186 out.print(buffer.toString()); 155 187 out.close(); … … 159 191 } 160 192 161 // private void printConfig()162 // {163 164 // String index_type="";165 // if (indexer.equals("luc")) {166 // index_type = "LUCENE";167 // } else if (indexer.equals("mg")) {168 // index_type = "MG";169 // }170 // /**** print buildConfig.xml ****/171 // try{172 // File target = new File(collHome + "building" + File.separator + "buildConfig.xml");173 // FileWriter fw = new FileWriter(target);174 // PrintWriter out = new PrintWriter(fw,true);175 176 // String str = "<buildConfig>\n";177 // str += "<metadataList/>\n";178 // //str += "<metadata name=\"numDocs\">" + String.valueOf(numDocs) + "</metadata>\n";179 // //str += "<metadata name=\"buildType\">" + indexer + "</metadata>\n";180 // //str += "</metadataList>\n";181 // str += "<serviceRackList>\n";182 // str += "<serviceRack name=\"Visualizer\">\n";183 // str += "<engineType name=\""+index_type+"\"/>\n";184 // str += "</serviceRack>\n";185 // str += "</serviceRackList>\n";186 // str += "</buildConfig>\n";187 // out.print(str);188 // out.close();189 // } catch (IOException e){ System.out.println("Error " + e.toString());}190 // }191 192 193 193 194 private void CKIndexing() 194 195 { 195 //CKWrapper ckw = new CKWrapper();196 196 CKIndexer cki = new CKIndexer(); 197 cki.setCollectionName(collID); 197 198 String in = collHome + "import"+File.separator; 198 199 String out = collHome + "building"+File.separator+"ck_index"+File.separator; 199 200 cki.setCollectionName(collID); 201 cki.setOutputDirectory(out); 202 cki.setInputDirectory(in); 203 cki.startIndexing(); 200 if (use_views) { 201 for (int i=0; i<views.size(); i++) { 202 String view = (String)views.get(i); 203 System.out.println("calculating candidate keywords for view "+view); 204 cki.setOutputDirectory(out+view+File.separator); 205 cki.setInputDirectory(in+view+File.separator); 206 cki.startIndexing(); 207 } 208 } else { 209 System.out.println("calculating candidate keywords"); 210 // just do the import dir as a whole 211 cki.setOutputDirectory(out); 212 cki.setInputDirectory(in); 213 cki.startIndexing(); 214 } 204 215 } 205 216 … … 210 221 String in = collHome + "import"+File.separator; 211 222 String out = collHome + "building"+File.separator + indexer + "_index"+File.separator; 212 213 if( indexer.equals("luc") ){ 214 LuceneWrapper luc = new LuceneWrapper(); 215 luc.setOutputDirectory(out); 216 luc.setInputDirectory(in); 217 luc.startIndexing(); 218 } 219 else if( indexer.equals("mg") ){ 220 MGWrapper mg = new MGWrapper(); 221 mg.setCollectionName(collID); 222 mg.setOutputDirectory(out); 223 mg.setInputDirectory(in); 224 mg.startIndexing(); 225 } 223 Indexer the_indexer; 224 if (indexer.equals("luc") ) { 225 the_indexer = new LuceneWrapper(); 226 } else { 227 the_indexer = new MGWrapper(); 228 } 229 the_indexer.setCollectionName(collID); 230 231 if (use_views) { 232 for (int i=0; i<views.size(); i++) { 233 String view = (String)views.get(i); 234 System.out.println("indexing the text for view "+view); 235 the_indexer.setOutputDirectory(out+view+File.separator); 236 the_indexer.setInputDirectory(in+view+File.separator); 237 the_indexer.startIndexing(); 238 } 239 240 } else { 241 System.out.println("indexing the text"); 242 the_indexer.setOutputDirectory(out); 243 the_indexer.setInputDirectory(in); 244 the_indexer.startIndexing(); 245 } 246 226 247 } 227 248 } -
trunk/gsdl3/packages/vishnu/src/vishnu/datablock/Collection.java
r8189 r8344 10 10 public int size; 11 11 public String engine; 12 13 public Collection(String di, String n, String d, int s, String e) 12 public String [] views; 13 14 public Collection(String di, String n, String d, int s, String e, String [] v) 14 15 { 15 16 dir = di; … … 18 19 size = s; 19 20 engine = e; 21 views = v; 20 22 } 21 23 } -
trunk/gsdl3/packages/vishnu/src/vishnu/server/CKServer.java
r8286 r8344 31 31 private Vector descriptions; 32 32 33 public CKServer(String collection_home ) {33 public CKServer(String collection_home, String view) { 34 34 35 35 this.index_directory = collection_home; … … 38 38 } 39 39 this.index_directory += "index" + File.separator + "ck_index" + File.separator; 40 if (view != null) { 41 this.index_directory += view + File.separator; 42 } 40 43 41 44 loadIndices(); … … 51 54 termFreq = (Vector)getObject(this.index_directory + FILE_TERM_FREQ); 52 55 } catch (Exception e) { 53 System.err.println("C ouldn't load up ck index data: "+e);56 System.err.println("CKServer Error: Couldn't load up ck index data: "+e); 54 57 } 55 58 } … … 239 242 int wordCount = KDMatrix[0].length; 240 243 int docHits = KDMatrix.length; 241 244 System.err.println("getClusters: word count = "+wordCount+", docHits = "+docHits); 242 245 int clusterNum = docHits>20?10:docHits; 243 246 … … 249 252 centroids= clustering.getCentroids(); 250 253 251 Sammon map = new Sammon(centroids);252 Point2D [] sammon = map.getMapping();253 254 // what are these for?? 255 //Sammon map = new Sammon(centroids); 256 //Point2D [] sammon = map.getMapping(); 254 257 return clusters; 255 258 } … … 280 283 public Point2D[] getSammonMap(double[][] centroids) 281 284 { 285 if (centroids == null) { 286 return null; 287 } 282 288 Sammon sammon = new Sammon(centroids); 283 289 Point2D[] p = sammon.getMapping(); -
trunk/gsdl3/packages/vishnu/src/vishnu/server/CKTester.java
r8286 r8344 23 23 String coll = args[1]; 24 24 String vis_home = args[2]; 25 25 String view = null; 26 if (args.length >= 4) { 27 view = args[3]; 28 } 26 29 27 30 /**** read in ck words, doc freq and term freq ****/ … … 30 33 ObjectInputStream in = null; 31 34 32 String root = vis_home + "/collections/" + coll + "/index/ck_index/"; 33 35 String root = vis_home; 36 if (!root.endsWith(File.separator)) { 37 root += File.separator; 38 } 39 root += "collections" + File.separator+ coll + File.separator + "index" + File.separator + "ck_index" + File.separator; 40 if (view != null) { 41 root += view+File.separator; 42 } 34 43 String fileDocFreq = "doc_freq"; 35 44 String fileTermFreq = "term_freq"; 36 45 String fileCKWords = "ck_words"; 37 46 38 float[] docFreq = (float[])getObject(root + "/" +fileDocFreq);39 String[] ck_words = (String[])getObject(root + "/" +fileCKWords);40 Vector termFreq = (Vector)getObject(root + "/" +fileTermFreq);47 float[] docFreq = (float[])getObject(root+fileDocFreq); 48 String[] ck_words = (String[])getObject(root + fileCKWords); 49 Vector termFreq = (Vector)getObject(root + fileTermFreq); 41 50 42 51 43 52 /**** get relevant docs ****/ 44 53 45 LUCSearcher lus = new LUCSearcher(coll ); //should be fullpath54 LUCSearcher lus = new LUCSearcher(coll, view); // coll should be fullpath 46 55 //lus.setRootDirectory(vis_home); 47 56 lus.search(query); -
trunk/gsdl3/packages/vishnu/src/vishnu/server/Search/LUCSearcher.java
r8189 r8344 51 51 private Hashtable ht; 52 52 53 public LUCSearcher(String coll_home )53 public LUCSearcher(String coll_home, String view) 54 54 { 55 55 collection_home = coll_home; … … 59 59 index_dir = collection_home + File.separator + "index" + 60 60 File.separator + "luc_index" + File.separator; 61 if (view != null) { 62 index_dir += view + File.separator; 63 } 61 64 } 62 65 -
trunk/gsdl3/packages/vishnu/src/vishnu/server/Search/MGSearcher.java
r8189 r8344 36 36 private MGWrapper mg_src; 37 37 38 public MGSearcher(String coll_home, String coll_name )38 public MGSearcher(String coll_home, String coll_name, String view) 39 39 { 40 40 collection_home = coll_home; … … 44 44 collection_name = coll_name; 45 45 mg_src = new MGWrapper(); 46 mg_index_path = "index"+File.separator+"mg_index"+ File.separator+collection_name+File.separator+collection_name; 46 mg_index_path = "index"+File.separator+"mg_index"+ File.separator; 47 if (view != null) { 48 mg_index_path += view + File.separator; 49 } 50 mg_index_path += collection_name+File.separator+collection_name; 47 51 mg_src.setIndex(mg_index_path); 48 52 } -
trunk/gsdl3/packages/vishnu/src/vishnu/server/VisServlet.java
r8287 r8344 20 20 21 21 import vishnu.server.Search.*; 22 import vishnu.datablock.*; 23 import vishnu.util.XMLUtil; 24 22 25 import java.io.*; 23 import vishnu.datablock.*;24 26 import javax.servlet.*; 25 27 import javax.servlet.http.*; … … 107 109 String query = (String)q.elementAt(1); 108 110 String collection = (String)q.elementAt(2); 111 String view = null; 112 if (q.size() == 4) { 113 view = (String)q.elementAt(3); 114 } 115 if (view != null && view.equals("")) { 116 view = null; 117 } 109 118 System.out.println("Requesting..." + collection); 110 119 … … 119 128 SearchInterface search_engine = null; 120 129 if( engine.equals("MG") ){ 121 search_engine = new MGSearcher(collection_home, collection );130 search_engine = new MGSearcher(collection_home, collection, view); 122 131 } else if( engine.equals("LUCENE") ){ 123 search_engine = new LUCSearcher(collection_home );132 search_engine = new LUCSearcher(collection_home, view); 124 133 } 125 134 … … 128 137 descriptions = search_engine.getDocDescriptions(); 129 138 System.out.println(docNums.size() + " documents in VisServlet"); 130 DataBlock data = generateDataBlock(collection_home, docNums, descriptions);139 DataBlock data = generateDataBlock(collection_home, view, docNums, descriptions); 131 140 if (data != null) { 132 141 response.addElement(data); … … 142 151 String docNum = (String)q.elementAt(1); 143 152 String collection = (String)q.elementAt(2); 153 String view = null; 154 if (q.size() == 4) { 155 view = (String)q.elementAt(3); 156 } 157 if (view != null && view.equals("")) { 158 view = null; 159 } 144 160 String engine; 145 161 String collection_home = COLLS_HOME+collection+File.separator; … … 153 169 SearchInterface search_engine = null; 154 170 if( engine.equals("MG") ){ 155 search_engine = new MGSearcher(collection_home, collection );171 search_engine = new MGSearcher(collection_home, collection, view); 156 172 } else if( engine.equals("LUCENE") ){ 157 search_engine = new LUCSearcher(collection_home );173 search_engine = new LUCSearcher(collection_home, view); 158 174 } 159 175 System.err.println("Searching for doc "+docNum); … … 175 191 private Vector activateCollections() 176 192 { 193 System.err.println("activating collections"); 177 194 Vector colls = new Vector(); 178 195 collH = new Hashtable(); … … 195 212 // ignore this collection 196 213 continue; 214 } else { 215 System.err.println("Trying to init collection "+f.getName()); 197 216 } 198 217 try { … … 201 220 doc = doc_build.parse(config_file); 202 221 } catch (Exception e) { 203 System.err.println("Error parsing config file "+config_file.getPath()+", ignoring this collec iton");222 System.err.println("Error parsing config file "+config_file.getPath()+", ignoring this collection"); 204 223 continue; 205 224 } … … 210 229 int size = Integer.parseInt(root.getAttribute("size")); 211 230 String coll_id = f.getName(); 212 Collection c = new Collection(coll_id,name,desc,size,engine); 231 Element view_elem = (Element)XMLUtil.getChildByTagName(root, "viewList"); 232 String [] views = null; 233 if (view_elem != null) { 234 NodeList view_list = view_elem.getElementsByTagName("view"); 235 int num_views = view_list.getLength(); 236 if (num_views > 0) { 237 views = new String[num_views]; 238 for (int j=0; j<num_views; j++) { 239 String v = ((Element)view_list.item(j)).getAttribute("name"); 240 views[j]=v; 241 } 242 } 243 } 244 Collection c = new Collection(coll_id,name,desc,size,engine,views); 213 245 System.out.println("Hashing.." + coll_id); 214 246 colls.addElement(c); … … 220 252 } 221 253 222 private DataBlock generateDataBlock(String collection_home, Vector docNums, Vector descriptions) { 223 254 private DataBlock generateDataBlock(String collection_home, String view, Vector docNums, Vector descriptions) { 255 256 if (docNums.size()==0) { 257 return null; 258 } 224 259 DataBlock data = new DataBlock(); 225 260 226 CKServer ck_server = new CKServer(collection_home );261 CKServer ck_server = new CKServer(collection_home, view); 227 262 228 263 /**** set data fields one by one and pass one what ever gets assembled ****/ … … 281 316 } catch (Exception e) { 282 317 System.err.println("VisServlet: computing clustering Error: "+e); 318 e.printStackTrace(); 283 319 } 284 320 ck_server = null; -
trunk/gsdl3/packages/vishnu/src/vishnu/testvis/object/DataManager.java
r8284 r8344 20 20 private CacheManager cache = null; 21 21 public Vector collections; 22 public Collection currentCollection ;23 22 public Collection currentCollection = null; 23 public String currentView = null; 24 24 /** Labels for the clusters needed by tree map, 25 25 * generated in this class */ … … 294 294 //GSDLEngine theEngine = new GSDLEngine(displayFrame); 295 295 System.out.println("Searching for " + queryStr); 296 297 DataBlock db = theEngine.getData(queryStr, currentCollection.dir); 296 DataBlock db = theEngine.getData(queryStr, currentCollection.dir, currentView); 298 297 299 298 if( db == null ) return 0; … … 351 350 theEngine.setDisplay(displayFrame); 352 351 //GSDLEngine engine = new GSDLEngine(displayFrame); 353 Vector document = theEngine.getDocument(Long.toString(docNum),currentCollection.dir );352 Vector document = theEngine.getDocument(Long.toString(docNum),currentCollection.dir, currentView); 354 353 355 354 // Fetch theFetch = new Fetch(displayFrame); -
trunk/gsdl3/packages/vishnu/src/vishnu/testvis/object/Engine.java
r8189 r8344 39 39 } 40 40 41 public DataBlock getData(String query, String collection )41 public DataBlock getData(String query, String collection, String view) 42 42 { 43 43 DataBlock data = null; … … 46 46 q.addElement(query); 47 47 q.addElement(collection); 48 q.addElement(view); 48 49 49 50 … … 52 53 sendObject(con,q); 53 54 Vector v = (Vector)receiveObject(con); 54 if( v == null ) System.out.println("Null result"); 55 else 56 data = (DataBlock)v.elementAt(0); 57 } catch( Exception ex) {System.out.println(ex);} 55 if( v == null || v.size()==0 ) { 56 System.out.println("Engine.getData: Null or empty result"); 57 } else { 58 data = (DataBlock)v.elementAt(0); 59 } 60 } catch( Exception ex) { 61 System.out.println("Engine.getData: "+ex); 62 } 58 63 59 64 return data; … … 61 66 62 67 63 public Vector getDocument(String id, String collection )68 public Vector getDocument(String id, String collection, String view) 64 69 { 65 70 Vector q = new Vector(); … … 68 73 q.addElement(id); 69 74 q.addElement(collection); 75 q.addElement(view); 70 76 71 77 try{ -
trunk/gsdl3/packages/vishnu/src/vishnu/testvis/object/GSDLEngine.java
r8284 r8344 28 28 } 29 29 30 public DataBlock getData(String query_term, String collection ) {30 public DataBlock getData(String query_term, String collection, String view) { 31 31 32 32 33 33 String query = servlet+"&type=search&q="+query_term; 34 if (view != null) { 35 query += "&view="+view; 36 } 34 37 System.out.println("sending query: " + query_term); 35 38 DataBlock db = null; … … 63 66 } 64 67 65 public Vector getDocument(String id, String collection ) {68 public Vector getDocument(String id, String collection, String view) { 66 69 String query = servlet+"&type=fetch&d="+id; 70 if (view != null) { 71 query += "&view="+view; 72 } 67 73 System.out.println("sending fetch: " + id); 68 74 Vector doc; -
trunk/gsdl3/packages/vishnu/src/vishnu/testvis/visual/Vishnu.java
r8189 r8344 36 36 public JTextField searchBox = null; 37 37 public JComboBox collCombo = null; 38 public JComboBox viewCombo = null; 38 39 protected int largeFont = 16; 39 40 40 41 public String query = null; 41 42 public String coll = null; 42 43 public String view = null; 44 43 45 public String server_address = null; 44 46 … … 49 51 query = getParameter("query"); 50 52 coll = getParameter("collection"); 53 view = getParameter("view"); 51 54 String library = getParameter("library"); 52 55 String viscgi = getParameter("viscgi"); … … 108 111 109 112 Collection current_collection=null; 113 String current_view = null; 110 114 if( coll == null || coll.equals("") || coll.equals("null") ) { 111 115 current_collection = ((Collection)dataManager.collections.elementAt(0)); 112 116 coll = current_collection.dir; 113 117 } else { 118 // try to find the one specified in the parameters 114 119 for( int i = 0; i < dataManager.collections.size(); i++ ){ 115 120 Collection c = (Collection)dataManager.collections.elementAt(i); 116 121 if( c.dir.equals(coll) ){ 117 122 current_collection = c; 123 current_view = view; // use the one from the parameters 118 124 break; 119 125 } … … 125 131 coll = current_collection.dir; 126 132 } 127 133 if (current_view == null) { 134 if (current_collection.views != null) { 135 current_view = (String)current_collection.views[0]; 136 } 137 } 128 138 dataManager.currentCollection = current_collection; 139 dataManager.currentView = current_view; 140 this.view = current_view; 129 141 dataManager.requestCollection(); 130 142 System.out.println("Requesting collection " + current_collection.name); 131 143 collCombo.setSelectedItem(current_collection); 144 if (current_view != null) { 145 viewCombo.setSelectedItem(current_view); 146 147 } 148 132 149 } 133 150 … … 172 189 collCombo.hidePopup(); 173 190 coll = dataManager.currentCollection.dir; 191 if (dataManager.currentCollection.views != null) { 192 viewCombo.setModel(new DefaultComboBoxModel(dataManager.currentCollection.views)); 193 viewCombo.setEnabled(true); 194 view = (String)viewCombo.getItemAt(0); 195 dataManager.currentView = view; 196 197 } else { 198 viewCombo.setModel(new DefaultComboBoxModel()); 199 viewCombo.setEnabled(false); 200 view = null; 201 dataManager.currentView = view; 202 } 174 203 dataManager.requestCollection(); 204 175 205 update(); 176 206 … … 188 218 }); 189 219 190 191 220 JLabel collLabel = new JLabel(); 192 221 collLabel.setFont(new java.awt.Font("Monospaced", 0, largeFont)); … … 196 225 collPanel.add(collLabel, BorderLayout.WEST); 197 226 collPanel.add(collCombo, BorderLayout.CENTER); 227 228 JPanel viewPanel = new JPanel(); 229 viewPanel.setLayout(new BorderLayout(5,5)); 230 viewPanel.setBackground(SystemColor.control); 231 232 viewCombo = new JComboBox(); 233 viewCombo.setEnabled(false); 234 235 JLabel viewLabel = new JLabel(); 236 viewLabel.setFont(new java.awt.Font("Monospaced", 0, largeFont)); 237 viewLabel.setForeground(Color.black); 238 viewLabel.setText("View:"); 239 240 viewPanel.add(viewLabel, BorderLayout.WEST); 241 viewPanel.add(viewCombo, BorderLayout.CENTER); 198 242 199 243 JPanel topPanel = new JPanel(); … … 245 289 pane.add(topPanel, BorderLayout.NORTH); 246 290 247 topPanel.add(collPanel, BorderLayout.WEST); 291 JPanel boxesPanel = new JPanel(); 292 boxesPanel.setLayout(new BorderLayout(5,5)); 293 boxesPanel.setBackground(SystemColor.control); 294 boxesPanel.add(collPanel, BorderLayout.WEST); 295 boxesPanel.add(viewPanel, BorderLayout.EAST); 296 297 topPanel.add(boxesPanel, BorderLayout.WEST); 248 298 topPanel.add(searchPanel, BorderLayout.CENTER); 249 299 topPanel.add(findButton, BorderLayout.EAST); … … 274 324 query = text.trim(); 275 325 326 String view1 = null; 327 if (viewCombo.isEnabled()) { 328 view1 = (String)viewCombo.getSelectedItem(); 329 } 330 if (!view1.equals(this.view)) { 331 this.view = view1; 332 dataManager.currentView = view1; 333 dataManager.requestCollection(); // resets previous data 334 } 276 335 setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); 277 336 -
trunk/gsdl3/packages/vishnu/src/vishnu/testvis/visual/VishnuSingle.java
r8189 r8344 22 22 protected void initCollections() { 23 23 // put in a dummy Collection 24 Collection c = new Collection(coll, coll, coll, 0, coll );24 Collection c = new Collection(coll, coll, coll, 0, coll, null); 25 25 dataManager.currentCollection = c; 26 26
Note:
See TracChangeset
for help on using the changeset viewer.