Changeset 6389
- Timestamp:
- 2004-01-09T15:08:11+13:00 (20 years ago)
- Location:
- trunk/gli/src/org/greenstone/gatherer
- Files:
-
- 1 added
- 21 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/Configuration.java
r6319 r6389 58 58 static final public boolean COLLECTION_SPECIFIC = true; 59 59 static final public boolean GENERAL_SETTING = true; 60 61 static final public int ASSISTANT_MODE = 1; 62 static final public int LIBRARIAN_MODE = 2; 63 static final public int SYSTEMS_MODE = 3; 64 static final public int EXPERT_MODE = 4; 60 65 61 66 /** The string identifying an argument's name attribute. */ … … 456 461 } 457 462 463 /** Because modes will soon be an integral part of GLI, they get their own easy to remember methods such as this one to get the mode. 464 * @return an int representing the mode 465 */ 466 public int getMode() { 467 return getInt("general.mode", GENERAL_SETTING); 468 } 469 470 /** Return the current mode as a string for use in title bar etc 471 * @return the mode as a String 472 */ 473 public String getModeAsString() { 474 String result; 475 switch(getInt("general.mode", GENERAL_SETTING)) { 476 case ASSISTANT_MODE: 477 result = Dictionary.get("Preferences.Mode.Assistant"); 478 break; 479 case SYSTEMS_MODE: 480 result = Dictionary.get("Preferences.Mode.Systems"); 481 break; 482 case EXPERT_MODE: 483 result = Dictionary.get("Preferences.Mode.Expert"); 484 break; 485 default: 486 result = Dictionary.get("Preferences.Mode.Librarian"); 487 } 488 return result; 489 } 490 458 491 /** Retrieve the value of the named property, and noting whether we consult the general or collection specific configuration. */ 459 492 public String getString(String property, boolean general) { … … 671 704 country = null; 672 705 setString(property, general, text.toString()); 706 } 707 708 /** Because modes will soon be an integral part of GLI, they get their own easy to remember methods such as this one to set the mode. 709 * @param value the new value for mode 710 */ 711 public void setMode(int value) { 712 setInt("general.mode", GENERAL_SETTING, value); 673 713 } 674 714 -
trunk/gli/src/org/greenstone/gatherer/cdm/Argument.java
r6087 r6389 2 2 *######################################################################### 3 3 * 4 * A component of the Gatherer application, part of the Greenstone digital 5 * library suite from the New Zealand Digital Library Project at the 6 * University of Waikato, New Zealand. 4 * A component of the Greenstone Librarian Interface (GLI) application, 5 * part of the Greenstone digital library software suite from the New 6 * Zealand Digital Library Project at the University of Waikato, 7 * New Zealand. 7 8 * 8 * Author: John Thompson, Greenstone Digital Library, University of Waikato 9 * Author: John Thompson 10 * Greenstone Project, New Zealand Digital Library 11 * University of Waikato 12 * http://www.nzdl.org 9 13 * 10 * Copyright (C) 1999 New Zealand Digital Library Project14 * Copyright (C) 2004 New Zealand Digital Library, University of Waikato 11 15 * 12 16 * This program is free software; you can redistribute it and/or modify … … 25 29 *######################################################################## 26 30 */ 31 27 32 package org.greenstone.gatherer.cdm; 28 33 29 34 import java.io.*; 30 35 import java.util.*; 36 import org.greenstone.gatherer.Configuration; 31 37 import org.greenstone.gatherer.Gatherer; 32 38 import org.greenstone.gatherer.cdm.CollectionConfiguration; … … 41 47 42 48 /** This class contains all the details about a single argument that can be passed to this plugin, including option lists if the parameters are restricted. 43 * @author John Thompson, Greenstone Digital Library, University of Waikato44 * @version 2. 349 * @author John Thompson, Greenstone Project, New Zealand Digital Library, University of Waikato 50 * @version 2.41 final 45 51 */ 46 52 public class Argument 47 53 implements Comparable, Serializable { 48 /** An element of the argument type enumeration . */54 /** An element of the argument type enumeration specifying a combobox control. */ 49 55 static final public byte ENUM = 0; 50 /** An element of the argument type enumeration . */56 /** An element of the argument type enumeration specifying a checkbox control. */ 51 57 static final public byte FLAG = 1; 52 /** An element of the argument type enumeration . */58 /** An element of the argument type enumeration specifying a tree control. */ 53 59 static final public byte HIERARCHY = 2; 54 /** An element of the argument type enumeration . */60 /** An element of the argument type enumeration specifying a spinner control. */ 55 61 static final public byte INTEGER = 3; 56 /** An element of the argument type enumeration . */62 /** An element of the argument type enumeration specifying a language combobox control. */ 57 63 static final public byte LANGUAGE = 4; 58 /** An element of the argument type enumeration . */64 /** An element of the argument type enumeration specifying a list control. */ 59 65 static final public byte METADATA = 5; 60 /** An element of the argument type enumeration . */66 /** An element of the argument type enumeration specifying a metadata combobox control. */ 61 67 static final public byte METADATUM = 6; 62 /** An element of the argument type enumeration . */68 /** An element of the argument type enumeration specifying a text field. */ 63 69 static final public byte STRING = 7; 70 /** An element of the argument type enumeration specifying a regular expression text field. */ 71 static final public byte REGEXP = 8; 72 /** true if this argument should actually be hidden within the GLI. This is iportant for arguments such as import dir or other location critical arguments. */ 73 private boolean hidden_gli = false; 64 74 /** <i>true</i> if this argument is required for the applicable script to work properly, <i>false</i> otherwise. */ 65 75 private boolean required = false; 66 /** The type of this argument. Initiallyan int, but bytes are cheaper. */76 /** The type of this argument. Used to be an int, but bytes are cheaper. */ 67 77 private byte type = STRING; 68 69 78 /** The maximum value an integer based control can have. */ 70 79 private int maximum = Integer.MAX_VALUE; 71 80 /** The minimum value an integer based control can have. */ 72 81 private int minimum = Integer.MIN_VALUE; 73 82 /** Every argument has a detail mode level at which it becomes available to the user to edit. 83 * @see org.greenstone.gatherer.Configuration 84 */ 85 private int mode_level = Configuration.LIBRARIAN_MODE; 86 /** The DOM element this argument is built around, if any. */ 74 87 private Element element; 75 88 /** If the argument is of type ENUM then this map holds all the various options. Each entry is an <option value> -> <description> mapping. */ … … 88 101 } 89 102 103 /** Another constructor but this one is a little more interesting as it takes a DOM element. 104 * @param element the Element this argument is based around 105 */ 90 106 public Argument(Element element) { 91 107 this.element = element; … … 93 109 94 110 /** Method to add an element to the option list. 95 * @param name The name value of the option as a <strong>String</strong>.96 * @param desc The description of this options as a <strong>String</strong>.111 * @param name the name value of the option as a String 112 * @param desc the description of this options as a String 97 113 */ 98 114 public void addOption(String name, String desc) { … … 109 125 110 126 /** Method to compare two arguments for ordering. 111 * @param object The argument we are comparing to, as an <strong>Object</strong>. 112 * @return An <i>int</i> specifying the argument order, using values as set out in String. 113 * @see java.lang.String#compareTo 127 * @param object the argument we are comparing to, as an Object 128 * @return an int specifying the argument order, using values as set out in String 114 129 * @see org.greenstone.gatherer.cdm.Argument 115 130 */ … … 123 138 } 124 139 140 /** Create a copy of this argument. 141 * @return a newly created Argument with the same details as this one 142 */ 125 143 public Argument copy() { 126 144 Argument copy = new Argument(); … … 136 154 137 155 /** Method to determine if two arguments are equal. 138 * @param object The argument to test against, as an <strong>Object</strong>.139 * @return <i>true</i> if the arguments names match, <i>false</i> otherwise.156 * @param object the argument to test against, as an Object 157 * @return true if the arguments names match, false otherwise 140 158 */ 141 159 public boolean equals(Object object) { … … 144 162 145 163 /** Method to retrieve the value of default_value. 146 * @return A <strong>String</strong> containing the default value.164 * @return a String containing the default value 147 165 */ 148 166 public String getDefaultValue() { … … 151 169 152 170 /** Method to retrieve this arguments description. 153 * @return A <strong>String</strong> containing the description.171 * @return a String containing the description 154 172 */ 155 173 public String getDescription() { … … 158 176 159 177 /** Method to retrieve the description of a certain list option value. 160 * @param key The <strong>String</strong> whose description we are searching for.161 * @return The description of the desired key as a <strong>String</strong> which may be empty if no such key exists.178 * @param key the String whose description we are searching for 179 * @return the description of the desired key as a String which may be empty if no such key exists 162 180 */ 163 181 public String getDescription(String key) { … … 168 186 } 169 187 188 /** Retrieve the upper bound of a range based argument. 189 * @return the maximum as an int 190 */ 170 191 public int getMaximum() { 171 192 return maximum; 172 193 } 173 194 195 /** Retrieve the lower bound of a range based argument. 196 * @return the minimum as an int 197 */ 174 198 public int getMinimum() { 175 199 return minimum; 176 200 } 177 201 178 /** Method to retrieve the option list forthis argument.179 * @return A <strong>HashMap</strong> containing <option value> -> <description> entries.180 */ 181 public HashMap getOptions() {182 return list;202 /** Retrieves the mode level at which this argument should become available. Any higher levels should also see this argument. 203 * @return the mode level as an int 204 */ 205 public int getModeLevel() { 206 return mode_level; 183 207 } 184 208 185 209 /** Method to retrieve the value of name. 186 * @return A <strong>String</strong> containing the argument name. 210 * @return a String containing the argument name 211 * @see org.greenstone.gatherer.util.StaticStrings#NAME_ATTRIBUTE 187 212 */ 188 213 public String getName() { … … 193 218 } 194 219 220 /** Method to retrieve the option list for this argument. 221 * @return a HashMap containing <option value> -> <description> entries 222 */ 223 public HashMap getOptions() { 224 return list; 225 } 226 195 227 /** Retrieve the name of the owner of this argument. 196 * @return The owners name as a <strong>String</strong>.228 * @return the owners name as a String 197 229 */ 198 230 public String getOwner() { … … 201 233 202 234 /** Method to determine the type of this argument. 203 * @return An <i>byte</i> specifying the type.235 * @return a byte specifying the type 204 236 */ 205 237 public byte getType() { … … 208 240 209 241 /** Method to retrieve the value of value. 210 * @return The value of value as a <strong>String</strong>. 242 * @return the value of value as a String 243 * @see org.greenstone.gatherer.Gatherer#c_man 244 * @see org.greenstone.gatherer.collection.Collection#msm 245 * @see org.greenstone.gatherer.collection.CollectionManager#getCollection 246 * @see org.greenstone.gatherer.msm.ElementWrapper 247 * @see org.greenstone.gatherer.msm.MetadataSetManager#getElement(String) 248 * @see org.greenstone.gatherer.msm.MSMUtils#getValue(Element) 211 249 */ 212 250 public String getValue() { … … 227 265 228 266 /** Retrieve the vector of values. 229 * @return An <strong>ArrayList</strong> of values. 267 * @return an ArrayList of values 268 * @see org.greenstone.gatherer.Gatherer#c_man 269 * @see org.greenstone.gatherer.collection.Collection#msm 270 * @see org.greenstone.gatherer.collection.CollectionManager#getCollection 271 * @see org.greenstone.gatherer.msm.ElementWrapper 272 * @see org.greenstone.gatherer.msm.MetadataSetManager#getElement(String) 273 * @see org.greenstone.gatherer.msm.MSMUtils#getValue(Element) 230 274 */ 231 275 public ArrayList getValues() { … … 250 294 251 295 /** Method to determine if this argument has been assigned. 252 * @return <i>true</i> if it has, <i>false</i> otherwise. 296 * @return true if it has, false otherwise 297 * @see org.greenstone.gatherer.util.StaticStrings#ASSIGNED_ATTRIBUTE 298 * @see org.greenstone.gatherer.util.StaticStrings#TRUE_STR 253 299 */ 254 300 public boolean isAssigned() { … … 256 302 } 257 303 304 /** Determine if this is a custom argument ie one that has been parsed from the config file but doesn't have a matching entry in the argument library. 305 * @return true if this argument is a custom, false otherwise 306 * @see org.greenstone.gatherer.util.StaticStrings#CUSTOM_ATTRIBUTE 307 * @see org.greenstone.gatherer.util.StaticStrings#TRUE_STR 308 */ 258 309 public boolean isCustomArgument() { 259 310 return (element != null && element.getAttribute(StaticStrings.CUSTOM_ATTRIBUTE).equals(StaticStrings.TRUE_STR)); 260 311 } 261 312 313 /** Determine if this argument is hidden in GLI 314 * @return true if the argument is hidden, false otherwise 315 */ 316 public boolean isHiddenGLI() { 317 return hidden_gli; 318 } 319 262 320 /** Method to determine of this argument is required for the associated script to work. 263 * @return <i>true</i> if this argument is required, <i>false</i> otherwise.321 * @return true if this argument is required, false otherwise 264 322 */ 265 323 public boolean isRequired() { … … 269 327 /** Method to allow for the activation of arguments that might never have their setValue() method called. 270 328 * @param assigned the desired state as a boolean 329 * @see org.greenstone.gatherer.util.StaticStrings#ASSIGNED_ATTRIBUTE 330 * @see org.greenstone.gatherer.util.StaticStrings#FALSE_STR 331 * @see org.greenstone.gatherer.util.StaticStrings#TRUE_STR 271 332 */ 272 333 public void setAssigned(boolean assigned) { … … 276 337 } 277 338 339 /** Set the custom argument flag. 340 * @param custom true to make this argument custom, false otherwise 341 * @see org.greenstone.gatherer.util.StaticStrings#CUSTOM_ATTRIBUTE 342 * @see org.greenstone.gatherer.util.StaticStrings#FALSE_STR 343 * @see org.greenstone.gatherer.util.StaticStrings#TRUE_STR 344 */ 278 345 public void setCustomArgument(boolean custom) { 279 346 if(element != null) { … … 290 357 291 358 /** Set the value of desc. 292 * @param description The new value of desc as a <strong>String</strong>.359 * @param description the new value of desc as a String 293 360 */ 294 361 public void setDescription(String description) { … … 296 363 } 297 364 365 /** Set the element this argument should be based upon. 366 * @param element the Element 367 */ 298 368 public void setElement(Element element) { 299 369 this.element = element; 300 370 } 301 371 372 /** Mark this argument as being hidden in GLI. */ 373 public void setHiddenGLI() { 374 hidden_gli = true; 375 } 376 377 /** Set the upper bound for a range type argument. 378 * @param maximum the maximum as an int 379 */ 302 380 public void setMaximum(int maximum) { 303 381 this.maximum = maximum; 304 382 } 305 383 384 /** Set the lower bound for a range type argument. 385 * @param minimum the minimum as an int 386 */ 306 387 public void setMinimum(int minimum) { 307 388 this.minimum = minimum; 308 389 } 309 390 391 /** Set the detail mode level where this argument will become available. 392 * @param mode_level the mode level as an int 393 */ 394 public void setModeLevel(int mode_level) { 395 this.mode_level = mode_level; 396 } 397 310 398 /** Set the value of name. 311 * @param name The new value of name as a <strong>String</strong>.399 * @param name the new value of name as a String 312 400 */ 313 401 public void setName(String name) { … … 316 404 317 405 /** Sets the value of the options list. 318 * @param list The new options list as a <strong>HashMap</strong>.406 * @param list the new options list as a HashMap 319 407 */ 320 408 public void setOptions(HashMap list) { … … 323 411 324 412 /** Set the owner of this argument. 325 * @param owner The name of the owner of this argument as a <strong>String</strong>.413 * @param owner the name of the owner of this argument as a String 326 414 */ 327 415 public void setOwner(String owner) { … … 330 418 331 419 /** Set the value of required. 332 * @param required The new value of required as a <i>boolean</i>.420 * @param required the new value of required as a boolean 333 421 */ 334 422 public void setRequired(boolean required) { … … 337 425 338 426 /** Set the value of type. 339 * @param type The new value of type as an <i>byte</i>.427 * @param type the new value of type as an byte 340 428 */ 341 429 public void setType(byte type) { … … 344 432 345 433 /** Set the value of type, by matching a type to the given string. 346 * @param new_type A <strong>String</strong> which contains the name of a certain argument type. 434 * @param new_type a String which contains the name of a certain argument type 435 * @see org.greenstone.gatherer.util.StaticStrings#ENUM_STR 436 * @see org.greenstone.gatherer.util.StaticStrings#FLAG_STR 437 * @see org.greenstone.gatherer.util.StaticStrings#HIERARCHY_STR 438 * @see org.greenstone.gatherer.util.StaticStrings#INT_STR 439 * @see org.greenstone.gatherer.util.StaticStrings#LANGUAGE_STR 440 * @see org.greenstone.gatherer.util.StaticStrings#METADATA_TYPE_STR 441 * @see org.greenstone.gatherer.util.StaticStrings#METADATUM_TYPE_STR 442 * @see org.greenstone.gatherer.util.StaticStrings#REGEXP_STR 347 443 */ 348 444 public void setType(String new_type) { … … 369 465 this.type = METADATUM; 370 466 } 467 else if(new_type.equalsIgnoreCase(StaticStrings.REGEXP_STR)) { 468 this.type = REGEXP; 469 } 371 470 else { 372 471 this.type = STRING; 373 472 } 374 375 } 473 } 474 376 475 /** Method to set the value of this argument. 377 * @param value 378 * @see org.greenstone.gatherer.Gatherer 379 * @see org.greenstone.gatherer.msm.MSMUtils 476 * @param value the new value for the argument 477 * @see org.greenstone.gatherer.Gatherer#println 478 * @see org.greenstone.gatherer.msm.MSMUtils#setValue 380 479 */ 381 480 public void setValue(String value) { … … 390 489 /** Set the values vector to the given values. Currently I just assign the new values, whereas I may later want to implement a deep clone. 391 490 * @param values an ArrayList of values 392 * @see org.greenstone.gatherer.Gatherer 393 * @see org.greenstone.gatherer.msm.MSMUtils 491 * @see org.greenstone.gatherer.Gatherer#println 492 * @see org.greenstone.gatherer.msm.MSMUtils#setValue 394 493 */ 395 494 public void setValues(ArrayList values) { … … 411 510 /** Method for translating the data of this class into a string. 412 511 * @return a String containing a fragment of the total arguments string 413 * @see org.greenstone.gatherer.Gatherer 414 * @see org.greenstone.gatherer.collection.Collection 415 * @see org.greenstone.gatherer.collection.CollectionManager 416 * @see org.greenstone.gatherer.msm.MetadataSetManager 417 * @see org.greenstone.gatherer.msm.MSMUtils 418 * @see org.greenstone.gatherer.util.StaticStrings 512 * @see org.greenstone.gatherer.Gatherer#c_man 513 * @see org.greenstone.gatherer.collection.Collection#msm 514 * @see org.greenstone.gatherer.collection.CollectionManager#getCollection 515 * @see org.greenstone.gatherer.msm.MetadataSetManager#getElement(String) 516 * @see org.greenstone.gatherer.msm.MSMUtils#getValue 517 * @see org.greenstone.gatherer.util.StaticStrings#COMMA_CHARACTER 518 * @see org.greenstone.gatherer.util.StaticStrings#NAME_ATTRIBUTE 519 * @see org.greenstone.gatherer.util.StaticStrings#SPACE_CHARACTER 520 * @see org.greenstone.gatherer.util.StaticStrings#SPEECH_CHARACTER 419 521 */ 420 522 public String toString() { -
trunk/gli/src/org/greenstone/gatherer/cdm/ArgumentConfiguration.java
r6324 r6389 31 31 import java.util.*; 32 32 import javax.swing.*; 33 import org.greenstone.gatherer.Configuration; 33 34 import org.greenstone.gatherer.Dictionary; 34 35 import org.greenstone.gatherer.Gatherer; … … 237 238 ArrayList arguments = data.getArguments(true, false); 238 239 int total_height = 250; 240 int mode = Gatherer.config.getMode(); 239 241 for(int i = 0; i < arguments.size(); i++) { 240 242 Argument argument = (Argument) arguments.get(i); 241 ArgumentControl argument_control = new ArgumentControl(argument); 242 total_height = total_height - argument_control.getPreferredSize().height; 243 central_pane.add(argument_control); 243 if(mode > Configuration.LIBRARIAN_MODE || !(argument.getType() == Argument.REGEXP)) { 244 ArgumentControl argument_control = new ArgumentControl(argument); 245 total_height = total_height - argument_control.getPreferredSize().height; 246 central_pane.add(argument_control); 247 } 244 248 } 245 249 if(total_height > 0) { … … 376 380 value = spinner; 377 381 break; 382 case Argument.REGEXP: 378 383 case Argument.STRING: 379 384 // Use a standard text field -
trunk/gli/src/org/greenstone/gatherer/cdm/ClassifierManager.java
r6318 r6389 548 548 private JButton configure = null; 549 549 550 private JButton move_bottom_button;550 //private JButton move_bottom_button; 551 551 552 552 private JButton move_down_button; 553 553 554 private JButton move_top_button;554 //private JButton move_top_button; 555 555 556 556 private JButton move_up_button; … … 565 565 566 566 /** Constructor. 567 * @see org.greenstone.gatherer.cdm.ClassifierManager.C ontrol.AddListener568 * @see org.greenstone.gatherer.cdm.ClassifierManager.C ontrol.ConfigureListener569 * @see org.greenstone.gatherer.cdm.ClassifierManager.C ontrol.RemoveListener567 * @see org.greenstone.gatherer.cdm.ClassifierManager.ClassifierControl.AddListener 568 * @see org.greenstone.gatherer.cdm.ClassifierManager.ClassifierControl.ConfigureListener 569 * @see org.greenstone.gatherer.cdm.ClassifierManager.ClassifierControl.RemoveListener 570 570 */ 571 571 public ClassifierControl() { … … 625 625 JPanel move_button_pane = new JPanel(); 626 626 627 move_top_button = new DoubleImageButton("", Utility.getImage("arrow-top.gif"), Utility.getImage("arrow-top-disabled.gif"));628 move_top_button.setEnabled(false);629 move_top_button.setMnemonic(KeyEvent.VK_T);627 //move_top_button = new DoubleImageButton("", Utility.getImage("arrow-top.gif"), Utility.getImage("arrow-top-disabled.gif")); 628 //move_top_button.setEnabled(false); 629 //move_top_button.setMnemonic(KeyEvent.VK_T); 630 630 // move_top_button.setDisplayedMnemonicIndex(8); // !! English-centric hack 631 move_top_button.setPreferredSize(Utility.DOUBLE_IMAGE_BUTTON_SIZE);632 Dictionary.registerBoth(move_top_button, "CDM.Move.Move_Top", "CDM.Move.Move_Top_Tooltip");631 //move_top_button.setPreferredSize(Utility.DOUBLE_IMAGE_BUTTON_SIZE); 632 //Dictionary.registerBoth(move_top_button, "CDM.Move.Move_Top", "CDM.Move.Move_Top_Tooltip"); 633 633 634 634 move_up_button = new DoubleImageButton("", Utility.getImage("arrow-up.gif"), Utility.getImage("arrow-up-disabled.gif")); … … 644 644 Dictionary.registerBoth(move_down_button, "CDM.Move.Move_Down", "CDM.Move.Move_Down_Tooltip"); 645 645 646 move_bottom_button = new DoubleImageButton("", Utility.getImage("arrow-bottom.gif"), Utility.getImage("arrow-bottom-disabled.gif"));647 move_bottom_button.setEnabled(false);648 move_bottom_button.setMnemonic(KeyEvent.VK_B);649 move_bottom_button.setPreferredSize(Utility.DOUBLE_IMAGE_BUTTON_SIZE);650 Dictionary.registerBoth(move_bottom_button, "CDM.Move.Move_Bottom", "CDM.Move.Move_Bottom_Tooltip");646 //move_bottom_button = new DoubleImageButton("", Utility.getImage("arrow-bottom.gif"), Utility.getImage("arrow-bottom-disabled.gif")); 647 //move_bottom_button.setEnabled(false); 648 //move_bottom_button.setMnemonic(KeyEvent.VK_B); 649 //move_bottom_button.setPreferredSize(Utility.DOUBLE_IMAGE_BUTTON_SIZE); 650 //Dictionary.registerBoth(move_bottom_button, "CDM.Move.Move_Bottom", "CDM.Move.Move_Bottom_Tooltip"); 651 651 652 652 // Listeners … … 660 660 661 661 MoveListener ml = new MoveListener(); 662 move_bottom_button.addActionListener(ml);662 //move_bottom_button.addActionListener(ml); 663 663 move_down_button.addActionListener(ml); 664 move_top_button.addActionListener(ml);664 //move_top_button.addActionListener(ml); 665 665 move_up_button.addActionListener(ml); 666 666 … … 675 675 676 676 move_button_pane.setLayout(new GridLayout(4,1)); 677 move_button_pane.add(move_top_button);678 677 move_button_pane.add(move_up_button); 678 move_button_pane.add(new JPanel()); 679 move_button_pane.add(new JPanel()); 679 680 move_button_pane.add(move_down_button); 680 move_button_pane.add(move_bottom_button);681 681 682 682 classifier_list_label.setBorder(BorderFactory.createEmptyBorder(0,2,0,2)); … … 858 858 if (!e.getValueIsAdjusting()) { // we get two events for one change in list selection - use the false one ( the second one) 859 859 if (classifier_list.isSelectionEmpty()) { 860 move_top_button.setEnabled(false);860 //move_top_button.setEnabled(false); 861 861 move_up_button.setEnabled(false); 862 862 move_down_button.setEnabled(false); 863 move_bottom_button.setEnabled(false);863 //move_bottom_button.setEnabled(false); 864 864 configure.setEnabled(false); 865 865 remove.setEnabled(false); 866 866 } 867 867 else { 868 move_top_button.setEnabled(true);868 //move_top_button.setEnabled(true); 869 869 move_up_button.setEnabled(true); 870 870 move_down_button.setEnabled(true); 871 move_bottom_button.setEnabled(true);871 //move_bottom_button.setEnabled(true); 872 872 configure.setEnabled(true); 873 873 remove.setEnabled(true); … … 888 888 if(object instanceof Classifier) { 889 889 Classifier classifier = (Classifier) object; 890 if(event.getSource() == move_top_button) { 891 moveClassifier(classifier, true, true); 892 } 893 else if(event.getSource() == move_up_button) { 890 //if(event.getSource() == move_top_button) { 891 // moveClassifier(classifier, true, true); 892 //} 893 //else 894 if(event.getSource() == move_up_button) { 894 895 moveClassifier(classifier, true, false); 895 896 } … … 897 898 moveClassifier(classifier, false, false); 898 899 } 899 else {900 moveClassifier(classifier, false, true);901 }900 //else { 901 // moveClassifier(classifier, false, true); 902 //} 902 903 classifier_list.setSelectedValue(classifier, true); 903 904 } -
trunk/gli/src/org/greenstone/gatherer/cdm/CollectionDesignManager.java
r6051 r6389 91 91 collect_config.display(); 92 92 } 93 loadDesignDetails(); 94 Gatherer.println("CollectionDesignModule loaded."); 95 } 96 97 /** Reloads the various managers to ensure they have built themselves from the latest details available in the collection configuration class 98 * @see org.greenstone.gatherer.cdm.ClassifierManager 99 * @see org.greenstone.gatherer.cdm.CollectionMetaManager 100 * @see org.greenstone.gatherer.cdm.FormatManager 101 * @see org.greenstone.gatherer.cdm.GeneralManager 102 * @see org.greenstone.gatherer.cdm.IndexManager 103 * @see org.greenstone.gatherer.cdm.LanguageManager 104 * @see org.greenstone.gatherer.cdm.MetadataSetView 105 * @see org.greenstone.gatherer.cdm.PlugInManager 106 * @see org.greenstone.gatherer.cdm.SearchTypeManager 107 * @see org.greenstone.gatherer.cdm.SubcollectionIndexManager 108 * @see org.greenstone.gatherer.cdm.SubcollectionManager 109 * @see org.greenstone.gatherer.cdm.SuperCollectionManager 110 * @see org.greenstone.gatherer.cdm.TranslationView 111 */ 112 public void loadDesignDetails() { 93 113 // Create the command information managers, registering the config file with each as necessary 94 114 language_manager = new LanguageManager(collect_config.getLanguages()); … … 113 133 translation_view = new TranslationView(); 114 134 format_manager = new FormatManager(); // Parse formats at the very end, given that they depend upon several other managers to appear properly. 115 Gatherer.println("CollectionDesignModule loaded."); 116 } 135 } 136 117 137 /** This method deconstructs each of the managers, causing them to dispose of their controls. 118 138 */ … … 157 177 } 158 178 159 /** Retrieve the name of the collection configuration file which is being used as the source of the information in this object. 160 * @return The files absolute path as a <strong>String</strong>. 161 */ 162 /* private String getFilename() { 163 return collect_config.getFile().getAbsolutePath(); 164 } */ 179 /** Called when the detail mode has changed which in turn may cause several design elements to be available/hidden 180 * @param mode the new mode as an int 181 */ 182 public void modeChanged(int mode) { 183 plugin_manager.modeChanged(mode); 184 subcollection_manager.modeChanged(mode); 185 } 165 186 166 187 /** The cdm is considered to be ready if the collect.cfg file was found and parsed and the collection title is not error. … … 177 198 * @see org.greenstone.gatherer.cdm.IndexManager 178 199 * @see org.greenstone.gatherer.cdm.LanguageManager 179 * @see org.greenstone.gatherer.cdm.MetadataSet Manager200 * @see org.greenstone.gatherer.cdm.MetadataSetView 180 201 * @see org.greenstone.gatherer.cdm.PlugInManager 181 202 * @see org.greenstone.gatherer.cdm.SubcollectionManager 182 * @see org.greenstone.gatherer.util.EmailAddress183 203 */ 184 204 public void save() { … … 218 238 /** Method used during a global search and replace to highlight the appropriate record within the Collection Design Managers version of the Metadata Set Manager (view only). 219 239 * @param element The name of the desired element as a <strong>String</strong>. 220 * @see org.greenstone.gatherer.cdm.G UI221 * @see org.greenstone.gatherer.cdm.MetadataSet Manager240 * @see org.greenstone.gatherer.cdm.GeneralManager 241 * @see org.greenstone.gatherer.cdm.MetadataSetView 222 242 */ 223 243 public Rectangle setSelectedElement(String element) { -
trunk/gli/src/org/greenstone/gatherer/cdm/CollectionMeta.java
r5930 r6389 112 112 113 113 /** Method to retrieve the value of language. 114 * @return The value of language as a <strong>String</strong>.114 * @return the value of language as a <strong>String</strong>. 115 115 */ 116 116 public String getLanguage() { … … 120 120 121 121 /** Method to retrieve the value of name. 122 * @return 122 * @return the name attribute of the collection meta as a String 123 123 */ 124 124 public String getName() { -
trunk/gli/src/org/greenstone/gatherer/cdm/GeneralManager.java
r6323 r6389 105 105 view = null; 106 106 } 107 108 /** Called whenever the detail mode changes to ensure the contents tree is at an appropriate level (ie with Partitions disabled in lower levels) 109 * Written 1543-07-01-2004, and made obsolete by a new list of requirements 1611-07-01-2004. *sigh* 110 * @param mode the mode level as an int 111 */ 112 /* public void modeChanged(int mode) { 113 tree.resetModel(mode); 114 } */ 107 115 108 116 /** Force the display to show a certain pane of controls. … … 519 527 public DesignTree() { 520 528 super(); 529 resetModel(Gatherer.config.getMode()); 530 expandRow(0); 531 setRootVisible(false); 532 setSelectionRow(0); 533 } 534 535 /** Reset the model used by the design page contents tree. This is necessary to hide the partitions entry when in lower detail modes 536 * @param mode the current detail mode as an int 537 */ 538 public void resetModel(int mode) { 521 539 root = new DesignNode("CDM.GUI.Root"); 522 this.setModel(new DefaultTreeModel(root));523 540 // Now add the design categories. 524 541 for(int i = 0; i < CONTENTS.length; i++) { 525 542 root.add(new DesignNode(CONTENTS[i])); 526 543 } 527 expandRow(0); 528 setRootVisible(false); 529 setSelectionRow(0); 544 this.setModel(new DefaultTreeModel(root)); 545 updateUI(); 530 546 } 531 547 /** Set the current view to the one specified. … … 570 586 * @see org.greenstone.gatherer.cdm.FormatManager 571 587 * @see org.greenstone.gatherer.cdm.LanguageManager 572 * @see org.greenstone.gatherer.cdm.MetadataSet Manager588 * @see org.greenstone.gatherer.cdm.MetadataSetView 573 589 * @see org.greenstone.gatherer.cdm.SubcollectionManager 590 * @see org.greenstone.gatherer.cdm.TranslationView 574 591 * @see org.greenstone.gatherer.cdm.PlugInManager 575 592 */ -
trunk/gli/src/org/greenstone/gatherer/cdm/IndexManager.java
r6318 r6389 510 510 * @see org.greenstone.gatherer.Configuration 511 511 * @see org.greenstone.gatherer.Gatherer 512 * @see org.greenstone.gatherer.cdm.IndexManager.Control.AddListener 513 * @see org.greenstone.gatherer.cdm.IndexManager.Control.ClearDefaultListener 514 * @see org.greenstone.gatherer.cdm.IndexManager.Control.NameListener 515 * @see org.greenstone.gatherer.cdm.IndexManager.Control.RemoveListener 516 * @see org.greenstone.gatherer.cdm.IndexManager.Control.SetDefaultListener 512 * @see org.greenstone.gatherer.cdm.IndexManager.IndexControl.AddListener 513 * @see org.greenstone.gatherer.cdm.IndexManager.IndexControl.NameListener 514 * @see org.greenstone.gatherer.cdm.IndexManager.IndexControl.RemoveListener 515 * @see org.greenstone.gatherer.cdm.IndexManager.IndexControl.SetDefaultListener 517 516 * @see org.greenstone.gatherer.collection.CollectionManager 518 517 * @see org.greenstone.gatherer.gui.Coloring -
trunk/gli/src/org/greenstone/gatherer/cdm/LanguageManager.java
r6318 r6389 248 248 private JTextField default_language_field = null; 249 249 /** Constructor. 250 * @see org.greenstone.gatherer.cdm.LanguageManager.Control.AddListener 251 * @see org.greenstone.gatherer.cdm.LanguageManager.Control.ClearDefaultListener 252 * @see org.greenstone.gatherer.cdm.LanguageManager.Control.ListListener 253 * @see org.greenstone.gatherer.cdm.LanguageManager.Control.RemoveListener 254 * @see org.greenstone.gatherer.cdm.LanguageManager.Control.SelectorListener 255 * @see org.greenstone.gatherer.cdm.LanguageManager.Control.SetDefaultListener 256 * @see org.greenstone.gatherer.cdm.LanguageManager.Control.TranslateListener 250 * @see org.greenstone.gatherer.cdm.LanguageManager.LanguageControl.AddListener 251 * @see org.greenstone.gatherer.cdm.LanguageManager.LanguageControl.ClearDefaultListener 252 * @see org.greenstone.gatherer.cdm.LanguageManager.LanguageControl.ListListener 253 * @see org.greenstone.gatherer.cdm.LanguageManager.LanguageControl.RemoveListener 254 * @see org.greenstone.gatherer.cdm.LanguageManager.LanguageControl.SelectorListener 255 * @see org.greenstone.gatherer.cdm.LanguageManager.LanguageControl.SetDefaultListener 257 256 */ 258 257 public LanguageControl() { -
trunk/gli/src/org/greenstone/gatherer/cdm/MetadataSetView.java
r6051 r6389 28 28 29 29 import java.awt.*; 30 import java.awt.event.*; 30 31 import java.util.*; 31 32 import javax.swing.*; … … 36 37 import org.greenstone.gatherer.cdm.Control; 37 38 import org.greenstone.gatherer.cdm.ElementWrapper; 39 import org.greenstone.gatherer.gui.GLIButton; 40 import org.greenstone.gatherer.mem.MetadataEditorManager; 38 41 import org.greenstone.gatherer.msm.MetadataSet; 39 42 import org.greenstone.gatherer.msm.MSMEvent; … … 80 83 /** Called when an element is changed within a set in the MSM, prompting us to refresh our list of elements being shown. 81 84 * @param event A <strong>MSMEvent</strong> which encapsulates relevant data about the change. 82 * @see org.greenstone.gatherer.cdm.MetadataSet Manager.Control85 * @see org.greenstone.gatherer.cdm.MetadataSetView.MetadataSetControl 83 86 */ 84 87 public void elementChanged(MSMEvent event) { … … 115 118 * @param element The elements fully qualified name as a <strong>String</strong>. 116 119 * @return The bounds of the selection as a <strong>Rectangle</strong>. 117 * @see org.greenstone.gatherer.cdm.MetadataSet Manager.Control120 * @see org.greenstone.gatherer.cdm.MetadataSetView.MetadataSetControl 118 121 */ 119 122 public Rectangle setSelectedElement(String element) { … … 123 126 /** Prints out the contents of this manager, as they would appear in the collection configuration file. 124 127 * @return A <strong>String</strong> containing a block of commands. 125 * @see org.greenstone.gatherer.cdm.MetadataSet Manager.SetWrapper128 * @see org.greenstone.gatherer.cdm.MetadataSetView.SetWrapper 126 129 */ 127 130 public String toString() { … … 143 146 /** Retrieves the current list of loaded metadata sets, and builds a list model around them. 144 147 * @see org.greenstone.gatherer.Gatherer 145 * @see org.greenstone.gatherer.cdm.MetadataSet Manager.SetWrapper148 * @see org.greenstone.gatherer.cdm.MetadataSetView.SetWrapper 146 149 * @see org.greenstone.gatherer.collection.CollectionManager 147 150 * @see org.greenstone.gatherer.msm.MetadataSet … … 160 163 extends JPanel 161 164 implements Control { 165 /** Listens for clicks upon the configure button, or double clicks from the metadata set list. */ 166 private ConfigureActionListener configure_action_listener; 167 /** Opens the MEM and systematically performs as if the add set button were clicked. */ 168 private JButton add_button; 169 /** Opens the MEM with the appropriate set open for editing. */ 170 private JButton configure_button; 171 /** Opens the MEM and systematically performs as if the remove set button were clicked. */ 172 private JButton remove_button; 162 173 /** The label denoting the element list. */ 163 174 private JLabel element_label = null; … … 186 197 * @see org.greenstone.gatherer.Coloring; 187 198 * @see org.greenstone.gatherer.Dictionary 188 * @see org.greenstone.gatherer.cdm.MetadataSet Manager.ListListener199 * @see org.greenstone.gatherer.cdm.MetadataSetView.ListListener 189 200 * @see org.greenstone.gatherer.msm.MetadataSetManager 190 201 */ … … 213 224 set_list = new JList(model); 214 225 set_list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); 226 if(model.size() > 0) { 227 set_list.setSelectedIndex(0); 228 } 229 215 230 set_pane = new JPanel(); 216 231 title = new JLabel(); … … 219 234 Dictionary.registerText(title, "CDM.MetadataSetManager.Title"); 220 235 236 JPanel button_pane = new JPanel(); 237 add_button = new GLIButton(); 238 add_button.setEnabled(true); 239 add_button.setMnemonic(KeyEvent.VK_A); 240 Dictionary.registerBoth(add_button, "CDM.MetadataSetManager.Add", "CDM.MetadataSetManager.Add_Tooltip"); 241 configure_button = new GLIButton(); 242 configure_button.setEnabled(false); 243 configure_button.setMnemonic(KeyEvent.VK_C); 244 Dictionary.registerBoth(configure_button, "CDM.MetadataSetManager.Configure", "CDM.MetadataSetManager.Configure_Tooltip"); 245 remove_button = new GLIButton(); 246 remove_button.setEnabled(false); 247 remove_button.setMnemonic(KeyEvent.VK_R); 248 Dictionary.registerBoth(remove_button, "CDM.MetadataSetManager.Remove", "CDM.MetadataSetManager.Remove_Tooltip"); 249 configure_action_listener = new ConfigureActionListener(); 250 221 251 // Add listeners 252 add_button.addActionListener(new AddButtonListener()); 253 configure_button.addActionListener(configure_action_listener); 254 remove_button.addActionListener(new RemoveButtonListener()); 222 255 set_list.addListSelectionListener(new ListListener()); 223 256 set_list.addMouseListener(configure_action_listener); 224 257 // Layout 225 258 instructions.setBorder(BorderFactory.createEmptyBorder(2,5,2,5)); … … 240 273 central_pane.add(set_pane); 241 274 central_pane.add(element_pane); 275 276 button_pane.setBorder(BorderFactory.createEmptyBorder(5,0,0,0)); 277 button_pane.setLayout(new GridLayout(1,3,0,0)); 278 button_pane.add(add_button); 279 button_pane.add(configure_button); 280 button_pane.add(remove_button); 242 281 243 282 setBorder(BorderFactory.createEmptyBorder(5,5,5,5)); … … 245 284 add(header_pane, BorderLayout.NORTH); 246 285 add(central_pane, BorderLayout.CENTER); 286 add(button_pane, BorderLayout.SOUTH); 247 287 } 248 288 /** Destructor. */ … … 256 296 * @param element The elements fully qualified name as a <strong>String</strong>. 257 297 * @return The bounds of the selection as a <strong>Rectangle</strong>. 258 * @see org.greenstone.gatherer.cdm.MetadataSet Manager.Control259 * @see org.greenstone.gatherer. cdm.MetadataSetManager.Control.ElementWrapper298 * @see org.greenstone.gatherer.cdm.MetadataSetView.MetadataSetControl 299 * @see org.greenstone.gatherer.msm.ElementWrapper 260 300 */ 261 301 public Rectangle setSelectedElement(String element) { … … 293 333 294 334 public void loseFocus() { 335 } 336 337 /** Listens for clicks on the add button, and actions them accordingly by opening the MEM and clicking add set. */ 338 private class AddButtonListener 339 implements ActionListener { 340 /** Called when the add button is clicked. 341 * @param event an ActionEvent containing information about the mouse click 342 * @see org.greenstone.gatherer.Gatherer 343 * @see org.greenstone.gatherer.collection.Collection 344 * @see org.greenstone.gatherer.collection.CollectionManager 345 * @see org.greenstone.gatherer.mem.MetadataEditorManager 346 * @see org.greenstone.gatherer.msm.MetadataSetManager 347 */ 348 public void actionPerformed(ActionEvent event) { 349 Gatherer.c_man.getCollection().msm.editMDS(null, MetadataEditorManager.ADD_SET); 350 } 351 } 352 353 /** Listens for clicks on the configure button or double clicks upon the metadata set list and chains to the MEM as appropriate. */ 354 private class ConfigureActionListener 355 extends MouseAdapter 356 implements ActionListener { 357 /** Called when the configure button is clicked. 358 * @param event an ActionEvent containing information about the mouse click 359 */ 360 public void actionPerformed(ActionEvent event) { 361 configureSet(); 362 } 363 364 /** Called whenever the mouse is clicked over a registered component, we use this to chain through to the configure prompt. 365 * @param event a MouseEvent containing information about the mouse click 366 */ 367 public void mouseClicked(MouseEvent event) { 368 if(event.getClickCount() == 2 ) { 369 configureSet(); 370 } 371 } 372 /** If some set is selected, then open the metadata set manager with the current set selected and expanded 373 * @see org.greenstone.gatherer.Gatherer 374 * @see org.greenstone.gatherer.collection.Collection 375 * @see org.greenstone.gatherer.collection.CollectionManager 376 * @see org.greenstone.gatherer.cdm.MetadataSetView.SetWrapper 377 * @see org.greenstone.gatherer.mem.MetadataEditorManager 378 * @see org.greenstone.gatherer.msm.MetadataSet 379 * @see org.greenstone.gatherer.msm.MetadataSetManager 380 */ 381 private void configureSet() { 382 if(!set_list.isSelectionEmpty()) { 383 MetadataSet set = ((SetWrapper)set_list.getSelectedValue()).getSet(); 384 Gatherer.c_man.getCollection().msm.editMDS(set, MetadataEditorManager.NORMAL); 385 } 386 else { 387 configure_button.setEnabled(false); 388 } 389 } 295 390 } 296 391 … … 307 402 Collections.sort(element_model); 308 403 element_list.setListData(element_model); 309 } 310 } 311 } 404 configure_button.setEnabled(true); 405 remove_button.setEnabled(true); 406 } 407 else { 408 configure_button.setEnabled(false); 409 remove_button.setEnabled(false); 410 } 411 } 412 } 413 414 /** Listens for clicks on the remove button, and actions them accordingly by opening the MEM and clicking remove set. */ 415 private class RemoveButtonListener 416 implements ActionListener { 417 /** Called when the remove button is clicked. 418 * @param event an ActionEvent containing information about the mouse click 419 * @see org.greenstone.gatherer.Gatherer 420 * @see org.greenstone.gatherer.collection.Collection 421 * @see org.greenstone.gatherer.collection.CollectionManager 422 * @see org.greenstone.gatherer.cdm.MetadataSetView.SetWrapper 423 * @see org.greenstone.gatherer.mem.MetadataEditorManager 424 * @see org.greenstone.gatherer.msm.MetadataSet 425 * @see org.greenstone.gatherer.msm.MetadataSetManager 426 */ 427 public void actionPerformed(ActionEvent event) { 428 if(!set_list.isSelectionEmpty()) { 429 MetadataSet set = ((SetWrapper)set_list.getSelectedValue()).getSet(); 430 Gatherer.c_man.getCollection().msm.editMDS(set, MetadataEditorManager.REMOVE_SET); 431 } 432 else { 433 remove_button.setEnabled(false); 434 } 435 } 436 } 312 437 } 313 438 -
trunk/gli/src/org/greenstone/gatherer/cdm/PlugInManager.java
r6318 r6389 36 36 import javax.swing.plaf.basic.*; 37 37 import org.apache.xerces.parsers.*; 38 import org.greenstone.gatherer.Configuration; 38 39 import org.greenstone.gatherer.Dictionary; 39 40 import org.greenstone.gatherer.Gatherer; … … 57 58 /** The library 'reserve' of base plugins. */ 58 59 private ArrayList library = null; 60 /** When asking how many rows are in the model, and if this variables value is true, then this modifier alters the number returned. This funtionality is used to hide the last three rows of the list in low detail modes. */ 61 private boolean modify_row_count = false; 59 62 /** The controls for editing the contents of this manager. */ 60 63 private Control controls = null; … … 68 71 public PlugInManager() { 69 72 super(CollectionDesignManager.collect_config.getDocumentElement(), CollectionConfiguration.PLUGIN_ELEMENT, new PlugIn()); 70 Gatherer.println("PlugInManager: " + getSize() + " plugins parsed.");73 Gatherer.println("PlugInManager: " + super.getSize() + " plugins parsed."); 71 74 model = this; 72 75 // Reload/Create the library … … 136 139 } 137 140 141 /** Overrides getSize in DOMProxyListModel to take into account the row count modifier used to hide the last three rows in lower detail modes 142 * @return an int indicating the number of rows in the model, or more correctly the desired number of rows to display 143 */ 144 public int getSize() { 145 int result = super.getSize(); 146 if(modify_row_count) { 147 result = result - 3; 148 } 149 return result; 150 } 151 152 /** Called when the detail mode has changed which in turn may cause several design elements to be available/hidden 153 * @param mode the new mode as an int 154 */ 155 public void modeChanged(int mode) { 156 if(controls != null) { 157 ((PlugInControl)controls).modeChanged(mode); 158 } 159 } 160 138 161 /** Method to move a plugin in the list order. 139 162 * @param plugin the PlugIn you want to move. … … 143 166 public void movePlugIn(PlugIn plugin, boolean direction, boolean all) { 144 167 // Can't ever move RecPlug or ArcPlug. 145 if( getSize() < 3) {168 if(super.getSize() < 3) { 146 169 //Gatherer.println("Not enough plugins to allow moving."); 147 170 return; … … 215 238 public void placeSeparator() { 216 239 ///ystem.err.println("Placing separator."); 217 int separator_index = getSize();240 int separator_index = super.getSize(); 218 241 if(separator_index > 0) { 219 242 boolean found_fixed = false; … … 269 292 } 270 293 294 /** Inform the model to hide/show the last three lines on the list. 295 * @param modify_row_count true to hide the last three lines, false otherwise 296 */ 297 public void setHideLines(boolean modify_row_count) { 298 this.modify_row_count = modify_row_count; 299 int original_size = super.getSize(); 300 if(modify_row_count) { 301 fireIntervalRemoved(this, original_size - 4, original_size - 1); 302 } 303 else { 304 fireIntervalAdded(this, original_size - 4, original_size - 1); 305 } 306 } 307 271 308 /** Determine the current separator index. */ 272 309 private int findSeparatorIndex() { 273 int separator_index = getSize() - 1;310 int separator_index = super.getSize() - 1; 274 311 while(separator_index >= 0) { 275 312 PlugIn search = (PlugIn) getElementAt(separator_index); … … 448 485 } 449 486 else if(node_name.equalsIgnoreCase(CollectionConfiguration.ABSTRACT_ELEMENT)) { 450 System.err.println("Is " + plugin.getName() + " abstract? " + MSMUtils.getValue(node).equalsIgnoreCase(CollectionConfiguration.YES_STR));451 487 plugin.setIsAbstract(MSMUtils.getValue(node).equalsIgnoreCase(CollectionConfiguration.YES_STR)); 452 488 } … … 553 589 private JButton configure = null; 554 590 /** Buttom to move an assinged plugin as low in the order as possible. */ 555 private JButton move_bottom_button = null;591 //private JButton move_bottom_button = null; 556 592 /** Button to move an assigned plugin one position lower in the order. */ 557 593 private JButton move_down_button = null; 558 594 /** Button to move an assigned plugin as high in the order as possible. */ 559 private JButton move_top_button = null;595 //private JButton move_top_button = null; 560 596 /** Button to move an assigned plugin one position higher in the order. */ 561 597 private JButton move_up_button = null; … … 613 649 Dictionary.registerText(instructions, "CDM.PlugInManager.Instructions"); 614 650 615 move_top_button = new DoubleImageButton("", Utility.getImage("arrow-top.gif"), Utility.getImage("arrow-top-disabled.gif"));616 move_top_button.setEnabled(false);617 move_top_button.setMnemonic(KeyEvent.VK_T);618 // 619 move_top_button.setPreferredSize(Utility.DOUBLE_IMAGE_BUTTON_SIZE);620 Dictionary.registerBoth(move_top_button, "CDM.Move.Move_Top", "CDM.Move.Move_Top_Tooltip");651 //move_top_button = new DoubleImageButton("", Utility.getImage("arrow-top.gif"), Utility.getImage("arrow-top-disabled.gif")); 652 //move_top_button.setEnabled(false); 653 //move_top_button.setMnemonic(KeyEvent.VK_T); 654 //move_top_button.setDisplayedMnemonicIndex(8); // !! English-centric hack 655 //move_top_button.setPreferredSize(Utility.DOUBLE_IMAGE_BUTTON_SIZE); 656 //Dictionary.registerBoth(move_top_button, "CDM.Move.Move_Top", "CDM.Move.Move_Top_Tooltip"); 621 657 622 658 move_up_button = new DoubleImageButton("", Utility.getImage("arrow-up.gif"), Utility.getImage("arrow-up-disabled.gif")); … … 632 668 Dictionary.registerBoth(move_down_button, "CDM.Move.Move_Down", "CDM.Move.Move_Down_Tooltip"); 633 669 634 move_bottom_button = new DoubleImageButton("", Utility.getImage("arrow-bottom.gif"), Utility.getImage("arrow-bottom-disabled.gif"));635 move_bottom_button.setEnabled(false);636 move_bottom_button.setMnemonic(KeyEvent.VK_B);637 move_bottom_button.setPreferredSize(Utility.DOUBLE_IMAGE_BUTTON_SIZE);638 Dictionary.registerBoth(move_bottom_button, "CDM.Move.Move_Bottom", "CDM.Move.Move_Bottom_Tooltip");670 //move_bottom_button = new DoubleImageButton("", Utility.getImage("arrow-bottom.gif"), Utility.getImage("arrow-bottom-disabled.gif")); 671 //move_bottom_button.setEnabled(false); 672 //move_bottom_button.setMnemonic(KeyEvent.VK_B); 673 //move_bottom_button.setPreferredSize(Utility.DOUBLE_IMAGE_BUTTON_SIZE); 674 //Dictionary.registerBoth(move_bottom_button, "CDM.Move.Move_Bottom", "CDM.Move.Move_Bottom_Tooltip"); 639 675 640 676 movement_pane = new JPanel(); 641 677 642 678 PlugInComboboxListener picl = new PlugInComboboxListener(); 643 679 plugin = new GComboBox(getAvailable()); 644 680 plugin.setBackgroundNonSelectionColor(Gatherer.config.getColor("coloring.editable_background", false)); … … 647 683 plugin.setTextNonSelectionColor(Gatherer.config.getColor("coloring.workspace_tree_foreground", false)); 648 684 plugin.setTextSelectionColor(Gatherer.config.getColor("coloring.collection_selection_foreground", false)); 649 685 picl.itemStateChanged(new ItemEvent(plugin, 0, null, ItemEvent.SELECTED)); 650 686 651 687 plugin_label = new JLabel(); … … 677 713 configure.addActionListener(new ConfigureListener()); 678 714 MoveListener ml = new MoveListener(); 679 move_bottom_button.addActionListener(ml);715 //move_bottom_button.addActionListener(ml); 680 716 move_down_button.addActionListener(ml); 681 move_top_button.addActionListener(ml);717 //move_top_button.addActionListener(ml); 682 718 move_up_button.addActionListener(ml); 683 719 plugin.addItemListener(picl); 684 720 remove.addActionListener(new RemoveListener()); 685 721 plugin_list.addMouseListener(new ClickListener()); 686 722 plugin_list.addListSelectionListener(new ListListener()); 687 723 picl = null; 688 724 689 725 // Layout … … 700 736 movement_pane.setBorder(BorderFactory.createEmptyBorder(0,2,0,0)); 701 737 movement_pane.setLayout(new GridLayout(4,1)); 702 movement_pane.add(move_top_button);703 738 movement_pane.add(move_up_button); 739 movement_pane.add(new JPanel()); 740 movement_pane.add(new JPanel()); 704 741 movement_pane.add(move_down_button); 705 movement_pane.add(move_bottom_button);706 742 707 743 plugin_list_pane.setLayout(new BorderLayout()); 708 744 plugin_list_pane.add(plugin_list_label, BorderLayout.NORTH); 709 745 plugin_list_pane.add(new JScrollPane(plugin_list), BorderLayout.CENTER); 710 plugin_list_pane.add(movement_pane, BorderLayout.EAST);746 modeChanged(Gatherer.config.getMode()); // Whether the movement buttons are visible is mode dependant 711 747 712 748 plugin_label.setBorder(BorderFactory.createEmptyBorder(0,0,5,0)); … … 760 796 761 797 public void loseFocus() { 798 } 799 800 /** The current detail mode controls two aspects of plugin manager: whether the movement buttons are visible and whether the fixed position plugins Arc and RecPlug are in the list 801 * @param mode the current mode as an int, which can be matched against static ints in the Configuration class 802 */ 803 public void modeChanged(int mode) { 804 // First of all we clear the current selection, as there can be some serious problems if the user selects the plugins we're hiding, or had the last plugin selected before we unhid the last three 805 plugin_list.clearSelection(); 806 // The first change is dependant on whether the user is systems mode or higher 807 if(mode >= Configuration.SYSTEMS_MODE) { 808 // Show movement buttons 809 plugin_list_pane.add(movement_pane, BorderLayout.EAST); 810 // Do we show Arc and RecPlugs or hide them and the separator line 811 setHideLines(!(mode >= Configuration.EXPERT_MODE)); 812 } 813 // Otherwise hide the movement buttons and fixed plugins 814 else { 815 plugin_list_pane.remove(movement_pane); 816 setHideLines(true); 817 } 818 plugin_list_pane.updateUI(); 762 819 } 763 820 … … 864 921 if (!e.getValueIsAdjusting()) { // we get two events for one change in list selection - use the false one (the second one) 865 922 if (plugin_list.isSelectionEmpty()) { 866 move_top_button.setEnabled(false);923 //move_top_button.setEnabled(false); 867 924 move_up_button.setEnabled(false); 868 925 move_down_button.setEnabled(false); 869 move_bottom_button.setEnabled(false);926 //move_bottom_button.setEnabled(false); 870 927 configure.setEnabled(false); 871 928 remove.setEnabled(false); … … 874 931 PlugIn selected_plugin = (PlugIn) plugin_list.getSelectedValue(); 875 932 if(selected_plugin.isSeparator()) { 876 move_top_button.setEnabled(false);933 //move_top_button.setEnabled(false); 877 934 move_up_button.setEnabled(false); 878 935 move_down_button.setEnabled(false); 879 move_bottom_button.setEnabled(false);936 //move_bottom_button.setEnabled(false); 880 937 configure.setEnabled(false); 881 938 remove.setEnabled(false); … … 886 943 // Some buttons are only available for plugins other than ArcPlug and RecPlug 887 944 if(plugin_name.equals(StaticStrings.ARCPLUG_STR) || plugin_name.equals(StaticStrings.RECPLUG_STR)) { 888 move_top_button.setEnabled(false);945 //move_top_button.setEnabled(false); 889 946 move_up_button.setEnabled(false); 890 947 move_down_button.setEnabled(false); 891 move_bottom_button.setEnabled(false);948 //move_bottom_button.setEnabled(false); 892 949 remove.setEnabled(false); 893 950 } … … 896 953 PlugIn first_plugin = (PlugIn) getElementAt(0); 897 954 if(!first_plugin.equals(selected_plugin)) { 898 move_top_button.setEnabled(true);955 //move_top_button.setEnabled(true); 899 956 move_up_button.setEnabled(true); 900 957 } 901 958 else { 902 move_top_button.setEnabled(false);959 //move_top_button.setEnabled(false); 903 960 move_up_button.setEnabled(false); 904 961 } … … 908 965 if(selected_index != separator_index - 1) { 909 966 move_down_button.setEnabled(true); 910 move_bottom_button.setEnabled(true);967 //move_bottom_button.setEnabled(true); 911 968 } 912 969 else { 913 970 move_down_button.setEnabled(false); 914 move_bottom_button.setEnabled(false);971 //move_bottom_button.setEnabled(false); 915 972 } 916 973 remove.setEnabled(true); … … 962 1019 if (object instanceof PlugIn) { 963 1020 PlugIn plugin = (PlugIn) object; 964 if (event.getSource() == move_top_button) { 965 movePlugIn(plugin, true, true); 966 } 967 else if (event.getSource() == move_up_button) { 1021 //if (event.getSource() == move_top_button) { 1022 // movePlugIn(plugin, true, true); 1023 //} 1024 //else 1025 if (event.getSource() == move_up_button) { 968 1026 movePlugIn(plugin, true, false); 969 1027 } … … 971 1029 movePlugIn(plugin, false, false); 972 1030 } 973 else if (event.getSource() == move_bottom_button) {974 movePlugIn(plugin, false, true);975 }1031 //else if (event.getSource() == move_bottom_button) { 1032 // movePlugIn(plugin, false, true); 1033 //} 976 1034 plugin_list.setSelectedValue(plugin, true); 977 1035 } -
trunk/gli/src/org/greenstone/gatherer/cdm/SubcollectionIndexManager.java
r6318 r6389 341 341 /** Any implementation of ActionListener must include this method so we can be informed when an action has been performed on one of our target controls. In this case we want to check if they have a series of subcollections selected, and if so build an new subindex based apon them. 342 342 * @param event An <strong>ActionEvent</strong> containing information about the event. 343 * @see org.greenstone.gatherer.cdm.Sub Index343 * @see org.greenstone.gatherer.cdm.SubcollectionIndex 344 344 */ 345 345 public void actionPerformed(ActionEvent event) { … … 374 374 /** Any implementation of ActionListener must include this method so we can be informed when an action has been performed on one of our target controls. In this case we want to check if they have a subindex selected, and if so remove it. 375 375 * @param event An <strong>ActionEvent</strong> containing information about the event. 376 * @see org.greenstone.gatherer.cdm.Sub Index376 * @see org.greenstone.gatherer.cdm.SubcollectionIndex 377 377 */ 378 378 public void actionPerformed(ActionEvent event) { … … 387 387 /** Any implementation of ActionListener must include this method so we can be informed when an action has been performed on one of our target controls. In this case we want to check if they have a subindex selected, and if so set it as default. 388 388 * @param event An <strong>ActionEvent</strong> containing information about the event. 389 * @see org.greenstone.gatherer.cdm.DefaultSubIndex 390 * @see org.greenstone.gatherer.cdm.SubIndex 389 * @see org.greenstone.gatherer.cdm.SubcollectionIndex 391 390 */ 392 391 public void actionPerformed(ActionEvent event) { -
trunk/gli/src/org/greenstone/gatherer/cdm/SubcollectionManager.java
r6318 r6389 36 36 import javax.swing.*; 37 37 import javax.swing.event.*; 38 import org.greenstone.gatherer.Configuration; 38 39 import org.greenstone.gatherer.Dictionary; 39 40 import org.greenstone.gatherer.Gatherer; … … 59 60 extends DOMProxyListModel { 60 61 62 static final private String DISABLED_CONTROLS = "Disabled"; 63 static final private String ENABLED_CONTROLS = "Normal"; 61 64 static final private String CLASS_DICTIONARY_NAME = "CDM.SubcollectionManager."; 62 65 … … 137 140 } */ 138 141 142 /** Called when the detail mode has changed which in turn may cause several design elements to be available/hidden 143 * @param mode the new mode as an int 144 */ 145 public void modeChanged(int mode) { 146 if(controls != null) { 147 ((SubcollectionControl)controls).modeChanged(mode); 148 } 149 } 150 139 151 /** Method to remove the given subcollection. 140 152 * @param subcollection the Subcollection you want to remove … … 162 174 implements Control { 163 175 176 private CardLayout card_layout; 164 177 private JButton add_button; 165 178 private JButton remove_button; … … 167 180 private JComboBox source_combobox; 168 181 private JList subcollection_list; 182 private JPanel border_pane; 169 183 private JTabbedPane tabbed_pane; 170 184 private JTextArea instructions_area; … … 178 192 public SubcollectionControl() { 179 193 // Create 180 JPanel border_pane = new JPanel();181 194 JPanel header_pane = new JPanel(); 182 195 instructions_area = new JTextArea(); … … 186 199 instructions_area.setWrapStyleWord(true); 187 200 Dictionary.registerText(instructions_area, "CDM.SubcollectionManager.Instructions"); 201 202 border_pane = new JPanel(); 203 card_layout = new CardLayout(); 188 204 189 205 tabbed_pane = new JTabbedPane(); … … 202 218 Dictionary.registerBoth(remove_button, "CDM.SubcollectionManager.Remove", "CDM.SubcollectionManager.Remove_Tooltip"); 203 219 update_button = new GLIButton(); 204 update_button.setMnemonic(KeyEvent.VK_ U);220 update_button.setMnemonic(KeyEvent.VK_C); 205 221 update_button.setEnabled(false); 206 222 Dictionary.registerBoth(update_button, "CDM.SubcollectionManager.Replace", "CDM.SubcollectionManager.Replace_Tooltip"); … … 256 272 Dictionary.registerText(subcollection_list_label, "CDM.SubcollectionManager.Assigned"); 257 273 274 // Create a message pane which explains why these controls are not currently active 275 JPanel message_pane = new JPanel(); 276 String args[] = new String[3]; 277 args[0] = Gatherer.config.getModeAsString(); 278 args[1] = Dictionary.get("Preferences.Mode.Systems"); 279 args[2] = Dictionary.get("Preferences.Mode.Expert"); 280 JTextArea message_textarea = new JTextArea(); 281 Dictionary.registerText(message_textarea, "CDM.SubcollectionManager.Partitions_Disabled", args); 282 message_textarea.setEditable(false); 283 message_textarea.setHighlighter(null); // Prevent highlighting 284 message_textarea.setLineWrap(true); 285 message_textarea.setOpaque(false); // Make it transparent 286 message_textarea.setWrapStyleWord(true); 287 258 288 // Add listeners 259 289 SubCollectionChangeListener cl = new SubCollectionChangeListener(); … … 316 346 tabbed_pane.addTab(Dictionary.get("CDM.SubcollectionManager.Language_Controls"), (JPanel) CollectionDesignManager.language_manager.getControls()); 317 347 348 message_pane.setBorder(BorderFactory.createEmptyBorder(0,5,5,5)); 349 message_pane.setLayout(new GridLayout(3,1,0,0)); 350 message_pane.add(new JPanel()); 351 message_pane.add(message_textarea); 352 message_pane.add(new JPanel()); 353 318 354 border_pane.setBorder(BorderFactory.createEmptyBorder(0,5,5,5)); 319 border_pane.setLayout(new BorderLayout()); 320 border_pane.add(tabbed_pane, BorderLayout.CENTER); 355 border_pane.setLayout(card_layout); 356 if(Gatherer.config.getMode() > Configuration.LIBRARIAN_MODE) { 357 border_pane.add(tabbed_pane, ENABLED_CONTROLS); 358 border_pane.add(message_pane, DISABLED_CONTROLS); 359 } 360 else { 361 border_pane.add(message_pane, DISABLED_CONTROLS); 362 border_pane.add(tabbed_pane, ENABLED_CONTROLS); 363 } 321 364 322 365 setLayout(new BorderLayout()); … … 338 381 339 382 public void loseFocus() { 383 } 384 385 /** Called when the detail mode has changed which in turn controls if any of the partition controls are visible, or if they are instead replaced with a message explaining why they are not. 386 * @param mode the new mode as an int 387 */ 388 public void modeChanged(int mode) { 389 if(mode > Configuration.LIBRARIAN_MODE) { 390 card_layout.show(border_pane, ENABLED_CONTROLS); 391 } 392 else { 393 card_layout.show(border_pane, DISABLED_CONTROLS); 394 } 340 395 } 341 396 -
trunk/gli/src/org/greenstone/gatherer/gui/CreatePane.java
r6318 r6389 44 44 import javax.swing.text.*; 45 45 import javax.swing.tree.*; 46 import org.greenstone.gatherer.Configuration; 46 47 import org.greenstone.gatherer.Dictionary; 47 48 import org.greenstone.gatherer.Gatherer; … … 91 92 extends JPanel 92 93 implements GShellListener { 94 95 static private Dimension ARGUMENT_SIZE = new Dimension(800,90); 96 /** The size of the buttons at the bottom of the screen. */ 97 static private Dimension BUTTON_SIZE = new Dimension (256, 50);//(386, 50); 98 /** The size of the labels on the progress pane. */ 99 static private Dimension LABEL_SIZE = new Dimension(140, 25); 100 /** The threshold for when the simple view is replaced by the complex one. */ 101 static private final int THRESHOLD = Configuration.EXPERT_MODE; 102 /** An identifier for the control panel within the card layout. */ 103 static private String CONTROL = "Control"; 104 /** An identifier for the progress panel within the card layout. */ 105 static private String PROGRESS = "Progress"; 106 /** An identifier for the simple panel within the card layout. */ 107 static private String SIMPLE = "Simple"; 108 93 109 /** Determines the current view that should be shown for this pane. */ 94 110 public boolean processing = false; … … 120 136 /** The label alongside the import progress bar gets some special treatment so... */ 121 137 private JLabel progress_import_label = null; 138 /** A panel containing the two progress bars. */ 139 private JPanel bar_area; 140 /** The panel on which buttons are rendered on higher detail modes. */ 141 private JPanel button_pane; 122 142 /** The pane which contains the controls for configuration. */ 123 143 private JPanel control_pane = null; … … 126 146 /** The pane which contains the progress information. */ 127 147 private JPanel progress_pane = null; 128 /** the pane on the right-hand side - shows the requested options view */148 /** The pane on the right-hand side - shows the requested options view */ 129 149 private JPanel right = null; 150 /** The simple panel on which all of the available arguments are rendered. */ 151 private JPanel sargument_configuration_panel; 152 /** The panel on which buttons are rendered on lower details modes. */ 153 private JPanel sbutton_panel; 154 /** A simplified version for lower detail modes containing both the control and progress panes smooshed together. */ 155 private JPanel simple_panel; 156 /** The inner panel of the simple pane which is global so that the bar_area can be added and removed from it. */ 157 private JPanel sinner_panel; 158 /** The outer panel of the simple pane which is global so that the arguments pane can be added and removed from it. */ 159 private JPanel souter_panel; 160 /** The scrolling pane for the log. */ 161 private JScrollPane log_scroll; 162 /** The scrolling pane the simple arguments are rendered within. */ 163 private JScrollPane sargument_configuration_scroll; 130 164 /** the scrolling pane the righthand side is inside - only used for import and build options. the log and log list are not inside a scrollpane */ 131 165 private JScrollPane scroll_pane; … … 138 172 /** The homepage address of the current collection */ 139 173 private String homepage = null; 140 /** The size of the buttons at the bottom of the screen. */ 141 static private Dimension BUTTON_SIZE = new Dimension (256, 50);//(386, 50); 142 /** The size of the labels on the progress pane. */ 143 static private Dimension LABEL_SIZE = new Dimension(140, 25); 144 /** An identifier for the control panel within the card layout. */ 145 static private String CONTROL = "Control"; 146 /** An identifier for the progress panel within the card layout. */ 147 static private String PROGRESS = "Progress"; 174 148 175 149 176 /** The constructor creates important helper classes, and initializes all the components. … … 162 189 Collection collection = Gatherer.c_man.getCollection(); 163 190 log_textarea = new JTextArea(); 191 log_scroll = new JScrollPane(log_textarea); 164 192 165 193 // Create components … … 168 196 control_pane = new JPanel(); 169 197 tree = new OptionTree(); 198 button_pane = new JPanel(); 170 199 171 200 // Progress Pane 172 progress_pane = new JPanel(); 201 progress_pane = new JPanel(); // One owner of the bar component 202 bar_area = new JPanel(); // This component will be shared about 173 203 174 204 progress_copy_label = new JLabel(); … … 202 232 Dictionary.registerText(progress_build_label, "CreatePane.Build_Progress"); 203 233 204 build_monitor = new GBuildProgressMonitor( (GImportProgressMonitor)import_monitor); //GBasicProgressMonitor();234 build_monitor = new GBuildProgressMonitor(); //GBasicProgressMonitor(); 205 235 Gatherer.c_man.registerBuildMonitor(build_monitor); 236 237 // And the simple panel 238 simple_panel = new JPanel(); 239 sbutton_panel = new JPanel(); 240 sinner_panel = new JPanel(); 206 241 207 242 // Buttons … … 240 275 } 241 276 Collection current_collection = Gatherer.c_man.getCollection(); 242 if (current_collection != previous_collection ) {277 if (current_collection != previous_collection && !Gatherer.c_man.isImporting()) { 243 278 this.options_pane = new OptionsPane(current_collection.build_options); 244 279 previous_collection = current_collection; 280 } 281 // If we are in simple mode, we have to rebuild the simple arguments list 282 if(Gatherer.config.getMode() < THRESHOLD) { 283 souter_panel.remove(sargument_configuration_scroll); 284 souter_panel.remove(sinner_panel); 285 sargument_configuration_panel = options_pane.buildImport(null); 286 sargument_configuration_panel = options_pane.buildBuild(sargument_configuration_panel); 287 sargument_configuration_scroll = new JScrollPane(sargument_configuration_panel); 288 sargument_configuration_scroll.setPreferredSize(ARGUMENT_SIZE); 289 souter_panel.add(sargument_configuration_scroll); 290 souter_panel.add(sinner_panel); 245 291 } 246 292 tree.valueChanged(null); … … 253 299 } 254 300 } 301 302 public void destroy() { 303 if(document != null) { 304 document.destroy(); 305 } 306 } 255 307 256 308 /** This method is called to actually layout the components. … … 260 312 public void display() { 261 313 314 int current_mode = Gatherer.config.getMode(); 315 262 316 // Build control_pane 263 317 JPanel left = new JPanel(); … … 276 330 options_area.add(right, BorderLayout.CENTER); 277 331 332 button_pane = new JPanel(); 333 button_pane.setBorder(BorderFactory.createEmptyBorder(5,10,10,10)); 334 button_pane.setLayout(new GridLayout(1,2)); 335 if(current_mode >= THRESHOLD) { 336 button_pane.add(build_button); 337 button_pane.add(cancel_button); 338 button_pane.add(preview_button); 339 } 340 278 341 control_pane.setLayout(new BorderLayout()); 279 342 control_pane.add(options_area, BorderLayout.CENTER); 343 control_pane.add(button_pane, BorderLayout.SOUTH); 280 344 281 345 // Build progress_pane … … 295 359 build_pane.add(build_monitor.getProgress(), BorderLayout.CENTER); 296 360 297 JPanel bar_area = new JPanel();298 361 bar_area.setBorder(BorderFactory.createEmptyBorder(10,10,5,10)); 299 362 … … 304 367 progress_pane.setBorder(BorderFactory.createEmptyBorder(20,20,20,20)); 305 368 progress_pane.setLayout(new BorderLayout()); 306 progress_pane.add(bar_area, BorderLayout.NORTH); 307 progress_pane.add(new JScrollPane(log_textarea), BorderLayout.CENTER); 369 if(current_mode >= THRESHOLD) { 370 progress_pane.add(bar_area, BorderLayout.NORTH); 371 progress_pane.add(log_scroll, BorderLayout.CENTER); 372 } 373 374 // Simple panel 375 sbutton_panel.setBorder(BorderFactory.createEmptyBorder(0,5,0,0)); 376 sbutton_panel.setLayout(new GridLayout(3,1)); 377 if(current_mode < THRESHOLD) { 378 sbutton_panel.add(build_button); 379 sbutton_panel.add(cancel_button); 380 sbutton_panel.add(preview_button); 381 } 382 383 sinner_panel.setBorder(BorderFactory.createEmptyBorder(5,0,5,0)); 384 sinner_panel.setLayout(new BorderLayout()); 385 if(current_mode < THRESHOLD) { 386 sinner_panel.add(bar_area, BorderLayout.CENTER); 387 } 388 sinner_panel.add(sbutton_panel, BorderLayout.EAST); 389 390 if(options_pane != null) { 391 sargument_configuration_panel = options_pane.buildImport(null); 392 sargument_configuration_panel = options_pane.buildBuild(sargument_configuration_panel); 393 } 394 else { 395 sargument_configuration_panel = new JPanel(); 396 } 397 sargument_configuration_scroll = new JScrollPane(sargument_configuration_panel); 398 sargument_configuration_scroll.setPreferredSize(ARGUMENT_SIZE); 399 souter_panel = new JPanel(); 400 souter_panel.setSize(new Dimension(400,800)); 401 souter_panel.setLayout(new GridLayout(2,1)); 402 souter_panel.add(sargument_configuration_scroll); 403 souter_panel.add(sinner_panel); 404 405 simple_panel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5)); 406 simple_panel.setLayout(new BorderLayout()); 407 simple_panel.add(souter_panel, BorderLayout.NORTH); 408 if(current_mode < THRESHOLD) { 409 simple_panel.add(log_scroll, BorderLayout.CENTER); 410 } 308 411 309 412 // Main pane 310 413 main_pane = new JPanel(card_layout); 414 if(current_mode < THRESHOLD) { // Simple mode - add first 415 main_pane.add(simple_panel, SIMPLE); 416 } 311 417 main_pane.add(control_pane, CONTROL); 312 418 main_pane.add(progress_pane, PROGRESS); 313 314 // Buttons 315 JPanel button_pane = new JPanel(); 316 button_pane.setBorder(BorderFactory.createEmptyBorder(5,10,10,10)); 317 button_pane.setLayout(new GridLayout(1,2)); 318 button_pane.add(build_button); 319 button_pane.add(cancel_button); 320 button_pane.add(preview_button); 419 if(current_mode >= THRESHOLD) { // Expert mode - add last 420 main_pane.add(simple_panel, SIMPLE); 421 } 321 422 322 423 this.setLayout(new BorderLayout()); 323 424 this.add(main_pane, BorderLayout.CENTER); 324 this.add(button_pane, BorderLayout.SOUTH);325 425 } 326 426 … … 331 431 */ 332 432 public void gainFocus() { 333 if(!processing) { 433 if(Gatherer.config.getMode() < THRESHOLD) { 434 card_layout.show(main_pane, SIMPLE); 435 } 436 else if(!processing) { 334 437 card_layout.show(main_pane, CONTROL); 438 } 439 else { 440 card_layout.show(main_pane, PROGRESS); 335 441 } 336 442 // Refresh the set of controls. … … 339 445 tree.setSelectionPath(path); 340 446 } 341 342 /** Method to acquire the progress monitor associated with builds.343 * @return The build <strong>GShellProgressMonitor</strong>.344 */345 /* private GShellProgressMonitor getBuildProgress() {346 return build_monitor;347 } */348 349 /** Method to acquire the progress monitor associated with copying.350 * @return The copying <strong>GShellProgressMonitor</strong>.351 */352 /* private GShellProgressMonitor getCopyProgress() {353 return copy_monitor;354 } */355 356 /** Method to acquire the progress monitor associated with import.357 * @return The import <strong>GShellProgressMonitor</strong>.358 */359 /* private GShellProgressMonitor getImportProgress() {360 return import_monitor;361 } */362 447 363 448 /** We are informed when this view pane loses focus so we can update build options. */ … … 376 461 document.appendLine(event.getMessage()); 377 462 log_textarea.setCaretPosition(document.getLengthToNearestLine()); 463 } 464 465 /** Called when the detail mode has changed which in turn may cause several import/build configuration arguments to be available/hidden 466 * @param mode the new mode as an int 467 */ 468 public void modeChanged(int mode) { 469 // If we are below the complexity threshold ensure the simple controls are being shown 470 if(Gatherer.config.getMode() < THRESHOLD) { 471 // Update the arguments 472 souter_panel.remove(sargument_configuration_scroll); 473 souter_panel.remove(sinner_panel); 474 if(options_pane != null) { 475 sargument_configuration_panel = options_pane.buildImport(null); 476 sargument_configuration_panel = options_pane.buildBuild(sargument_configuration_panel); 477 } 478 else { 479 sargument_configuration_panel = new JPanel(); 480 } 481 sargument_configuration_scroll = new JScrollPane(sargument_configuration_panel); 482 sargument_configuration_scroll.setPreferredSize(ARGUMENT_SIZE); 483 souter_panel.add(sargument_configuration_scroll); 484 souter_panel.add(sinner_panel); 485 // Remove the shared components from the expert panels 486 button_pane.remove(build_button); 487 button_pane.remove(cancel_button); 488 button_pane.remove(preview_button); 489 progress_pane.remove(bar_area); 490 progress_pane.remove(log_scroll); 491 // And add to simple one 492 sbutton_panel.add(build_button); 493 sbutton_panel.add(cancel_button); 494 sbutton_panel.add(preview_button); 495 sinner_panel.add(bar_area, BorderLayout.CENTER); 496 simple_panel.add(log_scroll, BorderLayout.CENTER); 497 // And bring the card to the front 498 card_layout.show(main_pane, SIMPLE); 499 } 500 // And if we are above the threshold change to the complex controls 501 else { 502 // Remove the shared components from the simple panel 503 sbutton_panel.remove(build_button); 504 sbutton_panel.remove(cancel_button); 505 sbutton_panel.remove(preview_button); 506 sinner_panel.remove(bar_area); 507 simple_panel.remove(log_scroll); 508 // And add then to the expert ones 509 button_pane.add(build_button); 510 button_pane.add(cancel_button); 511 button_pane.add(preview_button); 512 progress_pane.add(bar_area, BorderLayout.NORTH); 513 progress_pane.add(log_scroll, BorderLayout.CENTER); 514 // And bring the appropriate card to the front 515 if(!processing) { 516 card_layout.show(main_pane, CONTROL); 517 } 518 else { 519 card_layout.show(main_pane, PROGRESS); 520 } 521 } 522 tree.valueChanged(null); // Ensure tree argument panels are rebuilt 378 523 } 379 524 … … 397 542 document.setSpecialCharacter(OptionsPane.SUCCESSFUL); 398 543 options_pane.resetFileEntry(); 399 card_layout.show(main_pane, CONTROL); 544 build_monitor.reset(); 545 import_monitor.reset(); 546 if(Gatherer.config.getMode() >= THRESHOLD) { 547 card_layout.show(main_pane, CONTROL); 548 } 400 549 } 401 550 // Otherwise its completed import but still got build to go … … 414 563 } 415 564 options_pane.resetFileEntry(); 416 card_layout.show(main_pane, CONTROL); 565 if(Gatherer.config.getMode() >= THRESHOLD) { 566 card_layout.show(main_pane, CONTROL); 567 } 417 568 } 418 569 } … … 457 608 // First we force the build options to be updated if we haven't already. 458 609 tree.valueChanged(null); 610 611 // Remember that for lower thresholds the above doesn't work, so try this instead 612 if(Gatherer.config.getMode() < THRESHOLD) { 613 options_pane.update(sargument_configuration_panel); 614 } 615 459 616 // Now go about building. 460 617 build_button.setEnabled(false); 461 618 cancel_button.setEnabled(true); 462 619 preview_button.setEnabled(false); 463 // Create a new log document and assign it to the two textareas464 620 document = options_pane.createNewLogDocument(); 465 621 log_textarea.setDocument(document); … … 467 623 // Change the view. 468 624 processing = true; 469 card_layout.show(main_pane, PROGRESS); 625 if(Gatherer.config.getMode() >= THRESHOLD) { 626 card_layout.show(main_pane, PROGRESS); 627 } 470 628 // Reset the stop flag in all the process monitors, just incase. 471 629 ((GBuildProgressMonitor)build_monitor).reset(); … … 496 654 processing = false; 497 655 document.setSpecialCharacter(OptionsPane.CANCELLED); 498 card_layout.show(main_pane, CONTROL); 656 if(Gatherer.config.getMode() >= THRESHOLD) { 657 card_layout.show(main_pane, CONTROL); 658 } 499 659 // Set the stop flag in all the process monitor. 500 660 build_monitor.setStop(true); 661 build_monitor.reset(); 501 662 copy_monitor.setStop(true); 502 663 import_monitor.setStop(true); 664 import_monitor.reset(); 503 665 // Set removeold automatically. 504 666 Gatherer.c_man.getCollection().build_options.setImportValue("removeold", true, null); … … 591 753 } 592 754 if(node != null && node.equals(building)) { 593 previous_pane = options_pane.buildBuild( );755 previous_pane = options_pane.buildBuild(null); 594 756 scroll_pane = new JScrollPane(previous_pane); 595 757 right.add(scroll_pane, BorderLayout.CENTER); … … 597 759 } 598 760 else if(node != null && node.equals(importing)) { 599 previous_pane = options_pane.buildImport( );761 previous_pane = options_pane.buildImport(null); 600 762 scroll_pane = new JScrollPane(previous_pane); 601 763 right.add(scroll_pane, BorderLayout.CENTER); -
trunk/gli/src/org/greenstone/gatherer/gui/Filter.java
r6051 r6389 72 72 private DragTree tree = null; 73 73 /** The default size for the label. */ 74 static final private Dimension SIZE = new Dimension(100, 25);74 static final private Dimension SIZE = new Dimension(100,30); 75 75 /** Preprogrammed default filters. */ 76 76 static final private String DEFAULTS[] = {"^.*\\.html?$", "^.*\\.xml$", "^.*\\.txt$", "(^.*\\.jpe?g$)|(^.*\\.png$)|(^.*\\.gif$)|(^.*\\.bmp$)|(^.*\\.tif$)"}; … … 97 97 this.tree = tree; 98 98 // Create components. 99 combobox = new GComboBox( );99 combobox = new GComboBox(true); 100 100 combobox.add(new Entry()); 101 101 for(int i = 0; i < DEFAULTS.length; i++) { … … 108 108 } 109 109 } 110 combobox.setEditable(true);111 110 label = new JLabel(); 112 111 label.setPreferredSize(SIZE); … … 153 152 combobox.setSelectedItem(selection); 154 153 ignore = false; 154 } 155 156 /** Sets whether this combobox is editable or not 157 * @param value true to make the control editable, false otherwise 158 */ 159 public void setEditable(boolean value) { 160 combobox.setEditable(value); 155 161 } 156 162 -
trunk/gli/src/org/greenstone/gatherer/gui/GComboBox.java
r6321 r6389 45 45 /** 46 46 * @author John Thompson, Greenstone Digital Library, University of Waikato 47 * @version 47 * @version 2.3 48 48 */ 49 49 public class GComboBox … … 175 175 super.setEditable(editable); 176 176 this.editable = editable; 177 setEditor(new Editor()); 178 setRenderer(new Renderer()); 177 if(editable) { 178 this.setBackground(editable_background); 179 this.setForeground(editable_foreground); 180 } 181 else { 182 this.setBackground(background); 183 this.setForeground(foreground); 184 } 185 setEditor(new Editor()); 186 setRenderer(new Renderer()); 187 updateUI(); 179 188 } 180 189 … … 201 210 ComboBoxModel old_model = (ComboBoxModel) getModel(); 202 211 setModel(model); 212 setOpaque(true); 203 213 // Restore any data given into our model 204 214 for(int i = 0; i < old_model.getSize(); i++) { … … 226 236 setBorder(BorderFactory.createLoweredBevelBorder()); 227 237 setEditor(new Editor()); 228 setOpaque(true);229 238 setRenderer(new Renderer()); 230 239 } … … 234 243 implements ComboBoxEditor { 235 244 public Editor() { 236 setBackground(editable_background);237 setForeground(editable_foreground);238 245 setOpaque(true); 239 246 if(editable) { 240 setSelectionColor(selection_background); 241 setSelectedTextColor(selection_foreground); 242 } 247 setBackground(editable_background); 248 setForeground(editable_foreground); 249 } 250 else { 251 setBackground(background); 252 setForeground(foreground); 253 } 254 setSelectionColor(selection_background); 255 setSelectedTextColor(selection_foreground); 243 256 } 244 257 … … 301 314 public Renderer() { 302 315 super(""); 303 this.setBackground(background);304 this.setForeground(foreground);305 316 this.setOpaque(true); 306 317 } … … 312 323 this.setText(""); 313 324 } 314 if(editable) { 325 if(isSelected) { 326 this.setBackground(selection_background); 327 this.setForeground(selection_foreground); 328 } 329 else if(editable) { 315 330 this.setBackground(editable_background); 316 331 this.setForeground(editable_foreground); -
trunk/gli/src/org/greenstone/gatherer/gui/GConfigPane.java
r5658 r6389 104 104 } 105 105 } 106 107 /** Called whenever the detail mode changes to ensure the filters are at an appropriate level (ie only editable by those that understand regular expression matching) 108 * @param mode the mode level as an int 109 */ 110 public void modeChanged(int mode) { 111 cdm.modeChanged(mode); 112 } 106 113 107 114 public Rectangle setSelectedElement(ElementWrapper element) { -
trunk/gli/src/org/greenstone/gatherer/gui/GUIManager.java
r6220 r6389 74 74 import org.greenstone.gatherer.gui.tree.WorkspaceTree; 75 75 import org.greenstone.gatherer.help.HelpFrame; 76 import org.greenstone.gatherer.mem.MetadataEditorManager; 76 77 import org.greenstone.gatherer.msm.ElementWrapper; 77 78 import org.greenstone.gatherer.msm.Metadata; … … 392 393 } 393 394 395 public void destroy() { 396 // Destroying create pane ensures the latest log has been closed 397 if(create_pane != null) { 398 create_pane.destroy(); 399 } 400 } 401 394 402 /** Enabled events on the window to be trapped, creates all the visual components, then builds the tab and other layouts. 395 403 */ … … 511 519 } 512 520 else { 513 if(help != null) { 521 // Deal to help 522 if(help != null) { 514 523 help.destroy(); 515 524 help = null; 516 525 } 517 526 Gatherer.self.exit(); 518 527 } … … 547 556 int config_pos = tab_pane.indexOfComponent(config_pane); 548 557 tab_pane.setEnabledAt(config_pos, !lock); 558 } 559 } 560 561 public void modeChanged(int mode) { 562 // Set the title 563 String collection_title = null; 564 String collection_name = null; 565 if (Gatherer.c_man.ready()) { 566 Collection collection = Gatherer.c_man.getCollection(); 567 collection_title = collection.getTitle(); 568 collection_name = collection.getName(); 569 collection = null; 570 } 571 setTitle(collection_title, collection_name); 572 collection_title = null; 573 collection_name = null; 574 // Now pass on the message to anyone who cares 575 if(collection_pane != null) { 576 collection_pane.modeChanged(mode); 577 } 578 if(config_pane != null) { 579 config_pane.modeChanged(mode); 580 } 581 if(create_pane != null) { 582 create_pane.modeChanged(mode); 583 } 584 if(metaedit_pane != null) { 585 metaedit_pane.modeChanged(mode); 549 586 } 550 587 } … … 615 652 // Finally display the collection name in the title bar. 616 653 StringBuffer title_buffer = new StringBuffer(Utility.PROGRAM_NAME); 617 title_buffer.append(StaticStrings.COLON_CHARACTER);618 654 title_buffer.append(StaticStrings.SPACE_CHARACTER); 655 title_buffer.append(StaticStrings.SPACE_CHARACTER); 656 // Describe the current user mode 657 title_buffer.append(StaticStrings.MODE_STR); 658 title_buffer.append(Gatherer.config.getModeAsString()); 659 title_buffer.append(StaticStrings.SPACE_CHARACTER); 660 title_buffer.append(StaticStrings.SPACE_CHARACTER); 661 // Now for the current collection 662 title_buffer.append(StaticStrings.COLLECTION_STR); 619 663 if (title != null && name != null) { 620 664 title_buffer.append(title); … … 635 679 public void showEditMetadataBox() { 636 680 if(Gatherer.c_man.getCollection() != null) { 637 Gatherer.c_man.getCollection().msm.editMDS( );681 Gatherer.c_man.getCollection().msm.editMDS(null, MetadataEditorManager.NORMAL); 638 682 } 639 683 } … … 964 1008 } 965 1009 if(config_pos != -1) { 966 tab_pane.setEnabledAt(config_pos, ready && Gatherer.config.get("workflow.design", false) );1010 tab_pane.setEnabledAt(config_pos, ready && Gatherer.config.get("workflow.design", false) && Gatherer.config.getMode() > Configuration.ASSISTANT_MODE); 967 1011 } 968 1012 if(export_pos != -1) { … … 994 1038 } 995 1039 } 1040 1041 -
trunk/gli/src/org/greenstone/gatherer/gui/MetaEditPane.java
r6318 r6389 46 46 import javax.swing.table.*; 47 47 import javax.swing.tree.*; 48 import org.greenstone.gatherer.Configuration; 48 49 import org.greenstone.gatherer.Dictionary; 49 50 import org.greenstone.gatherer.Gatherer; … … 140 141 * @param tree_sync The <strong>TreeSynchronizer</strong> to be used on the collection tree 141 142 * @see org.greenstone.gatherer.Configuration 142 * @see org.greenstone.gatherer.gui.table.GTable 143 * @see org.greenstone.gatherer.valuetree.GValueTree 143 * @see org.greenstone.gatherer.gui.MetaEditPane.GValueTree 144 144 */ 145 145 public MetaEditPane(TreeSynchronizer tree_sync) … … 190 190 * @param event An <strong>ActionEvent</strong> containing information about the event. 191 191 * @see org.greenstone.gatherer.collection.CollectionManager 192 * @see org.greenstone.gatherer.gui.MetaEditPane.GValueTree 192 193 * @see org.greenstone.gatherer.gui.table.GTableModel 193 194 * @see org.greenstone.gatherer.msm.ElementWrapper 194 195 * @see org.greenstone.gatherer.msm.MetadataSetManager 195 196 * @see org.greenstone.gatherer.msm.MSMEvent 196 * @see org.greenstone.gatherer.valuetree.GValueTree197 197 */ 198 198 public void actionPerformed(ActionEvent event) { … … 317 317 * @param ready <i>true</i> if there is a collection currently ready to be editing, <i>false</i> otherwise. 318 318 * @see org.greenstone.gatherer.collection.CollectionManager 319 * @see org.greenstone.gatherer.collection.CollectionModel320 * @see org.greenstone.gatherer.tree.GTree321 319 * @see org.greenstone.gatherer.util.TreeSynchronizer 322 320 */ … … 358 356 * @see org.greenstone.gatherer.Gatherer 359 357 * @see org.greenstone.gatherer.collection.CollectionManager 360 * @see org.greenstone.gatherer.collection.CollectionModel361 358 * @see org.greenstone.gatherer.file.FileOpenActionListener 362 359 * @see org.greenstone.gatherer.gui.Filter 363 360 * @see org.greenstone.gatherer.gui.GComboBox 364 361 * @see org.greenstone.gatherer.gui.table.GTableModel 365 * @see org.greenstone.gatherer.tree.GTree366 * @see org.greenstone.gatherer.tree.GTreeModel367 * @see org.greenstone.gatherer.valuetree.GValueTree368 362 */ 369 363 public void display() { … … 403 397 filter = Gatherer.g_man.getFilter(collection_tree); 404 398 filter.setBackground(Gatherer.config.getColor("coloring.collection_heading_background", false)); 405 // Change the default colours of this filters combobox. 406 GComboBox fcb = filter.getComboBox(); 407 fcb.setBackgroundNonSelectionColor(Color.white); 408 fcb.setTextNonSelectionColor(Gatherer.config.getColor("coloring.collection_tree_foreground", false)); 409 fcb.setBackgroundSelectionColor(Gatherer.config.getColor("coloring.collection_selection_background", false)); 410 fcb.setTextSelectionColor(Gatherer.config.getColor("coloring.collection_selection_foreground", false)); 411 Dictionary.registerTooltip(fcb, "Collection.Filter_Tooltip"); 412 fcb = null; 399 filter.setEditable(Gatherer.config.getMode() > Configuration.LIBRARIAN_MODE); 400 Dictionary.registerTooltip(filter.getComboBox(), "Collection.Filter_Tooltip"); 413 401 414 402 // Connection … … 584 572 /** Ensures a certain tree path is expanded, visible and selected within the collection tree. 585 573 * @param path The <strong>TreePath</strong> to make visible. 586 * @see org.greenstone.gatherer. tree.GTree574 * @see org.greenstone.gatherer.gui.tree.DragTree 587 575 */ 588 576 private void expandPath(TreePath path) { … … 591 579 } 592 580 /** Called to inform this control panel that it has just gained focus as an effect of the user clicking on its tab. 593 * @see org.greenstone.gatherer. tree.GTree581 * @see org.greenstone.gatherer.gui.tree.DragTree 594 582 */ 595 583 public void gainFocus() { … … 630 618 */ 631 619 public void metadataChanged(MSMEvent event) {} 620 621 /** Called whenever the detail mode changes to ensure the filters are at an appropriate level (ie only editable by those that understand regular expression matching) 622 * @param mode the mode level as an int 623 */ 624 public void modeChanged(int mode) { 625 filter.setEditable(mode > Configuration.LIBRARIAN_MODE); 626 } 632 627 633 628 public void refreshTrees() { … … 717 712 * @param event The <strong>ListSelectionEvent</strong> which contains all the information about the event that has been fired. 718 713 * @see org.greenstone.gatherer.gui.table.GTableModel 719 * @see org.greenstone.gatherer. valuetree.GValueTree714 * @see org.greenstone.gatherer.gui.MetaEditPane.GValueTree 720 715 */ 721 716 public void valueChanged(ListSelectionEvent event) { … … 750 745 * @param event A <strong>TreeSelectionEvent</strong> containing information about the event. 751 746 * @see org.greenstone.gatherer.Gatherer 752 * @see org.greenstone.gatherer. collection.FileNode747 * @see org.greenstone.gatherer.file.FileNode 753 748 * @see org.greenstone.gatherer.gui.GUIManager 754 749 * @see org.greenstone.gatherer.gui.MenuBar 755 750 * @see org.greenstone.gatherer.gui.table.GTableModel 756 751 * @see org.greenstone.gatherer.msm.MetadataSetManager 757 * @see org.greenstone.gatherer. tree.GTree752 * @see org.greenstone.gatherer.gui.tree.DragTree 758 753 * @see org.greenstone.gatherer.util.ArrayTools 759 754 */ -
trunk/gli/src/org/greenstone/gatherer/gui/OptionsPane.java
r6321 r6389 44 44 import javax.swing.event.*; 45 45 import javax.swing.text.*; 46 import org.greenstone.gatherer.Configuration; 46 47 import org.greenstone.gatherer.Dictionary; 47 48 import org.greenstone.gatherer.Gatherer; … … 69 70 static final public char UNKNOWN = 'x'; 70 71 72 static private int BUILD = 0; 73 static private int IMPORT = 1; 74 static private int MINIMUM_ROWS = 11; 75 static private Dimension LABEL_SIZE = new Dimension(180, 25); 76 static private Dimension ROW_SIZE = new Dimension(610, 30); 77 static private Dimension SPINNER_SIZE = new Dimension(100, 25); 78 static private String DESCRIPTION_SEP = " + "; 79 71 80 /** All process messages are written to this log text area. */ 72 81 public JTextArea log_textarea = null; … … 85 94 private Vector writing_documents; 86 95 87 static private int BUILD = 0;88 static private int IMPORT = 1;89 static private Dimension LABEL_SIZE = new Dimension(180, 25);90 static private Dimension ROW_SIZE = new Dimension(610, 25);91 static private Dimension SPINNER_SIZE = new Dimension(100, 25);92 static private String DESCRIPTION_SEP = " + ";93 94 96 95 97 /** 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. */ … … 105 107 106 108 /** This method creates the panel with all the build only options on it. 107 * @return A <strong>JPanel</strong> which can be used to display all the build only options. 109 * @param pane a JPanel which already has previous arguments available on it, to allow for lower moes to concatenate all of the arguments together 110 * @return a JPanel which can be used to display all the build only options 111 * @see org.greenstone.gatherer.Configuration#EXPERT_MODE 112 * @see org.greenstone.gatherer.Configuration#getColor 113 * @see org.greenstone.gatherer.Configuration#getMode 114 * @see org.greenstone.gatherer.Gatherer#config 115 * @see org.greenstone.gatherer.cdm.Argument 116 * @see org.greenstone.gatherer.collection.BuildOptions#getBuildArgument 117 * @see org.greenstone.gatherer.collection.BuildOptions#getBuildArgumentCount 118 * @see org.greenstone.gatherer.collection.BuildOptions#getBuildValue 119 * @see org.greenstone.gatherer.collection.BuildOptions#getBuildValueEnabled 120 * @see org.greenstone.gatherer.gui.OptionsPane#ArgumentControl 108 121 */ 109 public JPanel buildBuild() { 110 current_controls.clear(); 111 JPanel pane = new JPanel(); 112 pane.setBackground(Gatherer.config.getColor("coloring.collection_tree_background", false)); 113 pane.setBorder(BorderFactory.createEmptyBorder(5,5,5,5)); 114 int build_argument_count = build_options.getBuildArgumentCount(); 115 pane.setLayout(new GridLayout(build_argument_count, 1, 5, 5)); 116 for(int i = 0; i < build_argument_count; i++) { 122 public JPanel buildBuild(JPanel pane) { 123 // Reset the arguments 124 if(pane == null) { 125 current_controls.clear(); 126 } 127 ArrayList build_arguments = new ArrayList(); 128 int current_mode = Gatherer.config.getMode(); 129 int total_build_argument_count = build_options.getBuildArgumentCount(); 130 for(int i = 0; i < total_build_argument_count; i++) { 117 131 // Retrieve the argument so we know how to format the control. 118 132 Argument argument = build_options.getBuildArgument(i); 119 // Now attempt to retrieve any existing value for this argument. 120 boolean enabled = build_options.getBuildValueEnabled(argument.getName()); 121 String value = build_options.getBuildValue(argument.getName()); 122 ArgumentControl argument_control = new ArgumentControl(BUILD, argument, enabled, value); 123 pane.add(argument_control); 124 current_controls.add(argument_control); 133 if(!argument.isHiddenGLI() && argument.getModeLevel() <= current_mode) { 134 // Now attempt to retrieve any existing value for this argument. 135 boolean enabled = build_options.getBuildValueEnabled(argument.getName()); 136 String value = build_options.getBuildValue(argument.getName()); 137 ArgumentControl argument_control = new ArgumentControl(BUILD, argument, enabled, value); 138 build_arguments.add(argument_control); 139 } 140 } 141 current_controls.addAll(build_arguments); 142 // Now that we know how many arguments there are we can build the pane to view them on. Modes lower than EXPERT can provide a previous pane on which to add the arguments. 143 if(pane == null || current_mode >= Configuration.EXPERT_MODE) { 144 pane = new JPanel(); 145 pane.setBorder(BorderFactory.createEmptyBorder(5,5,5,5)); 146 pane.setBackground(Gatherer.config.getColor("coloring.collection_tree_background", false)); 147 int argument_count = build_arguments.size(); 148 // If in any of the higher detail modes, and assuming we don't want super phat argument controls, we better ensure there is a minimum number or lines in the grid layout 149 if(current_mode >= Configuration.EXPERT_MODE) { 150 if(argument_count < MINIMUM_ROWS) { 151 argument_count = MINIMUM_ROWS; 152 } 153 pane.setLayout(new GridLayout(argument_count, 1, 5, 5)); 154 } 155 // Otherwise we're just going to throw them on one after another and chuck it in a scroll pane anyway 156 else { 157 pane.setLayout(new BoxLayout(pane, BoxLayout.Y_AXIS)); 158 } 159 } 160 for(int j = 0; j < build_arguments.size(); j++) { 161 pane.add((JComponent)build_arguments.get(j)); 125 162 } 126 163 pane.addMouseListener(this); 164 build_arguments = null; 127 165 return pane; 128 166 } 167 129 168 /** This method creates the panel with all the import only options on it. 130 * @return A <strong>JPanel</strong> which can be used to display all the import only options. 169 * @param pane a JPanel which already has previous arguments available on it, to allow for lower moes to concatenate all of the arguments together 170 * @return a JPanel which can be used to display all the build only options 171 * @see org.greenstone.gatherer.Configuration#EXPERT_MODE 172 * @see org.greenstone.gatherer.Configuration#getColor 173 * @see org.greenstone.gatherer.Configuration#getMode 174 * @see org.greenstone.gatherer.Gatherer#config 175 * @see org.greenstone.gatherer.cdm.Argument 176 * @see org.greenstone.gatherer.collection.BuildOptions#getImportArgument 177 * @see org.greenstone.gatherer.collection.BuildOptions#getImportArgumentCount 178 * @see org.greenstone.gatherer.collection.BuildOptions#getImportValue 179 * @see org.greenstone.gatherer.collection.BuildOptions#getImportValueEnabled 180 * @see org.greenstone.gatherer.gui.OptionsPane#ArgumentControl 131 181 */ 132 public JPanel buildImport() { 133 current_controls.clear(); 134 JPanel pane = new JPanel(); 135 pane.setBackground(Gatherer.config.getColor("coloring.collection_tree_background", false)); 136 pane.setBorder(BorderFactory.createEmptyBorder(5,5,5,5)); 137 int import_argument_count = build_options.getImportArgumentCount(); 138 pane.setLayout(new GridLayout(import_argument_count, 1, 5, 5)); 139 for(int i = 0; i < import_argument_count; i++) { 182 public JPanel buildImport(JPanel pane) { 183 // Reset the arguments 184 if(pane == null) { 185 current_controls.clear(); 186 } 187 ArrayList import_arguments = new ArrayList(); 188 int current_mode = Gatherer.config.getMode(); 189 int total_import_argument_count = build_options.getImportArgumentCount(); 190 for(int i = 0; i < total_import_argument_count; i++) { 140 191 // Retrieve the argument so we know how to format the control. 141 192 Argument argument = build_options.getImportArgument(i); 142 // Now attempt to retrieve any existing value for this argument. 143 boolean enabled = build_options.getImportValueEnabled(argument.getName()); 144 String value = build_options.getImportValue(argument.getName()); 145 ArgumentControl argument_control = new ArgumentControl(IMPORT, argument, enabled, value); 146 pane.add(argument_control); 147 current_controls.add(argument_control); 193 if(!argument.isHiddenGLI() && argument.getModeLevel() <= current_mode) { 194 // Now attempt to retrieve any existing value for this argument. 195 boolean enabled = build_options.getImportValueEnabled(argument.getName()); 196 String value = build_options.getImportValue(argument.getName()); 197 ArgumentControl argument_control = new ArgumentControl(IMPORT, argument, enabled, value); 198 import_arguments.add(argument_control); 199 } 200 } 201 current_controls.addAll(import_arguments); 202 // Now that we know how many arguments there are we can build the pane to view them on. Modes lower than EXPERT can provide a previous pane on which to add the arguments. 203 if(pane == null || current_mode >= Configuration.EXPERT_MODE) { 204 pane = new JPanel(); 205 pane.setBorder(BorderFactory.createEmptyBorder(5,5,5,5)); 206 pane.setBackground(Gatherer.config.getColor("coloring.collection_tree_background", false)); 207 int argument_count = import_arguments.size(); 208 // If in any of the higher detail modes, and assuming we don't want super phat argument controls, we better ensure there is a minimum number or lines in the grid layout 209 if(current_mode >= Configuration.EXPERT_MODE) { 210 if(argument_count < MINIMUM_ROWS) { 211 argument_count = MINIMUM_ROWS; 212 } 213 pane.setLayout(new GridLayout(argument_count, 1, 5, 5)); 214 } 215 // Otherwise we're just going to throw them on one after another and chuck it in a scroll pane anyway 216 else { 217 pane.setLayout(new BoxLayout(pane, BoxLayout.Y_AXIS)); 218 } 219 } 220 for(int j = 0; j < import_arguments.size(); j++) { 221 pane.add((JComponent)import_arguments.get(j)); 148 222 } 149 223 pane.addMouseListener(this); 224 import_arguments = null; 150 225 return pane; 151 226 } 227 152 228 /** This method is used to build a panel based on the message log, which is nothing like any of the other panels. 153 229 * @return A <strong>JPanel</strong> containing a scrollable text area which represents the shell process message log. … … 322 398 setLayout(new BorderLayout()); 323 399 setPreferredSize(ROW_SIZE); 400 setMaximumSize(ROW_SIZE); 324 401 325 402 // Try to determine what the value_controls value should be. … … 425 502 value_control = textfield; 426 503 break; 504 case Argument.METADATUM: 505 GComboBox gcombobox = new GComboBox(Gatherer.c_man.getCollection().msm.getAssignedElements(), false); 506 gcombobox.setEnabled(enable); 507 // Now ensure we have the existing value or default value selected if either exist. 508 if(value != null) { 509 boolean found = selectValue(gcombobox, value); 510 // Its possible that this is a custom value and so doesn't exist in the combobox. If so add it and then select it 511 if(!found) { 512 gcombobox.addItem(value); 513 gcombobox.setSelectedItem(value); 514 } 515 } 516 add(gcombobox, BorderLayout.CENTER); 517 value_control = gcombobox; 518 break; 427 519 } 428 520 … … 454 546 } 455 547 548 /** Method to ensure that a certain value is selected, if it exists within that combobox to begin with. 549 * @param combobox the JComboBox whose selection we are trying to preset 550 * @param target The desired value of the selection as a String 551 * @return true if the item was found and selected, false otherwise 552 */ 553 public boolean selectValue(JComboBox combobox, String target) { 554 for(int i = 0; i < combobox.getItemCount(); i++) { 555 if(combobox.getItemAt(i).toString().equals(target)) { 556 combobox.setSelectedIndex(i); 557 return true; 558 } 559 } 560 return false; 561 } 562 456 563 /** Update the values stored in the collection so as to rememebr the current state of this argument. */ 457 564 public void update() { … … 472 579 } 473 580 else if(value_control instanceof JComboBox) { 474 value = ( String) ((JComboBox)value_control).getSelectedItem();475 } 476 581 value = (((JComboBox)value_control).getSelectedItem()).toString(); 582 } 583 // If this argument was a flag, but is now disabled, remove from the build options altogether 477 584 if(!enable && value == null) { 478 585 if(type == BUILD) { … … 483 590 } 484 591 } 485 592 // Otherwise update the argument value 486 593 else { 487 594 if(type == BUILD) { … … 638 745 public void valueChanged(ListSelectionEvent e) { 639 746 if (!e.getValueIsAdjusting()) { // we get two events for one change in list selection - use the false one ( the second one) 747 ///ystem.err.println("Log change detected."); 640 748 JList source = (JList)e.getSource(); 641 749 file_entry = (FileEntry) source.getSelectedValue(); 642 750 // First we determine if the old log has been completely written to file 643 751 Document document = log_textarea.getDocument(); 644 if(document instanceof AppendLineOnlyFileDocument) { 645 AppendLineOnlyFileDocument append_line_only_file_document = (AppendLineOnlyFileDocument) document; 752 ///ystem.err.println(" * current document: " + document); 753 ///ystem.err.println(" * new document: " + file_entry.getDocument()); 754 // If we are dealing with the same document don't do anything. 755 if(document != file_entry.getDocument()) { 756 if(document instanceof AppendLineOnlyFileDocument) { 757 AppendLineOnlyFileDocument append_line_only_file_document = (AppendLineOnlyFileDocument) document; 646 758 if(append_line_only_file_document.isStillWriting()) { 759 ///ystem.err.println("Current log is still active... finishing."); 647 760 writing_documents.add(append_line_only_file_document); // We have to maintain a reference until they are all done. 648 761 append_line_only_file_document.setOwner(OptionsPane.this); 649 762 append_line_only_file_document.setExit(); 650 763 } 651 } 652 // Load the new log 653 log_textarea.setDocument(file_entry.getDocument()); 764 else { 765 ///ystem.err.println("Current log is complete. Nothing to do."); 766 } 767 } 768 // Load the new log 769 log_textarea.setDocument(file_entry.getDocument()); 770 } 654 771 } 655 772 } -
trunk/gli/src/org/greenstone/gatherer/gui/Preferences.java
r6319 r6389 76 76 private JLabel recursion_depth_label; 77 77 private JLabel title_label; 78 private JRadioButton assistant_mode_radio_button; 79 private JRadioButton expert_mode_radio_button; 80 private JRadioButton librarian_mode_radio_button; 81 private JRadioButton systems_mode_radio_button; 82 private JSpinner proxy_port_field; 83 private JSpinner recursion_depth_spinner; 78 84 private JTabbedPane tab_pane; 85 private JTextArea mode_description_textarea; 79 86 private JTextField library_path_field; 80 87 private JTextField proxy_host_field; 81 private JSpinner proxy_port_field;82 private JSpinner recursion_depth_spinner;83 88 private Preferences self; 84 89 85 static final Dimension LABEL_SIZE = new Dimension( 175, 25);90 static final Dimension LABEL_SIZE = new Dimension(240, 25); 86 91 static final Dimension ROW_SIZE = new Dimension(640, 25); 87 92 static final Dimension SIZE = new Dimension(640, 345); … … 101 106 JPanel general_preferences = createGeneralPreferences(); 102 107 tab_pane.add("Preferences.General", general_preferences); 108 tab_pane.add("Preferences.Mode", createModePreferences()); 103 109 tab_pane.add("Preferences.Workflow", createWorkflowPreferences()); 104 110 tab_pane.add("Preferences.Connection", createConnectionPreferences()); … … 330 336 } 331 337 338 /** Generate the controls for altering the detail mode. 339 * @return a JPanel of controls 340 */ 341 private JPanel createModePreferences() { 342 // Create Controls 343 JPanel mode_panel = new JPanel(); 344 JPanel button_panel = new JPanel(); 345 ButtonGroup mode_button_group = new ButtonGroup(); 346 assistant_mode_radio_button = new JRadioButton(Dictionary.get("Preferences.Mode.Assistant")); 347 assistant_mode_radio_button.setOpaque(false); 348 mode_button_group.add(assistant_mode_radio_button); 349 expert_mode_radio_button = new JRadioButton(Dictionary.get("Preferences.Mode.Expert")); 350 expert_mode_radio_button.setOpaque(false); 351 mode_button_group.add(expert_mode_radio_button); 352 librarian_mode_radio_button = new JRadioButton(Dictionary.get("Preferences.Mode.Librarian")); 353 librarian_mode_radio_button.setOpaque(false); 354 mode_button_group.add(librarian_mode_radio_button); 355 systems_mode_radio_button = new JRadioButton(Dictionary.get("Preferences.Mode.Systems")); 356 systems_mode_radio_button.setOpaque(false); 357 mode_button_group.add(systems_mode_radio_button); 358 mode_description_textarea = new JTextArea(); 359 mode_description_textarea.setEditable(false); 360 mode_description_textarea.setLineWrap(true); 361 mode_description_textarea.setWrapStyleWord(true); 362 // Determine which value is already selected 363 switch(Gatherer.config.getMode()) { 364 case Configuration.ASSISTANT_MODE: 365 assistant_mode_radio_button.setSelected(true); 366 mode_description_textarea.setText(Dictionary.get("Preferences.Mode.Assistant_Description")); 367 break; 368 case Configuration.SYSTEMS_MODE: 369 systems_mode_radio_button.setSelected(true); 370 mode_description_textarea.setText(Dictionary.get("Preferences.Mode.Systems_Description")); 371 break; 372 case Configuration.EXPERT_MODE: 373 expert_mode_radio_button.setSelected(true); 374 mode_description_textarea.setText(Dictionary.get("Preferences.Mode.Expert_Description")); 375 break; 376 default: 377 librarian_mode_radio_button.setSelected(true); 378 mode_description_textarea.setText(Dictionary.get("Preferences.Mode.Librarian_Description")); 379 } 380 // Connection - when a radio button is selected we have to change the description 381 ModeRadioButtonListener listener = new ModeRadioButtonListener(); 382 assistant_mode_radio_button.addActionListener(listener); 383 expert_mode_radio_button.addActionListener(listener); 384 librarian_mode_radio_button.addActionListener(listener); 385 systems_mode_radio_button.addActionListener(listener); 386 listener = null; 387 // Layout 388 button_panel.setBorder(BorderFactory.createEmptyBorder(0,0,5,0)); 389 button_panel.setLayout(new GridLayout(4,1,2,2)); 390 button_panel.add(assistant_mode_radio_button); 391 button_panel.add(librarian_mode_radio_button); 392 button_panel.add(systems_mode_radio_button); 393 button_panel.add(expert_mode_radio_button); 394 395 mode_panel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5)); 396 mode_panel.setLayout(new BorderLayout()); 397 mode_panel.add(button_panel, BorderLayout.NORTH); 398 mode_panel.add(new JScrollPane(mode_description_textarea), BorderLayout.CENTER); 399 400 return mode_panel; 401 } 402 332 403 /** The warning preferences are controlled through a checklist. */ 333 404 private JPanel createWarningPreferences() { … … 504 575 Gatherer.config.setInt("general.max_folder_depth", Configuration.COLLECTION_SPECIFIC, ((Integer)recursion_depth_spinner.getValue()).intValue()); 505 576 577 // Mode preferences 578 int current_mode = Gatherer.config.getMode(); 579 int new_mode; 580 if(assistant_mode_radio_button.isSelected()) { 581 new_mode = Configuration.ASSISTANT_MODE; 582 } 583 else if(systems_mode_radio_button.isSelected()) { 584 new_mode = Configuration.SYSTEMS_MODE; 585 } 586 else if(expert_mode_radio_button.isSelected()) { 587 new_mode = Configuration.EXPERT_MODE; 588 } 589 else { 590 new_mode = Configuration.LIBRARIAN_MODE; 591 } 592 // If there has been a change in modes, update the config, and also inform the persistant gui views that have a need to know 593 if(new_mode != current_mode) { 594 Gatherer.config.setMode(new_mode); 595 Gatherer.c_man.getCollection().cdm.modeChanged(new_mode); 596 Gatherer.g_man.modeChanged(new_mode); 597 } 506 598 // Warning preferences 507 599 for(int i = 0; i < warning_preferences_check_list.getEntryCount(); i++) { … … 522 614 Gatherer.g_man.workflowUpdate("Gather", workflow_gather.isSelected()); 523 615 Gatherer.g_man.workflowUpdate("Enrich", workflow_enrich.isSelected()); 524 Gatherer.g_man.workflowUpdate("Design", workflow_design.isSelected());616 Gatherer.g_man.workflowUpdate("Design", (workflow_design.isSelected() && Gatherer.config.getMode() > Configuration.ASSISTANT_MODE)); 525 617 Gatherer.g_man.workflowUpdate("Export", workflow_export.isSelected()); 526 618 Gatherer.g_man.workflowUpdate("Create", workflow_create.isSelected()); … … 568 660 return locale.getDisplayName(); 569 661 } 662 } 663 } 664 665 /** This listener updates the mode description depending on what mode is selected. */ 666 private class ModeRadioButtonListener 667 implements ActionListener { 668 public void actionPerformed(ActionEvent event) { 669 Object source = event.getSource(); 670 if(source == assistant_mode_radio_button) { 671 mode_description_textarea.setText(Dictionary.get("Preferences.Mode.Assistant_Description")); 672 } 673 else if(source == expert_mode_radio_button) { 674 mode_description_textarea.setText(Dictionary.get("Preferences.Mode.Expert_Description")); 675 } 676 else if(source == systems_mode_radio_button) { 677 mode_description_textarea.setText(Dictionary.get("Preferences.Mode.Systems_Description")); 678 } 679 else { 680 mode_description_textarea.setText(Dictionary.get("Preferences.Mode.Librarian_Description")); 681 } 682 source = null; 570 683 } 571 684 }
Note:
See TracChangeset
for help on using the changeset viewer.