Changeset 6622
- Timestamp:
- 2004-01-27T16:35:34+13:00 (20 years ago)
- Location:
- trunk/gli
- Files:
-
- 21 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/classes/xml/config.xml
r6534 r6622 116 116 <Argument name="warning.MissingMDS">true</Argument> 117 117 <Argument name="warning.NoMetadataSetsSelected">true</Argument> 118 <Argument name="warning.OldWGet">true</Argument> 118 119 <Argument name="warning.TitleClashes">true</Argument> 119 120 <!-- Workflow --> -
trunk/gli/gli.sh
r6467 r6622 19 19 20 20 ## ---- Determine GSDLHOME ---- 21 gsdlpath= 21 gsdlpath=/research/jmt12/gsdl 22 22 23 23 # Some users may set the above line manually … … 119 119 fi 120 120 121 ## ---- Check WGet exists ---- 122 wgetpath=/home/jmt12/local/bin/wget 123 124 wok="NoWGet" 125 # Some users may set the above line manually 126 if [ "$wgetpath" == "" ]; then 127 # Check if WGet is on the search path 128 wgetpath=`which wget 2> /dev/null` 129 fi 130 131 # Check that a WGet executable has been found 132 echo "Checking WGet: $wgetpath" 133 if [ ! -x "$wgetpath" ]; then 134 echo 135 echo "Failed to locate an appropriate version of WGet. Web mirroring will" 136 echo "be disabled. Greenstone Librarian Interface requires WGet installed" 137 echo "in order to fully access this feature." 138 else 139 ## -- Check the version of WGet is new enough (1.9 or higher) to run properly -- 140 wgetversion=`$wgetpath --version 2>&1 | sed -n 's/^GNU Wget \(.*\)/\1/p'` 141 wvmajor=`echo $wgetversion | sed -n 's/^\([0-9]*\).*$/\1/p'` 142 wvminor=`echo $wgetversion | sed -n 's/^[0-9]*\.\(.*\)$/\1/p'` 143 144 wok="WGet1.9" 145 if [ $wvmajor -lt 1 ] ; then 146 wok="<WGet1.9" 147 fi 148 if [ $wvmajor -eq 1 ] && [ $wvminor -lt 9 ] ; then 149 wok="<WGet1.9" 150 fi 151 if [ $wok == "<WGet1.9" ] ; then 152 echo 153 echo "The version of the WGet you have installed has a known bug when" 154 echo "mirroring files which contain encoded characters such as space and" 155 echo "tilde in their URL. While this shouldn't be a problem, we recommend" 156 echo "installing WGet 1.9 or higher." 157 fi 158 fi 121 159 122 160 ## ---- Check that the GLI has been compiled ---- … … 147 185 # -Xloggc:<file> Write garbage collection log 148 186 149 java -classpath classes/:GLI.jar:lib/apache.jar:lib/calpa.jar:lib/jp.jar:lib/polloxml.jar:lib/qfslib.jar:lib/skinlf.jar org.greenstone.gatherer.Gatherer -gsdl $GSDLHOME $*187 java -classpath classes/:GLI.jar:lib/apache.jar:lib/calpa.jar:lib/jp.jar:lib/polloxml.jar:lib/qfslib.jar:lib/skinlf.jar org.greenstone.gatherer.Gatherer -gsdl $GSDLHOME -wget $wok$wgetpath $* 150 188 151 189 echo "Done!" -
trunk/gli/src/org/greenstone/gatherer/Configuration.java
r6593 r6622 102 102 /** The screen size of the desktop the Gatherer will be displayed on. */ 103 103 public Dimension screen_size = Toolkit.getDefaultToolkit().getScreenSize(); 104 105 /** If true, overrides the mirroring enabled setting in the config.xml file. */ 106 private boolean mirroring_enabled = false; 104 107 /** Collection level configuration (which in some cases overrides general configuration. */ 105 108 private Document collection_config; … … 112 115 private int cache_hit = 0; 113 116 private int cache_miss = 0; 117 118 private String wget_path = null; 119 private String wget_version_str = StaticStrings.NO_WGET_STR; 120 114 121 public URL exec_address = null; 115 122 … … 119 126 * @param perl_path The path to the PERL executable, as a <strong>String</strong>. 120 127 */ 121 public Configuration(String gsdl_path, String exec_path, String perl_path ) {128 public Configuration(String gsdl_path, String exec_path, String perl_path, boolean mirroring_enabled, String wget_version_str, String wget_path) { 122 129 super(); 123 130 this.gsdl_path = gsdl_path; 124 131 this.exec_path = exec_path; 132 this.mirroring_enabled = mirroring_enabled; 133 this.wget_version_str = wget_version_str; 134 this.wget_path = wget_path; 135 125 136 // The exec_path may contain an url address, in which case we blindly use that and leave it up to the user to worry about settings and resetting. 126 137 Gatherer.println("EXEC_PATH = " + exec_path); … … 256 267 /** The default get action retrieves the named property from the desired configuration, and returns a true or false. */ 257 268 public boolean get(String property, boolean general) { 269 if(general && mirroring_enabled && property.equals(StaticStrings.WORKFLOW_MIRROR)) { 270 return mirroring_enabled; 271 } 258 272 String raw = getString(property, general); 259 273 return (raw != null && raw.equalsIgnoreCase("true")); … … 574 588 575 589 public String getWGetPath() { 576 return "/usr/bin/wget"; 590 return wget_path; 591 } 592 593 public String getWGetVersion() { 594 return wget_version_str; 577 595 } 578 596 -
trunk/gli/src/org/greenstone/gatherer/Gatherer.java
r6549 r6622 165 165 } 166 166 167 public void run(Dimension size, String gsdl_path, String exec_path, boolean debug_enabled, String perl_path, boolean no_load, Splash splash, String open_collection ) {167 public void run(Dimension size, String gsdl_path, String exec_path, boolean debug_enabled, String perl_path, boolean no_load, Splash splash, String open_collection, boolean mirroring_enabled, String wget_version_str, String wget_path) { 168 168 169 169 // This will hopefully catch ctrl-c and terminate, and exit gracefully. However it is platform specific, and may not be supported by some JVMs. … … 199 199 try { 200 200 // Load Config 201 loadConfig(gsdl_path, exec_path, perl_path );201 loadConfig(gsdl_path, exec_path, perl_path, mirroring_enabled, wget_version_str, wget_path); 202 202 203 203 // MDSTesting … … 499 499 500 500 boolean debug = false; 501 boolean mirroring_enabled = false; 501 502 boolean no_load = false; 502 503 Dictionary dictionary = new Dictionary(null, null); // Default dictionary. Only used for starting error messages. … … 507 508 String gsdl_path = null; 508 509 String perl_path = null; 510 String wget_path = null; 511 String wget_version_str = StaticStrings.NO_WGET_STR; 509 512 // Parse arguments 510 513 int argument_index = 0; 511 514 String next_token = null; 512 515 while(argument_index < args.length || next_token != null) { 513 // 1. We start by attempting to parse an argument name. An argument must start with a '-', and should not contain spaces. If anything else is encountered it is ignored. 514 String argument_name = null; 515 if(next_token == null) { 516 next_token = args[argument_index]; 517 argument_index++; 518 } 519 if(next_token.startsWith(StaticStrings.MINUS_CHARACTER)) { 520 // Trim second '-' just to be kind to Unixy-type people 521 if(next_token.startsWith(StaticStrings.MINUS_CHARACTER + StaticStrings.MINUS_CHARACTER)) { 522 argument_name = next_token.substring(1); 516 // 1. We start by attempting to parse an argument name. An argument must start with a '-', and should not contain spaces. If anything else is encountered it is ignored. 517 String argument_name = null; 518 if(next_token == null) { 519 next_token = args[argument_index]; 520 argument_index++; 521 } 522 if(next_token.startsWith(StaticStrings.MINUS_CHARACTER)) { 523 // Trim second '-' just to be kind to Unixy-type people 524 if(next_token.startsWith(StaticStrings.MINUS_CHARACTER + StaticStrings.MINUS_CHARACTER)) { 525 argument_name = next_token.substring(1); 526 } 527 else { 528 argument_name = next_token; 529 } 530 } 531 next_token = null; 532 // 2. If we now have an argument name we continue by attempting to parse a value. A value is taken to be the sequence of space seperated Strings between the last argument name and up to but not including the next argument name. Of course an argument needn't have any value (ie -debug, -help), in which case value will be null. 533 if(argument_name != null) { 534 String argument_value = null; 535 StringBuffer argument_value_buffer = new StringBuffer(""); 536 while(argument_index < args.length && next_token == null) { 537 next_token = args[argument_index]; 538 argument_index++; 539 // If we just parsed an arbitary String then append it to value, followed by a single space 540 if(!next_token.startsWith(StaticStrings.MINUS_CHARACTER)) { 541 argument_value_buffer.append(next_token); 542 argument_value_buffer.append(StaticStrings.SPACE_CHARACTER); 543 next_token = null; 544 } 545 // If the argument token retrieved is an argument name, then leave it in next_token, which will cause the argument parsing process to move onto the next step. 546 } 547 // If a value now exists in argument buffer, retrieve it. Remove the last character as it will be an erroneous space. 548 if(argument_value_buffer.length() > 0) { 549 argument_value = argument_value_buffer.substring(0, argument_value_buffer.length() - 1); 550 } 551 552 // 3. We now have the argument name, and any associated value. We are ready to store the data in the appropriate variables. 553 Gatherer.println("Parsed Argument: name=" + argument_name + (argument_value != null ? (", value=" + argument_value) : ", no value")); 554 // 3a. First those arguments that have no associated value 555 if(argument_value == null) { 556 if(argument_name.equals(StaticStrings.HELP_ARGUMENT)) { 557 printUsage(dictionary); 558 System.exit(0); 559 } 560 // Run GLI in debug mode. Produces debug log plus extra messages. 561 else if(argument_name.equals(StaticStrings.DEBUG_ARGUMENT)) { 562 debug = true; 563 } 564 // Forces no loading on previous collection. 565 else if(argument_name.equals(StaticStrings.NO_LOAD_ARGUMENT)) { 566 no_load = true; 567 filename = null; 568 } 569 // Run the GLI with mirroring enabled 570 else if(argument_name.equals(StaticStrings.MIRROR_ARGUMENT)) { 571 mirroring_enabled = true; 572 } 573 /* I've got a sneak suspicion Aqua look and feel is not free domain 574 // Specify the use of Greenstone LAF. 575 else if(argument_name.equals(StaticStrings.SKIN_ARGUMENT)) { 576 // SkinLF 577 try { 578 SkinLookAndFeel.setSkin(SkinLookAndFeel.loadThemePackDefinition(SkinUtils.toURL(new File(SKIN_DEFINITION_FILE)))); 579 SkinLookAndFeel.enable(); 580 } 581 catch (Exception error) { 582 ///ystem.err.println("Error: " + error); 583 error.printStackTrace(); 584 } 585 } 586 */ 587 } 588 // 3b. Now for those that do 589 else { 590 // Parse the path to the GSDL. Required argument. 591 if(argument_name.equals(StaticStrings.GSDL_ARGUMENT)) { 592 if(argument_value.endsWith(File.separator)) { 593 gsdl_path = argument_value; 523 594 } 524 595 else { 525 argument_name = next_token; 526 } 527 } 528 next_token = null; 529 // 2. If we now have an argument name we continue by attempting to parse a value. A value is taken to be the sequence of space seperated Strings between the last argument name and up to but not including the next argument name. Of course an argument needn't have any value (ie -debug, -help), in which case value will be null. 530 if(argument_name != null) { 531 String argument_value = null; 532 StringBuffer argument_value_buffer = new StringBuffer(""); 533 while(argument_index < args.length && next_token == null) { 534 next_token = args[argument_index]; 535 argument_index++; 536 // If we just parsed an arbitary String then append it to value, followed by a single space 537 if(!next_token.startsWith(StaticStrings.MINUS_CHARACTER)) { 538 argument_value_buffer.append(next_token); 539 argument_value_buffer.append(StaticStrings.SPACE_CHARACTER); 540 next_token = null; 541 } 542 // If the argument token retrieved is an argument name, then leave it in next_token, which will cause the argument parsing process to move onto the next step. 543 } 544 // If a value now exists in argument buffer, retrieve it. Remove the last character as it will be an erroneous space. 545 if(argument_value_buffer.length() > 0) { 546 argument_value = argument_value_buffer.substring(0, argument_value_buffer.length() - 1); 547 } 548 549 // 3. We now have the argument name, and any associated value. We are ready to store the data in the appropriate variables. 550 Gatherer.println("Parsed Argument: name=" + argument_name + (argument_value != null ? (", value=" + argument_value) : ", no value")); 551 // 3a. First those arguments that have no associated value 552 if(argument_value == null) { 553 if(argument_name.equals(StaticStrings.HELP_ARGUMENT)) { 554 printUsage(dictionary); 555 System.exit(0); 556 } 557 // Run GLI in debug mode. Produces debug log plus extra messages. 558 else if(argument_name.equals(StaticStrings.DEBUG_ARGUMENT)) { 559 debug = true; 560 } 561 // Forces no loading on previous collection. 562 else if(argument_name.equals(StaticStrings.NO_LOAD_ARGUMENT)) { 563 no_load = true; 564 filename = null; 565 } 566 /* I've got a sneak suspicion Aqua look and feel is not free domain 567 // Specify the use of Greenstone LAF. 568 else if(argument_name.equals(StaticStrings.SKIN_ARGUMENT)) { 569 // SkinLF 570 try { 571 SkinLookAndFeel.setSkin(SkinLookAndFeel.loadThemePackDefinition(SkinUtils.toURL(new File(SKIN_DEFINITION_FILE)))); 572 SkinLookAndFeel.enable(); 573 } 574 catch (Exception error) { 575 ///ystem.err.println("Error: " + error); 576 error.printStackTrace(); 577 } 578 } 579 */ 580 } 581 // 3b. Now for those that do 582 else { 583 // Parse the path to the GSDL. Required argument. 584 if(argument_name.equals(StaticStrings.GSDL_ARGUMENT)) { 585 if(argument_value.endsWith(File.separator)) { 586 gsdl_path = argument_value; 596 gsdl_path = argument_value + File.separator; 597 } 598 } 599 // Specify a collection to load initially. Could be used for file associations. 600 else if(argument_name.equals(StaticStrings.LOAD_ARGUMENT)) { 601 filename = argument_value; 602 no_load = false; 603 } 604 // Parse the url to a running web server, or a file path to the local library server. 605 else if(argument_name.equals(StaticStrings.LIBRARY_ARGUMENT)) { 606 exec_path = argument_value; 607 // If there is no colon in first five characters of the exec_path (which would either be an existing protocol, or a windows file path to say a local library), we can append the protocol http://. 608 if(argument_value.lastIndexOf(StaticStrings.COLON_CHARACTER, 5) == -1) { 609 exec_path = StaticStrings.HTTP_PROTOCOL_STR + argument_value; 610 } 611 else { 612 exec_path = argument_value; 613 } 614 // If the user has given us an address, but it ends with a '/' we assume we're using the greenstone library.cgi 615 if(exec_path.startsWith(StaticStrings.HTTP_PROTOCOL_STR) && exec_path.endsWith(StaticStrings.URL_SEPARATOR_CHARACTER)) { 616 exec_path = exec_path + StaticStrings.LIBRARY_STR; 617 } 618 } 619 // Parse the path to PERL. If not provided its assumes perl should be availble on the PATH. 620 else if(argument_name.equals(StaticStrings.PERL_ARGUMENT)) { 621 perl_path = argument_value; 622 // Test whether this points to the Perl bin directory or the Perl executable itself. 623 File perl_file = new File(perl_path); 624 if(perl_file.isDirectory()) { 625 // If this is windows we create a child file perl.exe, otherwise we create perl 626 if(Utility.isWindows()) { 627 perl_file = new File(perl_file, Utility.PERL_EXECUTABLE_WINDOWS); 587 628 } 588 629 else { 589 gsdl_path = argument_value + File.separator;630 perl_file = new File(perl_file, Utility.PERL_EXECUTABLE_UNIX); 590 631 } 591 } 592 // Specify a collection to load initially. Could be used for file associations. 593 else if(argument_name.equals(StaticStrings.LOAD_ARGUMENT)) { 594 filename = argument_value; 595 no_load = false; 596 } 597 // Parse the url to a running web server, or a file path to the local library server. 598 else if(argument_name.equals(StaticStrings.LIBRARY_ARGUMENT)) { 599 exec_path = argument_value; 600 // If there is no colon in first five characters of the exec_path (which would either be an existing protocol, or a windows file path to say a local library), we can append the protocol http://. 601 if(argument_value.lastIndexOf(StaticStrings.COLON_CHARACTER, 5) == -1) { 602 exec_path = StaticStrings.HTTP_PROTOCOL_STR + argument_value; 603 } 604 else { 605 exec_path = argument_value; 606 } 607 // If the user has given us an address, but it ends with a '/' we assume we're using the greenstone library.cgi 608 if(exec_path.startsWith(StaticStrings.HTTP_PROTOCOL_STR) && exec_path.endsWith(StaticStrings.URL_SEPARATOR_CHARACTER)) { 609 exec_path = exec_path + StaticStrings.LIBRARY_STR; 610 } 611 } 612 // Parse the path to PERL. If not provided its assumes perl should be availble on the PATH. 613 else if(argument_name.equals(StaticStrings.PERL_ARGUMENT)) { 614 perl_path = argument_value; 615 // Test whether this points to the Perl bin directory or the Perl executable itself. 616 File perl_file = new File(perl_path); 617 if(perl_file.isDirectory()) { 618 // If this is windows we create a child file perl.exe, otherwise we create perl 619 if(Utility.isWindows()) { 620 perl_file = new File(perl_file, Utility.PERL_EXECUTABLE_WINDOWS); 621 } 622 else { 623 perl_file = new File(perl_file, Utility.PERL_EXECUTABLE_UNIX); 624 } 625 // And store this new path. 626 perl_path = perl_file.getAbsolutePath(); 627 perl_file = null; 628 } 629 // Otherwise its fine as it is 630 } 631 } 632 } 633 // Argument name was null, nothing to be done. 632 // And store this new path. 633 perl_path = perl_file.getAbsolutePath(); 634 perl_file = null; 635 } 636 // Otherwise its fine as it is 637 } 638 // Test for the presence of a WGet version. This is only useful if the user has enabled mirroring. Note that mirroring can be enabled by running the GLI with -mirror, editing the config.xml for GLI, or through a new option on the connections page of the preferences. 639 else if(argument_name.equals(StaticStrings.WGET_ARGUMENT)) { 640 if(argument_value.startsWith(StaticStrings.WGET_STR)) { 641 wget_version_str = StaticStrings.WGET_STR; 642 wget_path = argument_value.substring(StaticStrings.WGET_STR.length()); 643 } 644 else if(argument_value.startsWith(StaticStrings.WGET_OLD_STR)) { 645 wget_version_str = StaticStrings.WGET_OLD_STR; 646 wget_path = argument_value.substring(StaticStrings.WGET_OLD_STR.length()); 647 } 648 } 649 } 650 } 651 // Argument name was null, nothing to be done. 634 652 } 635 653 next_token = null; … … 639 657 Splash splash = new Splash(); 640 658 dictionary.destroy(); 641 gatherer.run(size, gsdl_path, exec_path, debug, perl_path, no_load, splash, filename );659 gatherer.run(size, gsdl_path, exec_path, debug, perl_path, no_load, splash, filename, mirroring_enabled, wget_version_str, wget_path); 642 660 } 643 661 … … 766 784 * @see org.greenstone.gatherer.Configuration 767 785 */ 768 private void loadConfig(String gsdl_path, String exec_path, String perl_path ) {786 private void loadConfig(String gsdl_path, String exec_path, String perl_path, boolean mirroring_enabled, String wget_version_str, String wget_path) { 769 787 try { 770 config = new Configuration(gsdl_path, exec_path, perl_path );788 config = new Configuration(gsdl_path, exec_path, perl_path, mirroring_enabled, wget_version_str, wget_path); 771 789 } 772 790 catch (Exception error) { … … 1029 1047 if (exitCode != 0) { // if Netscape or mozilla was not open 1030 1048 Gatherer.println("couldn't do remote, trying original command"); 1031 printArray(commands); 1049 if(debug != null) { 1050 printArray(commands); 1051 } 1032 1052 process = rt.exec(commands); // try the original command 1033 1053 } … … 1060 1080 public void printArray(String [] array) { 1061 1081 for(int i = 0; i < array.length; i++) { 1082 debug.print(array[i]+" "); 1062 1083 System.err.println(array[i]+" "); 1063 1084 } -
trunk/gli/src/org/greenstone/gatherer/WGet.java
r6590 r6622 258 258 Gatherer.println("About to create a new job"); 259 259 // If it was decided not to download page requisites, then create the destination by basing it on the given destination, but appending the url host and paths. If page requisites is used then WGet will do this for us 260 if(!page_requisites ) {261 System.err.println("Initially destination: " + destination);260 if(!page_requisites && depth == 0) { 261 Gatherer.println("Initially destination: " + destination); 262 262 String almost_the_entire_path = url.getPath(); 263 263 int index = -1; … … 265 265 almost_the_entire_path = almost_the_entire_path.substring(0, index); 266 266 } 267 destination = destination + url.getHost() + almost_the_entire_path + "/";268 System.err.println("Finaledestination: " + destination);267 destination = destination + url.getHost() + almost_the_entire_path; 268 Gatherer.println("Final destination: " + destination); 269 269 } 270 270 Job new_job = new Job(Gatherer.config.get("mirroring.debug", false), no_parents, other_hosts, page_requisites, Gatherer.config.get("mirroring.quiet", false), url, depth, destination, Gatherer.config.proxy_pass, Gatherer.config.proxy_user, this, simple); 271 // Tell it to run as soon as possible 272 new_job.setState(Job.RUNNING); 273 271 274 // Add to job_queue job list. 272 275 job_queue.add(new_job); -
trunk/gli/src/org/greenstone/gatherer/collection/Job.java
r6590 r6622 221 221 if(user_pass.indexOf("@") != -1) { 222 222 // Write the use proxy command 223 command = command + "-e httpproxy=" + proxy_host + ":" + proxy_port + "/ --proxy-user= " + user_pass.substring(0, user_pass.indexOf("@")) + " --proxy-passwd=" + user_pass.substring(user_pass.indexOf("@") + 1) + "-Y on ";223 command = command + "-e httpproxy=" + proxy_host + ":" + proxy_port + "/ --proxy-user=\"" + user_pass.substring(0, user_pass.indexOf("@")) + "\" --proxy-passwd=*** -Y on "; 224 224 225 225 } … … 235 235 // or not. In which case we ensure links are rewritten. 236 236 else { 237 command = command + "-k "; 237 238 } 238 239 … … 289 290 String current_file_downloading = line.substring(line.indexOf("`") + 1, line.lastIndexOf("'")); 290 291 if(!ignore_for_robots) { 291 System.err.println("Not ignore for robots");292 Gatherer.println("Not ignore for robots"); 292 293 // Download complete 293 294 downloadComplete(current_file_downloading); 294 295 } 295 296 else { 296 System.err.println("Ignore for robots");297 Gatherer.println("Ignore for robots"); 297 298 ignore_for_robots = false; 298 299 } … … 382 383 // Parse arguments into array. 383 384 args.add(Utility.BASE_DIR + "wget"); 384 //args.add("-k");385 385 args.add("-d"); 386 386 args.add("-o"); … … 458 458 public void downloadComplete(String current_file_downloading) { 459 459 progress.downloadComplete(); 460 ///ystem.err.println("Current File: " + current_file_downloading);460 Gatherer.println("Current File: " + current_file_downloading); 461 461 //WorkspaceTreeModel.refreshWebCacheMappings(); 462 462 if(Gatherer.g_man.collection_pane.workspace_tree != null) { … … 473 473 // Add download cache name 474 474 /** @todo - add to dictionary */ 475 raw_path.add(0, "Mirror 475 raw_path.add(0, "Mirroring.Mirror_Cache"); 476 476 // And the root node 477 477 raw_path.add(0, tree_model.getRoot()); … … 481 481 FileNode destination_node = (FileNode) tree_model.getNode(destination_path); 482 482 // destination_path = null; 483 FileNode new_file_node = new FileNode(new_file); 484 SynchronizedTreeModelTools.insertNodeInto(tree_model, destination_node, new_file_node); 485 System.err.println("Ready to insert new FileNode."); 486 System.err.println("Model: " + tree_model); 487 System.err.println("Destination path: " + destination_path); 488 System.err.println("Destination node: " + destination_node); 489 System.err.println("New node: " + new_file_node); 490 491 new_file_node = null; 483 //FileNode new_file_node = new FileNode(new_file); 484 485 // It suddenly occurs to me that by retrieving the destination path, we are causing the potential destination node to map its children which includes the file which I am about to add. Hence I was ending up with two copies. 486 ///atherer.println("Ready to insert new FileNode."); 487 Gatherer.println("Model: " + tree_model); 488 Gatherer.println("Destination path: " + destination_path); 489 destination_node.unmap(); 490 ///atherer.println("Destination node: " + destination_node); 491 ///atherer.println("New node: " + new_file_node); 492 //SynchronizedTreeModelTools.insertNodeInto(tree_model, destination_node, new_file_node); 493 494 //new_file_node = null; 492 495 destination_node = null; 493 496 tree_model = null; … … 554 557 } 555 558 559 public void setState(int state) { 560 previous_state = this.state; 561 this.state = state; 562 } 563 556 564 /** A convinence call. 557 565 * @return A String representing the url of the initial url (root node of the mirrored tree). -
trunk/gli/src/org/greenstone/gatherer/file/FileAssociationManager.java
r6539 r6622 105 105 106 106 public String getBrowserCommand(String url) { 107 System.err.println("Get browser command: " + url);107 Gatherer.println("Get browser command: " + url); 108 108 // First off we try to retrieve one from the configuration 109 109 String command = Gatherer.config.getPreviewCommand(); … … 111 111 if(command != null && command.length() > 0) { 112 112 command = command.replaceAll("%1", url); 113 System.err.println("Result = " + command);113 Gatherer.println("Result = " + command); 114 114 return command; 115 115 } … … 164 164 // if we haven't got a command by now, we'll never get one 165 165 if (command == null) { 166 System.err.println("Result = " + command);166 Gatherer.println("Result = " + command); 167 167 return null; 168 168 } 169 169 // Replace %1 with the url in quotes 170 170 command = command.replaceAll(FILENAME_ARG, url); 171 System.err.println("Result = " + command);171 Gatherer.println("Result = " + command); 172 172 return command; 173 173 } -
trunk/gli/src/org/greenstone/gatherer/file/FileNode.java
r6255 r6622 218 218 /** Adds child to the receiver at index. */ 219 219 public void insert(MutableTreeNode child, int index) { 220 ///ystem.err.println("Insert " + child + " in " + this + " at index " + index + " [Model: " + model + "]");220 Gatherer.println("Insert " + child + " in " + this + " at index " + index + " [Model: " + model + "]"); 221 221 //map(); 222 222 try { -
trunk/gli/src/org/greenstone/gatherer/file/FileSystemModel.java
r6590 r6622 67 67 stale_node = (FileNode) stale_object; 68 68 } 69 Gatherer.print("Searching for '" + stale_ node+ "': ");69 Gatherer.print("Searching for '" + stale_object + "': "); 70 70 // Locate the fresh node by searching current's children. Remember to ensure that current is mapped. 71 71 current.map(); -
trunk/gli/src/org/greenstone/gatherer/gui/GProgressBar.java
r6590 r6622 50 50 extends JPanel 51 51 implements ActionListener { 52 53 static final private Dimension MINIMUM_BUTTON_SIZE = new Dimension(100, 25); 52 54 53 55 private boolean simple = false; … … 100 102 101 103 inner_pane = new JPanel(new BorderLayout()); 102 inner_pane.setBorder(BorderFactory.createEmptyBorder(2,2,2,2)); 103 104 action = new GLIButton(Utility.getImage("vcrplay.gif")); 105 action.addActionListener(this); 106 action.addActionListener(owner); 107 action.setMnemonic(KeyEvent.VK_ENTER); 108 Dictionary.setTooltip(action, "Mirroring.Job.Start_Tooltip"); 104 inner_pane.setBorder(BorderFactory.createEmptyBorder(2,(MINIMUM_BUTTON_SIZE.width + 2),2,2)); 109 105 110 106 center_pane = new JPanel(new GridLayout(3,1)); … … 128 124 center_pane.add(results_status); 129 125 130 cancel = new GLIButton(Utility.getImage("vcrstop.gif")); 126 JPanel button_pane = new JPanel(); 127 128 /** @todo - add to dictionary, and rewrite existing tooltip */ 129 action = new GLIButton("Mirroring.Job.Retry"); 130 action.addActionListener(this); 131 action.addActionListener(owner); 132 action.setMinimumSize(MINIMUM_BUTTON_SIZE); 133 action.setMnemonic(KeyEvent.VK_A); 134 Dictionary.setTooltip(action, "Mirroring.Job.Start_Tooltip"); 135 136 /** @todo - add to dictionary, and rewrite existing tooltip */ 137 cancel = new GLIButton("Mirroring.Job.Cancel"); 131 138 cancel.addActionListener(owner); 132 139 cancel.addActionListener(this); 133 cancel.setMnemonic(KeyEvent.VK_BACK_SPACE); 140 cancel.setMinimumSize(MINIMUM_BUTTON_SIZE); 141 cancel.setMnemonic(KeyEvent.VK_C); 134 142 Dictionary.setTooltip(cancel, "Mirroring.Job.Stop_Tooltip"); 135 143 144 // Layout - or at least some of it 145 136 146 inner_pane.add(center_pane, BorderLayout.NORTH); 137 147 138 this.add(action, BorderLayout.WEST); 148 button_pane.setLayout(new GridLayout(2,1)); 149 button_pane.add(action); 150 button_pane.add(cancel); 151 139 152 this.add(inner_pane, BorderLayout.CENTER); 140 this.add( cancel, BorderLayout.EAST);153 this.add(button_pane, BorderLayout.EAST); 141 154 142 155 // Make the labels, etc update. … … 148 161 if (current_action == Job.RUNNING) { 149 162 current_action = Job.STOPPED; 150 action.setIcon(Utility.getImage("vcrplay.gif")); 151 Dictionary.setTooltip(action, "Mirroring.Job.Start_Tooltip"); 152 cancel.setEnabled(true); 163 action.setEnabled(true); 153 164 } 154 165 else { 155 166 current_action = Job.RUNNING; 156 action.setIcon(Utility.getImage("vcrpause.gif")); 157 Dictionary.setTooltip(action, "Mirroring.Job.Pause_Tooltip"); 158 cancel.setEnabled(false); 167 action.setEnabled(false); 159 168 } 160 169 } … … 232 241 } 233 242 current_action = Job.RUNNING; 234 action.setIcon(Utility.getImage("vcrpause.gif")); 235 Dictionary.setTooltip(cancel, "Mirroring.Job.Pause_Tooltip"); 236 // If this is a simple download, then pause is not available (nor is prematurely stopping!) 237 action.setEnabled(!simple); 238 cancel.setEnabled(false); 243 action.setEnabled(false); 239 244 if(simple) { 240 245 progress.setIndeterminate(true); … … 258 263 //Dictionary.setText(progress, "Mirroring.Job.Mirror_Complete"); 259 264 260 action.setIcon(Utility.getImage("vcrfastforward.gif")); 261 Dictionary.setTooltip(action, "Mirroring.Job.Restart_Tooltip"); 262 action.setEnabled(true); 265 action.setEnabled(false); 263 266 cancel.setEnabled(true); 264 267 this.updateUI(); -
trunk/gli/src/org/greenstone/gatherer/gui/GUIManager.java
r6582 r6622 58 58 import org.greenstone.gatherer.file.FileOpenActionListener; 59 59 import org.greenstone.gatherer.gui.AboutDialog; 60 import org.greenstone.gatherer.gui.BrowsingPane;60 //import org.greenstone.gatherer.gui.BrowsingPane; 61 61 import org.greenstone.gatherer.gui.CollectionPane; 62 62 import org.greenstone.gatherer.gui.CreatePane; … … 87 87 implements ActionListener, ChangeListener { 88 88 /** The browsing pane behaves much like an internet browser, or at least will some day. */ 89 public BrowsingPane browser_pane = null;89 //public BrowsingPane browser_pane = null; 90 90 /** The collection pane is more like a file manager where you drag files from one tree to another. */ 91 91 public CollectionPane collection_pane = null; … … 146 146 this.meta_audit = new MetaAuditFrame(collection_tree_sync, null); 147 147 this.workspace_tree_sync = new TreeSynchronizer(); 148 149 // Add a focus listener to ourselves. Thus if we gain focus when a Modal Dialog should instead have it, we can try to bring the modal dialog to the fore. 150 this.addFocusListener(new GLIGUIFocusListener()); 151 148 152 // Make the Tool tip hang around for a rediculous amount of time. 149 153 ToolTipManager.sharedInstance().setDismissDelay(10000); … … 156 160 UIManager.put("FileChooser.fileNameLabelText", Dictionary.get("SaveCollectionBox.File_Name")); 157 161 } 162 163 private class GLIGUIFocusListener 164 extends FocusAdapter { 165 public void focusGained(FocusEvent e) { 166 if(Gatherer.current_modal != null) { 167 Gatherer.current_modal.makeVisible(); 168 Gatherer.current_modal.toFront(); 169 } 170 } 171 } 172 158 173 /** Any implementation of <i>ActionListener</i> must include this method so that we can be informed when an action has occured. In this case we are listening to actions from the menu-bar, and should react appropriately. 159 174 * @param event An <strong>ActionEvent</strong> containing information about the action that has occured. … … 304 319 new AboutDialog(this); 305 320 } 306 else if(esrc == menu_bar.help_browse) {307 help.setView("huntingforfiles");308 }321 // else if(esrc == menu_bar.help_browse) { 322 // help.setView("huntingforfiles"); 323 // } 309 324 else if(esrc == menu_bar.help_build) { 310 325 help.setView("producingthecollection"); … … 347 362 */ 348 363 public void afterDisplay() { 349 if(Gatherer.config.get("workflow.browse", true)) { 350 browser_pane.afterDisplay(); 351 } 364 // if(Gatherer.config.get("workflow.browse", true)) { 365 // browser_pane.afterDisplay(); 366 // } 367 mirror_pane.afterDisplay(); 352 368 metaedit_pane.afterDisplay(); 353 369 } … … 425 441 // Pretty corner icon 426 442 this.setIconImage(Utility.getImage("gatherer_small.gif").getImage()); 427 // BorderLayout for the main screen. I'll try my best to avoid t 428 // hese in subcomponents as they're space greedy. 443 // BorderLayout for the main screen. I'll try my best to avoid these in subcomponents as they're space greedy. 429 444 content_pane.setLayout(new BorderLayout()); 430 445 // Create the menu-bar and stick it up the top. … … 437 452 tab_pane.setFont(Gatherer.config.getFont("general.font", false)); 438 453 439 // May have to play with the order in which tabs are added.440 if(Gatherer.config.get("workflow.browse", true)) {441 browser_pane = new BrowsingPane();442 tab_pane.addTab("GUI.Hunt", Utility.getImage("browsing.gif"), browser_pane);443 tab_pane.setEnabledAt(tab_pane.indexOfComponent(browser_pane), Gatherer.config.get("workflow.browse", false));444 }445 446 if(Gatherer.config.get( "workflow.mirror", true)) {454 // // May have to play with the order in which tabs are added. 455 // if(Gatherer.config.get("workflow.browse", true)) { 456 // browser_pane = new BrowsingPane(); 457 // tab_pane.addTab("GUI.Hunt", Utility.getImage("browsing.gif"), browser_pane); 458 // tab_pane.setEnabledAt(tab_pane.indexOfComponent(browser_pane), Gatherer.config.get("workflow.browse", false)); 459 // } 460 461 if(Gatherer.config.get(StaticStrings.WORKFLOW_MIRROR, true)) { 447 462 mirror_pane = new MirrorPane(); 448 463 tab_pane.addTab("GUI.Mirror", Utility.getImage("mirroring.gif"), mirror_pane); 449 tab_pane.setEnabledAt(tab_pane.indexOfComponent(mirror_pane), Gatherer.config.get( "workflow.mirror", false));464 tab_pane.setEnabledAt(tab_pane.indexOfComponent(mirror_pane), Gatherer.config.get(StaticStrings.WORKFLOW_MIRROR, false)); 450 465 } 451 466 … … 490 505 //} 491 506 492 // Find the first tab that is enabled and select that. 493 boolean found = false; 494 for(int i = 0; !found && i < tab_pane.getTabCount(); i++) { 495 if(tab_pane.isEnabledAt(i)) { 496 tab_pane.setSelectedIndex(i); 497 found = true; 507 // Select the collect pane if it is available 508 if(Gatherer.config.get("workflow.gather", false)) { 509 tab_pane.setSelectedComponent(collection_pane); 510 } 511 // Otherwise find the first tab that is enabled and select that. 512 else { 513 boolean found = false; 514 for(int i = 0; !found && i < tab_pane.getTabCount(); i++) { 515 if(tab_pane.isEnabledAt(i)) { 516 tab_pane.setSelectedIndex(i); 517 found = true; 518 } 498 519 } 499 520 } … … 515 536 public void exit() { 516 537 // First of all an exit can only happen if no modal dialog is currently being displayed. Something is creating a modal dialog but not disposing of it. 517 //if(Gatherer.current_modal != null) { 518 // return; 519 //} 538 if(Gatherer.current_modal != null) { 539 System.err.println("There is a modal dialog open."); 540 Gatherer.current_modal.makeVisible(); 541 Gatherer.current_modal.toFront(); 542 return; 543 } 520 544 521 545 boolean cont = true; … … 871 895 872 896 menu_bar.tabSelected(tab_pane.getSelectedIndex()); 873 if(tab_pane.getSelectedIndex() == tab_pane.indexOfComponent(collection_pane)) { 897 int selected_index = tab_pane.getSelectedIndex(); 898 if( selected_index == tab_pane.indexOfComponent(collection_pane)) { 874 899 collection_pane.gainFocus(); 875 900 // "View assigned metadata" menu item is enabled for the "Gather" pane 876 901 menu_bar.metadata_view.setCanEnable(true); 877 902 } 878 else if( tab_pane.getSelectedIndex()== tab_pane.indexOfComponent(metaedit_pane)) {903 else if(selected_index == tab_pane.indexOfComponent(metaedit_pane)) { 879 904 metaedit_pane.gainFocus(); 880 905 // "View assigned metadata" menu item is enabled for the "Enrich" pane 881 906 menu_bar.metadata_view.setCanEnable(true); 882 907 } 883 else if( tab_pane.getSelectedIndex()== tab_pane.indexOfComponent(config_pane)) {908 else if(selected_index == tab_pane.indexOfComponent(config_pane)) { 884 909 config_pane.gainFocus(); 885 910 } 886 else if( tab_pane.getSelectedIndex()== tab_pane.indexOfComponent(create_pane)) {911 else if(selected_index == tab_pane.indexOfComponent(create_pane)) { 887 912 create_pane.gainFocus(); 913 } 914 else if(selected_index == tab_pane.indexOfComponent(mirror_pane)) { 915 mirror_pane.gainFocus(); 888 916 } 889 917 //else if(tab_pane.getSelectedIndex() == tab_pane.indexOfComponent(preview_pane)) { … … 973 1001 implements Runnable { 974 1002 private boolean ready = false; 975 private int browse_pos = -1;1003 //private int browse_pos = -1; 976 1004 private int mirror_pos = -1; 977 1005 private int config_pos = -1; … … 984 1012 this.ready = ready; 985 1013 this.tab_pane = tab_pane; 986 browse_pos = tab_pane.indexOfComponent(browser_pane);1014 //browse_pos = tab_pane.indexOfComponent(browser_pane); 987 1015 mirror_pos = tab_pane.indexOfComponent(mirror_pane); 988 1016 metaedit_pos = tab_pane.indexOfComponent(metaedit_pane); … … 992 1020 //preview_pos = tab_pane.indexOfComponent(preview_pane); 993 1021 } 1022 994 1023 public void run() { 995 if(browse_pos != -1) {996 if(ready) {997 tab_pane.setEnabledAt(browse_pos, Gatherer.config.get("workflow.browse", false));998 }999 else {1000 tab_pane.setEnabledAt(browse_pos, Gatherer.config.get("workflow.browse", true));1001 }1002 }1024 // if(browse_pos != -1) { 1025 // if(ready) { 1026 // tab_pane.setEnabledAt(browse_pos, Gatherer.config.get("workflow.browse", false)); 1027 // } 1028 // else { 1029 // tab_pane.setEnabledAt(browse_pos, Gatherer.config.get("workflow.browse", true)); 1030 // } 1031 // } 1003 1032 if(mirror_pos != -1) { 1004 1033 if(ready) { -
trunk/gli/src/org/greenstone/gatherer/gui/MirrorPane.java
r6590 r6622 51 51 import org.greenstone.gatherer.file.FileNode; 52 52 import org.greenstone.gatherer.gui.GLIButton; 53 import org.greenstone.gatherer.gui.URLField; 54 import org.greenstone.gatherer.util.StaticStrings; 53 55 import org.greenstone.gatherer.util.Utility; 54 56 … … 60 62 extends JPanel { 61 63 64 private boolean download_button_enabled = false; 65 private boolean ready = false; 62 66 private JButton download_button; 63 67 private JCheckBox higher_checkbox; … … 66 70 private JScrollPane list_scroll; 67 71 private JComboBox depth_combobox; 68 private JTextField url_textfield;72 private URLField url_field; 69 73 private Vector depth_model; 70 74 private WGet getter; … … 86 90 url_label.setPreferredSize(Utility.LABEL_SIZE); 87 91 Dictionary.registerText(url_label, "Mirroring.Source_URL"); 88 url_ textfield = new JTextField();89 Dictionary.registerTooltip(url_ textfield, "Mirroring.Source_URL_Tooltip");92 url_field = new URLField(Gatherer.config.getColor("coloring.editable_foreground", false), Gatherer.config.getColor("coloring.editable_background", false), Gatherer.config.getColor("coloring.error_foreground", false), Gatherer.config.getColor("coloring.error_background", false)); 93 Dictionary.registerTooltip(url_field, "Mirroring.Source_URL_Tooltip"); 90 94 91 95 depth_model = new Vector(); 92 96 /* @todo - add to dictionary */ 93 depth_model.add(new DepthEntry(0, " 0 (this page only)"));94 /* @todo - add to dictionary */ 95 depth_model.add(new DepthEntry(1, "1"));96 /* @todo - add to dictionary */ 97 depth_model.add(new DepthEntry(2, "2"));98 /* @todo - add to dictionary */ 99 depth_model.add(new DepthEntry(3, "3"));100 /* @todo - add to dictionary */ 101 depth_model.add(new DepthEntry(4, "4"));102 /* @todo - add to dictionary */ 103 depth_model.add(new DepthEntry(5, "5"));104 /* @todo - add to dictionary */ 105 depth_model.add(new DepthEntry(-1, " Unlimited"));97 depth_model.add(new DepthEntry(0, "Mirroring.Download_Depth.Zero")); 98 /* @todo - add to dictionary */ 99 depth_model.add(new DepthEntry(1, String.valueOf(1))); 100 /* @todo - add to dictionary */ 101 depth_model.add(new DepthEntry(2, String.valueOf(3))); 102 /* @todo - add to dictionary */ 103 depth_model.add(new DepthEntry(3, String.valueOf(3))); 104 /* @todo - add to dictionary */ 105 depth_model.add(new DepthEntry(4, String.valueOf(4))); 106 /* @todo - add to dictionary */ 107 depth_model.add(new DepthEntry(5, String.valueOf(5))); 108 /* @todo - add to dictionary */ 109 depth_model.add(new DepthEntry(-1, "Mirroring.Download_Depth.Unlimited")); 106 110 JPanel depth_pane = new JPanel(); 107 111 JLabel depth_label = new JLabel(); … … 121 125 122 126 /* @todo - add to dictionary */ 123 JLabel further_label = new JLabel(" For further options see File->Preferences->Connection");127 JLabel further_label = new JLabel("Mirroring.Further_Options"); 124 128 125 129 JPanel button_pane = new JPanel(); … … 130 134 // Connect 131 135 download_button.addActionListener(new DownloadButtonListener()); 136 url_field.getDocument().addDocumentListener(new DownloadButtonEnabler()); 132 137 133 138 // Layout 134 139 url_pane.setLayout(new BorderLayout()); 135 140 url_pane.add(url_label, BorderLayout.WEST); 136 url_pane.add(url_ textfield, BorderLayout.CENTER);141 url_pane.add(url_field, BorderLayout.CENTER); 137 142 138 143 depth_pane.setLayout(new GridLayout(1,3)); … … 165 170 } 166 171 172 public void afterDisplay() { 173 ready = true; 174 } 175 167 176 public void collectionChanged(boolean ready) { 168 177 } 169 178 179 /** This method is called whenever the Mirror pane is brought into focus and is a good time to display a warning message if WGet is not available or of an older, problematic, version. 180 */ 181 public void gainFocus() { 182 if(!ready) { 183 return; 184 } 185 // Lets see what warning message we should display, if any. 186 String wget_version_str = Gatherer.config.getWGetVersion(); 187 if(wget_version_str.equals(StaticStrings.NO_WGET_STR)) { 188 // If there was no WGet available then downloading is disabled entirely 189 download_button_enabled = false; 190 // And we tell the user why. 191 /** @todo - add to dictionary */ 192 JOptionPane.showMessageDialog(Gatherer.g_man, "Mirroring.No_WGet", "Mirroring.No_WGet_Title", JOptionPane.ERROR_MESSAGE); 193 } 194 else if(wget_version_str.equals(StaticStrings.WGET_OLD_STR)) { 195 // Downloading is enabled 196 download_button_enabled = true; 197 // But we display a preventable warning message about the path problems. 198 WarningDialog dialog = new WarningDialog("warning.OldWGet", false); 199 dialog.display(); 200 dialog.dispose(); 201 dialog = null; 202 } 203 // Otherwise version must be ok 204 else { 205 download_button_enabled = true; 206 } 207 // It is also a good time to determine if the download should be enabled - ie if its allowed to be enabled and a valid URL is present in the field. 208 download_button.setEnabled(download_button_enabled && !url_field.isEmpty() && url_field.validateURL()); 209 } 210 170 211 public void setURL(String url) { 171 url_ textfield.setText(url);212 url_field.setText(url); 172 213 } 173 214 … … 175 216 static public FileNode getWebCacheMapping() 176 217 { 177 if (Gatherer.config.get("workflow.mirror", false) && Gatherer.c_man.ready()) {218 if (Gatherer.config.get("workflow.mirror", true) || Gatherer.config.get("workflow.mirror", false)) { 178 219 /* @todo - add to dictionary */ 179 return new FileNode(Utility.getCacheDir(), "Mirror 220 return new FileNode(Utility.getCacheDir(), "Mirroring.Mirror_Cache"); 180 221 } 181 222 return null; … … 235 276 } 236 277 278 private class DownloadButtonEnabler 279 implements DocumentListener { 280 /** Gives notification that an attribute or set of attributes changed. */ 281 public void changedUpdate(DocumentEvent e) { 282 validateDownloadButton(); 283 } 284 /** Gives notification that there was an insert into the document. */ 285 public void insertUpdate(DocumentEvent e) { 286 validateDownloadButton(); 287 } 288 /** Gives notification that a portion of the document has been removed. */ 289 public void removeUpdate(DocumentEvent e) { 290 validateDownloadButton(); 291 } 292 private void validateDownloadButton() { 293 download_button.setEnabled(download_button_enabled && !url_field.isEmpty() && url_field.validateURL()); 294 } 295 } 296 237 297 private class DownloadButtonListener 238 298 implements ActionListener { … … 240 300 public void actionPerformed(ActionEvent event) { 241 301 // Retrieve the current url and confirm it is valid 242 String url_str = url_ textfield.getText();302 String url_str = url_field.getText(); 243 303 URL url = null; 244 304 try { … … 273 333 catch(Exception exception) { 274 334 /* @todo - add to dictionary */ 275 JOptionPane.showMessageDialog(Gatherer.g_man, " The depth value you have entered is not valid.\nPlease choose an item from the list, or type in\na number.", "Invalid Depth", JOptionPane.ERROR_MESSAGE);335 JOptionPane.showMessageDialog(Gatherer.g_man, "Mirroring.Mirror_Depth.Invalid_Depth", "Mirroring.Mirror_Depth.Invalid_Depth_Title", JOptionPane.ERROR_MESSAGE); 276 336 return; 277 337 } -
trunk/gli/src/org/greenstone/gatherer/gui/ModalDialog.java
r6539 r6622 49 49 public ModalDialog() { 50 50 super((Frame)null, "", false); 51 Gatherer.current_modal = this;52 51 } 53 52 … … 57 56 public ModalDialog(Dialog parent) { 58 57 super(parent, "", false); 59 Gatherer.current_modal = this;60 58 } 61 59 … … 67 65 super(parent, "", false); 68 66 this.modal = modal; 69 Gatherer.current_modal = this;70 67 } 71 68 … … 77 74 super (parent, title, false); 78 75 this.modal = false; 79 Gatherer.current_modal = this;80 76 } 81 77 … … 88 84 super (parent, title, false); 89 85 this.modal = modal; 90 Gatherer.current_modal = this;91 86 } 92 87 … … 96 91 public ModalDialog(Frame parent) { 97 92 super(parent, "", false); 98 Gatherer.current_modal = this;99 93 } 100 94 … … 106 100 super(parent, "", false); 107 101 this.modal = modal; 108 Gatherer.current_modal = this;109 102 } 110 103 … … 115 108 public ModalDialog(Frame parent, String title) { 116 109 super (parent, title, false); 117 Gatherer.current_modal = this;118 110 } 119 111 … … 126 118 super (parent, title, false); 127 119 this.modal = modal; 128 Gatherer.current_modal = this;129 120 } 130 121 131 122 public void dispose() { 132 Gatherer.current_modal = null;133 123 super.dispose(); 124 } 125 126 /** Ensures the current dialog is visible. */ 127 public void makeVisible() { 128 super.setVisible(true); 134 129 } 135 130 … … 142 137 super.setVisible (visible); 143 138 if (modal && visible) { 139 Gatherer.current_modal = this; 144 140 try { 145 141 if (SwingUtilities.isEventDispatchThread ()) { … … 180 176 } 181 177 else if(modal && !visible && waiting) { 178 Gatherer.current_modal = null; 182 179 ///ystem.err.println("Hiding dialog. Tree lock is: " + getTreeLock()); 183 180 synchronized(getTreeLock()) { … … 187 184 } 188 185 else if(modal && !waiting) { 186 Gatherer.current_modal = null; 189 187 ///ystem.err.println("Modal Dialog is not currently waiting."); 190 188 } -
trunk/gli/src/org/greenstone/gatherer/gui/NewCollectionDetailsPrompt.java
r6582 r6622 48 48 static public boolean titleClashes(String title, File current_config_file) { 49 49 // An empty collection title never clashes with anything. I may look ugly in the final collection but there is nothing wrong with having no title for a particular language. 50 if(title == null || title.length() == 0) {51 return false;52 }50 //if(title == null || title.length() == 0) { 51 // return false; 52 //} 53 53 File collection_directory = new File(Utility.getCollectionDir(Gatherer.config.gsdl_path)); 54 54 File children[] = collection_directory.listFiles(); -
trunk/gli/src/org/greenstone/gatherer/gui/OptionsPane.java
r6389 r6622 118 118 * @see org.greenstone.gatherer.collection.BuildOptions#getBuildValue 119 119 * @see org.greenstone.gatherer.collection.BuildOptions#getBuildValueEnabled 120 * @see org.greenstone.gatherer.gui.OptionsPane #ArgumentControl120 * @see org.greenstone.gatherer.gui.OptionsPane.ArgumentControl 121 121 */ 122 122 public JPanel buildBuild(JPanel pane) { … … 178 178 * @see org.greenstone.gatherer.collection.BuildOptions#getImportValue 179 179 * @see org.greenstone.gatherer.collection.BuildOptions#getImportValueEnabled 180 * @see org.greenstone.gatherer.gui.OptionsPane #ArgumentControl180 * @see org.greenstone.gatherer.gui.OptionsPane.ArgumentControl 181 181 */ 182 182 public JPanel buildImport(JPanel pane) { -
trunk/gli/src/org/greenstone/gatherer/gui/Preferences.java
r6567 r6622 56 56 private JButton apply_button; 57 57 private JButton cancel_button; 58 private JButton clear_cache_button; 58 59 private JButton ok_button; 59 60 private JCheckBox show_file_size_checkbox; … … 208 209 Dictionary.registerTooltip(proxy_port_field, "Preferences.Connection.Proxy_Port_Tooltip"); 209 210 211 /** @todo - add to dictionary. Bet you're getting sick of these by now! */ 212 clear_cache_button = new GLIButton("Preferences.Connection.Clear_Cache"); 213 210 214 // Connection 211 215 use_proxy_checkbox.addActionListener(new UseProxyListener()); 216 clear_cache_button.addActionListener(new ClearCacheListener()); 212 217 213 218 // Layout … … 235 240 connection_pane.add(proxy_host_pane); 236 241 connection_pane.add(proxy_port_pane); 242 if(Gatherer.config.get(StaticStrings.WORKFLOW_MIRROR, true)) { 243 connection_pane.add(clear_cache_button); 244 } 237 245 238 246 return connection_pane; … … 717 725 } 718 726 727 private class ClearCacheListener 728 implements ActionListener { 729 public void actionPerformed(ActionEvent event) { 730 // Retrieve the cache folder and delete it. 731 Utility.delete(Utility.getCacheDir()); 732 } 733 } 734 719 735 private class DictionaryEntry 720 736 implements Comparable { -
trunk/gli/src/org/greenstone/gatherer/gui/URLField.java
r6397 r6622 11 11 implements DocumentListener { 12 12 13 static final public Pattern URL_PATTERN = Pattern.compile("h|ht|htt|http|http:|http:/|http://|http://(([a-zA-Z]([a-zA-Z]|[0-9]|[\\$\\-_\\&\\+]|[!\\*\"\'\\(\\)]|(%[0-9A-Fa-f][0-9A-Fa-f]))*(\\.[a-zA-Z]([a-zA-Z]|[0-9]|[\\$\\-_\\&\\+]|[!\\*\"\'\\(\\)]|(%[0-9A-Fa-f][0-9A-Fa-f]))*)*)|(([0-9])+\\.([0-9])+\\.([0-9])+\\.([0-9])+))(:([0-9])+)?(/([a-zA-Z]|[0-9]|[\\$\\-_\\.\\&\\+]|[!\\*\"\'\\(\\),]|(%[0-9A-Fa-f][0-9A-Fa-f]))*)*"); 13 //static final public Pattern URL_PATTERN = Pattern.compile("(h|ht|htt|http|http:|http:/|http://|http://)?(([a-zA-Z]([a-zA-Z]|[0-9]|[\\$\\-_\\&\\+]|[!\\*\"\'\\(\\)]|(%[0-9A-Fa-f][0-9A-Fa-f]))*(\\.[a-zA-Z]([a-zA-Z]|[0-9]|[\\$\\-_\\&\\+]|[!\\*\"\'\\(\\)]|(%[0-9A-Fa-f][0-9A-Fa-f]))*)*)|(([0-9])+\\.([0-9])+\\.([0-9])+\\.([0-9])+))(:([0-9])+)?(/([a-zA-Z]|[0-9]|[\\$\\-_\\.\\&\\+]|[!\\*\"\'\\(\\),]|(%[0-9A-Fa-f][0-9A-Fa-f]))*)*"); 14 15 // Crap RegEx that matches everything dammit 16 //static final public Pattern URL_PATTERN = Pattern.compile("((.*?)://)?(([^:]*):([^@]*)@)?(([^/:]*)(:[^/]*))?([^\\?#]*/?)?(\\?([^?#]*))?(#(.*))?"); 17 18 //static final public Pattern URL_PATTERN = Pattern.compile("(h|ht|htt|http|http:|http:/|http://|http://)?[a-zA-Z0-9-]*(\.[a-zA-Z0-9-])*"); 19 20 static final public Pattern URL_PATTERN = Pattern.compile("(h|ht|htt|http|http:|http:/|http://|http://)?[\\w]+(\\.[\\w]+)([\\w\\-\\.,@?^=%&:/~\\+#]*[\\w\\-\\@?^=%&/~\\+#])?"); 14 21 15 22 private Color background; … … 52 59 validateURL(); 53 60 } 61 62 public boolean isEmpty() { 63 return (this.getText().length() == 0); 64 } 54 65 55 66 /** Gives notification that a portion of the document has been removed. -
trunk/gli/src/org/greenstone/gatherer/msm/MSMUtils.java
r6568 r6622 327 327 * @param element the Element whose attributes we wish to catalog 328 328 * @return a TreeSet of the attributes sorted by their natural ordering 329 * @see org.greenstone.gatherer.msm.MSMUtils#getValue( Element)329 * @see org.greenstone.gatherer.msm.MSMUtils#getValue(Node) 330 330 * @see org.greenstone.gatherer.util.StaticStrings#ATTRIBUTE_ELEMENT 331 331 * @see org.greenstone.gatherer.util.StaticStrings#CODE_ATTRIBUTE … … 817 817 * @return true if the desired attribute was successfully found and removed, false otherwise 818 818 * @see org.greenstone.gatherer.msm.MSMUtils#isAttributeLanguageDependant 819 * @see org.greenstone.gatherer.msm.MSMUtils#getValue( Element)819 * @see org.greenstone.gatherer.msm.MSMUtils#getValue(Node) 820 820 * @see org.greenstone.gatherer.util.StaticStrings#ATTRIBUTE_ELEMENT 821 821 * @see org.greenstone.gatherer.util.StaticStrings#CODE_ATTRIBUTE -
trunk/gli/src/org/greenstone/gatherer/util/AppendLineOnlyFileDocument.java
r6539 r6622 895 895 } 896 896 897 /** Listens for actions on the read button, and if detected creates a new ReadTask to test the document. */ 897 /** Listens for actions on the read button, and if detected creates a new ReadTask to test the document. 898 * @author John Thompson, Greenstone Project, New Zealand Digital Library, University of Waikato 899 * @version 2.41 final 900 */ 898 901 static private class ReadButtonListener 899 902 implements ActionListener { … … 918 921 } 919 922 920 /** This threaded task opens a large document, aptly named 'big.txt', and then bombards the document object we are testing with lines from the file. This file should be several megs (such as Alice or TREC) to fully test functionality, thread conditions etc. */ 923 /** This threaded task opens a large document, aptly named 'big.txt', and then bombards the document object we are testing with lines from the file. This file should be several megs (such as Alice or TREC) to fully test functionality, thread conditions etc. 924 * @author John Thompson, Greenstone Project, New Zealand Digital Library, University of Waikato 925 * @version 2.41 final 926 */ 921 927 static private class ReadTask 922 928 extends Thread { -
trunk/gli/src/org/greenstone/gatherer/util/StaticStrings.java
r6582 r6622 140 140 static final public String LANGUAGE_DEFAULT_STR = "defaultlanguage"; 141 141 static final public String LANGUAGE_STR = "language"; 142 static final public String LANGUAGEDEPENDANT_ATTRIBUTE = "language_depend ant";142 static final public String LANGUAGEDEPENDANT_ATTRIBUTE = "language_dependent"; 143 143 static final public String LANGUAGES_ELEMENT = "Languages"; 144 144 static final public String LANGUAGES_STR = "languages"; … … 167 167 static final public String MGPP_ATTRIBUTE = "mgpp_enabled"; 168 168 static final public String MINUS_CHARACTER = "-"; 169 static final public String MIRROR_ARGUMENT = "-mirror"; 169 170 static final public String MODE_STR = "Mode: "; 170 171 static final public String MODEGLI_ELEMENT = "ModeGLI"; … … 175 176 static final public String NEWLINE_ELEMENT = "NewLine"; 176 177 static final public String NO_LOAD_ARGUMENT = "-no_load"; 178 static final public String NO_WGET_STR = "NoWGet"; 177 179 static final public String ONE_CHARACTER = "1"; 178 180 static final public String OPEN_PARENTHESIS_CHARACTER = "("; … … 232 234 static final public String VALUE_ATTRIBUTE = "value"; 233 235 static final public String VALUE_TREE_ATTRIBUTE = "remember_values"; 234 static final public String WIN_9X_OPEN_COMMAND = "command.com /c start \"%1\""; 235 static final public String WIN_OPEN_COMMAND = "cmd.exe /c start \"\" \"%1\""; 236 static final public String WGET_ARGUMENT = "-wget"; 237 static final public String WGET_OLD_STR = "<WGet1.9"; 238 static final public String WGET_STR = "WGet1.9"; 239 static final public String WIN_9X_OPEN_COMMAND = "command.com /c start \"%1\""; 240 static final public String WIN_OPEN_COMMAND = "cmd.exe /c start \"\" \"%1\""; 241 static final public String WORKFLOW_MIRROR = "workflow.mirror"; 236 242 static final public String YES_STR = "yes"; 237 243 static final public String ZERO_CHARACTER = "0"; -
trunk/gli/src/org/greenstone/gatherer/util/SynchronizedTreeModelTools.java
r6212 r6622 42 42 } 43 43 44 static final public Runnable insertNodeInto(final DefaultTreeModel model, final MutableTreeNode parent, final MutableTreeNode target_node, boolean wait_allowed) {44 static final public Runnable insertNodeInto(final DefaultTreeModel model, final MutableTreeNode parent, final MutableTreeNode target_node, final boolean wait_allowed) { 45 45 final Runnable doInsertNodeInto = new Runnable() { 46 46 public void run() { 47 47 ///ystem.err.print("Running task... "); 48 Gatherer.println("insertNodeInto(" + model + ", " + parent + ", " + target_node + ", " + wait_allowed); 48 49 int index = -1; 49 50 int pos = 0;
Note:
See TracChangeset
for help on using the changeset viewer.