Ignore:
Timestamp:
2004-10-15T14:46:31+13:00 (20 years ago)
Author:
kjdon
Message:

added view stuff back in. A collection may be built with views - these are not predefined but are just subdirs in the import folder. the applet now has a menu for views, if they are available

Location:
trunk/greenstone3-extensions/vishnu/src/vishnu
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/greenstone3-extensions/vishnu/src/vishnu/builder/CollectionBuilder.java

    r8290 r8344  
    77{
    88    //String site;
    9     String collID; // directory name
    10     String collHome; // full path to collections directory
    11     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;
    1515    long numDocs=0;
    16    
     16    Vector views = null;
    1717    private static void usage()
    1818    {
    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 ]");
    2020    }
    2121   
     
    3636    int a = 0;
    3737    while( a < args.length ){
    38         //if( args[a].equals("-gHome") )
    39         //  gHome = args[++a];
    4038        if (args[a].equals("-collsHome"))
    4139        collsHome = args[++a];
     
    6866    }
    6967    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);
    7270    }
    7371   
     
    8381    this.use_views = use_views;
    8482   
     83    if (use_views) {
     84        views = new Vector();
     85    }
    8586    if (!setupCollection()) {
    8687        System.err.println("Couldn't setup the collection. Quitting build");
     
    8889    }
    8990   
    90    
    9191    /**** get text annotation ****/
    9292
     
    106106    private boolean setupCollection()
    107107    {
    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
    109117    try {
    110118        File index_dir = new File(collHome + "building");
     
    113121        } else if (!index_dir.isDirectory()) {
    114122        // 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());
    116124        return false;
    117125        }
     
    121129    }
    122130
     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    }
    123147    return true;
    124148    }
     
    146170        buffer.append("\" size=\"");
    147171        buffer.append(String.valueOf(numDocs));
    148         buffer.append("\" />");
     172        buffer.append("\">\n");
    149173       
    150174        // add in views
    151175        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       
    154186        out.print(buffer.toString());
    155187        out.close();
     
    159191    }
    160192   
    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    
    192193
    193194    private void CKIndexing()
    194195    {
    195     //CKWrapper ckw = new CKWrapper();
    196196    CKIndexer cki = new CKIndexer();
     197    cki.setCollectionName(collID);
    197198    String in = collHome + "import"+File.separator;
    198199    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    }
    204215    }
    205216   
     
    210221    String in = collHome + "import"+File.separator;
    211222    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
    226247    }
    227248}
  • trunk/greenstone3-extensions/vishnu/src/vishnu/datablock/Collection.java

    r8189 r8344  
    1010    public int size;
    1111    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)
    1415    {
    1516    dir = di;
     
    1819    size = s;
    1920    engine = e;
     21    views = v;
    2022    }
    2123}
  • trunk/greenstone3-extensions/vishnu/src/vishnu/server/CKServer.java

    r8286 r8344  
    3131    private Vector descriptions;
    3232   
    33     public CKServer(String collection_home) {
     33    public CKServer(String collection_home, String view) {
    3434   
    3535    this.index_directory = collection_home;
     
    3838    }
    3939    this.index_directory += "index" + File.separator + "ck_index" + File.separator;
     40    if (view != null) {
     41        this.index_directory += view + File.separator;
     42    }
    4043       
    4144    loadIndices();
     
    5154        termFreq = (Vector)getObject(this.index_directory + FILE_TERM_FREQ);
    5255    } catch (Exception e) {
    53         System.err.println("Couldn't load up ck index data: "+e);
     56        System.err.println("CKServer Error: Couldn't load up ck index data: "+e);
    5457    }
    5558    }
     
    239242    int wordCount = KDMatrix[0].length;
    240243    int docHits = KDMatrix.length;
    241 
     244    System.err.println("getClusters: word count = "+wordCount+", docHits = "+docHits);
    242245        int clusterNum =  docHits>20?10:docHits;
    243246     
     
    249252    centroids= clustering.getCentroids();
    250253   
    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();
    254257    return clusters;
    255258    }
     
    280283    public Point2D[] getSammonMap(double[][] centroids)
    281284    {
     285    if (centroids == null) {
     286        return null;
     287    }
    282288    Sammon sammon = new Sammon(centroids);
    283289    Point2D[] p = sammon.getMapping();
  • trunk/greenstone3-extensions/vishnu/src/vishnu/server/CKTester.java

    r8286 r8344  
    2323    String coll = args[1];
    2424    String vis_home = args[2];
    25 
     25    String view = null;
     26    if (args.length >= 4) {
     27        view = args[3];
     28    }
    2629
    2730    /**** read in ck words, doc freq and term freq ****/
     
    3033    ObjectInputStream in = null;
    3134   
    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    }
    3443    String fileDocFreq = "doc_freq";
    3544    String fileTermFreq = "term_freq";
    3645    String fileCKWords = "ck_words";
    3746   
    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);
    4150
    4251
    4352    /**** get relevant docs ****/
    4453
    45     LUCSearcher lus = new LUCSearcher(coll); // should be fullpath
     54    LUCSearcher lus = new LUCSearcher(coll, view); // coll should be fullpath
    4655    //lus.setRootDirectory(vis_home);
    4756    lus.search(query);
  • trunk/greenstone3-extensions/vishnu/src/vishnu/server/Search/LUCSearcher.java

    r8189 r8344  
    5151    private Hashtable ht;
    5252   
    53     public LUCSearcher(String coll_home)
     53    public LUCSearcher(String coll_home, String view)
    5454    {
    5555    collection_home = coll_home;
     
    5959    index_dir = collection_home + File.separator + "index" +
    6060        File.separator + "luc_index" + File.separator;
     61    if (view != null) {
     62        index_dir += view + File.separator;
     63    }
    6164    }
    6265
  • trunk/greenstone3-extensions/vishnu/src/vishnu/server/Search/MGSearcher.java

    r8189 r8344  
    3636    private MGWrapper mg_src;
    3737   
    38     public MGSearcher(String coll_home, String coll_name)
     38    public MGSearcher(String coll_home, String coll_name, String view)
    3939    {
    4040    collection_home = coll_home;
     
    4444    collection_name = coll_name;
    4545    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;
    4751    mg_src.setIndex(mg_index_path);
    4852    }
  • trunk/greenstone3-extensions/vishnu/src/vishnu/server/VisServlet.java

    r8287 r8344  
    2020
    2121import vishnu.server.Search.*;
     22import vishnu.datablock.*;
     23import vishnu.util.XMLUtil;
     24
    2225import java.io.*;
    23 import vishnu.datablock.*;
    2426import javax.servlet.*;
    2527import javax.servlet.http.*;
     
    107109        String query = (String)q.elementAt(1);
    108110        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        }
    109118        System.out.println("Requesting..." + collection);
    110119       
     
    119128        SearchInterface search_engine = null;
    120129        if( engine.equals("MG") ){
    121             search_engine = new MGSearcher(collection_home, collection);
     130            search_engine = new MGSearcher(collection_home, collection, view);
    122131        } else if( engine.equals("LUCENE") ){
    123             search_engine = new LUCSearcher(collection_home);
     132            search_engine = new LUCSearcher(collection_home, view);
    124133        }
    125134       
     
    128137        descriptions = search_engine.getDocDescriptions();
    129138        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);
    131140        if (data != null) {
    132141            response.addElement(data);
     
    142151        String docNum = (String)q.elementAt(1);
    143152        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        }
    144160        String engine;
    145161        String collection_home = COLLS_HOME+collection+File.separator;
     
    153169        SearchInterface search_engine = null;
    154170        if( engine.equals("MG") ){
    155             search_engine = new MGSearcher(collection_home, collection);
     171            search_engine = new MGSearcher(collection_home, collection, view);
    156172        } else if( engine.equals("LUCENE") ){
    157             search_engine = new LUCSearcher(collection_home);
     173            search_engine = new LUCSearcher(collection_home, view);
    158174        }
    159175        System.err.println("Searching for doc "+docNum);
     
    175191    private Vector activateCollections()
    176192    {
     193    System.err.println("activating collections");
    177194    Vector colls = new Vector();
    178195    collH = new Hashtable();
     
    195212            // ignore this collection
    196213            continue;
     214        } else {
     215            System.err.println("Trying to init collection "+f.getName());
    197216        }
    198217        try {
     
    201220            doc = doc_build.parse(config_file);
    202221        } catch (Exception e) {
    203             System.err.println("Error parsing config file "+config_file.getPath()+", ignoring this colleciton");
     222            System.err.println("Error parsing config file "+config_file.getPath()+", ignoring this collection");
    204223            continue;
    205224        }
     
    210229        int size = Integer.parseInt(root.getAttribute("size"));
    211230        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);
    213245        System.out.println("Hashing.." + coll_id);
    214246        colls.addElement(c);
     
    220252    }
    221253   
    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    }
    224259    DataBlock data = new DataBlock();
    225260
    226     CKServer ck_server = new CKServer(collection_home);
     261    CKServer ck_server = new CKServer(collection_home, view);
    227262   
    228263    /**** set data fields one by one and pass one what ever gets assembled ****/
     
    281316    } catch (Exception e) {
    282317        System.err.println("VisServlet: computing clustering Error: "+e);
     318        e.printStackTrace();
    283319    }
    284320    ck_server = null;
  • trunk/greenstone3-extensions/vishnu/src/vishnu/testvis/object/DataManager.java

    r8284 r8344  
    2020    private CacheManager cache = null;
    2121    public Vector collections;
    22     public Collection currentCollection;
    23 
     22    public Collection currentCollection = null;
     23    public String currentView = null;
    2424    /** Labels for the clusters needed by tree map,
    2525     *  generated in this class */
     
    294294    //GSDLEngine theEngine = new GSDLEngine(displayFrame);
    295295    System.out.println("Searching for " + queryStr);
    296 
    297     DataBlock db =  theEngine.getData(queryStr, currentCollection.dir);
     296    DataBlock db =  theEngine.getData(queryStr, currentCollection.dir, currentView);
    298297
    299298        if( db == null ) return 0;
     
    351350    theEngine.setDisplay(displayFrame);
    352351    //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);
    354353   
    355354    // Fetch theFetch = new Fetch(displayFrame);
  • trunk/greenstone3-extensions/vishnu/src/vishnu/testvis/object/Engine.java

    r8189 r8344  
    3939    }
    4040   
    41     public DataBlock getData(String query, String collection)
     41    public DataBlock getData(String query, String collection, String view)
    4242    {
    4343        DataBlock data = null;
     
    4646        q.addElement(query);
    4747    q.addElement(collection);
     48    q.addElement(view);
    4849   
    4950
     
    5253            sendObject(con,q);
    5354        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    }
    5863   
    5964    return data;
     
    6166
    6267   
    63     public Vector getDocument(String id, String collection)
     68    public Vector getDocument(String id, String collection, String view)
    6469    {
    6570    Vector q = new Vector();
     
    6873    q.addElement(id);
    6974    q.addElement(collection);
     75    q.addElement(view);
    7076
    7177    try{
  • trunk/greenstone3-extensions/vishnu/src/vishnu/testvis/object/GSDLEngine.java

    r8284 r8344  
    2828    }
    2929   
    30     public DataBlock getData(String query_term, String collection) {
     30    public DataBlock getData(String query_term, String collection, String view) {
    3131
    3232   
    3333    String query = servlet+"&type=search&q="+query_term;
     34    if (view != null) {
     35        query += "&view="+view;
     36    }
    3437    System.out.println("sending query: " + query_term);
    3538    DataBlock db = null;
     
    6366    }
    6467
    65     public Vector getDocument(String id, String collection) {
     68    public Vector getDocument(String id, String collection, String view) {
    6669    String query = servlet+"&type=fetch&d="+id;
     70    if (view != null) {
     71        query += "&view="+view;
     72    }   
    6773    System.out.println("sending fetch: " + id);
    6874    Vector doc;
  • trunk/greenstone3-extensions/vishnu/src/vishnu/testvis/visual/Vishnu.java

    r8189 r8344  
    3636    public JTextField searchBox = null;
    3737    public JComboBox collCombo = null;
     38    public JComboBox viewCombo = null;
    3839    protected int largeFont = 16;
    3940   
    4041    public String query = null;
    4142    public String coll = null;
    42 
     43    public String view = null;
     44   
    4345    public String server_address = null;
    4446   
     
    4951    query = getParameter("query");
    5052        coll = getParameter("collection");
     53    view = getParameter("view");
    5154    String library = getParameter("library");
    5255    String viscgi = getParameter("viscgi");
     
    108111
    109112    Collection current_collection=null;
     113    String current_view = null;
    110114    if( coll == null || coll.equals("") || coll.equals("null") ) {
    111115        current_collection = ((Collection)dataManager.collections.elementAt(0));
    112116        coll = current_collection.dir;
    113117    } else {
     118        // try to find the one specified in the parameters
    114119        for( int i = 0; i < dataManager.collections.size(); i++ ){
    115120        Collection c = (Collection)dataManager.collections.elementAt(i);
    116121        if( c.dir.equals(coll) ){
    117122            current_collection = c;
     123            current_view = view; // use the one from the parameters
    118124            break;
    119125        }
     
    125131        coll = current_collection.dir;
    126132    }
    127    
     133    if (current_view == null) {
     134        if (current_collection.views != null) {
     135        current_view = (String)current_collection.views[0];
     136        }
     137    }
    128138    dataManager.currentCollection = current_collection;
     139    dataManager.currentView = current_view;
     140    this.view = current_view;
    129141    dataManager.requestCollection();
    130142    System.out.println("Requesting collection " + current_collection.name);
    131143    collCombo.setSelectedItem(current_collection);
     144    if (current_view != null) {
     145        viewCombo.setSelectedItem(current_view);
     146       
     147    }
     148       
    132149    }
    133150
     
    172189            collCombo.hidePopup();
    173190            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            }
    174203            dataManager.requestCollection();
     204
    175205            update();
    176206           
     
    188218        });
    189219
    190 
    191220    JLabel collLabel = new JLabel();           
    192221    collLabel.setFont(new java.awt.Font("Monospaced", 0, largeFont));
     
    196225    collPanel.add(collLabel, BorderLayout.WEST);
    197226    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);
    198242
    199243    JPanel topPanel = new JPanel();
     
    245289        pane.add(topPanel, BorderLayout.NORTH);
    246290   
    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);
    248298    topPanel.add(searchPanel, BorderLayout.CENTER);
    249299    topPanel.add(findButton, BorderLayout.EAST);
     
    274324    query = text.trim();
    275325   
     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    }
    276335        setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
    277336   
  • trunk/greenstone3-extensions/vishnu/src/vishnu/testvis/visual/VishnuSingle.java

    r8189 r8344  
    2222    protected void initCollections() {
    2323    // 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);
    2525    dataManager.currentCollection = c;
    2626   
Note: See TracChangeset for help on using the changeset viewer.