- Timestamp:
- 2001-03-26T19:07:55+12:00 (23 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/java-client/org/nzdl/gsdl/SimpleGraphicalClient/CollectionInfoDialog.java
r2222 r2225 58 58 private NumberFormat numFormat = NumberFormat.getInstance(); 59 59 60 CollectionInfoDialog(Frame f, String collectionName, NzdlService nzdl) { 61 super(f, "Collection Information" ); 62 63 contentPanel = new JPanel(new GridLayout(0,2, 5, 4));; 64 buttonPanel = new JPanel(); 65 66 NzdlCollectionInfo collectionInfo = nzdl.getCollectionInfo(collectionName); 67 Set n = nzdl.getMetaData(collectionName, "collection", "collectionname"); 68 if (n.size() == 1) { 69 fullCollectionName = (String) n.toArray()[0]; 70 } 71 else { 72 System.err.println(collectionName + " has more than 1 collectionname"); 73 } 74 n.clear(); 75 76 collectionNamePanel = new JPanel(); 77 // collectionNamePanel.setBorder(BorderFactory.createEmptyBorder(2,2,2,2)); 78 collectionNamePanel.add(new JLabel(fullCollectionName)); 79 80 contentPanel.add(new JLabel("Short collection name:")); 81 JLabel collectionLabel = new JLabel(collectionName); 82 contentPanel.add(collectionLabel); 83 contentPanel.add(new JLabel("Number of Documents:")); 84 85 long numOfDocs = collectionInfo.getNumOfDocs(); 86 if (numOfDocs == 0) 87 numOfDocsString = "unknown"; 88 else 89 numOfDocsString = numFormat.format(numOfDocs); 90 contentPanel.add(new JLabel(numOfDocsString)); 91 contentPanel.add(new JLabel("Number of Words:")); 92 93 long numOfWords = collectionInfo.getNumOfWords(); 94 if (numOfWords == 0) 95 numOfWordsString = "unknown"; 96 else 97 numOfWordsString = numFormat.format(numOfWords); 98 contentPanel.add(new JLabel(numOfWordsString)); 99 contentPanel.add(new JLabel("Size:")); 100 long numOfBytes = collectionInfo.getNumOfBytes(); 101 contentPanel.add(new JLabel(formatByteSize(numOfBytes))); 102 contentPanel.add(new JLabel("Last built on:")); 103 // waiting for API to return a correct Date object ... 104 Date buildDate = new Date( collectionInfo.getBuildDate()*1000); 105 contentPanel.add(new JLabel(DateFormat.getDateTimeInstance().format(buildDate))); 106 contentPanel.add(new JLabel("Is it Public?")); 107 108 if (collectionInfo.isPublic()) 109 publicString = "yes"; 110 else 111 publicString = "no"; 112 contentPanel.add(new JLabel(publicString)); 113 contentPanel.add(new JLabel("Is it beta?")); 114 if (collectionInfo.isBeta()) 115 betaString = "yes"; 116 else 117 betaString = "no"; 118 contentPanel.add(new JLabel(betaString)); 119 120 JPanel descPanel = new JPanel(); 121 Set descSet = nzdl.getMetaData(collectionName, "collection", "collectionextra"); 122 if (descSet.size() == 1) { 123 descString = (String) descSet.toArray()[0]; 60 CollectionInfoDialog(Frame f, String collectionName, CSModel csModel) { 61 super(f, "Collection Information" ); 62 63 contentPanel = new JPanel(new GridLayout(0,2, 5, 4));; 64 buttonPanel = new JPanel(); 65 66 NzdlCollectionInfo collectionInfo = csModel.getCollectionInfo(collectionName); 67 /* 68 Set n = nzdl.getMetaData(collectionName, "collection", "collectionname"); 69 if (n.size() == 1) { 70 fullCollectionName = (String) n.toArray()[0]; 71 } 72 else { 73 System.err.println(collectionName + " has more than 1 collectionname"); 74 } 75 n.clear(); 76 */ 77 collectionNamePanel = new JPanel(); 78 // collectionNamePanel.setBorder(BorderFactory.createEmptyBorder(2,2,2,2)); 79 collectionNamePanel.add(new JLabel(csModel.getLongCollectionName(collectionName))); 80 81 contentPanel.add(new JLabel("Short collection name:")); 82 JLabel collectionLabel = new JLabel(collectionName); 83 contentPanel.add(collectionLabel); 84 contentPanel.add(new JLabel("Number of Documents:")); 85 86 long numOfDocs = collectionInfo.getNumOfDocs(); 87 if (numOfDocs == 0) 88 numOfDocsString = "unknown"; 89 else 90 numOfDocsString = numFormat.format(numOfDocs); 91 contentPanel.add(new JLabel(numOfDocsString)); 92 contentPanel.add(new JLabel("Number of Words:")); 93 94 long numOfWords = collectionInfo.getNumOfWords(); 95 if (numOfWords == 0) 96 numOfWordsString = "unknown"; 97 else 98 numOfWordsString = numFormat.format(numOfWords); 99 contentPanel.add(new JLabel(numOfWordsString)); 100 contentPanel.add(new JLabel("Size:")); 101 long numOfBytes = collectionInfo.getNumOfBytes(); 102 contentPanel.add(new JLabel(formatByteSize(numOfBytes))); 103 contentPanel.add(new JLabel("Last built on:")); 104 // waiting for API to return a correct Date object ... 105 Date buildDate = new Date( collectionInfo.getBuildDate()*1000); 106 contentPanel.add(new JLabel(DateFormat.getDateTimeInstance().format(buildDate))); 107 contentPanel.add(new JLabel("Is it Public?")); 108 109 if (collectionInfo.isPublic()) 110 publicString = "yes"; 111 else 112 publicString = "no"; 113 contentPanel.add(new JLabel(publicString)); 114 contentPanel.add(new JLabel("Is it beta?")); 115 if (collectionInfo.isBeta()) 116 betaString = "yes"; 117 else 118 betaString = "no"; 119 contentPanel.add(new JLabel(betaString)); 120 121 JPanel descPanel = new JPanel(); 122 descString = csModel.getCollectionDescription(collectionName); 124 123 //System.err.println(descString); 125 124 if (descString.length() > 0) { … … 143 142 descPanel.add(scrollPane); 144 143 } // if 145 } // if 146 descSet.clear(); 147 148 okButton = new JButton("Ok"); 149 okButton.setPreferredSize(new Dimension(80,20)); 150 okButton.addActionListener(this); 151 buttonPanel.add( okButton ); 152 getRootPane().setDefaultButton(okButton); 144 145 okButton = new JButton("Ok"); 146 okButton.setPreferredSize(new Dimension(80,20)); 147 okButton.addActionListener(this); 148 buttonPanel.add( okButton ); 149 getRootPane().setDefaultButton(okButton); 153 150 154 155 156 157 158 159 160 holderPanel.add(Box.createVerticalStrut(10));161 holderPanel.add(descPanel); // only if we have a description to show162 163 164 165 166 167 151 holderPanel = new JPanel(); 152 holderPanel.setBorder(BorderFactory.createEmptyBorder(10,10,2,10)); 153 holderPanel.setLayout( new BoxLayout(holderPanel, BoxLayout.Y_AXIS)); 154 holderPanel.add(collectionNamePanel); 155 holderPanel.add(contentPanel); 156 if (descString.length() > 0) { 157 holderPanel.add(Box.createVerticalStrut(10)); 158 holderPanel.add(descPanel); // only if we have a description to show 159 } 160 holderPanel.add(Box.createVerticalStrut(5)); 161 holderPanel.add(buttonPanel); 162 getContentPane().add(holderPanel); 163 pack(); 164 setVisible(true); 168 165 } //end CollectionInfoDialog constructor 169 166
Note:
See TracChangeset
for help on using the changeset viewer.