Changeset 5536
- Timestamp:
- 2003-09-26T14:58:33+12:00 (21 years ago)
- Location:
- trunk/gli/src/org/greenstone/gatherer
- Files:
-
- 21 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/Dictionary.java
r5529 r5536 1 package org.greenstone.gatherer;2 1 /** 3 2 *######################################################################### … … 36 35 *######################################################################## 37 36 */ 37 package org.greenstone.gatherer; 38 38 39 import java.awt.Component; 39 40 import java.io.*; … … 43 44 import javax.swing.text.*; 44 45 import javax.swing.tree.*; 45 import org.greenstone.gatherer.gui.GComboBox;46 import org.greenstone.gatherer.gui.border.TitledBorder;47 import org.greenstone.gatherer.util.DictionaryTreeNode;48 import org.greenstone.gatherer.util.MutableComboBoxEntry;49 import org.greenstone.gatherer.util.ArrayTools;50 46 import org.greenstone.gatherer.util.Utility; 47 51 48 /** Extends the ResourceBundle class to allow for the automatic insertion of arguments. Note that the key names beginning Farg are reserved for formatting. <BR> 52 49 * <BR> … … 91 88 /** Constructs the Dictionary class by first checking if a Locale has been set. If not the default locale is used, and a ResourceBundle is created. Finally a single important String, Language, is made available outside the class so a more read-able version of the Locale of this Dictionary is present. 92 89 * @param locale The <strong>Locale</strong> used to load the desired dictionary resource bundle. 93 90 */ 94 91 public Dictionary(Locale locale, FontUIResource font) { 95 92 super(); 96 93 this.self = this; 97 94 98 if (KEY_LIST_DEBUG) {95 if (KEY_LIST_DEBUG) { 99 96 // Reload the keylist 100 97 File file = new File(KEY_LIST_FILENAME); … … 116 113 // Initialize. 117 114 this.font = font; 118 if (locale == null) {115 if (locale == null) { 119 116 this.locale = Locale.getDefault(); 120 117 } … … 127 124 language = dictionary.getString("Language"); 128 125 } 129 /** Change the currently loaded dictionary and update registered (ie dynamic) components as possible. */ 130 public void changeDictionary(Locale locale) { 126 127 128 /** Change the currently loaded dictionary and update registered components */ 129 public void changeDictionary(Locale locale) 130 { 131 131 this.locale = locale; 132 132 133 // Load new dictionary 133 134 dictionary = ResourceBundle.getBundle(Utility.DICTIONARY, locale); 134 135 language = dictionary.getString("Language"); 135 Gatherer.println("Having loaded new dictionary: " + language); 136 Gatherer.println("Loaded new dictionary: " + language); 137 136 138 // Refresh all registered component 137 Gatherer.println("Updating components"); 138 for(Iterator keys = keySet().iterator(); keys.hasNext(); ) { 139 Object component = keys.next(); 140 String[] args = (String[]) get(component); 141 if(component instanceof AbstractButton) { 142 register((AbstractButton)component, args, true); 143 } 144 else if(component instanceof JComboBox) { 145 register((JComboBox)component, args, true); 146 } 147 else if(component instanceof JDialog) { 148 register((JDialog)component, args, true); 149 } 150 else if(component instanceof JFrame) { 151 register((JFrame)component, args, true); 152 } 153 else if(component instanceof JLabel) { 154 register((JLabel)component, args, true); 155 } 156 else if(component instanceof JTabbedPane) { 157 register((JTabbedPane)component, args, true); 158 } 159 else if(component instanceof JTextComponent) { 160 register((JTextComponent)component, args, true); 161 } 162 else if(component instanceof JTree) { 163 register((JTree)component, args, true); 164 } 165 else if(component instanceof TitledBorder) { 166 register((TitledBorder)component, args, true); 167 } 168 args = null; 169 component = null; 170 } 171 } 139 // !! TO FINISH !! 140 Gatherer.println("Updating components..."); 141 // ArrayList temp_list = new ArrayList(); 142 // Iterator components = keySet().iterator(); 143 // while (components.hasNext()) { 144 // Component component = (Component) components.next(); 145 // temp_list.add(component); 146 // } 147 148 // for (int i = 0; i < temp_list.size(); i++) { 149 // Component component = (Component) temp_list.get(i); 150 // ComponentDetails details = (ComponentDetails) get(component); 151 // oldSetBoth(component, details.text_key, details.text_args, details.tooltip_key); 152 // } 153 154 // for (Iterator keys = keySet().iterator(); keys.hasNext(); ) { 155 // Component component = (Component) keys.next(); 156 // ComponentDetails details = (ComponentDetails) get(component); 157 // oldSetBoth(component, details.text_key, details.text_args, details.tooltip_key); 158 // } 159 } 160 161 162 /** Change the currently loaded dictionary and update registered (ie dynamic) components as possible. */ 163 // public void oldChangeDictionary(Locale locale) { 164 // this.locale = locale; 165 // // Load new dictionary 166 // dictionary = ResourceBundle.getBundle(Utility.DICTIONARY, locale); 167 // language = dictionary.getString("Language"); 168 // Gatherer.println("Having loaded new dictionary: " + language); 169 // // Refresh all registered component 170 // Gatherer.println("Updating components"); 171 // for(Iterator keys = keySet().iterator(); keys.hasNext(); ) { 172 // Object component = keys.next(); 173 // String[] args = (String[]) get(component); 174 // if(component instanceof AbstractButton) { 175 // register((AbstractButton)component, args, true); 176 // } 177 // else if(component instanceof JComboBox) { 178 // register((JComboBox)component, args, true); 179 // } 180 // else if(component instanceof JDialog) { 181 // register((JDialog)component, args, true); 182 // } 183 // else if(component instanceof JFrame) { 184 // register((JFrame)component, args, true); 185 // } 186 // else if(component instanceof JLabel) { 187 // register((JLabel)component, args, true); 188 // } 189 // else if(component instanceof JTabbedPane) { 190 // register((JTabbedPane)component, args, true); 191 // } 192 // else if(component instanceof JTextComponent) { 193 // register((JTextComponent)component, args, true); 194 // } 195 // else if(component instanceof JTree) { 196 // register((JTree)component, args, true); 197 // } 198 // else if(component instanceof TitledBorder) { 199 // register((TitledBorder)component, args, true); 200 // } 201 // args = null; 202 // component = null; 203 // } 204 // } 205 172 206 /** Remove the component from our registered components list. */ 173 207 public void deregister(Object component) { … … 207 241 208 242 209 /** Overloaded to call get with both a key and an empty argument array. 243 /** 244 * @deprecated 245 * Overloaded to call get with both a key and an empty argument array. 210 246 * @param key A <strong>String</strong> which is mapped to a initial String within the ResourceBundle. 211 247 * @return A <strong>String</strong> which has been referenced by the key String and that either contains no argument fields, or has had the argument fields automatiically populated with formatting Strings of with argument String provided in the get call. … … 214 250 return get(key, (String[])null); 215 251 } 216 /** Convienence method with transforms the second string argument into a string array. */ 252 /** 253 * @deprecated 254 * Convienence method with transforms the second string argument into a string array. */ 217 255 public String get(String key, String arg) { 218 256 String[] args = new String[1]; … … 220 258 return get(key, args); 221 259 } 260 222 261 /** Used to retrieve a property value from the Locale specific ResourceBundle, based upon the key and arguments supplied. If the key cannot be found or if some other part of the call fails a default (English) error message is returned. <BR> 223 224 225 226 227 262 * Here the get recieves a second argument which is an array of Strings used to populate argument fields, denoted {<I>n</I>}, within the value String returned. Note that argument numbers greater than or equal to 32 are automatically mapped to the formatting String named Farg<I>n</I>. 263 * @param key A <strong>String</strong> which is mapped to a initial String within the ResourceBundle. 264 * @param args A <strong>String[]</strong> used to populate argument fields within the complete String. 265 * @return A <strong>String</strong> which has been referenced by the key String and that either contains no argument fields, or has had the argument fields automatiically populated with formatting Strings of with argument String provided in the get call. 266 */ 228 267 public String get(String key, String args[]) { 229 268 if(key_list != null) { … … 269 308 } 270 309 catch (Exception e) { 271 // if(!key.endsWith("_Tooltip")) { 272 System.err.println("Missing value for key: " + key); 273 // } 274 //e.printStackTrace(); 310 System.err.println("Missing value for key: " + key); 275 311 return key; 276 312 } … … 287 323 static public void setBoth(Component component, String text_key, String tooltip_key) 288 324 { 289 self.oldSetBoth(component, text_key, null, tooltip_key); 325 setText(component, text_key); 326 setTooltip(component, tooltip_key); 290 327 } 291 328 … … 293 330 static public void setText(Component component, String text_key) 294 331 { 295 se lf.oldSetText(component, text_key, null);332 setText(component, text_key, null); 296 333 } 297 334 … … 299 336 static public void setText(Component component, String text_key, String[] args) 300 337 { 301 self.oldSetText(component, text_key, args); 338 if (component != null) { 339 // Update the component using the AWTEvent queue 340 ComponentDetails details = new ComponentDetails(true, text_key, args, false, null); 341 ComponentUpdateTask task = new ComponentUpdateTask(component, details); 342 SwingUtilities.invokeLater(task); 343 } 302 344 } 303 345 … … 305 347 static public void setTooltip(Component component, String tooltip_key) 306 348 { 307 self.oldSetTooltip(component, tooltip_key); 308 } 309 310 311 private void oldSetBoth(Component component, String text_key, String[] args, String tooltip_key) 312 { 313 oldSetText(component, text_key, args); 314 oldSetTooltip(component, tooltip_key); 315 } 316 317 318 private void oldSetText(Component component, String text_key, String[] args) 349 if (component != null) { 350 // Update the component using the AWTEvent queue 351 ComponentDetails details = new ComponentDetails(false, null, null, true, tooltip_key); 352 ComponentUpdateTask task = new ComponentUpdateTask(component, details); 353 SwingUtilities.invokeLater(task); 354 } 355 } 356 357 358 static public void registerBoth(Component component, String text_key, String tooltip_key) 359 { 360 registerText(component, text_key, null); 361 registerTooltip(component, tooltip_key); 362 } 363 364 365 static public void registerText(Component component, String text_key) 366 { 367 registerText(component, text_key, null); 368 } 369 370 371 static public void registerText(Component component, String text_key, String[] args) 319 372 { 320 373 if (component != null) { 321 374 // Update the component's details 322 ComponentDetails details = (ComponentDetails) remove(component);375 ComponentDetails details = (ComponentDetails) self.remove(component); 323 376 if (details == null) { 324 377 details = new ComponentDetails(true, text_key, args, false, null); … … 329 382 details.text_args = args; 330 383 } 331 put(component, details);384 self.put(component, details); 332 385 333 386 // Update the component using the AWTEvent queue 334 RegisteredComponentUpdateTask task = new RegisteredComponentUpdateTask(component);387 ComponentUpdateTask task = new ComponentUpdateTask(component, details); 335 388 SwingUtilities.invokeLater(task); 336 389 } … … 338 391 339 392 340 private void oldSetTooltip(Component component, String tooltip_key)393 static public void registerTooltip(Component component, String tooltip_key) 341 394 { 342 395 if (component != null) { 343 396 // Update the component's details 344 ComponentDetails details = (ComponentDetails) remove(component);397 ComponentDetails details = (ComponentDetails) self.remove(component); 345 398 if (details == null) { 346 399 details = new ComponentDetails(false, null, null, true, tooltip_key); … … 350 403 details.tooltip_key = tooltip_key; 351 404 } 352 put(component, details);405 self.put(component, details); 353 406 354 407 // Update the component using the AWTEvent queue 355 RegisteredComponentUpdateTask task = new RegisteredComponentUpdateTask(component);408 ComponentUpdateTask task = new ComponentUpdateTask(component, details); 356 409 SwingUtilities.invokeLater(task); 357 410 } … … 359 412 360 413 361 private class ComponentDetails414 static private class ComponentDetails 362 415 { 363 416 public boolean has_text; … … 379 432 380 433 381 private class RegisteredComponentUpdateTask434 static private class ComponentUpdateTask 382 435 implements Runnable { 383 436 384 437 private Component component; 385 private ComponentDetails details;386 438 private String text = null; 387 439 private String tooltip = null; 388 440 389 public RegisteredComponentUpdateTask(Component component)441 public ComponentUpdateTask(Component component, ComponentDetails details) 390 442 { 391 443 this.component = component; 392 this.details = (ComponentDetails) get(component);393 444 394 445 if (details.has_text) { 395 text = get(details.text_key, details.text_args);446 text = self.get(details.text_key, details.text_args); 396 447 } 397 448 if (details.has_tooltip) { 398 tooltip = get(details.tooltip_key, (String[]) null);449 tooltip = self.get(details.tooltip_key, (String[]) null); 399 450 } 400 451 } … … 416 467 else if (component instanceof JTextComponent) { 417 468 ((JTextComponent) component).setText(text); 469 ((JTextComponent) component).setCaretPosition(0); 418 470 } 419 471 else { … … 434 486 /** 435 487 * @deprecated 436 * Register a n abstract button component*/437 public void register(AbstractButton component, String[] args, boolean already_registered)488 * Register a tab pane component. */ 489 static public void register(JTabbedPane component) 438 490 { 439 491 if(component != null) { 440 // Determine the key 441 String key = ""; 442 if(!already_registered) { 443 key = component.getText(); 444 } 445 else { 446 key = args[args.length - 1]; 447 } 448 // Update the component using the AWTEvent queue 449 String value = get(key, args); 450 String tooltip = get(key + "_Tooltip", (String[])null); 451 ChangeTask task = new AbstractButtonChangeTask(component, key, value, tooltip); 452 SwingUtilities.invokeLater(task); 453 // Register as necessary 454 if(!already_registered) { 455 args = ArrayTools.add(args, key); 456 put(component, args); 457 } 458 } 459 } 460 461 /** 462 * @deprecated 463 * Register a JCheckBox component */ 464 public void register(JCheckBox component, String[] args, boolean already_registered) 465 { 466 } 467 468 /** 469 * @deprecated 470 * Register a combobox component. */ 471 public void register(JComboBox component, String[] args, boolean already_registered) { 472 if(component != null) { 473 // If not already registered then args will be null. 474 if(!already_registered) { 475 args = new String[component.getItemCount()]; 476 } 477 // Retrieve the tooltip. The key is mostly derived from the comboboxes name. 478 String key = component.getName(); 479 String tooltip = get(key + "_Tooltip", (String[])null); 480 ChangeTask task = new JComboBoxChangeTask(component, key, -1, tooltip); 481 SwingUtilities.invokeLater(task); 482 // Iterate through the combobox, updating values and recording the original key of each item in args. 483 for(int i = 0; i < args.length; i++) { 484 if(args[i] == null) { 485 args[i] = component.getItemAt(i).toString(); 486 } 487 String value = get(args[i], (String[])null); 488 task = new JComboBoxChangeTask(component, key, i, value); 489 SwingUtilities.invokeLater(task); 490 } 491 // Register if necessary 492 if(!already_registered) { 493 put(component, args); 494 } 495 } 496 } 497 498 /** 499 * @deprecated 500 * Register a dialog component. */ 501 public void register(JDialog component, String[] args, boolean already_registered) { 502 if(component != null) { 503 // Determine the key 504 String key = ""; 505 if(!already_registered) { 506 key = component.getTitle(); 507 } 508 else { 509 key = args[args.length - 1]; 510 } 511 // Update the component using the AWTEvent queue 512 String value = get(key, args); 513 ChangeTask task = new JDialogChangeTask(component, key, value); 514 SwingUtilities.invokeLater(task); 515 // Register as necessary 516 if(!already_registered) { 517 args = ArrayTools.add(args, key); 518 put(component, args); 519 } 520 } 521 } 522 523 /** 524 * @deprecated 525 * Register a frame component. */ 526 public void register(JFrame component, String[] args, boolean already_registered) { 527 if(component != null) { 528 // Determine the key 529 String key = ""; 530 if(!already_registered) { 531 key = component.getTitle(); 532 } 533 else { 534 key = args[args.length - 1]; 535 } 536 // Update the component using the AWTEvent queue 537 String value = get(key, args); 538 ChangeTask task = new JFrameChangeTask(component, key, value); 539 SwingUtilities.invokeLater(task); 540 // Register as necessary 541 if(!already_registered) { 542 args = ArrayTools.add(args, key); 543 put(component, args); 544 } 545 } 546 } 547 548 /** 549 * @deprecated 550 * Register a label component. */ 551 public void register(JLabel component, String[] args, boolean already_registered) { 552 if(component != null) { 553 // Determine the key 554 String key = ""; 555 if(!already_registered) { 556 key = component.getText(); 557 } 558 else { 559 key = args[args.length - 1]; 560 } 561 // Update the component using the AWTEvent queue 562 String value = get(key, args); 563 ChangeTask task = new JLabelChangeTask(component, key, value); 564 SwingUtilities.invokeLater(task); 565 // Register as necessary 566 if(!already_registered) { 567 args = ArrayTools.add(args, key); 568 put(component, args); 569 } 570 } 571 } 572 573 /** 574 * @deprecated 575 * Register a tab pane component. */ 576 public void register(JTabbedPane component, String[] args, boolean already_registered) { 577 if(component != null) { 578 // If not already registered then args will be null. 579 if(!already_registered) { 580 args = new String[component.getTabCount()]; 581 } 492 String[] args = new String[component.getTabCount()]; 493 582 494 // Iterate through the tabbed panes tabs, updating values and recording the original key of each item in args. 583 495 for(int i = 0; i < args.length; i++) { … … 585 497 args[i] = component.getTitleAt(i); 586 498 } 587 String value = get(args[i], (String[])null);588 String tooltip = get(args[i] + "_Tooltip", (String[])null);589 ChangeTask task = new JTabbedPaneChangeTask(component, args[i], i, value, tooltip);499 String value = self.get(args[i], (String[])null); 500 String tooltip = self.get(args[i] + "_Tooltip", (String[])null); 501 JTabbedPaneChangeTask task = new JTabbedPaneChangeTask(component, args[i], i, value, tooltip); 590 502 SwingUtilities.invokeLater(task); 591 503 } 592 // Register if necessary 593 if(!already_registered) { 594 put(component, args); 595 } 596 } 597 } 598 599 /** 600 * @deprecated 601 * Register a text component. */ 602 public void register(JTextComponent component, String[] args, boolean already_registered) 603 { 604 if (component != null) { 605 // Determine the key 606 String key = ""; 607 if (!already_registered) { 608 key = component.getText(); 609 } 610 else { 611 key = args[args.length - 1]; 612 } 613 614 // Update the component using the AWTEvent queue 615 String value = get(key, args); 616 String tooltip = get(key + "_Tooltip", (String[])null); 617 ChangeTask task = new JTextComponentChangeTask(component, key, value, tooltip); 618 SwingUtilities.invokeLater(task); 619 // Register as necessary 620 if (!already_registered) { 621 args = ArrayTools.add(args, key); 622 put(component, args); 623 } 624 } 625 } 626 627 /** 628 * @deprecated 629 * Register a tree component. */ 630 public void register(JTree component, String[] args, boolean already_registered) { 631 if(component != null) { 632 // Retrieve the tooltip using the components name 633 String key = component.getName(); 634 String tooltip = get(key + "_Tooltip", (String[])null); 635 ChangeTask task = new JTreeChangeTask(component, key, tooltip); 636 SwingUtilities.invokeLater(task); 637 // A tree can never be previously registered. In otherwords the keys are harvested each time. Thus for a tree to remain consistant its up to the implementer to implement DictionaryTreeNode for the tree nodes! 638 ArrayList nodes = new ArrayList(); 639 nodes.add(component.getModel().getRoot()); 640 while(nodes.size() > 0) { 641 DictionaryTreeNode node = (DictionaryTreeNode) nodes.remove(0); 642 // Update 643 String value = get(node.getKey(), (String[])null); 644 task = new JTreeChangeTask(component, node.getKey(), node, value); 645 SwingUtilities.invokeLater(task); 646 // Add children to nodes 647 for(int i = 0; i < node.getChildCount(); i++) { 648 nodes.add(node.getChildAt(i)); 649 } 650 } 651 } 652 } 653 654 /** 655 * @deprecated 656 * Register a titled border component. */ 657 public void register(TitledBorder component, String[] args, boolean already_registered) { 658 if(component != null) { 659 // Determine the key 660 String key = ""; 661 if(!already_registered) { 662 key = component.getTitle(); 663 } 664 else { 665 key = args[args.length - 1]; 666 } 667 // Update the component using the AWTEvent queue 668 String value = get(key, args); 669 ChangeTask task = new TitledBorderChangeTask(component, key, value); 670 SwingUtilities.invokeLater(task); 671 // Register as necessary 672 if(!already_registered) { 673 args = ArrayTools.add(args, key); 674 put(component, args); 675 } 676 } 677 } 678 679 /** A get method called internally by components that have been previously been registered, which means that arg[index] is the original key value. Index is usually the last entry in the array, however this is not true for comboboxes, tabbed panes and trees. */ 680 private String get(String[] args, int index) { 681 return get(args[index], args); 682 } 683 684 685 private abstract class ChangeTask 686 implements Runnable { 687 protected String key; 688 protected String value; 689 public ChangeTask(String key, String value) { 690 this.key = key; 504 } 505 } 506 507 508 /** Updates a tabbed panes tab title and tooltip. */ 509 static private class JTabbedPaneChangeTask 510 implements Runnable { 511 protected String key; 512 protected String value; 513 private int index; 514 private JTabbedPane component; 515 private String tooltip; 516 517 public JTabbedPaneChangeTask(JTabbedPane component, String key, int index, String value, String tooltip) { 518 this.key = key; 691 519 this.value = value; 692 } 693 public void run() { 694 } 695 } 696 697 /** Update the text and tooltip for this button. */ 698 private class AbstractButtonChangeTask 699 extends ChangeTask { 700 private AbstractButton component; 701 private String tooltip; 702 public AbstractButtonChangeTask(AbstractButton component, String key, String value, String tooltip) { 703 super(key, value); 704 this.component = component; 705 this.tooltip = tooltip; 706 } 707 public void run() { 708 component.setText(value); 709 // if(!tooltip.equals(key+"_Tooltip")) { 710 component.setToolTipText(tooltip); 711 // } 712 // else { 713 // component.setToolTipText(null); 714 // } 715 } 716 } 717 /** Update the text associated with a combobox. If the index used is -1 then we are setting the tooltip for this combobox. */ 718 private class JComboBoxChangeTask 719 extends ChangeTask { 720 private int index; 721 private JComboBox component; 722 public JComboBoxChangeTask(JComboBox component, String key, int index, String value) { 723 super(key, value); 724 this.component = component; 725 this.index = index; 726 } 727 public void run() { 728 if(index != -1) { 729 try { 730 MutableComboBoxEntry entry = (MutableComboBoxEntry)component.getItemAt(index); 731 entry.setText(value); 732 } 733 catch (Exception error) { 734 } 735 } 736 else { 737 if(!value.equals(key+"_Tooltip")) { 738 component.setToolTipText(value); 739 } 740 else { 741 component.setToolTipText(null); 742 } 743 } 744 } 745 } 746 /** Update the title of this dialog. */ 747 private class JDialogChangeTask 748 extends ChangeTask { 749 private JDialog component; 750 public JDialogChangeTask(JDialog component, String key, String value) { 751 super(key, value); 752 this.component = component; 753 } 754 public void run() { 755 component.setTitle(value); 756 } 757 } 758 /** Update the title of this frame. */ 759 private class JFrameChangeTask 760 extends ChangeTask { 761 private JFrame component; 762 public JFrameChangeTask(JFrame component, String key, String value) { 763 super(key, value); 764 this.component = component; 765 } 766 public void run() { 767 component.setTitle(value); 768 } 769 } 770 771 /** Update the text of this label. */ 772 private class JLabelChangeTask 773 extends ChangeTask { 774 private JLabel component; 775 776 public JLabelChangeTask(JLabel component, String key, String value) { 777 super(key, value); 778 this.component = component; 779 } 780 781 public void run() { 782 component.setText(value); 783 } 784 } 785 786 /** Updates a tabbed panes tab title and tooltip. */ 787 private class JTabbedPaneChangeTask 788 extends ChangeTask { 789 private int index; 790 private JTabbedPane component; 791 private String tooltip; 792 public JTabbedPaneChangeTask(JTabbedPane component, String key, int index, String value, String tooltip) { 793 super(key, value); 794 this.component = component; 795 this.index = index; 796 this.tooltip = tooltip; 797 } 798 public void run() { 799 component.setTitleAt(index, value); 800 if(!tooltip.equals(key+"_Tooltip")) { 801 component.setToolTipTextAt(index, tooltip); 802 } 803 else { 804 component.setToolTipTextAt(index, null); 805 } 806 } 807 } 808 /** Update the text and tooltip of this text component. */ 809 private class JTextComponentChangeTask 810 extends ChangeTask { 811 private JTextComponent component; 812 private String tooltip; 813 public JTextComponentChangeTask(JTextComponent component, String key, String value, String tooltip) { 814 super(key, value); 815 this.component = component; 816 this.tooltip = tooltip; 817 } 818 public void run() { 819 component.setText(value); 820 if(!tooltip.equals(key+"_Tooltip")) { 821 component.setToolTipText(tooltip); 822 } 823 else { 824 component.setToolTipText(null); 825 } 826 } 827 } 828 /** Update the tooltip of a tree and its tree node's labels. Shouldn't really ever be used on a dynamic tree, but is quite useful for a 'contents' tree type control. */ 829 private class JTreeChangeTask 830 extends ChangeTask { 831 private DictionaryTreeNode node; 832 private JTree component; 833 public JTreeChangeTask(JTree component, String key, String value) { 834 super(key, value); 835 this.component = component; 836 } 837 public JTreeChangeTask(JTree component, String key, DictionaryTreeNode node, String value) { 838 super(key, value); 839 this.component = component; 840 this.node = node; 841 } 842 public void run() { 843 if(value != null) { 844 node.setText(value); 845 ((DefaultTreeModel)component.getModel()).nodeChanged((TreeNode)node); 846 } 847 // Set the tool tip 848 else { 849 if(!value.equals(key+"_Tooltip")) { 850 component.setToolTipText(value); 851 } 852 else { 853 component.setToolTipText(null); 854 } 855 } 856 } 857 } 858 /** Update the title of this titled border. */ 859 private class TitledBorderChangeTask 860 extends ChangeTask { 861 private TitledBorder component; 862 public TitledBorderChangeTask(TitledBorder component, String key, String value) { 863 super(key, value); 864 this.component = component; 865 } 866 public void run() { 867 component.setTitle(value); 868 component.getParent().repaint(); 869 } 520 this.component = component; 521 this.index = index; 522 this.tooltip = tooltip; 523 } 524 public void run() { 525 component.setTitleAt(index, value); 526 if(!tooltip.equals(key+"_Tooltip")) { 527 component.setToolTipTextAt(index, tooltip); 528 } 529 else { 530 component.setToolTipTextAt(index, null); 531 } 532 } 870 533 } 871 534 } -
trunk/gli/src/org/greenstone/gatherer/GAuthenticator.java
r5349 r5536 1 package org.greenstone.gatherer;2 1 /** 3 2 *######################################################################### … … 36 35 *######################################################################## 37 36 */ 38 import java.awt.Color; 39 import java.awt.Component; 40 import java.awt.Dimension; 41 import java.awt.GridLayout; 42 import java.awt.Point; 43 import java.awt.Toolkit; 44 import java.awt.event.ActionEvent; 45 import java.awt.event.ActionListener; 46 import java.net.Authenticator; 47 import java.net.PasswordAuthentication; 48 import javax.swing.BorderFactory; 49 import javax.swing.JButton; 50 import javax.swing.JDialog; 51 import javax.swing.JFrame; 52 import javax.swing.JLabel; 53 import javax.swing.JTextField; 54 import javax.swing.JPanel; 55 import javax.swing.JPasswordField; 37 package org.greenstone.gatherer; 38 39 import java.awt.*; 40 import java.awt.event.*; 41 import java.net.*; 42 import javax.swing.*; 43 56 44 /** Provides a graphic authenticator for network password requests. 57 45 * @author John Thompson, Greenstone Digital Library, University of Waikato … … 72 60 /** The default size of this dialog. */ 73 61 static final private Dimension SIZE = new Dimension(410,140); 62 74 63 /** Constructor. */ 75 64 public GAuthenticator() { 76 65 } 66 77 67 /** Prompt the user for authentication using a pretty dialog box. 78 79 80 81 68 * @return A <strong>PasswordAuthentication</strong> object containing the login and password valuees the user has submitted. 69 * @see org.greenstone.gatherer.GAuthenticator.AuthenticationActionListener 70 * @see org.greenstone.gatherer.GAuthenticator.RequestFocusListener 71 */ 82 72 protected PasswordAuthentication getPasswordAuthentication() { 83 73 // Component definition. 84 dialog = new JDialog (Gatherer.g_man, get("GAuthenticator.Title"), true);74 dialog = new JDialog (Gatherer.g_man, Dictionary.newget("GAuthenticator.Title"), true); 85 75 dialog.setModal(true); 86 76 dialog.setSize(SIZE); 87 JPanel content_pane = (JPanel) dialog.getContentPane();77 JPanel content_pane = (JPanel) dialog.getContentPane(); 88 78 JLabel title_label = new JLabel(getRequestingPrompt()); 89 79 JPanel user_panel = new JPanel(); 90 JLabel username_label = new JLabel(get("GAuthenticator.Username")); 80 JLabel username_label = new JLabel(); 81 Dictionary.setText(username_label, "GAuthenticator.Username"); 91 82 JTextField username = new JTextField(); 83 Dictionary.setTooltip(username, "GAuthenticator.Username_Tooltip"); 92 84 JPanel password_panel = new JPanel(); 93 JLabel password_label = new JLabel(get("GAuthenticator.Password")); 85 JLabel password_label = new JLabel(); 86 Dictionary.setText(password_label, "GAuthenticator.Password"); 94 87 password = new JPasswordField(); 95 password.setEchoChar ('*'); 88 password.setEchoChar('*'); 89 Dictionary.setTooltip(password, "GAuthenticator.Password_Tooltip"); 96 90 JPanel button_panel = new JPanel(); 97 ok_button = new JButton(get("General.OK")); 98 cancel_button = new JButton(get("General.Cancel")); 99 // Connect listeners. 91 ok_button = new JButton(); 92 Dictionary.setBoth(ok_button, "General.OK", "General.OK_Tooltip"); 93 cancel_button = new JButton(); 94 Dictionary.setBoth(cancel_button, "General.Cancel", "General.Cancel_Tooltip"); 95 96 // Connection 100 97 cancel_button.addActionListener(new AuthenticationActionListener(true)); 101 98 ok_button.addActionListener(new AuthenticationActionListener(false)); 102 99 password.addActionListener(new AuthenticationActionListener(false)); 103 100 username.addActionListener(new RequestFocusListener(password)); 104 // Layout the components. 101 102 // Layout 105 103 user_panel.setLayout(new GridLayout(1,2)); 106 104 user_panel.add(username_label); … … 121 119 content_pane.add(password_panel); 122 120 content_pane.add(button_panel); 123 // Position the window. 121 122 // Position the window 124 123 Dimension screen_size = Toolkit.getDefaultToolkit().getScreenSize(); 125 124 dialog.setLocation((screen_size.width - SIZE.width) / 2, (screen_size.height - SIZE.height) / 2); … … 134 133 } 135 134 136 /** Retrieve a phrase from the dictionary. 137 * @param key A <strong>String</strong> used to determine what phrase to retrieve. 138 * @return The required phrase as a <strong>String</strong>, or at least some meaningful error message. 139 * @see org.greenstone.gatherer.Dictionary 140 * @see org.greenstone.gatherer.Gatherer 141 */ 142 private String get(String key) { 143 if(key.indexOf(".") == -1) { 144 key = "GAuthenticator." + key; 145 } 146 return Gatherer.dictionary.get(key); 147 } 135 148 136 /** Detects actions upon any control that attempt to submit the current details for authentication. */ 149 137 private class AuthenticationActionListener … … 153 141 /** Constructor. 154 142 * @param cancel_action <i>true</i> if this authentication action cancels the authentication, <i>false</i> otherwise. 155 143 */ 156 144 public AuthenticationActionListener(boolean cancel_action) { 157 145 this.cancel_action = cancel_action; 158 146 } 159 147 /** Any implementation of an ActionListener must include this method so that we can be informed when an action has been performed on our registered controls, allowing us to dispose of the authentication dialog after determining if this is a submit action or a cancel one. 160 161 148 * @param event An <strong>ActionEvent</strong> with information about the event that fired this method. 149 */ 162 150 public void actionPerformed(ActionEvent event) { 163 151 authentication_cancelled = cancel_action; … … 165 153 } 166 154 } 155 167 156 /** This listener detects actions on registered controls, and when they occur ensures the focus is moved to some targetted component. */ 168 157 private class RequestFocusListener … … 172 161 /** Constructor. 173 162 * @param target The <strong>Component</strong> you wish to gain focus when an action is performed on a registered control. 174 163 */ 175 164 public RequestFocusListener(Component target) { 176 165 this.target = target; 177 166 } 178 167 /** Any implementation of an ActionListener must include this method so that we can be informed when an action has been performed on our registered controls, allowing us to request focus in the target control. 179 180 168 * @param event An <strong>ActionEvent</strong> with information about the event that fired this method. 169 */ 181 170 public void actionPerformed(ActionEvent event) { 182 171 target.requestFocus(); … … 184 173 } 185 174 } 186 187 188 189 190 191 192 -
trunk/gli/src/org/greenstone/gatherer/cdm/GeneralManager.java
r5529 r5536 25 25 *######################################################################## 26 26 */ 27 28 27 package org.greenstone.gatherer.cdm; 29 28 … … 32 31 import javax.swing.*; 33 32 import javax.swing.event.*; 34 import javax.swing.text.JTextComponent;35 33 import javax.swing.tree.*; 36 34 import org.greenstone.gatherer.Configuration; … … 41 39 import org.greenstone.gatherer.cdm.Control; 42 40 import org.greenstone.gatherer.gui.EmailField; 43 import org.greenstone.gatherer.msm.MSMUtils;44 41 import org.greenstone.gatherer.util.Utility; 42 45 43 /** This class is responsible for generating the necessary GUI components. It does this by calling the getEditControls() method of the appropriate class (i.e. IndexManager for index related edits). It also is in charge of correctly adding (and removing) listeners, using phrases from the <strong>Dictionary</strong> rather than the text keys inserted in the component classes, and several other aspects of the design page, including the config file section tree. 46 44 * @author John Thompson, Greenstone Digital Library, University of Waikato … … 73 71 JPanel tree_pane = new JPanel(); 74 72 JLabel title = new JLabel(); 75 Gatherer.dictionary.setText(title, "CDM.GUI.Design_Topics", null);73 Dictionary.registerText(title, "CDM.GUI.Design_Topics"); 76 74 tree = new DesignTree(); 77 75 view = controls; … … 176 174 title_label = new JLabel(); 177 175 title_label.setHorizontalAlignment(JLabel.CENTER); 178 Gatherer.dictionary.setText(title_label, "CDM.General.Title", null);176 Dictionary.registerText(title_label, "CDM.General.Title"); 179 177 180 178 instructions_textarea = new JTextArea(); … … 184 182 instructions_textarea.setRows(6); 185 183 instructions_textarea.setWrapStyleWord(true); 186 Gatherer.dictionary.setText(instructions_textarea, "CDM.General.Instructions", null);184 Dictionary.registerText(instructions_textarea, "CDM.General.Instructions"); 187 185 188 186 JPanel all_details_panel = new JPanel(); … … 191 189 creator_label = new JLabel(); 192 190 creator_label.setPreferredSize(LABEL_SIZE); 193 Gatherer.dictionary.setText(creator_label, "CDM.General.Email.Creator", null);191 Dictionary.registerText(creator_label, "CDM.General.Email.Creator"); 194 192 195 193 creator_emailfield = new EmailField(Gatherer.config.getColor("coloring.error_background", false)); 196 Gatherer.dictionary.setTooltip(creator_emailfield, "CDM.General.Email.Creator_Tooltip");194 Dictionary.registerTooltip(creator_emailfield, "CDM.General.Email.Creator_Tooltip"); 197 195 198 196 JPanel maintainer_panel = new JPanel(); 199 197 maintainer_label = new JLabel(); 200 198 maintainer_label.setPreferredSize(LABEL_SIZE); 201 Gatherer.dictionary.setText(maintainer_label, "CDM.General.Email.Maintainer", null);199 Dictionary.registerText(maintainer_label, "CDM.General.Email.Maintainer"); 202 200 203 201 maintainer_emailfield = new EmailField(Gatherer.config.getColor("coloring.error_background", false)); 204 Gatherer.dictionary.setTooltip(maintainer_emailfield, "CDM.General.Email.Maintainer_Tooltip");202 Dictionary.registerTooltip(maintainer_emailfield, "CDM.General.Email.Maintainer_Tooltip"); 205 203 public_checkbox = new JCheckBox("", public_collectionmeta.getValue(CollectionMeta.TEXT).equals(CollectionConfiguration.TRUE_STR)); 206 Gatherer.dictionary.setText(public_checkbox, "CDM.General.Access", null);204 Dictionary.registerText(public_checkbox, "CDM.General.Access"); 207 205 beta_checkbox = new JCheckBox("", beta_collectionmeta.getValue(CollectionMeta.TEXT).equals(CollectionConfiguration.TRUE_STR)); 208 Gatherer.dictionary.setText(beta_checkbox, "CDM.General.Beta", null);206 Dictionary.registerText(beta_checkbox, "CDM.General.Beta"); 209 207 JPanel name_panel = new JPanel(); 210 208 name_label = new JLabel(); 211 209 name_label.setPreferredSize(LABEL_SIZE); 212 Gatherer.dictionary.setText(name_label, "CDM.General.Collection_Name", null);210 Dictionary.registerText(name_label, "CDM.General.Collection_Name"); 213 211 name_textfield = new JTextField("CDM.General.Collection_Name"); 214 Gatherer.dictionary.setTooltip(name_textfield, "CDM.General.Collection_Name_Tooltip");212 Dictionary.registerTooltip(name_textfield, "CDM.General.Collection_Name_Tooltip"); 215 213 JPanel icon_panel = new JPanel(); 216 214 icon_label = new JLabel(); 217 215 icon_label.setPreferredSize(LABEL_SIZE); 218 Gatherer.dictionary.setText(icon_label, "CDM.General.Icon_Collection", null);216 Dictionary.registerText(icon_label, "CDM.General.Icon_Collection"); 219 217 icon_textfield = new JTextField("CDM.General.Icon_Collection"); 220 Gatherer.dictionary.setTooltip(icon_textfield, "CDM.General.Icon_Collection_Tooltip");218 Dictionary.registerTooltip(icon_textfield, "CDM.General.Icon_Collection_Tooltip"); 221 219 JPanel small_icon_panel = new JPanel(); 222 220 small_icon_label = new JLabel("CDM.General.Icon_Collection_Small"); 223 221 small_icon_label.setPreferredSize(LABEL_SIZE); 224 Gatherer.dictionary.setText(small_icon_label, "CDM.General.Icon_Collection_Small", null);222 Dictionary.registerText(small_icon_label, "CDM.General.Icon_Collection_Small"); 225 223 small_icon_textfield = new JTextField("CDM.General.Icon_Collection_Small"); 226 Gatherer.dictionary.setTooltip(small_icon_textfield, "CDM.General.Icon_Collection_Small_Tooltip");224 Dictionary.registerTooltip(small_icon_textfield, "CDM.General.Icon_Collection_Small_Tooltip"); 227 225 JPanel description_panel = new JPanel(); 228 226 description_label = new JLabel(); 229 227 description_label.setPreferredSize(LABEL_SIZE); 230 Gatherer.dictionary.setText(description_label, "CDM.General.Collection_Extra", null);228 Dictionary.registerText(description_label, "CDM.General.Collection_Extra"); 231 229 description_textarea = new JTextArea(); 232 230 description_textarea.setBackground(Gatherer.config.getColor("coloring.editable_background", false)); 233 Gatherer.dictionary.setTooltip(description_textarea, "CDM.General.Collection_Extra_Tooltip");231 Dictionary.registerTooltip(description_textarea, "CDM.General.Collection_Extra_Tooltip"); 234 232 // Connection 235 233 beta_checkbox.addActionListener(CollectionDesignManager.change_listener); … … 358 356 */ 359 357 public void setSelectedView(String type) { 360 type = Gatherer.dictionary.get(type);358 type = Dictionary.newget(type); 361 359 for(int i = 0; i < root.getChildCount(); i++) { 362 360 DesignNode child = (DesignNode) root.getChildAt(i); … … 381 379 */ 382 380 public String toString() { 383 return Gatherer.dictionary.get("CDM.GUI." + (String)getUserObject());381 return Dictionary.newget("CDM.GUI." + (String)getUserObject()); 384 382 } 385 383 } -
trunk/gli/src/org/greenstone/gatherer/cdm/IndexManager.java
r5375 r5536 26 26 */ 27 27 package org.greenstone.gatherer.cdm; 28 28 29 import java.awt.*; 29 30 import java.awt.event.*; … … 31 32 import javax.swing.*; 32 33 import javax.swing.event.*; 34 import org.greenstone.gatherer.Dictionary; 33 35 import org.greenstone.gatherer.Gatherer; 34 36 import org.greenstone.gatherer.cdm.CollectionMeta; … … 104 106 } 105 107 else { 106 JOptionPane.showMessageDialog(Gatherer.g_man, get("CDM.IndexManager.Index_Exists"),get("General.Warning"), JOptionPane.WARNING_MESSAGE);108 JOptionPane.showMessageDialog(Gatherer.g_man, Dictionary.newget("CDM.IndexManager.Index_Exists"), Dictionary.newget("General.Warning"), JOptionPane.WARNING_MESSAGE); 107 109 } 108 110 } … … 122 124 } 123 125 else { 124 JOptionPane.showMessageDialog(Gatherer.g_man, get("CDM.IndexManager.Level_Exists"),get("General.Warning"), JOptionPane.WARNING_MESSAGE);126 JOptionPane.showMessageDialog(Gatherer.g_man, Dictionary.newget("CDM.IndexManager.Level_Exists"), Dictionary.newget("General.Warning"), JOptionPane.WARNING_MESSAGE); 125 127 } 126 128 } … … 481 483 } 482 484 483 /** Overloaded to call get with both a key and an empty argument array.484 * @param key A <strong>String</strong> which is mapped to a initial String within the ResourceBundle.485 * @return A <strong>String</strong> which has been referenced by the key String and that either contains no argument fields, or has had the argument fields automatiically populated with formatting Strings of with argument String provided in the get call.486 */487 private String get(String key) {488 return get(key, null);489 }490 491 /** Used to retrieve a property value from the Locale specific ResourceBundle, based upon the key and arguments supplied. If the key cannot be found or if some other part of the call fails a default (English) error message is returned. <BR>492 * Here the get recieves a second argument which is an array of Strings used to populate argument fields, denoted {<I>n</I>}, within the value String returned. Note that argument numbers greater than or equal to 32 are automatically mapped to the formatting String named Farg<I>n</I>.493 * @param key A <strong>String</strong> which is mapped to a initial String within the ResourceBundle.494 * @param args A <strong>String[]</strong> used to populate argument fields within the complete String.495 * @return A <strong>String</strong> which has been referenced by the key String and that either contains no argument fields, or has had the argument fields automatically populated with formatting Strings of with argument String provided in the get call.496 * @see org.greenstone.gatherer.Gatherer497 * @see org.greenstone.gatherer.Dictionary498 */499 private String get(String key, String args[]) {500 if(key.indexOf('.') == -1) {501 key = "CDM.IndexManager." + key;502 }503 return Gatherer.dictionary.get(key, args);504 }505 485 506 486 /** This class creates a set of controls for editing the indexes. */ … … 552 532 553 533 JPanel instruction_pane = new JPanel(); 554 JLabel title_label = new JLabel( get("CDM.IndexManager.Title"));534 JLabel title_label = new JLabel(); 555 535 title_label.setHorizontalAlignment(JLabel.CENTER); 556 instruction_textarea = new JTextArea(get("CDM.IndexManager.Instructions")); 536 Dictionary.registerText(title_label, "CDM.IndexManager.Title"); 537 538 instruction_textarea = new JTextArea(); 557 539 instruction_textarea.setEditable(false); 558 540 instruction_textarea.setLineWrap(true); 559 541 instruction_textarea.setRows(6); 560 542 instruction_textarea.setWrapStyleWord(true); 543 Dictionary.registerText(instruction_textarea, "CDM.IndexManager.Instructions"); 561 544 562 545 JPanel assigned_indexes_pane = new JPanel(); 563 JLabel index_label = new JLabel(get("CDM.IndexManager.Indexes")); 546 JLabel index_label = new JLabel(); 547 Dictionary.registerText(index_label, "CDM.IndexManager.Indexes"); 564 548 index_list = new JList(model); 565 549 index_list.setCellRenderer(new IndexListRenderer()); … … 567 551 JPanel movement_pane = new JPanel(); 568 552 569 move_up_button = new DoubleImageButton( get("CDM.Move.Move_Up"), Utility.getImage("arrow-up.gif"), Utility.getImage("arrow-up-disabled.gif"));553 move_up_button = new DoubleImageButton("", Utility.getImage("arrow-up.gif"), Utility.getImage("arrow-up-disabled.gif")); 570 554 move_up_button.setEnabled(false); 571 555 move_up_button.setMnemonic(KeyEvent.VK_U); 572 556 move_up_button.setPreferredSize(Utility.DOUBLE_IMAGE_BUTTON_SIZE); 573 574 move_down_button = new DoubleImageButton(get("CDM.Move.Move_Down"), Utility.getImage("arrow-down.gif"), Utility.getImage("arrow-down-disabled.gif")); 557 Dictionary.registerBoth(move_up_button, "CDM.Move.Move_Up", "CDM.Move.Move_Up_Tooltip"); 558 559 move_down_button = new DoubleImageButton("", Utility.getImage("arrow-down.gif"), Utility.getImage("arrow-down-disabled.gif")); 575 560 move_down_button.setEnabled(false); 576 561 move_down_button.setMnemonic(KeyEvent.VK_D); 577 562 move_down_button.setPreferredSize(Utility.DOUBLE_IMAGE_BUTTON_SIZE); 563 Dictionary.registerBoth(move_down_button, "CDM.Move.Move_Down", "CDM.Move.Move_Down_Tooltip"); 578 564 579 565 JPanel index_pane = new JPanel(); … … 582 568 583 569 JPanel name_pane = new JPanel(); 584 JLabel name_label = new JLabel( get("CDM.IndexManager.Name"));570 JLabel name_label = new JLabel(); 585 571 name_label.setPreferredSize(Utility.LABEL_SIZE); 572 Dictionary.registerText(name_label, "CDM.IndexManager.Name"); 586 573 name_textfield = new JTextField(); 587 574 588 575 JPanel source_pane = new JPanel(); 589 JLabel source_label = new JLabel( get("CDM.IndexManager.Source"));576 JLabel source_label = new JLabel(); 590 577 source_label.setPreferredSize(Utility.LABEL_SIZE); 578 Dictionary.registerText(source_label, "CDM.IndexManager.Source"); 591 579 source_list = new CheckList(new_data, false); 592 580 593 581 JPanel level_pane = new JPanel(); 594 JLabel level_label = new JLabel( get("CDM.IndexManager.Level"));582 JLabel level_label = new JLabel(); 595 583 level_label.setPreferredSize(Utility.LABEL_SIZE); 584 Dictionary.registerText(level_label, "CDM.IndexManager.Level"); 596 585 level_combobox = new JComboBox(); 597 level_combobox.addItem( get("CDM.IndexManager.Document"));598 level_combobox.addItem( get("CDM.IndexManager.Paragraph"));599 level_combobox.addItem( get("CDM.IndexManager.Section"));586 level_combobox.addItem(Dictionary.newget("CDM.IndexManager.Document")); 587 level_combobox.addItem(Dictionary.newget("CDM.IndexManager.Paragraph")); 588 level_combobox.addItem(Dictionary.newget("CDM.IndexManager.Section")); 600 589 level_combobox.setEditable(false); 601 590 602 591 JPanel button_pane = new JPanel(); 603 add_button = new JButton( get("CDM.IndexManager.Add"));592 add_button = new JButton(); 604 593 add_button.setEnabled(false); 605 594 add_button.setMnemonic(KeyEvent.VK_A); 606 set_default_button = new JButton(get("CDM.IndexManager.Set_Default")); 595 Dictionary.registerBoth(add_button, "CDM.IndexManager.Add", "CDM.IndexManager.Add_Tooltip"); 596 set_default_button = new JButton(); 607 597 set_default_button.setEnabled(false); 608 598 set_default_button.setMnemonic(KeyEvent.VK_S); 609 remove_button = new JButton(get("CDM.IndexManager.Remove")); 599 Dictionary.registerBoth(set_default_button, "CDM.IndexManager.Set_Default", "CDM.IndexManager.Set_Default_Tooltip"); 600 remove_button = new JButton(); 610 601 remove_button.setEnabled(false); 611 602 remove_button.setMnemonic(KeyEvent.VK_R); 603 Dictionary.registerBoth(remove_button, "CDM.IndexManager.Remove", "CDM.IndexManager.Remove_Tooltip"); 612 604 613 605 // This class is getting a little crowded, so I'll generate the many mgpp controls in a inner class. … … 684 676 add(mgppindexes_control, MGPPINDEXES); 685 677 } 678 686 679 /* Destructor, removes persistant listeners from the Dictionary. 687 680 */ … … 803 796 JLabel component = (JLabel) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); 804 797 if(default_index != null && default_index.equals(value)) { 805 component.setText(component.getText() + " " + get("CDM.IndexManager.Default_Index_Indicator"));798 component.setText(component.getText() + " " + Dictionary.newget("CDM.IndexManager.Default_Index_Indicator")); 806 799 } 807 800 return component; … … 932 925 JPanel current_indexes_panel = new JPanel(); 933 926 934 current_indexes_label = new JLabel( "CDM.IndexManager.MGPP.Current_Indexes");935 927 current_indexes_label = new JLabel(); 928 Dictionary.registerText(current_indexes_label, "CDM.IndexManager.MGPP.Current_Indexes"); 936 929 current_indexes_list = new JList(model); 937 930 current_indexes_list.setVisibleRowCount(5); … … 939 932 JPanel index_movement_panel = new JPanel(); 940 933 941 ImageIcon move_index_up_icon = Utility.getImage("arrow-up.gif"); 942 move_index_up_button = new JButton(); 943 move_index_up_label = new JLabel("CDM.Move.Move_Up"); 944 move_index_up_label.setHorizontalAlignment(JLabel.CENTER); 945 move_index_up_label.setPreferredSize(LABEL_SIZE); 946 move_index_up_button.setLayout(new BorderLayout()); 947 move_index_up_button.add(new JLabel(move_index_up_icon), BorderLayout.WEST); 948 move_index_up_button.add(move_index_up_label, BorderLayout.CENTER); 949 move_index_up_button.add(new JLabel(move_index_up_icon), BorderLayout.EAST); 934 move_index_up_button = new DoubleImageButton("", Utility.getImage("arrow-up.gif"), Utility.getImage("arrow-up-disabled.gif")); 935 move_index_up_button.setEnabled(false); 950 936 move_index_up_button.setMnemonic(KeyEvent.VK_U); 951 952 ImageIcon move_index_down_icon = Utility.getImage("arrow-down.gif"); 953 move_index_down_button = new JButton(); 954 move_index_down_label = new JLabel("CDM.Move.Move_Down"); 955 move_index_down_label.setHorizontalAlignment(JLabel.CENTER); 956 move_index_down_label.setPreferredSize(LABEL_SIZE); 957 move_index_down_button.setLayout(new BorderLayout()); 958 move_index_down_button.add(new JLabel(move_index_down_icon), BorderLayout.WEST); 959 move_index_down_button.add(move_index_down_label, BorderLayout.CENTER); 960 move_index_down_button.add(new JLabel(move_index_down_icon), BorderLayout.EAST); 937 move_index_up_button.setPreferredSize(Utility.DOUBLE_IMAGE_BUTTON_SIZE); 938 Dictionary.registerBoth(move_index_up_button, "CDM.Move.Move_Up", "CDM.Move.Move_Up_Tooltip"); 939 940 move_index_down_button = new DoubleImageButton("", Utility.getImage("arrow-down.gif"), Utility.getImage("arrow-down-disabled.gif")); 941 move_index_down_button.setEnabled(false); 961 942 move_index_down_button.setMnemonic(KeyEvent.VK_D); 943 move_index_down_button.setPreferredSize(Utility.DOUBLE_IMAGE_BUTTON_SIZE); 944 Dictionary.registerBoth(move_index_down_button, "CDM.Move.Move_Down", "CDM.Move.Move_Down_Tooltip"); 962 945 963 946 JPanel index_spacer_panel = new JPanel(); … … 969 952 JPanel index_name_panel = new JPanel(); 970 953 971 index_name_label = new JLabel( "CDM.IndexManager.MGPP.Index_Name");954 index_name_label = new JLabel(); 972 955 index_name_label.setPreferredSize(LABEL_SIZE); 956 Dictionary.registerText(index_name_label, "CDM.IndexManager.MGPP.Index_Name"); 973 957 974 958 index_name_field = new JTextField(); 959 Dictionary.registerTooltip(index_name_field, "CDM.IndexManager.MGPP.Index_Name_Tooltip"); 975 960 976 961 JPanel index_panel = new JPanel(); … … 978 963 index_label = new JLabel("CDM.IndexManager.MGPP.Index"); 979 964 index_label.setPreferredSize(LABEL_SIZE); 965 Dictionary.registerText(index_label, "CDM.IndexManager.MGPP.Index"); 980 966 981 967 index_combobox = new GComboBox(); … … 985 971 index_combobox.setTextNonSelectionColor(Gatherer.config.getColor("coloring.workspace_tree_foreground", false)); 986 972 index_combobox.setTextSelectionColor(Gatherer.config.getColor("coloring.collection_selection_foreground", false)); 973 Dictionary.registerTooltip(index_combobox, "CDM.IndexManager.MGPP.Index_Tooltip"); 987 974 988 975 JPanel index_button_panel = new JPanel(); 989 976 990 add_index_button = new JButton( "CDM.IndexManager.MGPP.Add_Index");977 add_index_button = new JButton(); 991 978 add_index_button.setEnabled(false); 992 979 add_index_button.setMnemonic(KeyEvent.VK_A); 993 994 add_all_button = new JButton("CDM.IndexManager.MGPP.Add_All_Metadata"); 980 Dictionary.registerBoth(add_index_button, "CDM.IndexManager.MGPP.Add_Index", "CDM.IndexManager.MGPP.Add_Index_Tooltip"); 981 982 add_all_button = new JButton(); 995 983 add_all_button.setEnabled(true); 996 984 add_all_button.setMnemonic(KeyEvent.VK_L); 997 998 replace_button = new JButton("CDM.IndexManager.MGPP.Replace_Index"); 985 Dictionary.registerBoth(add_all_button, "CDM.IndexManager.MGPP.Add_All_Metadata", "CDM.IndexManager.MGPP.Add_All_Metadata_Tooltip"); 986 987 replace_button = new JButton(); 999 988 replace_button.setEnabled(false); 1000 989 replace_button.setMnemonic(KeyEvent.VK_C); 1001 1002 remove_index_button = new JButton("CDM.IndexManager.MGPP.Remove_Index"); 990 Dictionary.registerBoth(replace_button, "CDM.IndexManager.MGPP.Replace_Index", "CDM.IndexManager.MGPP.Replace_Index_Tooltip"); 991 992 remove_index_button = new JButton(); 1003 993 remove_index_button.setEnabled(false); 1004 994 remove_index_button.setMnemonic(KeyEvent.VK_A); 995 Dictionary.registerBoth(remove_index_button, "CDM.IndexManager.MGPP.Remove_Index", "CDM.IndexManager.MGPP.Remove_Index_Tooltip"); 1005 996 1006 997 JPanel index_empty_panel = new JPanel(); … … 1011 1002 add_all_button.addActionListener(new AddAllActionListener()); 1012 1003 current_indexes_list.addListSelectionListener(new CurrentIndexesListSelectionListener()); 1013 Gatherer.dictionary.register(add_index_button, null, false);1014 Gatherer.dictionary.register(add_all_button, null, false);1015 Gatherer.dictionary.register(current_indexes_label, null, false);1016 Gatherer.dictionary.register(index_label, null, false);1017 Gatherer.dictionary.register(index_name_label, null, false);1018 Gatherer.dictionary.register(move_index_down_label, null, false);1019 Gatherer.dictionary.register(move_index_up_label, null, false);1020 Gatherer.dictionary.register(replace_button, null, false);1021 Gatherer.dictionary.register(remove_index_button, null, false);1022 1004 index_combobox.addActionListener(index_eal); 1023 1005 ((JTextField)index_combobox.getEditor().getEditorComponent()).getDocument().addDocumentListener(index_eal); … … 1027 1009 replace_button.addActionListener(new ReplaceIndexActionListener()); 1028 1010 remove_index_button.addActionListener(new RemoveIndexActionListener(index_eal)); 1011 1029 1012 // Layout Indexes 1030 1013 index_movement_panel.setLayout(new GridLayout(2,1)); … … 1075 1058 JPanel current_levels_panel = new JPanel(); 1076 1059 1077 current_levels_label = new JLabel("CDM.IndexManager.MGPP.Current_Levels"); 1060 current_levels_label = new JLabel(); 1061 Dictionary.registerText(current_levels_label, "CDM.IndexManager.MGPP.Current_Levels"); 1078 1062 1079 1063 current_levels_list = new JList(levels_model); … … 1082 1066 JPanel level_movement_panel = new JPanel(); 1083 1067 1084 ImageIcon move_level_up_icon = Utility.getImage("arrow-up.gif"); 1085 move_level_up_button = new JButton(); 1086 move_level_up_label = new JLabel("CDM.Move.Move_Up"); 1087 move_level_up_label.setHorizontalAlignment(JLabel.CENTER); 1088 move_level_up_label.setPreferredSize(LABEL_SIZE); 1089 move_level_up_button.setLayout(new BorderLayout()); 1090 move_level_up_button.add(new JLabel(move_level_up_icon), BorderLayout.WEST); 1091 move_level_up_button.add(move_level_up_label, BorderLayout.CENTER); 1092 move_level_up_button.add(new JLabel(move_level_up_icon), BorderLayout.EAST); 1068 move_level_up_button = new DoubleImageButton("", Utility.getImage("arrow-up.gif"), Utility.getImage("arrow-up-disabled.gif")); 1069 move_level_up_button.setEnabled(false); 1093 1070 move_level_up_button.setMnemonic(KeyEvent.VK_U); 1094 1095 ImageIcon move_level_down_icon = Utility.getImage("arrow-down.gif"); 1096 move_level_down_button = new JButton(); 1097 move_level_down_label = new JLabel("CDM.Move.Move_Down"); 1098 move_level_down_label.setHorizontalAlignment(JLabel.CENTER); 1099 move_level_down_label.setPreferredSize(LABEL_SIZE); 1100 move_level_down_button.setLayout(new BorderLayout()); 1101 move_level_down_button.add(new JLabel(move_level_down_icon), BorderLayout.WEST); 1102 move_level_down_button.add(move_level_down_label, BorderLayout.CENTER); 1103 move_level_down_button.add(new JLabel(move_level_down_icon), BorderLayout.EAST); 1071 move_level_up_button.setPreferredSize(Utility.DOUBLE_IMAGE_BUTTON_SIZE); 1072 Dictionary.registerBoth(move_level_up_button, "CDM.Move.Move_Up", "CDM.Move.Move_Up_Tooltip"); 1073 1074 move_level_down_button = new DoubleImageButton("", Utility.getImage("arrow-down.gif"), Utility.getImage("arrow-down-disabled.gif")); 1075 move_level_down_button.setEnabled(false); 1104 1076 move_level_down_button.setMnemonic(KeyEvent.VK_D); 1077 move_level_down_button.setPreferredSize(Utility.DOUBLE_IMAGE_BUTTON_SIZE); 1078 Dictionary.registerBoth(move_level_down_button, "CDM.Move.Move_Down", "CDM.Move.Move_Down_Tooltip"); 1105 1079 1106 1080 JPanel level_spacer_panel = new JPanel(); … … 1112 1086 JPanel level_name_panel = new JPanel(); 1113 1087 1114 level_name_label = new JLabel( "CDM.IndexManager.MGPP.Level_Name");1088 level_name_label = new JLabel(); 1115 1089 level_name_label.setPreferredSize(LABEL_SIZE); 1090 Dictionary.registerText(level_name_label, "CDM.IndexManager.MGPP.Level_Name"); 1116 1091 1117 1092 level_name_field = new JTextField(); 1093 Dictionary.registerTooltip(level_name_field, "CDM.IndexManager.MGPP.Level_Name_Tooltip"); 1118 1094 1119 1095 JPanel level_panel = new JPanel(); … … 1121 1097 level_label = new JLabel("CDM.IndexManager.MGPP.Level"); 1122 1098 level_label.setPreferredSize(LABEL_SIZE); 1099 Dictionary.registerText(level_label, "CDM.IndexManager.MGPP.Level"); 1123 1100 1124 1101 level_combobox = new GComboBox(Index.LEVEL); … … 1128 1105 level_combobox.setTextNonSelectionColor(Gatherer.config.getColor("coloring.workspace_tree_foreground", false)); 1129 1106 level_combobox.setTextSelectionColor(Gatherer.config.getColor("coloring.collection_selection_foreground", false)); 1107 Dictionary.registerTooltip(level_combobox, "CDM.IndexManager.MGPP.Level_Tooltip"); 1130 1108 1131 1109 JPanel level_button_panel = new JPanel(); … … 1134 1112 add_level_button.setEnabled(false); 1135 1113 add_level_button.setMnemonic(KeyEvent.VK_A); 1114 Dictionary.registerBoth(add_level_button, "CDM.IndexManager.MGPP.Add_Level", "CDM.IndexManager.MGPP.Add_Level_Tooltip"); 1136 1115 1137 1116 remove_level_button = new JButton("CDM.IndexManager.MGPP.Remove_Level"); 1138 1117 remove_level_button.setEnabled(false); 1139 1118 remove_level_button.setMnemonic(KeyEvent.VK_A); 1119 Dictionary.registerBoth(remove_level_button, "CDM.IndexManager.MGPP.Remove_Level", "CDM.IndexManager.MGPP.Remove_Level_Tooltip"); 1140 1120 1141 1121 JPanel level_empty_panel = new JPanel(); … … 1145 1125 add_level_button.addActionListener(new AddLevelActionListener()); 1146 1126 current_levels_list.addListSelectionListener(new CurrentLevelsListSelectionListener()); 1147 Gatherer.dictionary.register(add_level_button, null, false);1148 Gatherer.dictionary.register(current_levels_label, null, false);1149 Gatherer.dictionary.register(level_label, null, false);1150 Gatherer.dictionary.register(level_name_label, null, false);1151 Gatherer.dictionary.register(move_level_down_label, null, false);1152 Gatherer.dictionary.register(move_level_up_label, null, false);1153 Gatherer.dictionary.register(remove_level_button, null, false);1154 1127 level_combobox.addActionListener(level_eal); 1155 1128 ((JTextField)level_combobox.getEditor().getEditorComponent()).getDocument().addDocumentListener(level_eal); … … 1203 1176 JPanel header_panel = new JPanel(); 1204 1177 1205 title_label = new JLabel("CDM.IndexManager.MGPP.Title"); 1206 1207 instructions_textarea = new JTextArea("CDM.IndexManager.MGPP.Instructions"); 1178 title_label = new JLabel(); 1179 title_label.setHorizontalAlignment(JLabel.CENTER); 1180 Dictionary.registerText(title_label, "CDM.IndexManager.MGPP.Title"); 1181 1182 instructions_textarea = new JTextArea(); 1208 1183 instructions_textarea.setEditable(false); 1209 1184 instructions_textarea.setLineWrap(true); 1210 1185 instructions_textarea.setRows(6); 1211 1186 instructions_textarea.setWrapStyleWord(true); 1187 Dictionary.registerText(instructions_textarea, "CDM.IndexManager.MGPP.Instructions"); 1212 1188 1213 1189 tabbed_pane = new JTabbedPane(); … … 1219 1195 header_panel.add(new JScrollPane(instructions_textarea), BorderLayout.CENTER); 1220 1196 1221 tabbed_pane.add( "CDM.IndexManager.MGPP.Indexes", indexes_panel);1222 tabbed_pane.add( "CDM.IndexManager.MGPP.Levels", levels_panel);1197 tabbed_pane.add(Dictionary.newget("CDM.IndexManager.MGPP.Indexes"), indexes_panel); 1198 tabbed_pane.add(Dictionary.newget("CDM.IndexManager.MGPP.Levels"), levels_panel); 1223 1199 1224 1200 setBorder(BorderFactory.createEmptyBorder(5,5,5,5)); … … 1226 1202 add(header_panel, BorderLayout.NORTH); 1227 1203 add(tabbed_pane, BorderLayout.CENTER); 1228 1229 // Connect General1230 Gatherer.dictionary.register(instructions_textarea, null, false);1231 Gatherer.dictionary.register(tabbed_pane, null, false);1232 Gatherer.dictionary.register(title_label, null, false);1233 1204 } 1234 1205 1235 1206 public void destroy() { 1236 Gatherer.dictionary.deregister(add_index_button);1237 Gatherer.dictionary.deregister(add_all_button);1238 Gatherer.dictionary.deregister(current_indexes_label);1239 Gatherer.dictionary.deregister(index_label);1240 Gatherer.dictionary.deregister(index_name_label);1241 Gatherer.dictionary.deregister(move_index_down_label);1242 Gatherer.dictionary.deregister(move_index_up_label);1243 Gatherer.dictionary.deregister(replace_button);1244 Gatherer.dictionary.deregister(remove_index_button);1245 1246 Gatherer.dictionary.deregister(instructions_textarea);1247 Gatherer.dictionary.deregister(tabbed_pane);1248 Gatherer.dictionary.deregister(title_label);1249 1207 } 1250 1208 -
trunk/gli/src/org/greenstone/gatherer/cdm/PlugInManager.java
r5529 r5536 35 35 import javax.swing.plaf.basic.*; 36 36 import org.apache.xerces.parsers.*; 37 import org.greenstone.gatherer.Dictionary; 37 38 import org.greenstone.gatherer.Gatherer; 38 39 import org.greenstone.gatherer.cdm.Argument; … … 145 146 } 146 147 if(plugin.getName().equals(StaticStrings.ARCPLUG_STR) || plugin.getName().equals(StaticStrings.RECPLUG_STR)) { 147 JOptionPane.showMessageDialog(Gatherer.g_man, Gatherer.dictionary.get("CDM.Move.Fixed"), Gatherer.dictionary.get("CDM.Move.Title"), JOptionPane.ERROR_MESSAGE);148 JOptionPane.showMessageDialog(Gatherer.g_man, Dictionary.newget("CDM.Move.Fixed"), Dictionary.newget("CDM.Move.Title"), JOptionPane.ERROR_MESSAGE); 148 149 return; 149 150 } … … 182 183 if(index < 0) { 183 184 String args[] = new String[2]; 184 args[0] = Gatherer.dictionary.get("CDM.PlugInManager.PlugIn_Str");185 args[0] = Dictionary.newget("CDM.PlugInManager.PlugIn_Str"); 185 186 args[1] = plugin.getName(); 186 JOptionPane.showMessageDialog(Gatherer.g_man, Gatherer.dictionary.get("CDM.Move.At_Top", args), Gatherer.dictionary.get("CDM.Move.Title"), JOptionPane.ERROR_MESSAGE);187 JOptionPane.showMessageDialog(Gatherer.g_man, Dictionary.newget("CDM.Move.At_Top", args), Dictionary.newget("CDM.Move.Title"), JOptionPane.ERROR_MESSAGE); 187 188 return; 188 189 } … … 197 198 String args[] = new String[1]; 198 199 args[0] = plugin.getName(); 199 JOptionPane.showMessageDialog(Gatherer.g_man, Gatherer.dictionary.get("CDM.Move.Cannot", args), Gatherer.dictionary.get("CDM.Move.Title"), JOptionPane.ERROR_MESSAGE);200 JOptionPane.showMessageDialog(Gatherer.g_man, Dictionary.newget("CDM.Move.Cannot", args), Dictionary.newget("CDM.Move.Title"), JOptionPane.ERROR_MESSAGE); 200 201 // Still not going to move RecPlug or ArcPlug. 201 202 return; … … 373 374 String plugin_name = getPlugInName(plugin); 374 375 //Gatherer.println("Zero length argument xml detected for: " + plugin_name); 375 JOptionPane.showMessageDialog(Gatherer.g_man, Gatherer.dictionary.get("CDM.PlugInManager.PlugIn_XML_Parse_Failed", plugin_name), Gatherer.dictionary.get("General.Error"), JOptionPane.ERROR_MESSAGE); 376 String[] margs = new String[1]; 377 margs[0] = plugin_name; 378 JOptionPane.showMessageDialog(Gatherer.g_man, Dictionary.newget("CDM.PlugInManager.PlugIn_XML_Parse_Failed", margs), Dictionary.newget("General.Error"), JOptionPane.ERROR_MESSAGE); 376 379 } 377 380 } … … 410 413 if(files != null) { 411 414 // Create a progress indicator. 412 ParsingProgress progress = new ParsingProgress( Gatherer.dictionary.get("CDM.PlugInManager.Parsing.Title"), Gatherer.dictionary.get("CDM.PlugInManager.Parsing.Message"), files.length);415 ParsingProgress progress = new ParsingProgress(Dictionary.newget("CDM.PlugInManager.Parsing.Title"), Dictionary.newget("CDM.PlugInManager.Parsing.Message"), files.length); 413 416 for(int i = 0; i < files.length; i++) { 414 417 // We only want to check Perl Modules. … … 559 562 add = new JButton(); 560 563 add.setMnemonic(KeyEvent.VK_A); 561 Gatherer.dictionary.setBoth(add, "CDM.PlugInManager.Add", "CDM.PlugInManager.Add_Tooltip");564 Dictionary.registerBoth(add, "CDM.PlugInManager.Add", "CDM.PlugInManager.Add_Tooltip"); 562 565 563 566 button_pane = new JPanel(); … … 567 570 configure.setEnabled(false); 568 571 configure.setMnemonic(KeyEvent.VK_C); 569 Gatherer.dictionary.setBoth(configure, "CDM.PlugInManager.Configure", "CDM.PlugInManager.Configure_Tooltip");572 Dictionary.registerBoth(configure, "CDM.PlugInManager.Configure", "CDM.PlugInManager.Configure_Tooltip"); 570 573 571 574 header_pane = new JPanel(); … … 577 580 instructions.setRows(6); 578 581 instructions.setWrapStyleWord(true); 579 Gatherer.dictionary.setText(instructions, "CDM.PlugInManager.Instructions", null);582 Dictionary.registerText(instructions, "CDM.PlugInManager.Instructions"); 580 583 581 584 move_top_button = new DoubleImageButton("", Utility.getImage("arrow-top.gif"), Utility.getImage("arrow-top-disabled.gif")); … … 584 587 // move_top_button.setDisplayedMnemonicIndex(8); // !! English-centric hack 585 588 move_top_button.setPreferredSize(Utility.DOUBLE_IMAGE_BUTTON_SIZE); 586 Gatherer.dictionary.setBoth(move_top_button, "CDM.Move.Move_Top", "CDM.Move.Move_Top_Tooltip");589 Dictionary.registerBoth(move_top_button, "CDM.Move.Move_Top", "CDM.Move.Move_Top_Tooltip"); 587 590 588 591 move_up_button = new DoubleImageButton("", Utility.getImage("arrow-up.gif"), Utility.getImage("arrow-up-disabled.gif")); … … 590 593 move_up_button.setMnemonic(KeyEvent.VK_U); 591 594 move_up_button.setPreferredSize(Utility.DOUBLE_IMAGE_BUTTON_SIZE); 592 Gatherer.dictionary.setBoth(move_up_button, "CDM.Move.Move_Up", "CDM.Move.Move_Up_Tooltip");595 Dictionary.registerBoth(move_up_button, "CDM.Move.Move_Up", "CDM.Move.Move_Up_Tooltip"); 593 596 594 597 move_down_button = new DoubleImageButton("", Utility.getImage("arrow-down.gif"), Utility.getImage("arrow-down-disabled.gif")); … … 596 599 move_down_button.setMnemonic(KeyEvent.VK_D); 597 600 move_down_button.setPreferredSize(Utility.DOUBLE_IMAGE_BUTTON_SIZE); 598 Gatherer.dictionary.setBoth(move_down_button, "CDM.Move.Move_Down", "CDM.Move.Move_Down_Tooltip");601 Dictionary.registerBoth(move_down_button, "CDM.Move.Move_Down", "CDM.Move.Move_Down_Tooltip"); 599 602 600 603 move_bottom_button = new DoubleImageButton("", Utility.getImage("arrow-bottom.gif"), Utility.getImage("arrow-bottom-disabled.gif")); … … 602 605 move_bottom_button.setMnemonic(KeyEvent.VK_B); 603 606 move_bottom_button.setPreferredSize(Utility.DOUBLE_IMAGE_BUTTON_SIZE); 604 Gatherer.dictionary.setBoth(move_bottom_button, "CDM.Move.Move_Bottom", "CDM.Move.Move_Bottom_Tooltip");607 Dictionary.registerBoth(move_bottom_button, "CDM.Move.Move_Bottom", "CDM.Move.Move_Bottom_Tooltip"); 605 608 606 609 movement_pane = new JPanel(); … … 613 616 plugin.setTextNonSelectionColor(Gatherer.config.getColor("coloring.workspace_tree_foreground", false)); 614 617 plugin.setTextSelectionColor(Gatherer.config.getColor("coloring.collection_selection_foreground", false)); 615 Gatherer.dictionary.setTooltip(plugin, "CDM.PlugInManager.PlugIn_Tooltip");618 Dictionary.registerTooltip(plugin, "CDM.PlugInManager.PlugIn_Tooltip"); 616 619 617 620 plugin_label = new JLabel(); 618 Gatherer.dictionary.setText(plugin_label, "CDM.PlugInManager.PlugIn", null);621 Dictionary.registerText(plugin_label, "CDM.PlugInManager.PlugIn"); 619 622 620 623 plugin_list = new JList(model); … … 624 627 plugin_list_label.setHorizontalAlignment(JLabel.CENTER); 625 628 plugin_list_label.setOpaque(true); 626 Gatherer.dictionary.setText(plugin_list_label, "CDM.PlugInManager.Assigned", null);629 Dictionary.registerText(plugin_list_label, "CDM.PlugInManager.Assigned"); 627 630 628 631 plugin_list_pane = new JPanel(); … … 632 635 remove.setEnabled(false); 633 636 remove.setMnemonic(KeyEvent.VK_R); 634 Gatherer.dictionary.setBoth(remove, "CDM.PlugInManager.Remove", "CDM.PlugInManager.Remove_Tooltip");637 Dictionary.registerBoth(remove, "CDM.PlugInManager.Remove", "CDM.PlugInManager.Remove_Tooltip"); 635 638 636 639 title = new JLabel(); 637 640 title.setHorizontalAlignment(JLabel.CENTER); 638 641 title.setOpaque(true); 639 Gatherer.dictionary.setText(title, "CDM.PlugInManager.Title", null);642 Dictionary.registerText(title, "CDM.PlugInManager.Title"); 640 643 641 644 // Listeners … … 693 696 (BorderFactory.createEmptyBorder(5,0,5,0), 694 697 BorderFactory.createCompoundBorder 695 (BorderFactory.createTitledBorder( Gatherer.dictionary.get("CDM.PlugInManager.Controls")),698 (BorderFactory.createTitledBorder(Dictionary.newget("CDM.PlugInManager.Controls")), 696 699 BorderFactory.createEmptyBorder(2,2,2,2)))); 697 700 … … 768 771 } 769 772 else { 770 JOptionPane.showMessageDialog(Gatherer.g_man, Gatherer.dictionary.get("CDM.PlugInManager.PlugIn_Exists"), Gatherer.dictionary.get("General.Error"), JOptionPane.ERROR_MESSAGE);773 JOptionPane.showMessageDialog(Gatherer.g_man, Dictionary.newget("CDM.PlugInManager.PlugIn_Exists"), Dictionary.newget("General.Error"), JOptionPane.ERROR_MESSAGE); 771 774 } 772 775 base_plugin = null; -
trunk/gli/src/org/greenstone/gatherer/cdm/SearchTypeManager.java
r5318 r5536 35 35 import javax.swing.*; 36 36 import javax.swing.event.*; 37 import org.greenstone.gatherer.Dictionary; 37 38 import org.greenstone.gatherer.Gatherer; 38 39 import org.greenstone.gatherer.cdm.CollectionConfiguration; … … 100 101 if((direction && index < 0) || (!direction && index >= getSize())) { 101 102 String args[] = new String[2]; 102 args[0] = Gatherer.dictionary.get("CDM.SearchTypeManager.SearchType");103 args[0] = Dictionary.newget("CDM.SearchTypeManager.SearchType"); 103 104 args[1] = search_type.toString(); 104 105 String message = null; 105 if (direction) {106 message = Gatherer.dictionary.get("CDM.Move.At_Top", args);106 if (direction) { 107 message = Dictionary.newget("CDM.Move.At_Top", args); 107 108 } 108 109 else { 109 message = Gatherer.dictionary.get("CDM.Move.At_Bottom", args);110 } 111 JOptionPane.showMessageDialog(Gatherer.g_man, message, Gatherer.dictionary.get("CDM.Move.Title"), JOptionPane.ERROR_MESSAGE);110 message = Dictionary.newget("CDM.Move.At_Bottom", args); 111 } 112 JOptionPane.showMessageDialog(Gatherer.g_man, message, Dictionary.newget("CDM.Move.Title"), JOptionPane.ERROR_MESSAGE); 112 113 return; 113 114 } … … 147 148 public SearchTypeControl() { 148 149 // Creation 150 title_label = new JLabel(); 151 title_label.setHorizontalAlignment(JLabel.CENTER); 152 Dictionary.registerText(title_label, "CDM.SearchTypeManager.Title"); 153 149 154 JPanel instructions_panel = new JPanel(); 150 title_label = new JLabel("CDM.SearchTypeManager.Title"); 151 title_label.setHorizontalAlignment(JLabel.CENTER); 152 instructions_textarea = new JTextArea(Gatherer.dictionary.get("CDM.SearchTypeManager.Instructions")); 155 instructions_textarea = new JTextArea(); 153 156 instructions_textarea.setCaretPosition(0); 154 157 instructions_textarea.setEditable(false); … … 156 159 instructions_textarea.setRows(6); 157 160 instructions_textarea.setWrapStyleWord(true); 161 Dictionary.registerText(instructions_textarea, "CDM.SearchTypeManager.Instructions"); 158 162 159 163 JPanel spacer_panel = new JPanel(); … … 162 166 163 167 JPanel inner_panel = new JPanel(); 164 165 enable_advanced_searches_checkbox = new JCheckBox("CDM.SearchTypeManager.Enable"); 168 169 enable_advanced_searches_checkbox = new JCheckBox(); 170 Dictionary.registerText(enable_advanced_searches_checkbox, "CDM.SearchTypeManager.Enable"); 166 171 167 172 JPanel current_search_types_panel = new JPanel(); 168 current_search_types_label = new JLabel("CDM.SearchTypeManager.Assigned"); 173 current_search_types_label = new JLabel(); 174 Dictionary.registerText(current_search_types_label, "CDM.SearchTypeManager.Assigned"); 169 175 current_search_types_list = new JList(model); 170 176 current_search_types_list.setVisibleRowCount(3); … … 172 178 JPanel movement_panel = new JPanel(); 173 179 174 move_up_button = new DoubleImageButton(" CDM.Move.Move_Up", Utility.getImage("arrow-up.gif"), Utility.getImage("arrow-up-disabled.gif"));180 move_up_button = new DoubleImageButton("", Utility.getImage("arrow-up.gif"), Utility.getImage("arrow-up-disabled.gif")); 175 181 move_up_button.setEnabled(false); 176 182 move_up_button.setMnemonic(KeyEvent.VK_U); 177 183 move_up_button.setPreferredSize(Utility.DOUBLE_IMAGE_BUTTON_SIZE); 178 179 move_down_button = new DoubleImageButton("CDM.Move.Move_Down", Utility.getImage("arrow-down.gif"), Utility.getImage("arrow-down-disabled.gif")); 184 Dictionary.registerBoth(move_up_button, "CDM.Move.Move_Up", "CDM.Move.Move_Up_Tooltip"); 185 186 move_down_button = new DoubleImageButton("", Utility.getImage("arrow-down.gif"), Utility.getImage("arrow-down-disabled.gif")); 180 187 move_down_button.setEnabled(false); 181 188 move_down_button.setMnemonic(KeyEvent.VK_D); 182 189 move_down_button.setPreferredSize(Utility.DOUBLE_IMAGE_BUTTON_SIZE); 190 Dictionary.registerBoth(move_down_button, "CDM.Move.Move_Down", "CDM.Move.Move_Down_Tooltip"); 183 191 184 192 JPanel search_type_panel = new JPanel(); 185 search_type_label = new JLabel("CDM.SearchTypeManager.SearchType_Selection"); 193 search_type_label = new JLabel(); 194 Dictionary.registerText(search_type_label, "CDM.SearchTypeManager.SearchType_Selection"); 186 195 search_type_combobox = new GComboBox(SEARCH_TYPES); 187 196 search_type_combobox.setBackgroundNonSelectionColor(Gatherer.config.getColor("coloring.editable_background", false)); … … 191 200 search_type_combobox.setTextNonSelectionColor(Gatherer.config.getColor("coloring.workspace_tree_foreground", false)); 192 201 search_type_combobox.setTextSelectionColor(Gatherer.config.getColor("coloring.collection_selection_foreground", false)); 202 Dictionary.registerTooltip(search_type_combobox, "CDM.SearchTypeManager.SearchType_Selection_Tooltip"); 193 203 194 204 JPanel button_panel = new JPanel(); 195 add_button = new JButton( "CDM.SearchTypeManager.Add");205 add_button = new JButton(); 196 206 add_button.setEnabled(false); 197 207 add_button.setMnemonic(KeyEvent.VK_A); 198 199 remove_button = new JButton("CDM.SearchTypeManager.Remove"); 208 Dictionary.registerBoth(add_button, "CDM.SearchTypeManager.Add", "CDM.SearchTypeManager.Add_Tooltip"); 209 210 remove_button = new JButton(); 200 211 remove_button.setEnabled(false); 201 212 remove_button.setMnemonic(KeyEvent.VK_R); 213 Dictionary.registerBoth(remove_button, "CDM.SearchTypeManager.Remove", "CDM.SearchTypeManager.Remove_Tooltip"); 202 214 203 215 // Connection … … 207 219 move_up_button.addActionListener(new MoveListener(true)); 208 220 move_down_button.addActionListener(new MoveListener(false)); 209 Gatherer.dictionary.register(add_button, null, false);210 Gatherer.dictionary.register(current_search_types_label, null, false);211 Gatherer.dictionary.register(enable_advanced_searches_checkbox, null, false);212 //Gatherer.dictionary.register(instructions_textarea, null, false);213 Gatherer.dictionary.register(move_up_button, null, false);214 Gatherer.dictionary.register(move_down_button, null, false);215 Gatherer.dictionary.register(remove_button, null, false);216 Gatherer.dictionary.register(search_type_label, null, false);217 Gatherer.dictionary.register(title_label, null, false);218 221 remove_button.addActionListener(new RemoveActionListener()); 219 222 SearchTypesActionDocumentListener stadl = new SearchTypesActionDocumentListener(); 220 223 search_type_combobox.addActionListener(stadl); 221 224 ((JTextField)search_type_combobox.getEditor().getEditorComponent()).getDocument().addDocumentListener(stadl); 225 222 226 // Layout 223 227 instructions_panel.setBorder(BorderFactory.createEmptyBorder(0,0,2,0)); … … 263 267 264 268 public void destroy() { 265 Gatherer.dictionary.deregister(add_button);266 Gatherer.dictionary.deregister(current_search_types_label);267 Gatherer.dictionary.deregister(enable_advanced_searches_checkbox);268 //Gatherer.dictionary.deregister(instructions_textarea);269 Gatherer.dictionary.deregister(move_up_button);270 Gatherer.dictionary.deregister(move_down_button);271 Gatherer.dictionary.deregister(remove_button);272 Gatherer.dictionary.deregister(search_type_label);273 Gatherer.dictionary.deregister(title_label);274 269 } 275 270 -
trunk/gli/src/org/greenstone/gatherer/collection/DeleteCollectionPrompt.java
r5347 r5536 1 package org.greenstone.gatherer.collection;2 1 /** 3 2 *######################################################################### … … 36 35 *######################################################################## 37 36 */ 37 package org.greenstone.gatherer.collection; 38 38 39 import java.awt.*; 39 40 import java.awt.event.*; … … 41 42 import javax.swing.*; 42 43 import javax.swing.event.*; 44 import org.greenstone.gatherer.Dictionary; 43 45 import org.greenstone.gatherer.Gatherer; 44 46 import org.greenstone.gatherer.collection.Collection; 45 import org.greenstone.gatherer.collection.CollectionManager;46 47 import org.greenstone.gatherer.gui.ModalDialog; 47 48 import org.greenstone.gatherer.gui.SimpleMenuBar; … … 50 51 import org.greenstone.gatherer.util.StaticStrings; 51 52 import org.greenstone.gatherer.util.Utility; 53 52 54 /** This class provides the functionality to delete current collections from the GSDLHOME/collect/ directory. The user chooses the collection from a list, where each entry also displays details about itself, confirms the delete of a collection by checking a checkbox then presses the ok button to actually delete the collection. 53 55 * @author John Thompson, Greenstone Digital Library, University of Waikato … … 60 62 /** The model behind the list. */ 61 63 private DefaultListModel list_model = null; 62 /** A reference to ourself so any inner-classes getdispose of us. */64 /** A reference to ourself so any inner-classes can dispose of us. */ 63 65 private DeleteCollectionPrompt prompt = null; 64 66 /** The close button, which exits the prompt without deleting anything. */ … … 82 84 /** The size of the delete prompt screen. */ 83 85 public static final Dimension SIZE = new Dimension(500, 500); 86 84 87 /** Constructor. 85 88 * @see org.greenstone.gatherer.collection.DeleteCollectionPrompt.CloseButtonListener … … 90 93 public DeleteCollectionPrompt() { 91 94 super(Gatherer.g_man); 92 this.close_button = new JButton(get("General.Close", null)); 93 this.confirmation = new JCheckBox(get("DeleteCollectionPrompt.Confirm_Delete", null)); 94 this.details = new JTextArea(); 95 this.details_label = new JLabel(get("DeleteCollectionPrompt.Collection_Details", null)); 96 this.list = new JList(); 97 this.list_label = new JLabel(get("DeleteCollectionPrompt.Collection_List", null)); 98 this.list_model = new DefaultListModel(); 99 this.ok_button = new JButton(get("General.OK", null)); 100 this.prompt = this; 101 this.setModal(true); 102 this.setSize(SIZE); 103 this.setTitle(get("DeleteCollectionPrompt.Title", null)); 104 this.setJMenuBar(new SimpleMenuBar("0")); // need to find an appropriate help page to open at 95 close_button = new JButton(); 96 Dictionary.setText(close_button, "General.Close"); 97 confirmation = new JCheckBox(); 98 Dictionary.setText(confirmation, "DeleteCollectionPrompt.Confirm_Delete"); 99 details = new JTextArea(); 100 details.setFont(Gatherer.config.getFont("general.tooltip_font", false)); 101 Dictionary.setText(details, "DeleteCollectionPrompt.No_Collection"); 102 details_label = new JLabel(); 103 Dictionary.setText(details_label, "DeleteCollectionPrompt.Collection_Details"); 104 list = new JList(); 105 list_label = new JLabel(); 106 Dictionary.setText(list_label, "DeleteCollectionPrompt.Collection_List"); 107 list_model = new DefaultListModel(); 108 ok_button = new JButton(); 109 Dictionary.setText(ok_button, "General.OK"); 110 prompt = this; 111 setModal(true); 112 setSize(SIZE); 113 // setTitle(); 114 Dictionary.setText(this, "DeleteCollectionPrompt.Title"); 115 116 setJMenuBar(new SimpleMenuBar("0")); // need to find an appropriate help page to open at 105 117 close_button.addActionListener(new CloseButtonListener()); 106 118 confirmation.addActionListener(new ConfirmationCheckBoxListener()); 107 119 confirmation.setEnabled(false); 108 120 confirmation.setSelected(false); 109 details.setFont(Gatherer.config.getFont("general.tooltip_font", false));110 details.setText(get("DeleteCollectionPrompt.No_Collection", null));111 121 list.addListSelectionListener(new CollectionListListener()); 112 122 list.clearSelection(); … … 117 127 scanForCollections(); 118 128 } 129 119 130 /** Destructor. */ 120 131 public void destroy() { … … 129 140 prompt = null; 130 141 } 142 131 143 /** This method causes the modal prompt to be displayed. 132 * returns true if it has deleted the collection that is currently open */144 * returns true if it has deleted the collection that is currently open */ 133 145 public boolean display() { 134 146 // Central pane … … 176 188 177 189 } 190 178 191 /** Shows a delete complete prompt. 179 180 181 192 * @param success A <strong>boolean</strong> indicating if the collection was successfully deleted. 193 * @see org.greenstone.gatherer.collection.Collection 194 */ 182 195 public void resultPrompt(boolean success) { 183 196 args = new String[1]; 184 197 args[0] = collection.getName(); 185 if (success) {186 JOptionPane.showMessageDialog(prompt, get("DeleteCollectionPrompt.Successful_Delete", args),get("DeleteCollectionPrompt.Successful_Title", null),JOptionPane.INFORMATION_MESSAGE);198 if (success) { 199 JOptionPane.showMessageDialog(prompt,Dictionary.newget("DeleteCollectionPrompt.Successful_Delete", args),Dictionary.newget("DeleteCollectionPrompt.Successful_Title"),JOptionPane.INFORMATION_MESSAGE); 187 200 } 188 201 else { 189 JOptionPane.showMessageDialog(prompt,get("DeleteCollectionPrompt.Failed_Delete", args),get("DeleteCollectionPrompt.Failed_Title", null),JOptionPane.WARNING_MESSAGE); 190 } 191 } 192 /** Retrieves a phrase from the <strong>Dictionary</strong> in <strong>Gatherer</strong>. 193 * @param key A <strong>String</strong> used to match against a specific phrase in the dictionary. 194 * @see org.greenstone.gatherer.Dictionary 195 * @see org.greenstone.gatherer.Gatherer 196 */ 197 private String get(String key, String args[]) { 198 if(key.indexOf(".") == -1) { 199 key = "DeleteCollectionPrompt." + key; 200 } 201 return Gatherer.dictionary.get(key, args); 202 } 202 JOptionPane.showMessageDialog(prompt,Dictionary.newget("DeleteCollectionPrompt.Failed_Delete", args),Dictionary.newget("DeleteCollectionPrompt.Failed_Title"),JOptionPane.WARNING_MESSAGE); 203 } 204 } 205 203 206 204 207 /** Method to scan the collect directory retrieving and reloading each collection it finds, while building the list of known collections. 205 206 207 208 209 208 * @see org.greenstone.gatherer.Configuration 209 * @see org.greenstone.gatherer.Gatherer 210 * @see org.greenstone.gatherer.util.ArrayTools 211 * @see org.greenstone.gatherer.util.Utility 212 */ 210 213 private void scanForCollections() { 211 214 // Start at the collect dir. … … 232 235 // Otherwise the collect directory doesn't actually exist, so there ain't much we can do. 233 236 } 237 234 238 /** A button listener implementation, which listens for actions on the close button and disposes of the dialog when detected. */ 235 239 private class CloseButtonListener … … 237 241 /** Any implementation of ActionListener must include this method so we can be informed when the button is actioned. 238 242 * @param event An <strong>ActionEvent</strong> containing all the relevant information garnered from the event itself. 239 243 */ 240 244 public void actionPerformed(ActionEvent event) { 241 245 // Ask the collection manager to refresh the 'Greenstone Collections' folder … … 245 249 } 246 250 } 251 247 252 /** This private class listens for selection events in from the list and then displays the appropriate details for that collection. 248 253 */ 249 254 private class CollectionListListener 250 255 implements ListSelectionListener { … … 264 269 args[3] = collection.getMaintainer(); 265 270 args[4] = collection.getDescription(); 266 details.setText(get("DeleteCollectionPrompt.Details", args));271 Dictionary.setText(details, "DeleteCollectionPrompt.Details", args); 267 272 details.setCaretPosition(0); 268 273 } 269 274 else { 270 275 confirmation.setEnabled(false); 271 details.setText(get("DeleteCollectionPrompt.No_Collection", null)); 272 } 273 } 274 } 275 /** A check box listener so we can tell if the users selected confirm. */ 276 Dictionary.setText(details, "DeleteCollectionPrompt.No_Collection"); 277 } 278 } 279 } 280 281 /** A check box listener so we can tell if the user has confirmed the deletion */ 276 282 private class ConfirmationCheckBoxListener 277 283 implements ActionListener { 278 284 /** Any implementation of ActionListener must include this method so we can be informed when the button is actioned. 279 285 * @param event An <strong>ActionEvent</strong> containing all the relevant information garnered from the event itself. 280 286 */ 281 287 public void actionPerformed(ActionEvent event) { 282 if(confirmation.isSelected()) { 283 ok_button.setEnabled(true); 284 } 285 else { 286 ok_button.setEnabled(false); 287 } 288 // OK button is only enabled if the confirmation check box is ticked 289 ok_button.setEnabled(confirmation.isSelected()); 288 290 } 289 291 } 292 290 293 /** The OK button listener implementation. */ 291 294 private class OKButtonListener … … 314 317 resultPrompt(true); 315 318 list_model.removeElement(collection); 316 details.setText(get("DeleteCollectionPrompt.No_Collection", null));319 Dictionary.setText(details, "DeleteCollectionPrompt.No_Collection"); 317 320 confirmation.setEnabled(false); 318 321 confirmation.setSelected(false); … … 355 358 return config.getMaintainer(); 356 359 } 360 357 361 public String toString() { 358 return config.getName(); 359 362 return config.getName(); 360 363 } 361 364 } -
trunk/gli/src/org/greenstone/gatherer/collection/SaveCollectionBox.java
r5355 r5536 94 94 } 95 95 /** Displays the prompt by first building the controls, then waits for a user selection. 96 97 96 * @param name The name of the current collection as a <strong>String</strong>. 97 */ 98 98 public int getUserOption(String name) { 99 99 JPanel content_pane = (JPanel) this.getContentPane(); … … 145 145 } 146 146 /** Method to retrieve a phrase from the dictionary based of a key. 147 148 149 147 * @param key A <strong>String</strong> used to find the correct phrase. 148 * @return A <strong>String</strong> containing the correct phrase with the correct formatting. 149 */ 150 150 private String get(String key) { 151 151 return get(key, null); 152 152 } 153 153 /** Method to retrieve a phrase from the dictionary based of a key and including arguments. 154 155 156 157 154 * @param key A <strong>String</strong> used to find the correct phrase. 155 * @param args A <strong>String[]</strong> of arguments used in formatting and filling out the phrase. 156 * @return A <strong>String</strong> containing the correct phrase with the correct formatting. 157 */ 158 158 private String get(String key, String args[]) { 159 159 if(key.indexOf('.') == -1) { … … 167 167 /** Any extension of KeyAdapter can override this method so that we can be informed whenever a key is released (ie after a keyTyped event). In this case we map the key press to an appropriate click on one of the buttons (not necessarily the one the key release was detected on). 168 168 * @param event A <strong>KeyEvent</strong> containing details about the key release event. 169 169 */ 170 170 public void keyReleased(KeyEvent event) { 171 171 if(event.getKeyCode() == KeyEvent.VK_Y) { -
trunk/gli/src/org/greenstone/gatherer/file/FileQueue.java
r5353 r5536 281 281 } 282 282 args = null; 283 //file_status.setToolTipText(Utility.formatHTMLWidth(file_status.getText(), 80)); 283 284 284 // If source is a file 285 285 if(source_file.isFile()) { … … 461 461 file_status.setText(get("FileActions.Deleting", args)); 462 462 args = null; 463 //file_status.setToolTipText(Utility.formatHTMLWidth(file_status.getText(), 80)); 463 464 464 // Remove its metadata 465 465 ArrayList metadatum = null; -
trunk/gli/src/org/greenstone/gatherer/gui/BrowsingPane.java
r5529 r5536 1 package org.greenstone.gatherer.gui;2 1 /** 3 2 *######################################################################### … … 36 35 *######################################################################## 37 36 */ 37 package org.greenstone.gatherer.gui; 38 38 39 import calpa.html.*; 39 40 import java.awt.*; … … 88 89 back_button = new JButton(Utility.getImage("back.gif")); 89 90 back_button.setEnabled(false); 90 Dictionary. setTooltip(back_button, "Browser.Back");91 Dictionary.registerTooltip(back_button, "Browser.Back"); 91 92 92 93 // refresh_button = new JButton(Utility.getImage("reload.gif")); 93 94 // refresh_button.setEnabled(false); 94 // Dictionary. setTooltip(refresh_button, "Browser.Reload");95 // Dictionary.registerTooltip(refresh_button, "Browser.Reload"); 95 96 96 97 bookmarks_button = new JButton(Utility.getImage("bookmark.gif")); 97 98 bookmarks_button.setEnabled(false); 98 Dictionary. setTooltip(bookmarks_button, "Browser.Bookmarks");99 Dictionary.registerTooltip(bookmarks_button, "Browser.Bookmarks"); 99 100 100 101 home_button = new JButton(Utility.getImage("home.gif")); 101 Dictionary. setTooltip(home_button, "Browser.Home");102 Dictionary.registerTooltip(home_button, "Browser.Home"); 102 103 103 104 JPanel address_pane = new JPanel(); 104 105 address_field = new JTextField(Gatherer.config.getString("general.home_page", false)); 105 Dictionary. setTooltip(address_field, "Browser.Address_Tooltip");106 Dictionary.registerTooltip(address_field, "Browser.Address_Tooltip"); 106 107 107 108 JPanel right_button_pane = new JPanel(); 108 109 go_button = new JButton(Utility.getImage("go.gif")); 109 Dictionary. setTooltip(go_button, "Browser.Go");110 Dictionary.registerTooltip(go_button, "Browser.Go"); 110 111 111 112 stop_button = new JButton(Utility.getImage("stop.gif")); 112 113 stop_button.setEnabled(false); 113 Dictionary. setTooltip(stop_button, "Browser.Stop");114 Dictionary.registerTooltip(stop_button, "Browser.Stop"); 114 115 115 116 forward_button = new JButton(Utility.getImage("forward.gif")); 116 117 forward_button.setEnabled(false); 117 Dictionary. setTooltip(forward_button, "Browser.Forward");118 Dictionary.registerTooltip(forward_button, "Browser.Forward"); 118 119 119 120 // Calpa Pane stuff … … 122 123 // Status bar 123 124 status_label = new JLabel(); 124 Dictionary. setText(status_label, "Browser.Ready");125 Dictionary.registerText(status_label, "Browser.Ready"); 125 126 126 127 // Connection … … 238 239 public void clear() { 239 240 data.removeAllElements(); 240 241 241 // Re-add the "Add Bookmark" entry. 242 //add 242 243 } 243 244 244 245 public void load() { 245 246 // Clear existing 246 247 data.removeAllElements(); 247 248 // Determine the file to load from... 248 249 File bookmarks = new File(Gatherer.c_man.getCollectionDirectory() + BOOKMARKS_FILE); 249 250 if(bookmarks.exists()) { … … 290 291 } 291 292 } 292 293 293 294 private class GoButtonListener 294 295 implements ActionListener { 295 296 public void actionPerformed(ActionEvent event) { 296 297 // Attempt to create a GURL 297 298 GURL url = new GURL(address_field.getText()); 298 299 address_field.setText(url.getURL().toString()); … … 355 356 args = new String[1]; 356 357 args[0] = url.toString(); 357 Dictionary. setText(status_label, "Browser.Follow");358 Dictionary.registerText(status_label, "Browser.Follow"); 358 359 args = null; 359 360 } … … 375 376 args = new String[1]; 376 377 args[0] = url.toString(); 377 Dictionary. setText(status_label, "Browser.Loading", args);378 Dictionary.registerText(status_label, "Browser.Loading", args); 378 379 args = null; 379 380 break; … … 396 397 stop_button.setEnabled(false); 397 398 // Rendering complete. 398 Dictionary. setText(status_label, "Browser.Ready");399 Dictionary.registerText(status_label, "Browser.Ready"); 399 400 go_button.setEnabled(true); 400 401 stop_button.setEnabled(false); -
trunk/gli/src/org/greenstone/gatherer/gui/CollectionPane.java
r5529 r5536 123 123 /** The initial size of the trees. */ 124 124 static private Dimension TREE_SIZE = new Dimension(400, 430); 125 125 126 /* Constructor. 126 127 * @param tree_sync Ensures that expansion events between like trees are synchronized. … … 138 139 stop_action.addActionListener(this); 139 140 stop_action.setEnabled(false); 140 Dictionary. setBoth(stop_action, "Collection.Stop", "Collection.Stop_Tooltip");141 Dictionary.registerBoth(stop_action, "Collection.Stop", "Collection.Stop_Tooltip"); 141 142 142 143 new_folder = new JButton(Utility.getImage("folder.gif")); … … 145 146 new_folder.setMinimumSize(MIN_SIZE); 146 147 new_folder.setPreferredSize(MIN_SIZE); 147 Dictionary. setTooltip(new_folder, "Collection.New_Folder_Tooltip");148 Dictionary.registerTooltip(new_folder, "Collection.New_Folder_Tooltip"); 148 149 } 149 150 … … 219 220 args = new String[1]; 220 221 args[0] = Gatherer.c_man.getCollection().getName(); 221 Dictionary. setText(collection_label, "Collection.Collection", args);222 Dictionary.registerText(collection_label, "Collection.Collection", args); 222 223 collection_tree.setModel(collection); 223 224 collection_tree.repaint(); … … 227 228 String args[] = new String[1]; 228 229 args[0] = Dictionary.newget("Collection.No_Collection"); 229 Dictionary. setText(collection_label, "Collection.Collection", args);230 Dictionary.registerText(collection_label, "Collection.Collection", args); 230 231 args = null; 231 232 collection_tree.setModel(new DefaultTreeModel(new DefaultMutableTreeNode("Error"))); … … 234 235 collection_tree.setEnabled(ready); 235 236 collection_filter.setEnabled(ready); 236 Dictionary. setTooltip(collection_filter.getComboBox(), "Collection.Filter_Tooltip");237 Dictionary.registerTooltip(collection_filter.getComboBox(), "Collection.Filter_Tooltip"); 237 238 238 239 // Change the label at the top of collection tree. … … 265 266 workspace_label.setBackground(Gatherer.config.getColor("coloring.workspace_heading_background", false)); 266 267 workspace_label.setForeground(Gatherer.config.getColor("coloring.workspace_heading_foreground", false)); 267 Dictionary. setText(workspace_label, "Collection.Workspace");268 Dictionary.registerText(workspace_label, "Collection.Workspace"); 268 269 269 270 workspace = Gatherer.c_man.getWorkspace(); … … 293 294 fcb.setBackgroundSelectionColor(Gatherer.config.getColor("coloring.collection_selection_background", false)); 294 295 fcb.setTextSelectionColor(Gatherer.config.getColor("coloring.collection_selection_foreground", false)); 295 Dictionary. setTooltip(fcb, "Collection.Filter_Tooltip");296 Dictionary.registerTooltip(fcb, "Collection.Filter_Tooltip"); 296 297 fcb = null; 297 298 … … 306 307 collection_label = new JLabel(); 307 308 collection_label.setOpaque(true); 308 Dictionary. setText(collection_label, "Collection.Collection", args);309 Dictionary.registerText(collection_label, "Collection.Collection", args); 309 310 310 311 collection = Gatherer.c_man.getRecordSet(); … … 375 376 bin_button.setMinimumSize(MIN_SIZE); 376 377 bin_button.setPreferredSize(MIN_SIZE); 377 Dictionary. setTooltip(bin_button, "Collection.Delete_Tooltip");378 Dictionary.registerTooltip(bin_button, "Collection.Delete_Tooltip"); 378 379 group.add(bin_button); 379 380 … … 506 507 507 508 /** Used to set the enabled state, and hence the colouring, of the two tree labels. 508 509 510 511 512 509 * @param label The <strong>JLabel</strong> to be affected. 510 * @param state <i>true</i> for enabled, i.e. when a collection is ready, <i>false</i> otherwise. 511 * @param foreground The <strong>Color</strong> to make the foreground text of the label when enabled. 512 * @param background The <strong>Color</strong> to make the background of the label when enabled. 513 */ 513 514 private void setEnabled(JLabel label, boolean state, Color foreground, Color background) { 514 515 ///ystem.err.println("Setting the label color to state " + state); … … 524 525 ///ystem.err.println("Color is now " + label.getBackground()); 525 526 } 527 526 528 /** When a user right-clicks within the trees on the collection pane view they are presented with a small popup menu of context based options. This class provides such functionality. 527 529 */ 528 530 private class GPopupMenu 529 531 extends JPopupMenu -
trunk/gli/src/org/greenstone/gatherer/gui/CreatePane.java
r5451 r5536 1 package org.greenstone.gatherer.gui;2 1 /** 3 2 *######################################################################### … … 36 35 *######################################################################## 37 36 */ 37 package org.greenstone.gatherer.gui; 38 38 39 import java.awt.*; 39 40 import java.awt.event.*; … … 43 44 import javax.swing.text.*; 44 45 import javax.swing.tree.*; 46 import org.greenstone.gatherer.Dictionary; 45 47 import org.greenstone.gatherer.Gatherer; 46 48 import org.greenstone.gatherer.collection.BuildOptions; … … 193 195 Gatherer.c_man.registerBuildMonitor(build_monitor); 194 196 195 // Buttons .196 build_button = new JButton( get("CreatePane.Build_Collection"));197 // Buttons 198 build_button = new JButton(); 197 199 build_button.addActionListener(new BuildButtonListener()); 198 200 build_button.setPreferredSize(BUTTON_SIZE); 199 build_button.setToolTipText(get("CreatePane.Build_Collection_Tooltip")); 200 cancel_button = new JButton(get("CreatePane.Cancel_Build")); 201 Dictionary.registerBoth(build_button, "CreatePane.Build_Collection", "CreatePane.Build_Collection_Tooltip"); 202 203 cancel_button = new JButton(); 201 204 cancel_button.addActionListener(new CancelButtonListener()); 202 205 cancel_button.setEnabled(false); 203 206 cancel_button.setPreferredSize(BUTTON_SIZE); 204 cancel_button.setToolTipText(get("CreatePane.Cancel_Build_Tooltip")); 205 } 207 Dictionary.registerBoth(cancel_button, "CreatePane.Cancel_Build", "CreatePane.Cancel_Build_Tooltip"); 208 } 209 206 210 /** This method is invoked at any time there has been a significant change in the collection, such as saving, loading or creating. 207 208 209 210 211 212 211 * @param ready A <strong>boolean</strong> indicating if a collection is currently available. 212 * @see org.greenstone.gatherer.Gatherer 213 * @see org.greenstone.gatherer.collection.CollectionManager 214 * @see org.greenstone.gatherer.gui.BuildOptions 215 * @see org.greenstone.gatherer.gui.OptionsPane 216 */ 213 217 public void collectionChanged(boolean ready) { 214 218 ///ystem.err.println("Collection changed... "); … … 223 227 } 224 228 /** This method is called to actually layout the components. 225 226 227 229 * @see org.greenstone.gatherer.Configuration 230 * @see org.greenstone.gatherer.Gatherer 231 */ 228 232 public void display() { 229 233 … … 297 301 } 298 302 /** This method is called whenever the 'Create' tab is selected from the view bar. It allows this view to perform any preactions required prior to display. In this case this entails gathering up to date information about the status of the collection including number of documents etc. 299 300 301 302 303 * @see org.greenstone.gatherer.Gatherer 304 * @see org.greenstone.gatherer.collection.CollectionManager 305 * @see org.greenstone.gatherer.gui.CreatePane.OptionTree 306 */ 303 307 public void gainFocus() { 304 308 if(!processing) { … … 311 315 } 312 316 /** Method to acquire the progress monitor associated with builds. 313 314 317 * @return The build <strong>GShellProgressMonitor</strong>. 318 */ 315 319 public GShellProgressMonitor getBuildProgress() { 316 320 return build_monitor; 317 321 } 318 322 /** Method to acquire the progress monitor associated with copying. 319 320 323 * @return The copying <strong>GShellProgressMonitor</strong>. 324 */ 321 325 public GShellProgressMonitor getCopyProgress() { 322 326 return copy_monitor; 323 327 } 324 328 /** Method to acquire the progress monitor associated with import. 325 326 329 * @return The import <strong>GShellProgressMonitor</strong>. 330 */ 327 331 public GShellProgressMonitor getImportProgress() { 328 332 return import_monitor; … … 347 351 348 352 /** All implementation of GShellListener must include this method so the listener can be informed when a GShell begins its task. Implementation side-effect, not actually used. 349 350 353 * @param event A <strong>GShellEvent</strong> that contains details of the initial state of the <strong>GShell</strong> before task comencement. 354 */ 351 355 public synchronized void processBegun(GShellEvent event) { 352 356 // We don't care. We'll get a more acurate start from the progress monitors. 353 357 } 354 358 /** All implementation of GShellListener must include this method so the listener can be informed when a GShell completes its task. 355 356 359 * @param event A <strong>GShellEvent</strong> that contains details of the final state of the <strong>GShell</strong> after task completion. 360 */ 357 361 public synchronized void processComplete(GShellEvent event) { 358 362 if(event.getStatus() == GShell.OK) { … … 378 382 } 379 383 /** This method retrieves a phrase from the dictionary based apon the key. 380 381 382 384 * @param key A <strong>String</strong> used as a reference to the correct phrase. 385 * @return A phrase, matching the key, as a <strong>String</strong>. 386 */ 383 387 private String get(String key) { 384 388 return get(key, null); 385 389 } 386 390 /** This method retrieves a phrase from the dictionary based apon the key and arguments. 387 388 389 390 391 392 391 * @param key A <strong>String</strong> used as a reference to the correct phrase. 392 * @param args A <strong>String[]</strong> whose contents are often substituted into the phrase before it is returned. 393 * @return A phrase, matching the key and constructed using the arguments, as a <strong>String</strong>. 394 * @see org.greenstone.gatherer.Dictionary 395 * @see org.greenstone.gatherer.Gatherer 396 */ 393 397 private String get(String key, String args[]) { 394 398 if(key.indexOf(".") == -1) { … … 397 401 return Gatherer.dictionary.get(key, args); 398 402 } 403 399 404 /** This class serves as the listener for actions on the build button. */ 400 405 private class BuildButtonListener … … 502 507 } 503 508 /** Any implementation of TreeSelectionListener must include this method to allow this listener to know when the selection has changed. Here we swap the options view depending on the selected OptionTreeNode. 504 505 506 509 * @param event A <Strong>TreeSelectionEvent</strong> which contains all the information garnered when the event occured. 510 * @see org.greenstone.gatherer.gui.CreatePane.OptionTreeNode 511 */ 507 512 public void valueChanged(TreeSelectionEvent event) { 508 513 TreePath path = null; … … 561 566 /** Constructor. 562 567 * @param title The <strong>String</strong> which serves as this nodes title. 563 568 */ 564 569 public OptionTreeNode(String title) { 565 570 super(); … … 567 572 } 568 573 /** This method compares two nodes for ordering. 569 570 571 574 * @param obj The <strong>Object</strong> to compare to. 575 * @return An <strong>int</strong> of one of the possible values -1, 0 or 1 indicating if this node is less than, equal to or greater than the target node respectively. 576 */ 572 577 public int compareTo(Object obj) { 573 578 return title.compareTo(obj.toString()); 574 579 } 575 580 /** This method checks if two nodes are equivelent. 576 577 578 581 * @param obj The <strong>Object</strong> to be tested against. 582 * @return A <strong>boolean</strong> which is <i>true</i> if the objects are equal, <i>false</i> otherwise. 583 */ 579 584 public boolean equals(Object obj) { 580 585 if(compareTo(obj) == 0) { … … 596 601 597 602 /** Method to translate this node into a textual representation. 598 599 603 * @return A <strong>String</strong> which in this case is the title. 604 */ 600 605 public String toString() { 601 606 return title; … … 614 619 int row, 615 620 boolean hasFocus) { 616 621 617 622 super.getTreeCellRendererComponent(tree, value, sel, 618 623 expanded, leaf, row, … … 626 631 return this; 627 632 } 628 629 } 630 633 } 631 634 } -
trunk/gli/src/org/greenstone/gatherer/gui/GUIManager.java
r5529 r5536 48 48 import javax.swing.text.*; 49 49 import org.greenstone.gatherer.Configuration; 50 import org.greenstone.gatherer.Dictionary; 50 51 import org.greenstone.gatherer.Gatherer; 51 52 import org.greenstone.gatherer.collection.Collection; … … 381 382 System.gc(); 382 383 } 384 383 385 /** Enabled events on the window to be trapped, creates all the visual components, then builds the tab and other layouts. 384 386 */ 385 387 public void display() { 386 388 content_pane = (JPanel) this.getContentPane(); … … 472 474 } 473 475 474 Gatherer.dictionary.register(tab_pane, null, false);476 Dictionary.register(tab_pane); 475 477 content_pane.add(tab_pane, BorderLayout.CENTER); 476 478 // Drive a sessionReady event to update all controls to reflect current collection status. -
trunk/gli/src/org/greenstone/gatherer/gui/LockFileDialog.java
r5527 r5536 7 7 import org.greenstone.gatherer.Dictionary; 8 8 import org.greenstone.gatherer.Gatherer; 9 import org.greenstone.gatherer.gui.TextFieldLabel;10 9 import org.greenstone.gatherer.msm.MSMUtils; 11 10 import org.greenstone.gatherer.util.Utility; … … 51 50 JLabel name_label = new JLabel(get("LockFileDialog.Name")); 52 51 name_label.setPreferredSize(LABEL_SIZE); 53 TextFieldLabel name_field = new TextFieldLabel(name); 52 JTextField name_field = new JTextField(name); 53 name_field.setEditable(false); 54 54 name_field.setBackground(Gatherer.config.getColor("coloring.collection_tree_background", false)); 55 55 JPanel person_pane = new JPanel(); 56 56 JLabel person_label = new JLabel(get("LockFileDialog.User")); 57 57 person_label.setPreferredSize(LABEL_SIZE); 58 TextFieldLabel person_field = new TextFieldLabel(getValue("User")); 58 JTextField person_field = new JTextField(getValue("User")); 59 person_field.setEditable(false); 59 60 person_field.setBackground(Gatherer.config.getColor("coloring.collection_tree_background", false)); 60 61 JPanel machine_pane = new JPanel(); 61 62 JLabel machine_label = new JLabel(get("LockFileDialog.Machine")); 62 63 machine_label.setPreferredSize(LABEL_SIZE); 63 TextFieldLabel machine_field = new TextFieldLabel(getValue("Machine")); 64 JTextField machine_field = new JTextField(getValue("Machine")); 65 machine_field.setEditable(false); 64 66 machine_field.setBackground(Gatherer.config.getColor("coloring.collection_tree_background", false)); 65 67 JPanel created_pane = new JPanel(); 66 68 JLabel created_label = new JLabel(get("LockFileDialog.Date")); 67 69 created_label.setPreferredSize(LABEL_SIZE); 68 TextFieldLabel created_field = new TextFieldLabel(getValue("Date")); 70 JTextField created_field = new JTextField(getValue("Date")); 71 created_field.setEditable(false); 69 72 created_field.setBackground(Gatherer.config.getColor("coloring.collection_tree_background", false)); 70 73 JLabel central_label = new JLabel(get("LockFileDialog.Lockfile_Message_Two")); -
trunk/gli/src/org/greenstone/gatherer/gui/MetaEditPane.java
r5529 r5536 144 144 add.setMnemonic(KeyEvent.VK_A); 145 145 add.setPreferredSize(BUTTON_SIZE); 146 Dictionary. setBoth(add, "MetaEdit.Accumulate", "MetaEdit.Accumulate_Tooltip");146 Dictionary.registerBoth(add, "MetaEdit.Accumulate", "MetaEdit.Accumulate_Tooltip"); 147 147 148 148 update = new JButton(); … … 151 151 update.setMnemonic(KeyEvent.VK_P); 152 152 update.setPreferredSize(BUTTON_SIZE); 153 Dictionary. setBoth(update, "MetaEdit.Overwrite", "MetaEdit.Overwrite_Tooltip");153 Dictionary.registerBoth(update, "MetaEdit.Overwrite", "MetaEdit.Overwrite_Tooltip"); 154 154 155 155 remove = new JButton(); … … 158 158 remove.setMnemonic(KeyEvent.VK_R); 159 159 remove.setPreferredSize(BUTTON_SIZE); 160 Dictionary. setBoth(remove, "MetaEdit.Remove", "MetaEdit.Remove_Tooltip");160 Dictionary.registerBoth(remove, "MetaEdit.Remove", "MetaEdit.Remove_Tooltip"); 161 161 162 162 expand = new JButton(); … … 165 165 expand.setMnemonic(KeyEvent.VK_E); 166 166 expand.setPreferredSize(new Dimension(25, 25)); 167 Dictionary. setBoth(expand, "MetaEdit.Expand", "MetaEdit.Expand_Tooltip");167 Dictionary.registerBoth(expand, "MetaEdit.Expand", "MetaEdit.Expand_Tooltip"); 168 168 169 169 tree = new GValueTree(CONTROL_SIZE.width, CONTROL_SIZE.height); … … 301 301 String[] args = new String[1]; 302 302 args[0] = Gatherer.c_man.getCollection().getName(); 303 Dictionary. setText(collection_label, "Collection.Collection", args);303 Dictionary.registerText(collection_label, "Collection.Collection", args); 304 304 // Update label coloring. 305 305 collection_label.setBackground(Gatherer.config.getColor("coloring.collection_heading_background", false)); … … 320 320 } 321 321 else { 322 Dictionary. setText(collection_label, "Collection.No_Collection");322 Dictionary.registerText(collection_label, "Collection.No_Collection"); 323 323 collection_label.setBackground(Color.lightGray); 324 324 collection_label.setForeground(Color.black); … … 353 353 ///atherer.println("\tCreating collection_label"); 354 354 collection_label = new JLabel(); 355 Dictionary. setText(collection_label, "Collection.Collection");355 Dictionary.registerText(collection_label, "Collection.Collection"); 356 356 collection_label.setOpaque(true); 357 357 … … 384 384 fcb.setBackgroundSelectionColor(Gatherer.config.getColor("coloring.collection_selection_background", false)); 385 385 fcb.setTextSelectionColor(Gatherer.config.getColor("coloring.collection_selection_foreground", false)); 386 Dictionary. setTooltip(fcb, "Collection.Filter_Tooltip");386 Dictionary.registerTooltip(fcb, "Collection.Filter_Tooltip"); 387 387 fcb = null; 388 388 … … 419 419 table_label.setBackground(Gatherer.config.getColor("coloring.collection_tree_background", false)); 420 420 table_label.setEditable(false); 421 Dictionary. setText(table_label, "MetaEdit.No_File");421 Dictionary.registerText(table_label, "MetaEdit.No_File"); 422 422 423 423 card_layout = new CardLayout(); … … 435 435 no_file_message.setOpaque(false); 436 436 no_file_message.setVerticalAlignment(JLabel.CENTER); 437 Dictionary. setText(no_file_message, "MetaEdit.No_File");437 Dictionary.registerText(no_file_message, "MetaEdit.No_File"); 438 438 439 439 JLabel no_metadata_message = new JLabel(); … … 441 441 no_metadata_message.setOpaque(false); 442 442 no_metadata_message.setVerticalAlignment(JLabel.CENTER); 443 Dictionary. setText(no_metadata_message, "MetaEdit.No_Metadata");443 Dictionary.registerText(no_metadata_message, "MetaEdit.No_Metadata"); 444 444 445 445 JPanel table_pane_one = new JPanel(); … … 490 490 tools_off_label.setOpaque(false); 491 491 tools_off_label.setVerticalAlignment(JLabel.CENTER); 492 Dictionary. setText(tools_off_label, "MetaEdit.No_Metadata_Element");492 Dictionary.registerText(tools_off_label, "MetaEdit.No_Metadata_Element"); 493 493 494 494 JPanel tools_on_pane = new JPanel(); … … 740 740 else { 741 741 records = null; 742 Dictionary. setText(table_label, "MetaEdit.No_File");742 Dictionary.registerText(table_label, "MetaEdit.No_File"); 743 743 744 744 // Remove old model from msm … … 1128 1128 String[] args = new String[1]; 1129 1129 args[0] = selected_metadata_element.toString(); 1130 Dictionary. setText(extracted_message, "MetaEdit.AutoMessage", args);1130 Dictionary.registerText(extracted_message, "MetaEdit.AutoMessage", args); 1131 1131 card_layout.show(this, NONE); 1132 1132 card_showing = NONE; -
trunk/gli/src/org/greenstone/gatherer/gui/MetaEditPrompt.java
r5529 r5536 1 package org.greenstone.gatherer.gui;2 1 /** 3 2 *######################################################################### … … 26 25 *######################################################################## 27 26 */ 27 package org.greenstone.gatherer.gui; 28 28 29 import java.awt.*; 29 30 import java.awt.event.*; 30 31 import java.io.File; 31 32 import javax.swing.*; 33 import org.greenstone.gatherer.Dictionary; 32 34 import org.greenstone.gatherer.Gatherer; 33 import org.greenstone.gatherer.gui.TextFieldLabel;34 35 import org.greenstone.gatherer.gui.SimpleMenuBar; 35 36 import org.greenstone.gatherer.gui.ModalDialog; … … 78 79 // Setup 79 80 this.setSize(SIZE); 80 this.setTitle("MetaEditPrompt.Title");81 Dictionary.setText(this, "MetaEditPrompt.Title"); 81 82 82 83 if (type.equals(ADD_PROMPT)) { … … 92 93 // Creation 93 94 JPanel content_pane = (JPanel)this.getContentPane(); 94 JLabel title_label = new JLabel(type); 95 JLabel title_label = new JLabel(); 96 Dictionary.setText(title_label, type); 95 97 96 98 JPanel details_pane = new JPanel(); 97 99 JPanel filename_panel = new JPanel(); 98 JLabel filename_label = new JLabel( "MetaEditPrompt.File");100 JLabel filename_label = new JLabel(); 99 101 filename_label.setPreferredSize(LABEL_SIZE); 100 TextFieldLabel filename_field = new TextFieldLabel(Utility.trimCenter(file.getAbsolutePath(), 120)); 102 Dictionary.setText(filename_label, "MetaEditPrompt.File"); 103 JTextField filename_field = new JTextField(Utility.trimCenter(file.getAbsolutePath(), 120)); 104 filename_field.setEditable(false); 101 105 filename_field.setFont(Gatherer.config.getFont("general.tooltip_font", false)); 102 106 filename_field.setBackground(Gatherer.config.getColor("coloring.collection_tree_background", false)); 103 107 JPanel element_panel = new JPanel(); 104 JLabel element_label = new JLabel( "MetaEditPrompt.Element");108 JLabel element_label = new JLabel(); 105 109 element_label.setPreferredSize(LABEL_SIZE); 106 TextFieldLabel element_field = new TextFieldLabel(element); 110 Dictionary.setText(element_label, "MetaEditPrompt.Element"); 111 JTextField element_field = new JTextField(element); 112 element_field.setEditable(false); 107 113 element_field.setBackground(Gatherer.config.getColor("coloring.collection_tree_background", false)); 108 114 JPanel current_value_panel = new JPanel(); 109 JLabel current_value_label = new JLabel( "MetaEditPrompt.Current_Value");115 JLabel current_value_label = new JLabel(); 110 116 current_value_label.setPreferredSize(LABEL_SIZE); 111 TextFieldLabel current_value_field = new TextFieldLabel(current_value); 117 Dictionary.setText(current_value_label, "MetaEditPrompt.Current_Value"); 118 JTextField current_value_field = new JTextField(current_value); 119 current_value_field.setEditable(false); 112 120 current_value_field.setBackground(Gatherer.config.getColor("coloring.collection_tree_background", false)); 113 121 JPanel new_value_panel = new JPanel(); 114 JLabel new_value_label = new JLabel( "MetaEditPrompt.New_Value");122 JLabel new_value_label = new JLabel(); 115 123 new_value_label.setPreferredSize(LABEL_SIZE); 116 TextFieldLabel new_value_field = new TextFieldLabel(new_value, (type == ADD_PROMPT || type == UPDATE_PROMPT)); 124 Dictionary.setText(new_value_label, "MetaEditPrompt.New_Value"); 125 JTextField new_value_field = new JTextField(new_value); // , (type == ADD_PROMPT || type == UPDATE_PROMPT)); 126 new_value_field.setEditable(false); 117 127 new_value_field.setBackground(Gatherer.config.getColor("coloring.collection_tree_background", false)); 118 128 JPanel buttons_pane = new JPanel(); 119 129 120 accumulate = new JButton( "MetaEdit.Accumulate");130 accumulate = new JButton(); 121 131 accumulate.setEnabled(type == ADD_PROMPT); 122 132 accumulate.setMnemonic(KeyEvent.VK_A); 123 124 accumulate_all = new JButton("MetaEditPrompt.Accumulate_All"); 133 Dictionary.setBoth(accumulate, "MetaEdit.Accumulate", "MetaEdit.Accumulate_Tooltip"); 134 135 accumulate_all = new JButton(); 125 136 accumulate_all.setEnabled(type == ADD_PROMPT && multiple_selection); 126 137 accumulate_all.setMnemonic(KeyEvent.VK_L); 127 128 overwrite = new JButton("MetaEdit.Overwrite"); 138 Dictionary.setBoth(accumulate_all, "MetaEditPrompt.Accumulate_All", "MetaEditPrompt.Accumulate_All_Tooltip"); 139 140 overwrite = new JButton(); 129 141 overwrite.setEnabled(type == UPDATE_PROMPT); 130 142 overwrite.setMnemonic(KeyEvent.VK_R); 131 132 overwrite_all = new JButton("MetaEditPrompt.Overwrite_All"); 143 Dictionary.setBoth(overwrite, "MetaEdit.Overwrite", "MetaEdit.Overwrite_Tooltip"); 144 145 overwrite_all = new JButton(); 133 146 overwrite_all.setEnabled(type == UPDATE_PROMPT && multiple_selection); 134 147 overwrite_all.setMnemonic(KeyEvent.VK_P); 135 136 remove = new JButton("MetaEdit.Remove"); 148 Dictionary.setBoth(overwrite_all, "MetaEditPrompt.Overwrite_All", "MetaEditPrompt.Overwrite_All_Tooltip"); 149 150 remove = new JButton(); 137 151 remove.setEnabled(type == REMOVE_PROMPT); 138 152 remove.setMnemonic(KeyEvent.VK_R); 139 140 remove_all = new JButton("MetaEditPrompt.Remove_All"); 153 Dictionary.setBoth(remove, "MetaEdit.Remove", "MetaEdit.Remove_Tooltip"); 154 155 remove_all = new JButton(); 141 156 remove_all.setEnabled(type == REMOVE_PROMPT && multiple_selection); 142 157 remove_all.setMnemonic(KeyEvent.VK_A); 143 144 skip = new JButton("MetaEditPrompt.Skip"); 158 Dictionary.setBoth(remove_all, "MetaEditPrompt.Remove_All", "MetaEditPrompt.Remove_All_Tooltip"); 159 160 skip = new JButton(); 145 161 skip.setEnabled(multiple_selection); 146 162 skip.setMnemonic(KeyEvent.VK_S); 147 148 cancel = new JButton("General.Cancel"); 163 Dictionary.setBoth(skip, "MetaEditPrompt.Skip", "MetaEditPrompt.Skip_Tooltip"); 164 165 cancel = new JButton(); 149 166 cancel.setMnemonic(KeyEvent.VK_C); 167 Dictionary.setBoth(cancel, "General.Cancel", "General.Cancel_Tooltip"); 150 168 151 169 // Connection … … 212 230 Rectangle frame_bounds = Gatherer.g_man.getBounds(); 213 231 this.setLocation(frame_bounds.x + ((frame_bounds.width - SIZE.width) / 2), frame_bounds.y + ((frame_bounds.height - SIZE.height) / 2)); 214 215 // Dictionary registration216 Gatherer.dictionary.register(title_label, null, false);217 Gatherer.dictionary.register(filename_label, null, false);218 Gatherer.dictionary.register(element_label, null, false);219 Gatherer.dictionary.register(current_value_label, null, false);220 Gatherer.dictionary.register(new_value_label, null, false);221 222 Gatherer.dictionary.register(accumulate, null, false);223 Gatherer.dictionary.register(accumulate_all, null, false);224 Gatherer.dictionary.register(cancel, null, false);225 Gatherer.dictionary.register(skip, null, false);226 Gatherer.dictionary.register(overwrite, null, false);227 Gatherer.dictionary.register(overwrite_all, null, false);228 Gatherer.dictionary.register(remove, null, false);229 Gatherer.dictionary.register(remove_all, null, false);230 232 } 231 233 -
trunk/gli/src/org/greenstone/gatherer/gui/MirrorPane.java
r5529 r5536 1 package org.greenstone.gatherer.gui;2 1 /** 3 2 *######################################################################### … … 36 35 *######################################################################## 37 36 */ 37 package org.greenstone.gatherer.gui; 38 38 39 import java.awt.*; 39 40 import java.awt.event.*; … … 47 48 import org.greenstone.gatherer.WGet; 48 49 import org.greenstone.gatherer.util.Utility; 50 49 51 /** 50 52 * @author John Thompson, Greenstone Digital Library, University of Waikato … … 81 83 JLabel url_label = new JLabel(); 82 84 url_label.setPreferredSize(Utility.LABEL_SIZE); 83 Dictionary. setText(url_label, "Mirroring.Source_URL");85 Dictionary.registerText(url_label, "Mirroring.Source_URL"); 84 86 url_textfield = new JTextField(); 85 Dictionary. setTooltip(url_textfield, "Mirroring.Source_URL_Tooltip");87 Dictionary.registerTooltip(url_textfield, "Mirroring.Source_URL_Tooltip"); 86 88 87 89 JPanel depth_pane = new JPanel(); 88 90 JLabel depth_label = new JLabel(); 89 Dictionary. setText(depth_label, "Mirroring.Download_Depth");91 Dictionary.registerText(depth_label, "Mirroring.Download_Depth"); 90 92 depth_spinner = new JSpinner(); 91 Dictionary. setTooltip(depth_spinner, "Mirroring.Download_Depth_Tooltip");93 Dictionary.registerTooltip(depth_spinner, "Mirroring.Download_Depth_Tooltip"); 92 94 93 95 JPanel destination_pane = new JPanel(); 94 96 JLabel destination_label = new JLabel(); 95 Dictionary. setText(destination_label, "Mirroring.Destination_Folder");97 Dictionary.registerText(destination_label, "Mirroring.Destination_Folder"); 96 98 ButtonGroup group = new ButtonGroup(); 97 99 public_radiobutton = new JRadioButton(); 98 100 public_radiobutton.setBackground(Gatherer.config.getColor("coloring.collection_tree_background", false)); 99 101 public_radiobutton.setOpaque(false); 100 Dictionary. setText(public_radiobutton, "Tree.Public");102 Dictionary.registerText(public_radiobutton, "Tree.Public"); 101 103 private_radiobutton = new JRadioButton(); 102 104 private_radiobutton.setBackground(Gatherer.config.getColor("coloring.collection_tree_background", false)); 103 105 private_radiobutton.setOpaque(false); 104 Dictionary. setText(private_radiobutton, "Tree.Private");106 Dictionary.registerText(private_radiobutton, "Tree.Private"); 105 107 group.add(public_radiobutton); 106 108 group.add(private_radiobutton); … … 109 111 JPanel first_pane = new JPanel(); 110 112 automatic_checkbox = new JCheckBox(); 111 Dictionary. setText(automatic_checkbox, "Mirroring.Download_Hidden");113 Dictionary.registerText(automatic_checkbox, "Mirroring.Download_Hidden"); 112 114 overwrite_checkbox = new JCheckBox(); 113 Dictionary. setText(overwrite_checkbox, "Mirroring.Overwrite_Existing");115 Dictionary.registerText(overwrite_checkbox, "Mirroring.Overwrite_Existing"); 114 116 115 117 JPanel second_pane = new JPanel(); 116 118 higher_checkbox = new JCheckBox(); 117 Dictionary. setText(higher_checkbox, "Mirroring.Higher_Directories");119 Dictionary.registerText(higher_checkbox, "Mirroring.Higher_Directories"); 118 120 same_host_checkbox = new JCheckBox(); 119 Dictionary. setText(same_host_checkbox, "Mirroring.Same_Host");121 Dictionary.registerText(same_host_checkbox, "Mirroring.Same_Host"); 120 122 121 123 remove_failed_checkbox = new JCheckBox(); 122 Dictionary. setText(remove_failed_checkbox, "Mirroring.Remove_Failed");124 Dictionary.registerText(remove_failed_checkbox, "Mirroring.Remove_Failed"); 123 125 124 126 JLabel further_label = new JLabel(); 125 Dictionary. setText(further_label, "Mirroring.Further_Options");127 Dictionary.registerText(further_label, "Mirroring.Further_Options"); 126 128 127 129 JPanel button_pane = new JPanel(); 128 130 download_button = new JButton(); 129 Dictionary. setBoth(download_button, "Mirroring.Download", "Mirroring.Download_Tooltip");131 Dictionary.registerBoth(download_button, "Mirroring.Download", "Mirroring.Download_Tooltip"); 130 132 131 133 // Connect -
trunk/gli/src/org/greenstone/gatherer/gui/NewCollectionDetailsPrompt.java
r5527 r5536 8 8 import javax.swing.event.*; 9 9 import javax.swing.text.*; 10 import org.greenstone.gatherer.Dictionary; 10 11 import org.greenstone.gatherer.Gatherer; 11 12 import org.greenstone.gatherer.collection.CollectionConfiguration; … … 45 46 setJMenuBar(new SimpleMenuBar("creatingacollection")); 46 47 setSize(size); 47 setTitle(get("NewCollectionPrompt.Title")); 48 Dictionary.setText(this, "NewCollectionPrompt.Title"); 49 48 50 // Model building. Build a model of all of the collections in the gsdl collect directory with the appropriate directories and hardcode the big five. 49 51 Vector base_collection_model = new Vector(); … … 52 54 File[] possible_collections = gsdl_collection_directory.listFiles(); 53 55 for(int i = 0; possible_collections != null && i < possible_collections.length; i++) { 54 56 // The simpliest case is if the directory etc/collect.cfg file and a metadata/ in it. Thus it can easily be built upon. 55 57 File collect_cfg_file = new File(possible_collections[i], Utility.CONFIG_DIR); 56 58 File metadata_directory = new File(possible_collections[i], Utility.META_DIR); … … 68 70 // Else not a collection we know how to retrieve the metadata set for. 69 71 } 70 72 // Else not a collection at all. Someones pulling a fast one. 71 73 } 72 74 // Sort the result. 73 75 Collections.sort(base_collection_model); 74 base_collection_model.add(0, new Item(null, get("NewCollectionPrompt.NewCollection"))); 75 // Creation. 76 base_collection_model.add(0, new Item(null, Dictionary.newget("NewCollectionPrompt.NewCollection"))); 77 78 // Creation 76 79 JPanel content_pane = (JPanel) getContentPane(); 77 80 content_pane.setOpaque(true); 78 81 JPanel upper_pane = new JPanel(); 79 upper_pane.setOpaque(false); 80 JLabel instructions_label = new JLabel(get("NewCollectionPrompt.Instructions")); 81 instructions_label.setOpaque(false); 82 JLabel instructions_label = new JLabel(); 83 Dictionary.setText(instructions_label, "NewCollectionPrompt.Instructions"); 82 84 JPanel title_pane = new JPanel(); 83 title_pane.setOpaque(false); 84 JLabel title_label = new JLabel(get("NewCollectionPrompt.Collection_Title")); 85 title_label.setOpaque(false); 85 JLabel title_label = new JLabel(); 86 Dictionary.setText(title_label, "CDM.General.Collection_Name"); 86 87 title = new JTextField(); 88 Dictionary.setTooltip(title, "CDM.General.Collection_Name_Tooltip"); 87 89 JPanel name_pane = new JPanel(); 88 name_pane.setOpaque(false); 89 JLabel name_label = new JLabel(get("NewCollectionPrompt.Collection_Name")); 90 name_label.setOpaque(false); 90 JLabel name_label = new JLabel(); 91 Dictionary.setText(name_label, "NewCollectionPrompt.Collection_Name"); 91 92 JPanel file_pane = new JPanel(); 92 file_pane.setOpaque(false);93 93 file = new RestrictedTextField(new RestrictedTextDocument(FILENAME_SIZE), "", FILENAME_SIZE); 94 Dictionary.setTooltip(file, "NewCollectionPrompt.Collection_Name_Tooltip"); 94 95 JLabel file_label = new JLabel(".col"); 95 file_label.setOpaque(false);96 96 JPanel email_pane = new JPanel(); 97 email_pane.setOpaque(false); 98 JLabel email_label = new JLabel(get("NewCollectionPrompt.Collection_Email")); 99 email_label.setOpaque(false); 97 JLabel email_label = new JLabel(); 98 Dictionary.setText(email_label, "NewCollectionPrompt.Collection_Email"); 100 99 JPanel host_pane = new JPanel(); 101 host_pane.setOpaque(false);102 100 JPanel address_pane = new JPanel(); 103 address_pane.setOpaque(false);104 101 address = new JTextField(); 102 Dictionary.setTooltip(address, "CDM.General.Email.Creator_Tooltip"); 105 103 JLabel at_label = new JLabel("@"); 106 104 host = new JTextField(); 105 Dictionary.setTooltip(host, "CDM.General.Email.Creator_Tooltip"); 106 107 107 JPanel center_pane = new JPanel(); 108 center_pane.setOpaque(false);109 108 JPanel description_pane = new JPanel(); 110 description_pane.setOpaque(false); 111 JLabel description_label = new JLabel(get("NewCollectionPrompt.Collection_Description")); 112 description_label.setOpaque(false); 109 JLabel description_label = new JLabel(); 110 Dictionary.setText(description_label, "NewCollectionPrompt.Collection_Description"); 113 111 description = new JTextArea(); 114 112 description.setBackground(Gatherer.config.getColor("coloring.editable_background", false)); 115 113 description.setForeground(Gatherer.config.getColor("coloring.editable_foreground", false)); 116 114 description.setRows(5); 115 Dictionary.setTooltip(description, "CDM.General.Collection_Extra_Tooltip"); 117 116 118 117 JPanel bottom_pane = new JPanel(); 119 118 // Base Collection 120 119 JPanel base_collection_pane = new JPanel(); 121 JLabel base_collection_label = new JLabel(get("NewCollectionPrompt.Base_Collection")); 120 JLabel base_collection_label = new JLabel(); 121 Dictionary.setText(base_collection_label, "NewCollectionPrompt.Base_Collection"); 122 122 base_collection = new JComboBox(base_collection_model); 123 // JButton base_collection_browse = new JButton(get("General.Browse"));123 Dictionary.setTooltip(base_collection, "NewCollectionPrompt.Base_Collection_Tooltip"); 124 124 125 125 JPanel button_pane = new JPanel(); 126 button_pane.setOpaque(false); 127 create_button = new JButton(get("General.OK")); 126 create_button = new JButton(); 128 127 create_button.setMnemonic(KeyEvent.VK_O); 129 JButton cancel_button = new JButton(get("General.Cancel")); 128 Dictionary.setBoth(create_button, "General.OK", "General.OK_Tooltip"); 129 JButton cancel_button = new JButton(); 130 130 cancel_button.setMnemonic(KeyEvent.VK_C); 131 Dictionary.setBoth(cancel_button, "General.Cancel", "General.Cancel_Tooltip"); 131 132 ColorListener email_color_listener = new ColorListener(address, host); 133 132 134 // Connection 133 // base_collection_browse.addActionListener(new BrowseListener());134 135 cancel_button.addActionListener(new CancelListener()); 135 136 create_button.addActionListener(new CreateListener()); … … 237 238 } 238 239 239 // public boolean viewExtractedMetadata() {240 // return view_extracted_metadata_radio_button.isSelected();241 // }242 243 /** Gets a phrase from the dictionary based on key.244 * @param key A <strong>String</strong> which serves as the unique identifier of a phrase.245 * @return The desired phrase as a <strong>String</strong> or at least a meaningful error message.246 */247 private String get(String key) {248 if(key.indexOf(".") == -1) {249 key = "NewCollectionPrompt." + key;250 }251 return Gatherer.dictionary.get(key);252 }253 240 254 241 private class BrowseListener … … 262 249 file = new File(Utility.BASE_DIR); 263 250 } 264 251 // Show OpenCollectionPrompt. 265 252 OpenCollectionDialog chooser = new OpenCollectionDialog(file); 266 253 file = chooser.getSelectedFile(); … … 311 298 title_final = title.getText(); 312 299 if(title_final.length() == 0) { 313 GPrompt err_msg = new GPrompt(self, get("NewCollectionPrompt.Error"),get("NewCollectionPrompt.Title_Error"), "error.gif", null);300 GPrompt err_msg = new GPrompt(self, Dictionary.newget("NewCollectionPrompt.Error"), Dictionary.newget("NewCollectionPrompt.Title_Error"), "error.gif", null); 314 301 err_msg.display(); 315 302 err_msg.destroy(); … … 326 313 for(int i = 0; children != null && i < children.length; i++) { 327 314 if(children[i].getName().equals(name_final)) { 328 GPrompt err_msg = new GPrompt(self, get("NewCollectionPrompt.Error"),get("NewCollectionPrompt.Name_Error"), "error.gif", null);315 GPrompt err_msg = new GPrompt(self, Dictionary.newget("NewCollectionPrompt.Error"), Dictionary.newget("NewCollectionPrompt.Name_Error"), "error.gif", null); 329 316 err_msg.display(); 330 317 err_msg.destroy(); … … 337 324 } 338 325 else { 339 GPrompt err_msg = new GPrompt(self, get("NewCollectionPrompt.Error"),get("NewCollectionPrompt.Name_Error"), "error.gif", null);326 GPrompt err_msg = new GPrompt(self, Dictionary.newget("NewCollectionPrompt.Error"), Dictionary.newget("NewCollectionPrompt.Name_Error"), "error.gif", null); 340 327 err_msg.display(); 341 328 err_msg.destroy(); … … 347 334 email_final = address.getText() + "@" + host.getText(); 348 335 if(email_final.length() == 0 || email_final.startsWith("@") || email_final.endsWith("@")) { 349 GPrompt err_msg = new GPrompt(self, get("NewCollectionPrompt.Error"),get("NewCollectionPrompt.Email_Error"), "error.gif", null);336 GPrompt err_msg = new GPrompt(self, Dictionary.newget("NewCollectionPrompt.Error"), Dictionary.newget("NewCollectionPrompt.Email_Error"), "error.gif", null); 350 337 err_msg.display(); 351 338 err_msg.destroy(); … … 359 346 description_final = description.getText(); 360 347 if(description_final.length() == 0) { 361 GPrompt err_msg = new GPrompt(self, get("NewCollectionPrompt.Error"),get("NewCollectionPrompt.Description_Error"), "error.gif", null);348 GPrompt err_msg = new GPrompt(self, Dictionary.newget("NewCollectionPrompt.Error"), Dictionary.newget("NewCollectionPrompt.Description_Error"), "error.gif", null); 362 349 err_msg.display(); 363 350 err_msg.destroy(); … … 444 431 public void insertString(int offs, String str, AttributeSet a) 445 432 throws BadLocationException { 446 433 // Remove any blocked characters. 447 434 StringBuffer temp = new StringBuffer(str); 448 435 for(int i = 0; block != null && i < block.length; i++) { … … 472 459 updateFilename(); 473 460 } 474 461 475 462 /** Gives notification that there was an insert into the document. */ 476 463 public void insertUpdate(DocumentEvent e) { -
trunk/gli/src/org/greenstone/gatherer/gui/OpenCollectionDialog.java
r5302 r5536 1 package org.greenstone.gatherer.gui;2 1 /** 3 2 *######################################################################### … … 36 35 *######################################################################## 37 36 */ 37 package org.greenstone.gatherer.gui; 38 38 39 import java.awt.*; 39 40 import java.awt.event.*; … … 43 44 import java.text.*; 44 45 import java.util.*; 45 import javax.accessibility.*;46 46 import javax.swing.*; 47 47 import javax.swing.filechooser.*; … … 51 51 import org.greenstone.gatherer.collection.CollectionManager; 52 52 import org.greenstone.gatherer.util.Utility; 53 import org.outerj.pollo.util.*;54 53 55 54 public class OpenCollectionDialog … … 59 58 /** The name of the mouse listener that initiates editing on a double click. */ 60 59 static final private String SINGLE_CLICK_LISTENER = "SingleClickListener"; 60 61 61 /** Constructor */ 62 62 public OpenCollectionDialog(File file) { … … 65 65 // Other initialization 66 66 setAcceptAllFileFilterUsed(false); 67 setDialogTitle( Gatherer.dictionary.get("OpenCollectionDialog.Title"));67 setDialogTitle(Dictionary.newget("OpenCollectionDialog.Title")); 68 68 setFileFilter(new GathererFilter()); 69 69 setFileSystemView(new GathererFileSystemView()); … … 79 79 JPanel center_pane = (JPanel) accessory_pane.getParent(); 80 80 center_pane.add(accessory_pane, BorderLayout.SOUTH); 81 // Done.82 81 } 83 82 … … 125 124 } 126 125 127 static public void main(String args[]) {128 JFrame frame = new JFrame();129 frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);130 frame.setSize(800,640);131 OpenCollectionDialog chooser = new OpenCollectionDialog(new File("/research/jmt12/gsdl/collect/"));132 // Show dialog133 int result = chooser.showOpenDialog(frame);134 }135 126 136 127 /* The DescriptionPreview accessory is adapted from the ImagePreview.java (an example used by FileChooserDemo2.java). */ … … 140 131 private File file = null; 141 132 private JTextArea text; 142 //private JEditorPane text; 133 143 134 public DescriptionPreview(JFileChooser fc) { 144 135 setName("Description Preview"); 145 136 setPreferredSize(new Dimension(100, 75)); // About three rows. 146 137 147 text = new JTextArea(Gatherer.dictionary.get("OpenCollectionDialog.No_Description")); 148 //text.setLineWrap(true); 149 //text.setWrapStyleWord(true); 150 //text = new JEditorPane(); 151 //text.setText(Gatherer.dictionary.get("OpenCollectionDialog.No_Description")); 138 text = new JTextArea(); 139 Dictionary.setText(text, "OpenCollectionDialog.No_Description"); 152 140 153 141 setBorder(BorderFactory.createEmptyBorder(5,0,0,0)); … … 157 145 fc.addPropertyChangeListener(this); 158 146 } 147 159 148 /** Whenever a new file or folder is selected we determine what description should be displayed. */ 160 149 public void propertyChange(PropertyChangeEvent e) { 161 150 boolean update = false; 162 151 String prop = e.getPropertyName(); 163 //If the directory changed, don't show an image.152 // If the directory changed, don't show an image. 164 153 if (JFileChooser.DIRECTORY_CHANGED_PROPERTY.equals(prop)) { 165 154 file = null; 166 update = true; 167 168 //If a file became selected, find out which one.169 }else if (JFileChooser.SELECTED_FILE_CHANGED_PROPERTY.equals(prop)) {155 update = true; 156 } 157 // If a file became selected, find out which one. 158 else if (JFileChooser.SELECTED_FILE_CHANGED_PROPERTY.equals(prop)) { 170 159 file = (File) e.getNewValue(); 171 160 update = true; 172 161 } 173 //Update the description accordingly. 162 163 // Update the description accordingly. 174 164 if (update) { 175 165 if(file == null) { 176 text.setText(Gatherer.dictionary.get("OpenCollectionDialog.No_Description"));166 Dictionary.setText(text, "OpenCollectionDialog.No_Description"); 177 167 } 178 168 else { … … 186 176 } 187 177 } 188 } 178 } 189 179 } 190 180 … … 192 182 private class GathererFilter 193 183 extends FileFilter { 194 195 // Accept all directories and all gif, jpg, tiff, or png files.184 185 // Accept all directories and all .col files 196 186 public boolean accept(File f) { 197 187 return (f.isDirectory() || f.getName().toLowerCase().endsWith(".col")); 198 188 } 199 200 // The description of this filter189 190 // The description of this filter 201 191 public String getDescription() { 202 return Gatherer.dictionary.get("OpenCollectionDialog.Collection");192 return Dictionary.newget("OpenCollectionDialog.Collection"); 203 193 } 204 194 } … … 217 207 /** Gets the list of shown (i.e. */ 218 208 public File[] getFiles(File dir, boolean useFileHiding) { 219 209 // Retrieve the files usually returned by the platform specific file system view. 220 210 File[] files = default_system_view.getFiles(dir, useFileHiding); 221 211 // Determine if the current dir actually contains a valid greenstone collection. To do this we check for the presence of the file <dir>/etc/collect.cfg and a directory named import. 222 212 File collect_cfg_file = new File(dir, Utility.CONFIG_DIR); 223 213 File import_dir_file = new File(dir, Utility.IMPORT_DIR); … … 246 236 private class GathererFileView 247 237 extends FileView { 238 248 239 public String getDescription(File file) { 249 240 String description = null; 250 if (file.getName().endsWith(".col")) {251 if (!lockExists(file)) {252 Gatherer.dictionary.get("OpenCollectionDialog.Normal_Collection");241 if (file.getName().endsWith(".col")) { 242 if (!lockExists(file)) { 243 description = Dictionary.newget("OpenCollectionDialog.Normal_Collection"); 253 244 } 254 245 else { 255 Gatherer.dictionary.get("OpenCollectionDialog.Locked_Collection");246 description = Dictionary.newget("OpenCollectionDialog.Locked_Collection"); 256 247 } 257 248 } 258 249 return description; 259 250 } 251 260 252 public Icon getIcon(File file) { 261 253 Icon icon = null; 262 if (file.getName().endsWith(".col")) {263 if (!lockExists(file)) {254 if (file.getName().endsWith(".col")) { 255 if (!lockExists(file)) { 264 256 icon = NORMAL_COLLECTION_ICON; 265 257 } … … 270 262 return icon; 271 263 } 264 272 265 /** Determine if a lock file exists. */ 273 266 private boolean lockExists(File file) { -
trunk/gli/src/org/greenstone/gatherer/gui/OptionsPane.java
r5350 r5536 1 package org.greenstone.gatherer.gui;2 1 /** 3 2 *######################################################################### … … 36 35 *######################################################################## 37 36 */ 37 package org.greenstone.gatherer.gui; 38 38 39 import java.awt.*; 39 40 import java.awt.event.*; … … 43 44 import javax.swing.event.*; 44 45 import javax.swing.text.*; 46 import org.greenstone.gatherer.Dictionary; 45 47 import org.greenstone.gatherer.Gatherer; 46 48 import org.greenstone.gatherer.cdm.Argument; … … 53 55 import org.greenstone.gatherer.util.AppendLineOnlyFileDocumentOwner; 54 56 import org.greenstone.gatherer.util.Utility; 55 //import org.w3c.dom.*; 57 56 58 /** This class serves as the data holder for all subclasses of option panes, such as Import options or All options. It also contains methods for creating each of the option lines as they would appear in the subpane. Futhermore it has a method for considering all the arguments and generating a <strong>String[]</strong> to allow you to pass them to the <strong>GShell</strong>. 57 59 * @author John Thompson, Greenstone Digital Library, University of Waikato … … 91 93 92 94 93 95 /** The default constructor creates the few session length options, but either retrieves the rest from the current collection, or creates a default set of options. */ 94 96 public OptionsPane(BuildOptions build_options) { 95 97 this.build_options = build_options; … … 102 104 103 105 /** This method creates the panel with all the build only options on it. 104 105 106 * @return A <strong>JPanel</strong> which can be used to display all the build only options. 107 */ 106 108 public JPanel buildBuild() { 107 109 JPanel pane = new JPanel(); … … 122 124 } 123 125 /** This method creates the panel with all the import only options on it. 124 125 126 * @return A <strong>JPanel</strong> which can be used to display all the import only options. 127 */ 126 128 public JPanel buildImport() { 127 129 JPanel pane = new JPanel(); … … 142 144 } 143 145 /** This method is used to build a panel based on the message log, which is nothing like any of the other panels. 144 145 146 * @return A <strong>JPanel</strong> containing a scrollable text area which represents the shell process message log. 147 */ 146 148 public JPanel buildLog() { 147 149 // we now save the log pane … … 179 181 log_list.addListSelectionListener(new LogListListener()); 180 182 181 JLabel log_history_label = new JLabel(get("OptionsPane.LogHistory")); 183 JLabel log_history_label = new JLabel(); 184 Dictionary.registerText(log_history_label, "OptionsPane.LogHistory"); 182 185 JPanel log_history_pane = new JPanel(); 183 186 log_history_pane.setPreferredSize(new Dimension(600, 100)); … … 211 214 } 212 215 213 /** This method retrieves a phrase from the dictionary based apon the key. 214 * @param key A <strong>String</strong> used as a reference to the correct phrase. 215 * @return A phrase, matching the key, as a <strong>String</strong>. 216 */ 217 private String get(String key) { 218 return get(key, null); 219 } 220 /** This method retrieves a phrase from the dictionary based apon the key and arguments. 221 * @param key A <strong>String</strong> used as a reference to the correct phrase. 222 * @param args A <strong>String[]</strong> whose contents are often substituted into the phrase before it is returned. 223 * @return A phrase, matching the key and constructed using the arguments, as a <strong>String</strong>. 224 * @see org.greenstone.gatherer.Dictionary 225 * @see org.greenstone.gatherer.Gatherer 226 */ 227 private String get(String key, String args[]) { 228 if(key.indexOf(".") == -1) { 229 key = "OptionsPane." + key; 230 } 231 return Gatherer.dictionary.get(key, args); 232 } 216 233 217 /** Attempts to discover the latest document count. 234 218 * @return An <strong>int</strong> detailing the number of documents in this collection. … … 285 269 setLayout(new BorderLayout()); 286 270 setPreferredSize(ROW_SIZE); 287 288 /*289 JPanel inner_pane = new JPanel();290 inner_pane.setOpaque(false);291 */292 271 293 272 // Try to determine what the value_controls value should be. … … 389 368 } 390 369 391 370 // If the argument is required, then you don't get a choice of whether it is enabled. 392 371 if(argument.isRequired()) { 393 372 JLabel label = new JLabel(argument.getName()); … … 460 439 } 461 440 /** Any implementation of ActionListener must include this method so that we can be informed when an action has been performed on or registered check box, prompting us to change the state of the other controls as per the users request. 462 463 441 * @param event An <strong>ActionEvent</strong> containing information about the click. 442 */ 464 443 public void actionPerformed(ActionEvent event) { 465 444 JCheckBox source = (JCheckBox)event.getSource(); … … 562 541 switch (success) { 563 542 case SUCCESSFUL: 564 d.append( get("OptionsPane.Successful"));543 d.append(Dictionary.newget("OptionsPane.Successful")); 565 544 break; 566 545 case UNSUCCESSFUL: 567 d.append( get("OptionsPane.Unsuccessful"));546 d.append(Dictionary.newget("OptionsPane.Unsuccessful")); 568 547 break; 569 548 case CANCELLED: 570 d.append( get("OptionsPane.Cancelled"));549 d.append(Dictionary.newget("OptionsPane.Cancelled")); 571 550 break; 572 551 default: 573 d.append( get("OptionsPane.Unknown"));552 d.append(Dictionary.newget("OptionsPane.Unknown")); 574 553 } 575 554 display = d.toString(); -
trunk/gli/src/org/greenstone/gatherer/gui/Preferences.java
r5527 r5536 9 9 import javax.swing.event.*; 10 10 import org.greenstone.gatherer.Configuration; 11 import org.greenstone.gatherer.Dictionary; 11 12 import org.greenstone.gatherer.Gatherer; 12 13 import org.greenstone.gatherer.checklist.CheckList; … … 61 62 this.self = this; 62 63 setSize(SIZE); 63 setTitle("Preferences");64 Dictionary.registerText(this, "Preferences"); 64 65 setJMenuBar(new SimpleMenuBar("preferences")); 66 65 67 // Creation 66 68 JPanel content_pane = (JPanel) getContentPane(); 67 69 tab_pane = new JTabbedPane(); 68 tab_pane.add("Preferences.General", createGeneralPreferences()); 70 JPanel general_preferences = createGeneralPreferences(); 71 tab_pane.add("Preferences.General", general_preferences); 69 72 tab_pane.add("Preferences.Workflow", createWorkflowPreferences()); 70 73 tab_pane.add("Preferences.Connection", createConnectionPreferences()); 71 74 tab_pane.add("Preferences.Warnings", createWarningPreferences()); 75 Dictionary.register(tab_pane); 72 76 73 77 JPanel button_pane = new JPanel(); 74 ok_button = new JButton("General.OK"); 75 apply_button = new JButton("General.Apply"); 76 cancel_button = new JButton("General.Cancel"); 78 ok_button = new JButton(); 79 Dictionary.registerBoth(ok_button, "General.OK", "General.OK_Tooltip"); 80 apply_button = new JButton(); 81 Dictionary.registerBoth(apply_button, "General.Apply", "General.Apply_Tooltip"); 82 cancel_button = new JButton(); 83 Dictionary.registerBoth(cancel_button, "General.Cancel", "General.Cancel_Tooltip"); 84 77 85 // Connection 78 Gatherer.dictionary.register(this, null, false);79 Gatherer.dictionary.register(tab_pane, null, false);80 Gatherer.dictionary.register(ok_button, null, false);81 Gatherer.dictionary.register(apply_button, null, false);82 Gatherer.dictionary.register(cancel_button, null, false);83 86 ok_button.addActionListener(new OKButtonListener(true)); 84 87 apply_button.addActionListener(new OKButtonListener(false)); 85 88 cancel_button.addActionListener(new CancelButtonListener()); 89 86 90 // Layout 87 91 button_pane.setBorder(BorderFactory.createEmptyBorder(5,2,2,2)); … … 114 118 JPanel library_path_pane = new JPanel(); 115 119 library_path_pane.setPreferredSize(ROW_SIZE); 116 library_path_label = new JLabel( "Preferences.Connection.Library_Path");120 library_path_label = new JLabel(); 117 121 library_path_label.setPreferredSize(LABEL_SIZE); 122 Dictionary.registerText(library_path_label, "Preferences.Connection.Library_Path"); 118 123 library_path_field = new JTextField(Gatherer.config.getString("general.exec_address", true)); 119 124 library_path_field.setCaretPosition(0); 125 Dictionary.registerTooltip(library_path_field, "Preferences.Connection.Library_Path_Tooltip"); 120 126 121 127 boolean currently_enabled = Gatherer.config.get("general.use_proxy", true); 122 128 // Creation 123 129 JPanel connection_pane = new JPanel(); 124 use_proxy_checkbox = new JCheckBox("Preferences.Connection.Use_Proxy", currently_enabled); 130 use_proxy_checkbox = new JCheckBox(); 131 use_proxy_checkbox.setSelected(currently_enabled); 132 Dictionary.registerText(use_proxy_checkbox, "Preferences.Connection.Use_Proxy"); 133 125 134 use_proxy_checkbox.setPreferredSize(ROW_SIZE); 126 135 JPanel proxy_host_pane = new JPanel(); 127 136 proxy_host_pane.setPreferredSize(ROW_SIZE); 128 proxy_host_label = new JLabel( "Preferences.Connection.Proxy_Host");137 proxy_host_label = new JLabel(); 129 138 proxy_host_label.setPreferredSize(LABEL_SIZE); 139 Dictionary.registerText(proxy_host_label, "Preferences.Connection.Proxy_Host"); 130 140 proxy_host_field = new JTextField(Gatherer.config.getString("general.proxy_host", true)); 131 141 proxy_host_field.setEnabled(currently_enabled); 142 Dictionary.registerTooltip(proxy_host_field, "Preferences.Connection.Proxy_Host_Tooltip"); 132 143 JPanel proxy_port_pane = new JPanel(); 133 144 proxy_port_pane.setPreferredSize(ROW_SIZE); 134 proxy_port_label = new JLabel( "Preferences.Connection.Proxy_Port");145 proxy_port_label = new JLabel(); 135 146 proxy_port_label.setPreferredSize(LABEL_SIZE); 147 Dictionary.registerText(proxy_port_label, "Preferences.Connection.Proxy_Port"); 136 148 proxy_port_field = new NumberField(Gatherer.config.getString("general.proxy_port", true)); 137 149 proxy_port_field.setEnabled(currently_enabled); 150 Dictionary.registerTooltip(proxy_port_field, "Preferences.Connection.Proxy_Port_Tooltip"); 138 151 139 152 // Connection 140 Gatherer.dictionary.register(library_path_label, null, false);141 Gatherer.dictionary.register(use_proxy_checkbox, null, false);142 Gatherer.dictionary.register(proxy_host_label, null, false);143 Gatherer.dictionary.register(proxy_port_label, null, false);144 153 use_proxy_checkbox.addActionListener(new UseProxyListener()); 145 154 … … 214 223 215 224 // Extracted metadata 216 view_extracted_metadata_checkbox = new JCheckBox("Preferences.General.View_Extracted_Metadata", false); 225 view_extracted_metadata_checkbox = new JCheckBox(); 226 view_extracted_metadata_checkbox.setSelected(false); 227 Dictionary.registerText(view_extracted_metadata_checkbox, "Preferences.General.View_Extracted_Metadata"); 217 228 if (Gatherer.config.get("general.view_extracted_metadata", Configuration.COLLECTION_SPECIFIC)) { 218 229 view_extracted_metadata_checkbox.setSelected(true); … … 220 231 221 232 // Show file sizes 222 show_file_size_checkbox = new JCheckBox("Preferences.General.Show_File_Size", false); 233 show_file_size_checkbox = new JCheckBox(); 234 show_file_size_checkbox.setSelected(false); 235 Dictionary.registerText(show_file_size_checkbox, "Preferences.General.Show_File_Size"); 223 236 if (Gatherer.config.get("general.show_file_size", Configuration.COLLECTION_SPECIFIC)) { 224 237 show_file_size_checkbox.setSelected(true); … … 227 240 // Language 228 241 JPanel language_pane = new JPanel(); 229 language_label = new JLabel( "Preferences.General.Interface_Language");242 language_label = new JLabel(); 230 243 language_label.setPreferredSize(LABEL_SIZE); 244 Dictionary.registerText(language_label, "Preferences.General.Interface_Language"); 231 245 language_combobox = new JComboBox(dictionary_model.toArray()); 232 246 233 247 // Connect 234 Gatherer.dictionary.register(view_extracted_metadata_checkbox, null, false);235 Gatherer.dictionary.register(show_file_size_checkbox, null, false);236 Gatherer.dictionary.register(language_label, null, false);237 248 language_combobox.addActionListener(new LanguageComboboxListener()); 238 249 … … 260 271 String value = (String) warning_preferences.get(property); 261 272 // Remove 'warning.' 262 String title = Gatherer.dictionary.get(property.substring(8) + ".Title");273 String title = Dictionary.newget(property.substring(8) + ".Title"); 263 274 Entry entry = new Entry(title, value.equalsIgnoreCase(TRUE)); 264 275 entry.setProperty(property); … … 277 288 278 289 private JPanel createWorkflowPreferences() { 279 // Read in the predefined configurations file .290 // Read in the predefined configurations file 280 291 Vector predefined = new Vector(); 281 292 Document predefined_document = Utility.parse("xml/workflows.xml", true); … … 285 296 predefined.add(new WorkflowElementWrapper((Element)workflow_elements.item(i))); 286 297 } 298 287 299 // Creation 288 300 JPanel workflow_preferences_pane = new JPanel(); 289 301 JPanel checklist_pane = new JPanel(); 290 title_label = new JLabel( "Preferences.Workflow.Title");302 title_label = new JLabel(); 291 303 title_label.setPreferredSize(ROW_SIZE); 292 workflow_browse = new JCheckBox("Preferences.Workflow.Browse", Gatherer.config.get("workflow.browse", false)); 304 Dictionary.registerText(title_label, "Preferences.Workflow.Title"); 305 306 workflow_browse = new JCheckBox(); 307 workflow_browse.setSelected(Gatherer.config.get("workflow.browse", false)); 293 308 workflow_browse.setPreferredSize(ROW_SIZE); 294 workflow_mirror = new JCheckBox("Preferences.Workflow.Mirror", Gatherer.config.get("workflow.mirror", false)); 309 Dictionary.registerText(workflow_browse, "Preferences.Workflow.Browse"); 310 311 workflow_mirror = new JCheckBox(); 312 workflow_mirror.setSelected(Gatherer.config.get("workflow.mirror", false)); 295 313 workflow_mirror.setPreferredSize(ROW_SIZE); 296 workflow_gather = new JCheckBox("Preferences.Workflow.Gather", Gatherer.config.get("workflow.gather", false)); 314 Dictionary.registerText(workflow_mirror, "Preferences.Workflow.Mirror"); 315 316 workflow_gather = new JCheckBox(); 317 workflow_gather.setSelected(Gatherer.config.get("workflow.gather", false)); 297 318 workflow_gather.setPreferredSize(ROW_SIZE); 298 workflow_enrich = new JCheckBox("Preferences.Workflow.Enrich", Gatherer.config.get("workflow.enrich", false)); 319 Dictionary.registerText(workflow_gather, "Preferences.Workflow.Gather"); 320 321 workflow_enrich = new JCheckBox(); 322 workflow_enrich.setSelected(Gatherer.config.get("workflow.enrich", false)); 299 323 workflow_enrich.setPreferredSize(ROW_SIZE); 300 workflow_design = new JCheckBox("Preferences.Workflow.Design", Gatherer.config.get("workflow.design", false)); 324 Dictionary.registerText(workflow_enrich, "Preferences.Workflow.Enrich"); 325 326 workflow_design = new JCheckBox(); 327 workflow_design.setSelected(Gatherer.config.get("workflow.design", false)); 301 328 workflow_design.setPreferredSize(ROW_SIZE); 302 workflow_export = new JCheckBox("Preferences.Workflow.Export", Gatherer.config.get("workflow.export", false)); 329 Dictionary.registerText(workflow_design, "Preferences.Workflow.Design"); 330 331 workflow_export = new JCheckBox(); 332 workflow_export.setSelected(Gatherer.config.get("workflow.export", false)); 303 333 workflow_export.setPreferredSize(ROW_SIZE); 304 workflow_create = new JCheckBox("Preferences.Workflow.Create", Gatherer.config.get("workflow.create", false)); 334 Dictionary.registerText(workflow_export, "Preferences.Workflow.Export"); 335 336 workflow_create = new JCheckBox(); 337 workflow_create.setSelected(Gatherer.config.get("workflow.create", false)); 305 338 workflow_create.setPreferredSize(ROW_SIZE); 306 workflow_preview = new JCheckBox("Preferences.Workflow.Preview", Gatherer.config.get("workflow.preview", false)); 339 Dictionary.registerText(workflow_create, "Preferences.Workflow.Create"); 340 341 workflow_preview = new JCheckBox(); 342 workflow_preview.setSelected(Gatherer.config.get("workflow.preview", false)); 307 343 workflow_preview.setPreferredSize(ROW_SIZE); 344 Dictionary.registerText(workflow_preview, "Preferences.Workflow.Preview"); 345 308 346 JPanel predefined_pane = new JPanel(); 309 predefined_label = new JLabel( "Preferences.Workflow.Predefined.Label");347 predefined_label = new JLabel(); 310 348 predefined_label.setPreferredSize(new Dimension(150,25)); 349 Dictionary.registerText(predefined_label, "Preferences.Workflow.Predefined.Label"); 311 350 JComboBox predefined_combobox = new JComboBox(predefined); 351 312 352 // Connection 313 Gatherer.dictionary.register(title_label, null, false);314 Gatherer.dictionary.register(workflow_browse, null, false);315 Gatherer.dictionary.register(workflow_mirror, null, false);316 Gatherer.dictionary.register(workflow_gather, null, false);317 Gatherer.dictionary.register(workflow_enrich, null, false);318 Gatherer.dictionary.register(workflow_design, null, false);319 Gatherer.dictionary.register(workflow_export, null, false);320 Gatherer.dictionary.register(workflow_create, null, false);321 Gatherer.dictionary.register(workflow_preview, null, false);322 Gatherer.dictionary.register(predefined_label, null, false);323 353 predefined_combobox.addActionListener(new PredefinedActionListener()); 354 324 355 // Layout 325 356 checklist_pane.setLayout(new BoxLayout(checklist_pane, BoxLayout.Y_AXIS)); 326 357 checklist_pane.add(title_label); 327 if (Gatherer.config.get("workflow.browse", true)) {358 if (Gatherer.config.get("workflow.browse", true)) { 328 359 checklist_pane.add(workflow_browse); 329 360 } 330 if (Gatherer.config.get("workflow.mirror", true)) {361 if (Gatherer.config.get("workflow.mirror", true)) { 331 362 checklist_pane.add(workflow_mirror); 332 363 } 333 if (Gatherer.config.get("workflow.gather", true)) {364 if (Gatherer.config.get("workflow.gather", true)) { 334 365 checklist_pane.add(workflow_gather); 335 366 } 336 if (Gatherer.config.get("workflow.enrich", true)) {367 if (Gatherer.config.get("workflow.enrich", true)) { 337 368 checklist_pane.add(workflow_enrich); 338 369 } 339 if (Gatherer.config.get("workflow.design", true)) {370 if (Gatherer.config.get("workflow.design", true)) { 340 371 checklist_pane.add(workflow_design); 341 372 } 342 if (Gatherer.config.get("workflow.export", true)) {373 if (Gatherer.config.get("workflow.export", true)) { 343 374 checklist_pane.add(workflow_export); 344 375 } 345 if (Gatherer.config.get("workflow.create", true)) {376 if (Gatherer.config.get("workflow.create", true)) { 346 377 checklist_pane.add(workflow_create); 347 378 } 348 if (Gatherer.config.get("workflow.preview", true)) {379 if (Gatherer.config.get("workflow.preview", true)) { 349 380 checklist_pane.add(workflow_preview); 350 381 } … … 362 393 363 394 public void dispose() { 364 // Deregister dictionary components365 366 // Connection367 Gatherer.dictionary.deregister(library_path_label);368 Gatherer.dictionary.deregister(use_proxy_checkbox);369 Gatherer.dictionary.deregister(proxy_host_label);370 Gatherer.dictionary.deregister(proxy_port_label);371 372 // General373 Gatherer.dictionary.deregister(view_extracted_metadata_checkbox);374 Gatherer.dictionary.deregister(show_file_size_checkbox);375 Gatherer.dictionary.deregister(language_label);376 377 // Workflow378 Gatherer.dictionary.deregister(title_label);379 Gatherer.dictionary.deregister(workflow_browse);380 Gatherer.dictionary.deregister(workflow_mirror);381 Gatherer.dictionary.deregister(workflow_gather);382 Gatherer.dictionary.deregister(workflow_enrich);383 Gatherer.dictionary.deregister(workflow_design);384 Gatherer.dictionary.deregister(workflow_export);385 Gatherer.dictionary.deregister(workflow_create);386 Gatherer.dictionary.deregister(workflow_preview);387 Gatherer.dictionary.deregister(predefined_label);388 389 // Dialog390 Gatherer.dictionary.deregister(this);391 Gatherer.dictionary.deregister(tab_pane);392 Gatherer.dictionary.deregister(ok_button);393 Gatherer.dictionary.deregister(apply_button);394 Gatherer.dictionary.deregister(cancel_button);395 395 // Dispose 396 396 super.dispose(); … … 534 534 Gatherer.dictionary.changeDictionary(entry.getLocale()); 535 535 // Display message 536 JOptionPane.showMessageDialog(Gatherer.g_man, Gatherer.dictionary.get("Preferences.General.Restart_Required"), Gatherer.dictionary.get("Preferences.General.Restart_Required"), JOptionPane.WARNING_MESSAGE);536 JOptionPane.showMessageDialog(Gatherer.g_man, Dictionary.newget("Preferences.General.Restart_Required"), Dictionary.newget("Preferences.General.Restart_Required"), JOptionPane.WARNING_MESSAGE); 537 537 } 538 538 }
Note:
See TracChangeset
for help on using the changeset viewer.