- Timestamp:
- 2003-06-03T16:27:12+12:00 (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/cdm/custom/CustomAZList.java
r4416 r4466 90 90 /** An array of togglebuttons showing what separations are available. */ 91 91 private JToggleButton separators[] = null; 92 /** A reference to the progress dialog if it exists. */ 93 private ProgressDialog pd = null; 92 94 /** A private dictionary for this custom classifier. */ 93 95 private ResourceBundle dictionary = null; … … 601 603 // 33% - Allocation of metadata to records, 33 / <number of files>. 602 604 // Hopefully the previous dialog should have already vanished (its dispose() caused by the process click). 603 ProgressDialogpd = new ProgressDialog("Custom Classifier Creation", "Preparing for operation.");605 pd = new ProgressDialog("Custom Classifier Creation", "Preparing for operation."); 604 606 // Step 1: Create the new dummy element and add it if necessary. 605 607 pd.setText("Creating dummy metadata element."); … … 652 654 // Step 5: Recurse the entire tree, adding the appropriate values where necessary (overwriting any existing value for this element). 653 655 pd.setText("Allocating metadata to records."); 654 int document_count = gatherer.c_man.getCollection().getDocumentCount();656 int count = gatherer.c_man.getCollection().getCount(); 655 657 TreeModel record_tree = gatherer.c_man.getRecordSet(); 656 658 FileNode records[] = ArrayTools.add(null, (FileNode)record_tree.getRoot()); 657 659 while(records != null) { 658 if(records[0].isLeaf()) { 659 addMetadata(0L, records[0], element); 660 // Each iteration. 661 pd.increase(1, document_count, 50); 662 } 663 else { 660 FileNode current_record = records[0]; 661 // There is no point in assigning hidden metadata to a file node we doesn't have any of that metadata set... 662 ArrayList current_metadatum = Gatherer.c_man.getCollection().gdm.getMetadata(current_record.getFile()); 663 for(int z = 0; z < current_metadatum.size(); z++) { 664 Metadata current_metadata = (Metadata) current_metadatum.get(z); 665 if(current_metadata.getElement().equals(element) && current_metadata.isFileLevel()) { 666 ///ystem.err.println("The file " + current_record + " has previous " + element + " metadata in: " + current_metadata); 667 addMetadata(0L, current_record, element); 668 } 669 } 670 if(!current_record.isLeaf()) { 664 671 // Add all children to records at once hopefully. 665 FileNode children[] = new FileNode[ records[0].getChildCount()];672 FileNode children[] = new FileNode[current_record.getChildCount()]; 666 673 for(int i = 0; i < children.length; i++) { 667 children[i] = (FileNode) records[0].getChildAt(i);674 children[i] = (FileNode) current_record.getChildAt(i); 668 675 } 669 676 records = ArrayTools.add(records, children); 670 677 } 671 678 records = ArrayTools.tail(records); 679 pd.increase(1, count, 50); 672 680 } 673 681 // Step 6: Done. 674 682 pd.dispose(); 675 } 683 pd = null; 684 } 685 686 public boolean valueIsAdjusting() { 687 return (pd == null); 688 } 689 676 690 /** A dialog window used to show the progress of processing the file records in terms of adding hidden metadata. */ 677 691 private class ProgressDialog
Note:
See TracChangeset
for help on using the changeset viewer.