Changeset 18180
- Timestamp:
- 2008-12-11T15:35:44+13:00 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
other-projects/trunk/greenstone3-extension/mat/src/org/greenstone/gsdl3_extension/mat/CollectionChooser.java
r18093 r18180 3 3 import java.awt.*; 4 4 import java.awt.event.*; 5 import java.io.File; 6 5 7 import javax.swing.*; 6 8 … … 10 12 11 13 public class CollectionChooser extends JFrame { 12 14 13 15 JPanel jPanel; 14 16 JButton jButton1; 15 17 JComboBox collectionComboBox; 18 String fileSeparator = File.separator; 16 19 17 20 public CollectionChooser(String collectionName){ … … 20 23 21 24 public CollectionChooser() { 22 23 25 super(); 24 26 this.setTitle("Choose a collection"); … … 27 29 dm.describe(); 28 30 29 31 Node cList = dm.getCollectionList(); 30 32 Element collectionList = (Element) cList; 31 33 NodeList collectionNameList = collectionList.getElementsByTagName("collection"); 32 String[] collectionStrings = new String[collectionNameList.getLength()]; 34 35 String[] collectionTemp = new String[collectionNameList.getLength()]; 33 36 37 int count =0; 34 38 for(int i=0; i<collectionNameList.getLength(); i++){ 35 39 Node nameNode = collectionNameList.item(i); 36 collectionStrings[i] = nameNode.getAttributes().item(0).getNodeValue(); 40 String collName = nameNode.getAttributes().item(0).getNodeValue();; 41 42 43 String path = dm.site_home+fileSeparator+"collect"+fileSeparator+collName+fileSeparator+"index"+fileSeparator+"text"+fileSeparator+collName+".ldb"; 44 45 File dbFile = new File(path); 46 if(dbFile.exists()){ 47 collectionTemp[count] = collName; 48 count++; 49 } 37 50 } 38 51 52 String[] collectionStrings = new String[count]; 53 54 for(int i = 0; i<count; i++){ 55 collectionStrings[i]= collectionTemp[i]; 56 } 57 58 if(collectionStrings.length==0){ 59 JOptionPane.showMessageDialog(new JFrame(),"No collections available."); 60 System.exit(0); 61 } 39 62 jButton1 = new JButton("Enter"); 40 63 jButton1.setPreferredSize(new Dimension(150,30));
Note:
See TracChangeset
for help on using the changeset viewer.