Changeset 11181
- Timestamp:
- 2006-02-01T10:44:44+13:00 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/gui/WriteCDImagePrompt.java
r10659 r11181 90 90 private JTextArea instructions_textarea; 91 91 /** A string array used to pass arguments to the phrase retrieval method. */ 92 private JCheckBox netscape_checkbox = null; 93 JLabel netscape_label = null; 92 94 private JTextField title_field = null; 93 95 private JTextField estimated_size_field = null; … … 102 104 /** the error message if any */ 103 105 private StringBuffer error_message = null; 104 /** This is the size of the exported stuff on its own (no collections). */ 105 private long total_exported_size = 52000000; 106 /** This is the size of the exported stuff on its own without 107 netscape and no collections. */ 108 private long total_exported_size = 16250000; 109 /** the size of netscape */ 110 private long netscape_size = 16500000; 106 111 /** The size of the export prompt screen. */ 107 112 public static final Dimension SIZE = new Dimension(500, 500); … … 151 156 Dictionary.setText(estimated_size_label, "WriteCDImagePrompt.Size_Label"); 152 157 158 netscape_checkbox = new JCheckBox(); 159 netscape_checkbox.addActionListener(new NetscapeCheckBoxListener()); 160 netscape_label = new JLabel(); 161 Dictionary.setText(netscape_label, "WriteCDImagePrompt.Netscape_Compatibility"); 162 153 163 scanForCollections(); 154 164 list.setListData(all_collections); … … 167 177 ok_button.setEnabled(false); 168 178 //title.getDocument().addDocumentListener(new DocumentListener()); 179 180 // work out the size of the extra images needed for netscape 4 181 // this assumes that they'll be installed (lang pack). 182 //exportcol.pl will crap out if they are not. 183 netscape_size += getFileSize(new File(LocalGreenstone.getDirectoryPath()+File.separator+"images")); 169 184 } 170 185 … … 200 215 title_pane.add(title_label, BorderLayout.WEST); 201 216 title_pane.add(title_field, BorderLayout.CENTER); 202 instructions_pane.add(title_pane, BorderLayout.SOUTH); 217 // instructions_pane.add(title_pane, BorderLayout.SOUTH); 218 219 JPanel netscape_pane = new JPanel(new BorderLayout()); 220 netscape_pane.add(netscape_checkbox, BorderLayout.WEST); 221 netscape_pane.add(netscape_label, BorderLayout.CENTER); 222 223 JPanel grid_pane = new JPanel(new GridLayout(2,1)); 224 grid_pane.add(title_pane); 225 grid_pane.add(netscape_pane); 226 instructions_pane.add(grid_pane, BorderLayout.SOUTH); 203 227 204 228 // Central pane … … 250 274 251 275 276 protected long getFileSize(File file) 277 { 278 long file_size = 0; 279 280 // Directory case 281 if (file.isDirectory()) { 282 File files[] = file.listFiles(); 283 for (int i = 0; i < files.length; i++) { 284 file_size += getFileSize(files[i]); 285 } 286 } 287 // File case 288 else { 289 file_size = file.length(); 290 } 291 292 return file_size; 293 } 294 252 295 /** This method calls the builcol.pl scripts via a GShell so as to not lock up the processor. 253 296 * @see org.greenstone.gatherer.Configuration … … 270 313 cd_title = cd_title.replaceAll("\"",""); 271 314 315 boolean use_netscape = false; 316 if (netscape_checkbox.isSelected()) { 317 use_netscape = true; 318 } 319 272 320 // Generate the exportcol.pl command 273 321 ArrayList command_parts_list = new ArrayList(); … … 278 326 command_parts_list.add(LocalGreenstone.getBinScriptDirectoryPath() + "exportcol.pl"); 279 327 280 if (Gatherer.isGsdlRemote) { 328 //if (Gatherer.isGsdlRemote || !use_netscape) { 329 if (!use_netscape) { 330 // now we allow remote users to use the netscape version 281 331 command_parts_list.add("-nonetscape"); 282 332 } … … 432 482 } 433 483 434 484 private class NetscapeCheckBoxListener 485 implements ActionListener { 486 public void actionPerformed(ActionEvent e) { 487 if (netscape_checkbox.isSelected()) { 488 total_exported_size += netscape_size; 489 } else { 490 total_exported_size -= netscape_size; 491 } 492 // Update the size field 493 estimated_size_field.setText(Utility.formatFileLength(total_exported_size)); 494 } 495 } 435 496 /** This private class listens for selection events in from the list and then displays the appropriate details for that collection. 436 497 */ … … 482 543 // Update the size field 483 544 estimated_size_field.setText(Utility.formatFileLength(total_exported_size)); 484 }485 486 487 private long getFileSize(File file)488 {489 long file_size = 0;490 491 // Directory case492 if (file.isDirectory()) {493 File files[] = file.listFiles();494 for (int i = 0; i < files.length; i++) {495 file_size += getFileSize(files[i]);496 }497 }498 // File case499 else {500 file_size = file.length();501 }502 503 return file_size;504 545 } 505 546 }
Note:
See TracChangeset
for help on using the changeset viewer.