Changeset 5529 for trunk/gli/src/org/greenstone/gatherer/cdm
- Timestamp:
- 2003-09-24T16:09:13+12:00 (21 years ago)
- Location:
- trunk/gli/src/org/greenstone/gatherer/cdm
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/cdm/GeneralManager.java
r5357 r5529 25 25 *######################################################################## 26 26 */ 27 27 28 package org.greenstone.gatherer.cdm; 29 28 30 import java.awt.*; 29 31 import java.awt.event.*; … … 70 72 // Creation 71 73 JPanel tree_pane = new JPanel(); 72 JLabel title = new JLabel(get("CDM.GUI.Design_Topics")); 74 JLabel title = new JLabel(); 75 Gatherer.dictionary.setText(title, "CDM.GUI.Design_Topics", null); 73 76 tree = new DesignTree(); 74 77 view = controls; … … 106 109 /** Refresh the values on our controls that could be stale due to changes in other components. */ 107 110 public void gainFocus() { 108 if (view != null) {111 if (view != null) { 109 112 view.gainFocus(); 110 113 } … … 113 116 /** Saves the state of the controls in the current view. */ 114 117 public void loseFocus() { 115 if (view != null) {118 if (view != null) { 116 119 view.loseFocus(); 117 120 } 118 }119 120 /** Overloaded to call get with both a key and an empty argument array.121 * @param key a String which is mapped to a key within the dictionary122 * @return a String which has been referenced by the key and that either contains no argument fields, or has had the argument fields automatically populated with arguments provided in the get call123 */124 private String get(String key) {125 return get(key, null);126 }127 128 /** 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>129 * 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>.130 * @param key A <strong>String</strong> which is mapped to a initial String within the ResourceBundle.131 * @param args A <strong>String[]</strong> used to populate argument fields within the complete String.132 * @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.133 * @see org.greenstone.gatherer.Gatherer134 * @see org.greenstone.gatherer.Dictionary135 */136 private String get(String key, String args[]) {137 if(key.indexOf('.') == -1) {138 key = "CDM.GUI." + key;139 }140 return Gatherer.dictionary.get(key, args);141 121 } 142 122 … … 191 171 beta_collectionmeta = new CollectionMeta(CollectionDesignManager.collect_config.getBeta()); 192 172 public_collectionmeta = new CollectionMeta(CollectionDesignManager.collect_config.getPublic()); 193 173 194 174 // Creation 195 175 JPanel instruction_panel = new JPanel(); 196 title_label = new JLabel( "CDM.General.Title");176 title_label = new JLabel(); 197 177 title_label.setHorizontalAlignment(JLabel.CENTER); 198 instructions_textarea = new JTextArea("CDM.General.Instructions"); 178 Gatherer.dictionary.setText(title_label, "CDM.General.Title", null); 179 180 instructions_textarea = new JTextArea(); 199 181 instructions_textarea.setCaretPosition(0); 200 182 instructions_textarea.setEditable(false); … … 202 184 instructions_textarea.setRows(6); 203 185 instructions_textarea.setWrapStyleWord(true); 186 Gatherer.dictionary.setText(instructions_textarea, "CDM.General.Instructions", null); 204 187 205 188 JPanel all_details_panel = new JPanel(); 206 189 JPanel details_panel = new JPanel(); 207 190 JPanel creator_panel = new JPanel(); 208 creator_label = new JLabel( "CDM.General.Email.Creator");191 creator_label = new JLabel(); 209 192 creator_label.setPreferredSize(LABEL_SIZE); 193 Gatherer.dictionary.setText(creator_label, "CDM.General.Email.Creator", null); 194 210 195 creator_emailfield = new EmailField(Gatherer.config.getColor("coloring.error_background", false)); 196 Gatherer.dictionary.setTooltip(creator_emailfield, "CDM.General.Email.Creator_Tooltip"); 197 211 198 JPanel maintainer_panel = new JPanel(); 212 maintainer_label = new JLabel( "CDM.General.Email.Maintainer");199 maintainer_label = new JLabel(); 213 200 maintainer_label.setPreferredSize(LABEL_SIZE); 201 Gatherer.dictionary.setText(maintainer_label, "CDM.General.Email.Maintainer", null); 202 214 203 maintainer_emailfield = new EmailField(Gatherer.config.getColor("coloring.error_background", false)); 215 public_checkbox = new JCheckBox("CDM.General.Access", public_collectionmeta.getValue(CollectionMeta.TEXT).equals(CollectionConfiguration.TRUE_STR)); 216 beta_checkbox = new JCheckBox("CDM.General.Beta", beta_collectionmeta.getValue(CollectionMeta.TEXT).equals(CollectionConfiguration.TRUE_STR)); 204 Gatherer.dictionary.setTooltip(maintainer_emailfield, "CDM.General.Email.Maintainer_Tooltip"); 205 public_checkbox = new JCheckBox("", public_collectionmeta.getValue(CollectionMeta.TEXT).equals(CollectionConfiguration.TRUE_STR)); 206 Gatherer.dictionary.setText(public_checkbox, "CDM.General.Access", null); 207 beta_checkbox = new JCheckBox("", beta_collectionmeta.getValue(CollectionMeta.TEXT).equals(CollectionConfiguration.TRUE_STR)); 208 Gatherer.dictionary.setText(beta_checkbox, "CDM.General.Beta", null); 217 209 JPanel name_panel = new JPanel(); 218 name_label = new JLabel( "CDM.General.Collection_Name");210 name_label = new JLabel(); 219 211 name_label.setPreferredSize(LABEL_SIZE); 220 name_textfield = new JTextField(); 212 Gatherer.dictionary.setText(name_label, "CDM.General.Collection_Name", null); 213 name_textfield = new JTextField("CDM.General.Collection_Name"); 214 Gatherer.dictionary.setTooltip(name_textfield, "CDM.General.Collection_Name_Tooltip"); 221 215 JPanel icon_panel = new JPanel(); 222 icon_label = new JLabel( "CDM.General.Icon_Collection");216 icon_label = new JLabel(); 223 217 icon_label.setPreferredSize(LABEL_SIZE); 224 icon_textfield = new JTextField(); 218 Gatherer.dictionary.setText(icon_label, "CDM.General.Icon_Collection", null); 219 icon_textfield = new JTextField("CDM.General.Icon_Collection"); 220 Gatherer.dictionary.setTooltip(icon_textfield, "CDM.General.Icon_Collection_Tooltip"); 225 221 JPanel small_icon_panel = new JPanel(); 226 222 small_icon_label = new JLabel("CDM.General.Icon_Collection_Small"); 227 223 small_icon_label.setPreferredSize(LABEL_SIZE); 228 small_icon_textfield = new JTextField(); 224 Gatherer.dictionary.setText(small_icon_label, "CDM.General.Icon_Collection_Small", null); 225 small_icon_textfield = new JTextField("CDM.General.Icon_Collection_Small"); 226 Gatherer.dictionary.setTooltip(small_icon_textfield, "CDM.General.Icon_Collection_Small_Tooltip"); 229 227 JPanel description_panel = new JPanel(); 230 description_label = new JLabel( "CDM.General.Collection_Extra");228 description_label = new JLabel(); 231 229 description_label.setPreferredSize(LABEL_SIZE); 230 Gatherer.dictionary.setText(description_label, "CDM.General.Collection_Extra", null); 232 231 description_textarea = new JTextArea(); 233 232 description_textarea.setBackground(Gatherer.config.getColor("coloring.editable_background", false)); 233 Gatherer.dictionary.setTooltip(description_textarea, "CDM.General.Collection_Extra_Tooltip"); 234 234 // Connection 235 235 beta_checkbox.addActionListener(CollectionDesignManager.change_listener); … … 241 241 name_textfield.getDocument().addDocumentListener(CollectionDesignManager.change_listener); 242 242 small_icon_textfield.getDocument().addDocumentListener(CollectionDesignManager.change_listener); 243 Gatherer.dictionary.register(beta_checkbox, null, false); 244 Gatherer.dictionary.register(creator_label, null, false); 245 Gatherer.dictionary.register(description_label, null, false); 246 Gatherer.dictionary.register(icon_label, null, false); 247 Gatherer.dictionary.register(instructions_textarea, null, false); 248 Gatherer.dictionary.register(maintainer_label, null, false); 249 Gatherer.dictionary.register(name_label, null, false); 250 Gatherer.dictionary.register(public_checkbox, null, false); 251 Gatherer.dictionary.register(small_icon_label, null, false); 252 Gatherer.dictionary.register(title_label, null, false); 243 253 244 // Layout 254 245 instruction_panel.setBorder(BorderFactory.createEmptyBorder(0,0,5,0)); … … 299 290 add(all_details_panel, BorderLayout.CENTER); 300 291 } 292 301 293 /** Destructor. */ 302 294 public void destroy() { 303 Gatherer.dictionary.deregister(beta_checkbox); 304 Gatherer.dictionary.deregister(creator_label); 305 Gatherer.dictionary.deregister(description_label); 306 Gatherer.dictionary.deregister(icon_label); 307 Gatherer.dictionary.deregister(instructions_textarea); 308 Gatherer.dictionary.deregister(maintainer_label); 309 Gatherer.dictionary.deregister(name_label); 310 Gatherer.dictionary.deregister(public_checkbox); 311 Gatherer.dictionary.deregister(small_icon_label); 312 Gatherer.dictionary.deregister(title_label); 313 } 295 } 296 314 297 /** Called to refresh the components. */ 315 298 public void gainFocus() { … … 361 344 public DesignTree() { 362 345 super(); 363 root = new DesignNode(" CDM.GUI.Root");346 root = new DesignNode("Root"); 364 347 this.setModel(new DefaultTreeModel(root)); 365 348 // Now add the design categories. … … 390 373 /** Constructor. 391 374 * @param object The <strong>Object</strong> assigned to this node. 392 375 */ 393 376 public DesignNode(String object) { 394 377 super(object); … … 398 381 */ 399 382 public String toString() { 400 return get((String)getUserObject());383 return Gatherer.dictionary.get("CDM.GUI." + (String)getUserObject()); 401 384 } 402 385 } -
trunk/gli/src/org/greenstone/gatherer/cdm/PlugInManager.java
r5342 r5529 145 145 } 146 146 if(plugin.getName().equals(StaticStrings.ARCPLUG_STR) || plugin.getName().equals(StaticStrings.RECPLUG_STR)) { 147 JOptionPane.showMessageDialog(Gatherer.g_man, get("CDM.Move.Fixed"),get("CDM.Move.Title"), JOptionPane.ERROR_MESSAGE);147 JOptionPane.showMessageDialog(Gatherer.g_man, Gatherer.dictionary.get("CDM.Move.Fixed"), Gatherer.dictionary.get("CDM.Move.Title"), JOptionPane.ERROR_MESSAGE); 148 148 return; 149 149 } … … 182 182 if(index < 0) { 183 183 String args[] = new String[2]; 184 args[0] = get("CDM.PlugInManager.PlugIn_Str");184 args[0] = Gatherer.dictionary.get("CDM.PlugInManager.PlugIn_Str"); 185 185 args[1] = plugin.getName(); 186 JOptionPane.showMessageDialog(Gatherer.g_man, get("CDM.Move.At_Top", args),get("CDM.Move.Title"), JOptionPane.ERROR_MESSAGE);186 JOptionPane.showMessageDialog(Gatherer.g_man, Gatherer.dictionary.get("CDM.Move.At_Top", args), Gatherer.dictionary.get("CDM.Move.Title"), JOptionPane.ERROR_MESSAGE); 187 187 return; 188 188 } … … 197 197 String args[] = new String[1]; 198 198 args[0] = plugin.getName(); 199 JOptionPane.showMessageDialog(Gatherer.g_man, get("CDM.Move.Cannot", args),get("CDM.Move.Title"), JOptionPane.ERROR_MESSAGE);199 JOptionPane.showMessageDialog(Gatherer.g_man, Gatherer.dictionary.get("CDM.Move.Cannot", args), Gatherer.dictionary.get("CDM.Move.Title"), JOptionPane.ERROR_MESSAGE); 200 200 // Still not going to move RecPlug or ArcPlug. 201 201 return; … … 279 279 } 280 280 281 /* Retrieve a phrase from the dictionary based on a certain key.282 * @param key The search <strong>String</strong>.283 * @return The matching phrase from the Dictionary.284 */285 private String get(String key) {286 return get(key, (String[])null);287 }288 289 private String get(String key, String arg) {290 String args[] = new String[1];291 args[0] = arg;292 return get(key, args);293 }294 295 /* Retrieve a phrase from the dictionary based on a certain key and arguments.296 * @param key The search <strong>String</strong>.297 * @param args A <strong>String[]</strong> of arguments used to complete and format the choosen phrase.298 * @return The matching phrase from the Dictionary.299 */300 private String get(String key, String args[]) {301 if(key.indexOf(".") == -1) {302 key = "CDM.PlugInManager." + key;303 }304 return Gatherer.dictionary.get(key, args);305 }306 281 307 282 /** Retrieve a list of those plugins that are in library but not in the assigned plugins. */ … … 398 373 String plugin_name = getPlugInName(plugin); 399 374 //Gatherer.println("Zero length argument xml detected for: " + plugin_name); 400 JOptionPane.showMessageDialog(Gatherer.g_man, get("CDM.PlugInManager.PlugIn_XML_Parse_Failed", plugin_name),get("General.Error"), JOptionPane.ERROR_MESSAGE);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); 401 376 } 402 377 } … … 435 410 if(files != null) { 436 411 // Create a progress indicator. 437 ParsingProgress progress = new ParsingProgress( get("CDM.PlugInManager.Parsing.Title"),get("CDM.PlugInManager.Parsing.Message"), files.length);412 ParsingProgress progress = new ParsingProgress(Gatherer.dictionary.get("CDM.PlugInManager.Parsing.Title"), Gatherer.dictionary.get("CDM.PlugInManager.Parsing.Message"), files.length); 438 413 for(int i = 0; i < files.length; i++) { 439 414 // We only want to check Perl Modules. … … 565 540 /** The area where the add, configure and remove buttons are placed. */ 566 541 private JPanel button_pane = null; 567 /** The region which divides the central portion of the view into list and controls .*/542 /** The region which divides the central portion of the view into list and controls */ 568 543 private JPanel central_pane = null; 569 544 /** The area where title label and instructions sit. */ … … 577 552 /** The text area containing instructions on the use of this control. */ 578 553 private JTextArea instructions = null; 554 579 555 /** Constructor. 580 556 */ 581 557 public PlugInControl() { 582 558 // Create 583 add = new JButton( get("CDM.PlugInManager.Add"));559 add = new JButton(); 584 560 add.setMnemonic(KeyEvent.VK_A); 561 Gatherer.dictionary.setBoth(add, "CDM.PlugInManager.Add", "CDM.PlugInManager.Add_Tooltip"); 562 585 563 button_pane = new JPanel(); 586 564 central_pane = new JPanel(); 587 configure = new JButton(get("CDM.PlugInManager.Configure")); 565 566 configure = new JButton(); 588 567 configure.setEnabled(false); 589 568 configure.setMnemonic(KeyEvent.VK_C); 569 Gatherer.dictionary.setBoth(configure, "CDM.PlugInManager.Configure", "CDM.PlugInManager.Configure_Tooltip"); 570 590 571 header_pane = new JPanel(); 591 instructions = new JTextArea(get("CDM.PlugInManager.Instructions")); 572 573 instructions = new JTextArea(); 592 574 instructions.setBackground(Gatherer.config.getColor("coloring.collection_tree_background", false)); 593 575 instructions.setEditable(false); … … 595 577 instructions.setRows(6); 596 578 instructions.setWrapStyleWord(true); 597 598 move_top_button = new DoubleImageButton(get("CDM.Move.Move_Top"), Utility.getImage("arrow-top.gif"), Utility.getImage("arrow-top-disabled.gif")); 579 Gatherer.dictionary.setText(instructions, "CDM.PlugInManager.Instructions", null); 580 581 move_top_button = new DoubleImageButton("", Utility.getImage("arrow-top.gif"), Utility.getImage("arrow-top-disabled.gif")); 599 582 move_top_button.setEnabled(false); 600 583 move_top_button.setMnemonic(KeyEvent.VK_T); 601 move_top_button.setDisplayedMnemonicIndex(8); // !! English-centric hack584 // move_top_button.setDisplayedMnemonicIndex(8); // !! English-centric hack 602 585 move_top_button.setPreferredSize(Utility.DOUBLE_IMAGE_BUTTON_SIZE); 603 604 move_up_button = new DoubleImageButton(get("CDM.Move.Move_Up"), Utility.getImage("arrow-up.gif"), Utility.getImage("arrow-up-disabled.gif")); 586 Gatherer.dictionary.setBoth(move_top_button, "CDM.Move.Move_Top", "CDM.Move.Move_Top_Tooltip"); 587 588 move_up_button = new DoubleImageButton("", Utility.getImage("arrow-up.gif"), Utility.getImage("arrow-up-disabled.gif")); 605 589 move_up_button.setEnabled(false); 606 590 move_up_button.setMnemonic(KeyEvent.VK_U); 607 591 move_up_button.setPreferredSize(Utility.DOUBLE_IMAGE_BUTTON_SIZE); 608 609 move_down_button = new DoubleImageButton(get("CDM.Move.Move_Down"), Utility.getImage("arrow-down.gif"), Utility.getImage("arrow-down-disabled.gif")); 592 Gatherer.dictionary.setBoth(move_up_button, "CDM.Move.Move_Up", "CDM.Move.Move_Up_Tooltip"); 593 594 move_down_button = new DoubleImageButton("", Utility.getImage("arrow-down.gif"), Utility.getImage("arrow-down-disabled.gif")); 610 595 move_down_button.setEnabled(false); 611 596 move_down_button.setMnemonic(KeyEvent.VK_D); 612 597 move_down_button.setPreferredSize(Utility.DOUBLE_IMAGE_BUTTON_SIZE); 613 614 move_bottom_button = new DoubleImageButton(get("CDM.Move.Move_Bottom"), Utility.getImage("arrow-bottom.gif"), Utility.getImage("arrow-bottom-disabled.gif")); 598 Gatherer.dictionary.setBoth(move_down_button, "CDM.Move.Move_Down", "CDM.Move.Move_Down_Tooltip"); 599 600 move_bottom_button = new DoubleImageButton("", Utility.getImage("arrow-bottom.gif"), Utility.getImage("arrow-bottom-disabled.gif")); 615 601 move_bottom_button.setEnabled(false); 616 602 move_bottom_button.setMnemonic(KeyEvent.VK_B); 617 603 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"); 618 605 619 606 movement_pane = new JPanel(); … … 626 613 plugin.setTextNonSelectionColor(Gatherer.config.getColor("coloring.workspace_tree_foreground", false)); 627 614 plugin.setTextSelectionColor(Gatherer.config.getColor("coloring.collection_selection_foreground", false)); 628 629 plugin_label = new JLabel(get("CDM.PlugInManager.PlugIn")); 615 Gatherer.dictionary.setTooltip(plugin, "CDM.PlugInManager.PlugIn_Tooltip"); 616 617 plugin_label = new JLabel(); 618 Gatherer.dictionary.setText(plugin_label, "CDM.PlugInManager.PlugIn", null); 619 630 620 plugin_list = new JList(model); 631 621 plugin_list.setCellRenderer(new ListRenderer()); 632 622 plugin_list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); 633 plugin_list_label = new JLabel( get("CDM.PlugInManager.Assigned"));623 plugin_list_label = new JLabel(); 634 624 plugin_list_label.setHorizontalAlignment(JLabel.CENTER); 635 625 plugin_list_label.setOpaque(true); 626 Gatherer.dictionary.setText(plugin_list_label, "CDM.PlugInManager.Assigned", null); 627 636 628 plugin_list_pane = new JPanel(); 637 629 plugin_pane = new JPanel(); 638 remove = new JButton(get("CDM.PlugInManager.Remove")); 630 631 remove = new JButton(); 639 632 remove.setEnabled(false); 640 633 remove.setMnemonic(KeyEvent.VK_R); 641 title = new JLabel(get("CDM.PlugInManager.Title")); 634 Gatherer.dictionary.setBoth(remove, "CDM.PlugInManager.Remove", "CDM.PlugInManager.Remove_Tooltip"); 635 636 title = new JLabel(); 642 637 title.setHorizontalAlignment(JLabel.CENTER); 643 638 title.setOpaque(true); 639 Gatherer.dictionary.setText(title, "CDM.PlugInManager.Title", null); 640 644 641 // Listeners 645 642 add.addActionListener(new AddListener()); … … 653 650 plugin_list.addMouseListener(new ClickListener()); 654 651 plugin_list.addListSelectionListener(new ListListener()); 652 655 653 // Layout 656 654 title.setBorder(BorderFactory.createEmptyBorder(0,0,2,0)); … … 683 681 plugin_pane.add(plugin); 684 682 683 button_pane.setLayout(new GridLayout(1,3)); 684 button_pane.add(add); 685 button_pane.add(configure); 686 button_pane.add(remove); 687 685 688 // Scope these mad bordering skillz. 689 // !! TO DO: Dictionary registration !! 686 690 JPanel temp = new JPanel(new BorderLayout()); 687 691 temp.setBorder … … 689 693 (BorderFactory.createEmptyBorder(5,0,5,0), 690 694 BorderFactory.createCompoundBorder 691 (BorderFactory.createTitledBorder( get("CDM.PlugInManager.Controls")),695 (BorderFactory.createTitledBorder(Gatherer.dictionary.get("CDM.PlugInManager.Controls")), 692 696 BorderFactory.createEmptyBorder(2,2,2,2)))); 693 697 … … 698 702 central_pane.add(plugin_list_pane, BorderLayout.CENTER); 699 703 central_pane.add(temp, BorderLayout.SOUTH); 700 701 button_pane.setLayout(new GridLayout(1,3));702 button_pane.add(add);703 button_pane.add(configure);704 button_pane.add(remove);705 704 706 705 setBorder(BorderFactory.createEmptyBorder(5,5,5,5)); … … 708 707 add(header_pane, BorderLayout.NORTH); 709 708 add(central_pane, BorderLayout.CENTER); 710 //add(button_pane, BorderLayout.SOUTH);711 } 709 } 710 712 711 /** Method which acts like a destructor, tidying up references to persistant objects. 713 712 */ … … 725 724 726 725 public void loseFocus() { 727 728 726 } 729 727 … … 770 768 } 771 769 else { 772 JOptionPane.showMessageDialog(Gatherer.g_man, get("CDM.PlugInManager.PlugIn_Exists"),get("General.Error"), JOptionPane.ERROR_MESSAGE);770 JOptionPane.showMessageDialog(Gatherer.g_man, Gatherer.dictionary.get("CDM.PlugInManager.PlugIn_Exists"), Gatherer.dictionary.get("General.Error"), JOptionPane.ERROR_MESSAGE); 773 771 } 774 772 base_plugin = null; … … 930 928 */ 931 929 static private JPanel getSeparator() { 932 // we put the separator inside a panel to control 933 // its appearance 930 // We put the separator inside a panel to control its appearance 934 931 JPanel _sepPanel = new JPanel(); 935 932 _sepPanel.setOpaque(false);
Note:
See TracChangeset
for help on using the changeset viewer.