- Timestamp:
- 2003-09-26T14:58:33+12:00 (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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();
Note:
See TracChangeset
for help on using the changeset viewer.