Changeset 7454
- Timestamp:
- 2004-05-27T10:51:18+12:00 (20 years ago)
- Location:
- trunk/gli/src/org/greenstone/gatherer
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/Gatherer.java
r7453 r7454 295 295 // Create Collection Manager 296 296 c_man = new CollectionManager(); 297 // If there was an open collection last session, reopen it.298 297 299 298 if (GS3) { … … 306 305 } 307 306 } 308 if(open_collection == null) { 307 308 // If there was an open collection last session, reopen it. 309 if (open_collection == null) { 309 310 open_collection = config.getString("general.open_collection", true); 310 311 } 311 if (!no_load && open_collection.length() > 0) {312 if (!no_load && open_collection.length() > 0) { 312 313 c_man.loadCollection(open_collection); 313 314 } 315 314 316 // Create GUI Manager (last) or else suffer the death of a thousand NPE's 315 317 splash.toFront(); -
trunk/gli/src/org/greenstone/gatherer/cdm/FormatManager.java
r7151 r7454 83 83 84 84 // Ensure the default formats for DateList, HList and VList are assigned 85 if (getFormat("DateList") == null) {86 addFormat(new Format("","DateList","<td>[link][icon][/link]</td><td>[highlight]{Or}{[dls.Title],[dc.Title],[Title],Untitled}[/highlight]</td><td>[Date]</td>"));87 } 88 89 if (getFormat("HList") == null) {90 addFormat(new Format("","HList","[link][highlight]{Or}{[dls.Title],[dc.Title],[Title],Untitled}[/highlight][/link]"));91 } 92 93 if (getFormat("VList") == null) {94 addFormat(new Format("","VList","<td valign=top>[link][icon][/link]</td><td valign=top>[srclink]{Or}{[thumbicon],[srcicon]}[/srclink]</td><td valign=top>[highlight]{Or}{[dls.Title],[dc.Title],[Title],Untitled}[/highlight]{If}{[Source],<br><i>([Source])</i>}</td>"));85 if (getFormat("DateList") == null) { 86 addFormat(new Format("","DateList","<td>[link][icon][/link]</td><td>[highlight]{Or}{[dls.Title],[dc.Title],[Title],Untitled}[/highlight]</td><td>[Date]</td>")); 87 } 88 89 if (getFormat("HList") == null) { 90 addFormat(new Format("","HList","[link][highlight]{Or}{[dls.Title],[dc.Title],[Title],Untitled}[/highlight][/link]")); 91 } 92 93 if (getFormat("VList") == null) { 94 addFormat(new Format("","VList","<td valign=top>[link][icon][/link]</td><td valign=top>[srclink]{Or}{[thumbicon],[srcicon]}[/srclink]</td><td valign=top>[highlight]{Or}{[dls.Title],[dc.Title],[Title],Untitled}[/highlight]{If}{[Source],<br><i>([Source])</i>}</td>")); 95 95 } 96 96 } … … 117 117 } 118 118 119 /** Have the formats changed since the last save. */120 public boolean formatsChanged() {121 122 }123 119 /** Have the formats changed since the last save. */ 120 public boolean formatsChanged() { 121 return formats_changed; 122 } 123 124 124 /** Gets the format indicated by the index. 125 125 * @param index The location of the desired format, as an <i>int</i>. … … 163 163 } 164 164 165 /** Set the state of the formats changed flag.166 * @param state the new state as a boolean167 */168 public void setFormatsChanged(boolean state) {169 170 }171 165 /** Set the state of the formats changed flag. 166 * @param state the new state as a boolean 167 */ 168 public void setFormatsChanged(boolean state) { 169 formats_changed = state; 170 } 171 172 172 private HashMap buildDefaultMappings(ArrayList features_model, ArrayList parts_model) { 173 173 Gatherer.println("buildDefaultMappings(): replace me with something that reads in a data xml file."); 174 174 return new HashMap(); 175 175 } … … 232 232 private HashMap default_mappings; 233 233 private JButton add_button; 234 235 234 //private JButton default_button; 235 private JButton insert_button; 236 236 private JButton remove_button; 237 237 private JButton replace_button; … … 243 243 private JTextArea instructions_textarea; 244 244 private JTextArea editor_textarea; 245 246 245 private JPanel blank_pane; 246 private JPanel control_pane; 247 247 private JPanel part_pane; 248 248 private JPanel selection_pane; … … 459 459 private class AddListener 460 460 implements ActionListener { 461 public void actionPerformed(ActionEvent event) { 461 462 public void actionPerformed(ActionEvent event) 463 { 462 464 ignore_event = true; // Prevent format_list excetera propagating events 463 Entry entry = (Entry)feature_combobox.getSelectedItem(); 465 466 Entry entry = (Entry) feature_combobox.getSelectedItem(); 464 467 Object f = entry.getFeature(); 465 468 String p = ""; … … 467 470 p = part_combobox.getSelectedItem().toString(); 468 471 } 472 473 // Add a new format string of the appropriate type 469 474 Format format = null; 470 if (view_type.equals(FLAG)) {475 if (view_type.equals(FLAG)) { 471 476 format = new Format(f, p, enabled_checkbox.isSelected()); 472 477 } … … 475 480 } 476 481 addFormat(format); 482 483 // Save the collection configuration file immediately 484 Gatherer.g_man.design_pane.saveConfiguration(); 485 477 486 add_button.setEnabled(false); 478 487 replace_button.setEnabled(false); 479 488 remove_button.setEnabled(true); 489 480 490 // Update list selection 481 491 format_list.setSelectedValue(format, true); … … 770 780 private class RemoveListener 771 781 implements ActionListener { 772 public void actionPerformed(ActionEvent event) { 773 if(!format_list.isSelectionEmpty()) { 782 783 public void actionPerformed(ActionEvent event) 784 { 785 if (!format_list.isSelectionEmpty()) { 786 // Remove the current format 774 787 removeFormat((Format)format_list.getSelectedValue()); 788 789 // Save the collection configuration file immediately 790 Gatherer.g_man.design_pane.saveConfiguration(); 791 775 792 // Change buttons 776 793 add_button.setEnabled(true); 777 794 replace_button.setEnabled(false); 778 795 } 796 779 797 remove_button.setEnabled(false); 780 798 } … … 784 802 implements ActionListener { 785 803 786 public void actionPerformed(ActionEvent event) { 787 ignore_event = true; // Prevent format_list excetera propagating events 788 789 if(!format_list.isSelectionEmpty()) { 790 791 // Remove the current format 792 removeFormat((Format)format_list.getSelectedValue()); 793 794 Entry entry = (Entry)feature_combobox.getSelectedItem(); 795 Object f = entry.getFeature(); 796 String p = ""; 797 if (entry.canHavePart()) { 798 p = part_combobox.getSelectedItem().toString(); 799 } 800 Format format = null; 801 if(view_type.equals(FLAG)) { 802 format = new Format(f, p, enabled_checkbox.isSelected()); 803 } 804 else { 805 format = new Format(f, p, editor_textarea.getText()); 806 } 807 addFormat(format); 808 add_button.setEnabled(false); 809 remove_button.setEnabled(true); 810 // Update list selection 811 format_list.setSelectedValue(format, true); 812 format = null; 813 p = null; 814 f = null; 815 entry = null; 816 } 817 replace_button.setEnabled(false); 818 ignore_event = false; 819 } 804 public void actionPerformed(ActionEvent event) 805 { 806 ignore_event = true; // Prevent format_list excetera propagating events 807 808 if (!format_list.isSelectionEmpty()) { 809 // Remove the current format 810 removeFormat((Format) format_list.getSelectedValue()); 811 812 Entry entry = (Entry) feature_combobox.getSelectedItem(); 813 Object f = entry.getFeature(); 814 String p = ""; 815 if (entry.canHavePart()) { 816 p = part_combobox.getSelectedItem().toString(); 817 } 818 819 // Add a new format string of the appropriate type 820 Format format = null; 821 if (view_type.equals(FLAG)) { 822 format = new Format(f, p, enabled_checkbox.isSelected()); 823 } 824 else { 825 format = new Format(f, p, editor_textarea.getText()); 826 } 827 addFormat(format); 828 829 // Save the collection configuration file immediately 830 Gatherer.g_man.design_pane.saveConfiguration(); 831 832 add_button.setEnabled(false); 833 remove_button.setEnabled(true); 834 // Update list selection 835 format_list.setSelectedValue(format, true); 836 format = null; 837 p = null; 838 f = null; 839 entry = null; 840 } 841 842 replace_button.setEnabled(false); 843 ignore_event = false; 844 } 820 845 } 821 846 }
Note:
See TracChangeset
for help on using the changeset viewer.