Changeset 4675


Ignore:
Timestamp:
2003-06-16T10:47:06+12:00 (21 years ago)
Author:
jmt12
Message:

Sunday's work

Location:
trunk/gli
Files:
20 edited

Legend:

Unmodified
Added
Removed
  • trunk/gli/Gatherer.bat

    r4293 r4675  
    1212:Run
    1313REM ********************************************
    14 set GSDLHOME=**GSDLHOME**
    15 set PERLHOME=**PERLHOME**
    16 set JAVAHOME=**JAVAHOME**
    17 set CGIBINHOME=**CGIBINHOME**
     14set GSDLHOME=D:\Progra~1\gsdl\
     15set PERLHOME=D:\Progra~1\Perl\bin\
     16set JAVAHOME=D:\Progra~1\j2sdk1.4.0
     17REM set CGIBINHOME=http://vektor/gsdl
     18set CGIBINHOME=D:\Progra~1\gsdl\server.exe
    1819REM ********************************************
    1920
     
    2223if "%OS%" == "" set PATH="%PATH%";"%PERLHOME%";"%JAVAHOME%\bin";"%GSDLHOME%\bin\windows";"%GSDLHOME%\bin\script"
    2324
    24 java.exe -cp Gatherer.jar;classes/;lib/apache.jar;lib/calpa.jar;lib/jp.jar;lib/polloxml.jar;lib/qfslib.jar;lib/skinlf.jar org.greenstone.gatherer.Gatherer -gsdl %GSDLHOME% -perl %PERLHOME% -library %CGIBINHOME%
     25java.exe -cp classes/;Gatherer.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% -perl %PERLHOME% -library %CGIBINHOME%
    2526echo "Done!"
    2627
    2728:End
     29
     30if "%1" == "SetEnv" goto EndAndExit
     31
     32echo "Closing initial console."
     33
     34cls
     35
     36:EndAndExit
     37
     38echo "Closing second console."
     39
     40exit
     41cls
  • trunk/gli/classes/dictionary.properties

    r4673 r4675  
    118118CDM.ClassifierManager.Assigned:Currently Assigned Classifiers
    119119CDM.ClassifierManager.Classifier:Select classifier to add:
    120 CDM.ClassifierManager.Classifier_XML_Parse_Failed:Unable to determine the arguments for the {0}\nclassifier.  Please ensure that the classifier in question\nprovides the  -xml flag by running the classinfo.pl script\nsimilar to the  description of the  pluginfo.pl  script in\nsection   2.1  of   the   Greenstone   Developers   Guide.
     120CDM.ClassifierManager.Classifier_XML_Parse_Failed:GLI has been unable to determine the arguments for the {0}\nclassifier.  Please ensure that the classifier in question\nprovides the  -xml flag by running the classinfo.pl script\nsimilar to the  description of the  pluginfo.pl  script in\nsection   2.1  of   the   Greenstone   Developers   Guide.
    121121CDM.ClassifierManager.Configure:Configure Selected Classifier
    122122CDM.ClassifierManager.Controls:Editing Controls
     
    210210CDM.PlugInManager.Move_Up:Move Up
    211211CDM.PlugInManager.PlugIn:Select plugin to add:
    212 CDM.PlugInManager.PlugIn_XML_Parse_Failed:Unable to determine the arguments for the {0}\nplugin. Please ensure that the plugin in question provides\nthe  -xml flag by running the pluginfo.pl script described\nin  section  2.1  of  the   Greenstone  Developers  Guide.
     212CDM.PlugInManager.PlugIn_XML_Parse_Failed:GLI has been unable to determine the arguments for the {0}\nplugin. Please ensure that the plugin in question provides\nthe  -xml flag by running the pluginfo.pl script described\nin  section  2.1  of  the   Greenstone  Developers  Guide.
    213213CDM.PlugInManager.Remove:Remove Selected Plugin
    214214CDM.PlugInManager.Title:{39}{46}Plugin Selection & Configuration{47}{34}
     
    350350DeleteCollectionPrompt.Collection_List:Available collections.
    351351DeleteCollectionPrompt.Confirm_Delete:Please tick the box to confirm collection deletion.
    352 DeleteCollectionPrompt.Details:Title    - {0}\nFilename - {1}\nEmail    - {2}\nDescription\n{3}
     352DeleteCollectionPrompt.Details:Title      - {0}\nFilename   - {1}\nCreator    - {2}\nMaintainer - {3}\nDescription\n{4}
    353353DeleteCollectionPrompt.Failed_Delete:Collection could not be completely deleted.
    354354DeleteCollectionPrompt.Failed_Title:Deletion Failed!
     
    769769MSMPrompt.Select_Element_Element:Select Element:
    770770MSMPrompt.Select_Element_Ignore:Ignore
    771 MSMPrompt.Select_Element_Instructions:The metadata element {0} cannot be automatically imported into the collection. Select a metadata set and either:\n(1) press 'Add' to add the metadata to that set (only available if no element with that name already exists), or\n(2) choose an element and press 'Merge' to import {0} metadata to this element.
     771MSMPrompt.Select_Element_Instructions:The metadata element {0} cannot be automatically imported into the collection. Select a metadata set and either:\n(1) press 'Add' to add the metadata to that set, or\n(2) choose an element and press 'Merge' to import {0} metadata to this element.
    772772MSMPrompt.Select_Element_Merge:Merge
    773773MSMPrompt.Select_Element_Original:Original element name:
     
    795795NewCollectionPrompt.Instructions:To create a new collection fill out the fields below.
    796796NewCollectionPrompt.Metadata_Elements:Elements within selected set:
    797 NewCollectionPrompt.Metadata_Instructions:Check the boxes beside the metadata sets to include in your collection. (Note: You can add new ones later).
     797NewCollectionPrompt.Metadata_Instructions1:Check the boxes beside the metadata sets to include in your collection.
     798NewCollectionPrompt.Metadata_Instructions2:(Note: You can add new ones later).
    798799NewCollectionPrompt.Name_Error:You have either failed to enter a name for the collection, or the name you have choosen is already in use. Please correct.
    799800NewCollectionPrompt.NewCollection:-- New Collection --
  • trunk/gli/src/org/greenstone/gatherer/Gatherer.java

    r4669 r4675  
    733733
    734734    private void stopServerEXE() {
    735     if(server != null) {
     735    if(server != null && config.exec_address != null) {
    736736        // See if its already exited for some reason.
    737737        gsdlsite_cfg.load();
  • trunk/gli/src/org/greenstone/gatherer/cdm/TranslationManager.java

    r4657 r4675  
    8989        if(!features_model.contains(bob)) {
    9090        features_model.add(bob);
    91         } 
     91        }
    9292    }
    9393    Collections.sort(features_model);
    9494    return features_model.toArray();
    9595    }
    96    
     96
    9797
    9898    private class BobTheMagicalComparableWrapper
     
    174174        JPanel fragment_selection_panel = new JPanel();
    175175        JLabel fragment_label = new JLabel(get("Assigned_Fragments"));
     176
    176177        fragment_table = new JTable(fragment_table_model);
    177178        fragment_table.setAutoResizeMode(JTable.AUTO_RESIZE_LAST_COLUMN);
     
    187188        //fragment_table.sizeColumnsToFit(0);
    188189
     190        JScrollPane table_scroll = new JScrollPane(fragment_table);
     191        table_scroll.getViewport().setBackground(Gatherer.config.getColor("coloring.collection_tree_background", false));
     192        table_scroll.setOpaque(true);
     193
    189194        JPanel south_panel = new JPanel();
    190195
     
    211216        translation_area.setLineWrap(true);
    212217        translation_area.setWrapStyleWord(true);
    213    
     218
    214219        // Connection
    215220        language_combobox.addActionListener(new LanguageActionListener());
     
    229234        fragment_selection_panel.setLayout(new BorderLayout());
    230235        fragment_selection_panel.add(fragment_label, BorderLayout.NORTH);
    231         fragment_selection_panel.add(new JScrollPane(fragment_table), BorderLayout.CENTER);
     236        fragment_selection_panel.add(table_scroll, BorderLayout.CENTER);
    232237
    233238        selection_panel.setLayout(new GridLayout(2,1,0,5));
     
    278283    }
    279284
    280     private class FeaturesListSelectionListener 
     285    private class FeaturesListSelectionListener
    281286        implements ListSelectionListener {
    282287        public void valueChanged(ListSelectionEvent event) {
     
    302307                String language_name = language_combobox.getSelectedItem().toString();
    303308                int index = fragment_table_model.getMetadataIndexByLanguage(language_name);
    304                 if(index != -1) { 
     309                if(index != -1) {
    305310                CollectionMeta metadata = fragment_table_model.getMetadata(index);
    306311                fragment_table.setRowSelectionInterval(index, index);
     
    322327                // Update and disable the text area
    323328                translation_area.setText("");
    324                 translation_area.setEnabled(false); 
     329                translation_area.setEnabled(false);
    325330                translation_area.setBackground(Gatherer.config.getColor("coloring.disabled", false));
    326331            }
     
    364369    private class FragmentTableModel
    365370        extends AbstractTableModel {
    366        
     371
    367372        private ArrayList metadatum;
    368373
     
    409414        return "#Error";
    410415        }
    411        
     416
    412417        public void remove(int index) {
    413418        metadatum.remove(index);
     
    453458            String language_name = language_combobox.getSelectedItem().toString();
    454459            int index = fragment_table_model.getMetadataIndexByLanguage(language_name);
    455             if(index != -1) { 
     460            if(index != -1) {
    456461            CollectionMeta metadata = fragment_table_model.getMetadata(index);
    457462            fragment_table.setRowSelectionInterval(index, index);
     
    463468            }
    464469            // Ready the text area
    465             translation_area.setEnabled(true); 
     470            translation_area.setEnabled(true);
    466471            translation_area.setBackground(Gatherer.config.getColor("coloring.editable", false));
    467472            ignore_event = false;
    468473        }
    469         }       
     474        }
    470475    }
    471476
  • trunk/gli/src/org/greenstone/gatherer/collection/CollectionConfiguration.java

    r4366 r4675  
    1414    private Element maintainer_element;
    1515    private Element name_element;
     16    private File file;
    1617    private String creator;
    1718    private String description;
     
    2021
    2122    public CollectionConfiguration(File file) {
     23    this.file = file;
    2224    try {
    2325        String filename = file.getName().toLowerCase();
    2426        if(filename.endsWith(".xml")) {
    25                      
     27
    2628        }
    2729        else if(filename.endsWith(".cfg")) {
     
    5658                    String language = temp.substring(temp.indexOf("=") + 1, temp.length() - 1);
    5759                    if(name == null || language.equalsIgnoreCase(Gatherer.dictionary.getLanguage())) {
    58                         name = Utility.decodeGreenstone(tokenizer.nextToken()); 
     60                        name = Utility.decodeGreenstone(tokenizer.nextToken());
    5961                    }
    6062                    }
     
    101103                ///ystem.err.println("creator     = " + creator);
    102104                ///ystem.err.println("maintainer  = " + maintainer);
    103                 ///ystem.err.println("description = " + description); 
     105                ///ystem.err.println("description = " + description);
    104106    }
    105107    catch(Exception error) {
     
    131133    }
    132134
     135    public File getFile() {
     136        return file;
     137    }
     138
    133139    public String getMaintainer() {
    134140    String result = "";
     
    153159    }
    154160
     161    /** Retrieve the short name for this collection which, given this current file is in <col_name>/etc/collect.cfg, is the name of this file's parent file's parent.
     162    * @return the short name of this collection as a String
     163    */
     164    public String getShortName() {
     165        return file.getParentFile().getParentFile().getName();
     166    }
     167
    155168    public void setName(String name) {
    156169    /** @todo */
    157170    }
     171
     172    /** Display the title for this collection. */
     173    public String toString() {
     174        return getName();
     175    }
    158176}
  • trunk/gli/src/org/greenstone/gatherer/collection/CollectionManager.java

    r4673 r4675  
    103103
    104104    private int special_case = -1;
     105    /** Holds a reference to the thread responsible for closing the collection. If non-null then only calls from the given thread will see the collection is non-ready. All other threads will have to wait until closing thread, and all of it consequential calls, are completely finished. */
     106    private Thread closing_thread = null;
     107
    105108    /** The name of the standard lock file. */
    106109    static final public String LOCK_FILE = "gatherer.lck";
     
    142145      */
    143146    public void buildCollection() {
    144     Gatherer.println("Building collection");
     147    Gatherer.println("CollectionManager.buildCollection()");
    145148    building = true;
    146149
     
    162165    shell.addGShellListener(Gatherer.g_man.create_pane);
    163166    shell.start();
     167    Gatherer.println("CollectionManager.buildCollection().return");
    164168    }
    165169    /** Used to determine whether the currently active collection has been built.
     
    178182     */
    179183    public void closeCollection() {
     184    Gatherer.println("Close collection: " + collection.getName());
     185    // We set the closing thread, as it should be the only one who can actually see the collection is closed, at least until the closing thread expires.
     186    closing_thread = Thread.currentThread();
    180187    // System.err.println("Closing collection...");
    181188    // Remove the lock on this file, then remove the collection.
     
    190197    Gatherer.g_man.collectionChanged(false);
    191198    // System.err.println("Closed collection.");
     199    // All of the consequences of a close should have been processed by now, so others should now see the collection as non-ready.
     200    closing_thread = null;
    192201    }
    193202
     
    199208    }
    200209
    201     /** Used to set the current collection to the given collection. Note that this call should -always- be proceeded by a ready call, and if the colection is ready and the saved flag is unset then the user should be prompted to save. Also note that this method creates yet another GShell to run buildcol.pl. 
     210    /** Used to set the current collection to the given collection. Note that this call should -always- be proceeded by a ready call, and if the colection is ready and the saved flag is unset then the user should be prompted to save. Also note that this method creates yet another GShell to run buildcol.pl.
    202211     * @param description a description of the collection as a String
    203212     * @param email the email address of the author/maintainer as a String
     
    243252        progress.setNote(get("Log_Created"));
    244253        }
    245                
     254
    246255        progress.setProgress(2);
    247256
     
    707716      */
    708717    public void importCollection() {
     718    Gatherer.println("CollectionManager.importCollection()");
    709719    if(!saved()) {
    710720        // Force save.
     
    742752        shell.start();
    743753    }
     754    Gatherer.println("CollectionManager.importCollection().return");
    744755    }
    745756    /** Attempts to load the given collection. Currently uses simple serialization of the collection class.
     
    890901      */
    891902    public synchronized void processBegun(GShellEvent event) {
     903    Gatherer.println("CollectionManager.processBegun(" + event.getType() + ")");
    892904    ///ystem.err.println("ProcessBegun " + event.getType());
    893905    // If this is one of the types where we wish to lock user control
     
    901913      */
    902914    public synchronized void processComplete(GShellEvent event) {
     915    Gatherer.println("CollectionManager.processComplete(" + event.getType() + ")");
    903916    ///ystem.err.println("ProcessComplete " + event.getType());
    904917    Gatherer.g_man.lockCollection((event.getType() == GShell.IMPORT), false);
     
    936949      * @return A <i>boolean</i> which is <i>true</i> to indicate a collection has been loaded and thus the collection is ready for editing, <i>false</i> otherwise.
    937950      */
    938     public boolean ready() {
    939     if(collection != null) {
    940         return true;
    941     }
    942     return false;
    943     }
     951
     952    public synchronized boolean ready() {
     953        if(collection != null) {
     954            return true;
     955        }
     956        else {
     957            return false;
     958        }
     959    }
     960
     961    public synchronized boolean reallyReady() {
     962    if(collection == null) {
     963        Gatherer.println("Called reallyReady() when collection was null.");
     964        Gatherer.println("Closing thread = " + closing_thread);
     965        Gatherer.println("This thread = " + Thread.currentThread());
     966        Gatherer.println("Thus we return: " + (closing_thread == null || closing_thread == Thread.currentThread() ? "not ready" : "ready"));
     967    }
     968    // If the closing thread is non-null we should only allow that thread to see the collection as closed.
     969    if(closing_thread != null) {
     970        // Only the closing thread sees the truth
     971        if(Thread.currentThread() == closing_thread) {
     972            return (collection == null);
     973        }
     974        // All other threads are told a lie.
     975        else {
     976            return true;
     977        }
     978    }
     979    else {
     980        if(collection != null) {
     981            return true;
     982        }
     983        else {
     984            return false;
     985        }
     986    }
     987    }
    944988    /** Called to refresh the models upon which the trees are based.
    945989      * @see org.greenstone.gatherer.collection.Collection
     
    10011045      */
    10021046    public void saveCollection(boolean close_after, boolean exit_after) {
     1047        Gatherer.println("Save collection: " + collection.getName());
    10031048    try {
    10041049        SaveCollectionTask save_task = new SaveCollectionTask(collection, close_after, exit_after);
     1050        save_task.start();
    10051051        // Run this in the same thread
    1006         save_task.run();
     1052        //save_task.run();
    10071053    }
    10081054    catch(Exception error) {
     
    10881134
    10891135    try {
    1090                 // We have to ensure that the local library 
     1136                // We have to ensure that the local library
    10911137        if(Gatherer.config.exec_file != null) {
    10921138        ///ystem.err.println("Local Library Found!");
  • trunk/gli/src/org/greenstone/gatherer/collection/DeleteCollectionPrompt.java

    r4660 r4675  
    4343import org.greenstone.gatherer.Gatherer;
    4444import org.greenstone.gatherer.collection.Collection;
    45 import org.greenstone.gatherer.gui.ModalDialog;
    46 import org.greenstone.gatherer.gui.SimpleMenuBar;
    4745import org.greenstone.gatherer.util.ArrayTools;
    48 import org.greenstone.gatherer.util.GSDLSiteConfig;
    4946import org.greenstone.gatherer.util.Utility;
    5047/** This class provides the functionality to delete current collections from the GSDLHOME/collect/ directory. The user chooses the collection from a list, where each entry also displays details about itself, confirms the delete of a collection by checking a checkbox then presses the ok button to actually delete the collection.
     
    5350 */
    5451public class DeleteCollectionPrompt
    55     extends ModalDialog {
     52    extends JDialog {
    5653    /** The currently selected collection for deletion. */
    57     private CollectionEntry collection = null;
     54    private CollectionConfiguration collection = null;
    5855    /** The model behind the list. */
    5956    private DefaultListModel list_model = null;
     
    7673    /** A string array used to pass arguments to the phrase retrieval method. */
    7774    private String args[] = null;
    78 
    79     private boolean current_coll_deleted = false;
    8075    /** The size of the delete prompt screen. */
    8176    public static final Dimension SIZE = new Dimension(500, 500);
     
    8782     */
    8883    public DeleteCollectionPrompt() {
    89     super(Gatherer.g_man);
     84    super();
    9085    this.close_button = new JButton(get("General.Close", null));
    9186    this.confirmation = new JCheckBox(get("Confirm_Delete", null));
     
    10095    this.setSize(SIZE);
    10196    this.setTitle(get("Title", null));
    102     this.setJMenuBar(new SimpleMenuBar("0")); // need to find an appropriate help page to open at
    10397    close_button.addActionListener(new CloseButtonListener());
    10498    confirmation.addActionListener(new ConfirmationCheckBoxListener());
     
    127121    prompt = null;
    128122    }
    129     /** This method causes the modal prompt to be displayed.
    130      * returns true if it has deleted the collection that is currently open*/
    131     public boolean display() {
     123    /** This method causes the modal prompt to be displayed. */
     124    public void display() {
    132125    // Central pane
    133126    JPanel list_pane = new JPanel(new BorderLayout());
     
    170163    Dimension screen_size = Gatherer.config.screen_size;
    171164    this.setLocation((screen_size.width - SIZE.width) / 2, (screen_size.height - SIZE.height) / 2);
    172     this.setVisible(true); // blocks until the dialog is killed
    173     return current_coll_deleted;
    174    
    175     }
    176     /** Shows a delete complete prompt.
     165    this.show();
     166    }
     167
     168    /** Shows a delete complete prompt.
    177169      * @param success A <strong>boolean</strong> indicating if the collection was successfully deleted.
    178170      * @see org.greenstone.gatherer.collection.Collection
     
    188180    }
    189181    }
     182
    190183    /** Retrieves a phrase from the <strong>Dictionary</strong> in <strong>Gatherer</strong>.
    191184      * @param key A <strong>String</strong> used to match against a specific phrase in the dictionary.
     
    199192    return Gatherer.dictionary.get(key, args);
    200193    }
    201     /** Attempts to load the given collection. Currently uses simple
    202       * serialization of the collection class.
    203       * @param location The path to the serialized collection.
    204       */
    205 //      public Collection loadCollection(File file) {
    206 //      Collection col = null;
    207 //      try {
    208 //          FileInputStream fis = new FileInputStream(file);
    209 //          BufferedInputStream bin = new BufferedInputStream(fis);
    210 //          ObjectInputStream input = new ObjectInputStream(bin);
    211 //          col = (Collection) input.readObject();
    212 //          input.close();
    213 //          input = null;
    214 //          bin.close();
    215 //          bin = null;
    216 //          fis.close();
    217 //          fis = null;
    218 //      }
    219 //      catch (Exception error) {
    220 //          error.printStackTrace();
    221 //      }
    222 //      return col;
    223 //      }
     194
    224195    /** Method to scan the collect directory retrieving and reloading each collection it finds, while building the list of known collections.
    225196      * @see org.greenstone.gatherer.Configuration
     
    233204    File collect_directory = new File(collect_directory_name);
    234205    if(collect_directory.exists()) {
    235         // Now for each child directory see if it contains a .col file and
    236         // if so try to load it..
     206        // Now for each child directory see if it contains a .col file and if so try to load it..
    237207        File collections[] = collect_directory.listFiles();
    238208        ArrayTools.sort(collections);
    239209        for(int i = 0; collections != null && i < collections.length; i++) {
    240         File config_file = Utility.findConfigFile(collections[i]);
    241         if (config_file != null) {
    242             CollectionConfiguration config = new CollectionConfiguration(config_file);
    243             if (config != null) {
    244             CollectionEntry col = new CollectionEntry(collections[i].getName(), config);
    245             list_model.addElement(col);
     210        File children[] = collections[i].listFiles();
     211        for(int j = 0; children != null && j < children.length; j++) {
     212            if(children[j].getAbsolutePath().endsWith(".col")) {
     213            list_model.addElement(new CollectionConfiguration(children[j]));
    246214            }
    247            
    248             //File children[] = collections[i].listFiles();
    249             //for(int j = 0; children != null && j < children.length; j++) {
    250             //if(children[j].getAbsolutePath().endsWith(".col")) {
    251             //Collection col = loadCollection(children[j]);
    252             // If we've actually loaded
    253             //if(col != null) {
    254             //   list_model.addElement(col);
    255             //}
    256             //}
    257215        }
    258216        }
     
    261219    }
    262220    /** A button listener implementation, which listens for actions on the close button and disposes of the dialog when detected. */
    263     private class CloseButtonListener 
     221    private class CloseButtonListener
    264222    implements ActionListener {
    265223    /** Any implementation of ActionListener must include this method so we can be informed when the button is actioned.
     
    272230    /** This private class listens for selection events in from the list and then displays the appropriate details for that collection.
    273231      */
    274     private class CollectionListListener 
     232    private class CollectionListListener
    275233    implements ListSelectionListener {
    276234    /** Any implementation of ListSelectionListener must include this method so we can be informed when the list selection changes.
     
    280238        if(!list.isSelectionEmpty()) {
    281239        confirmation.setEnabled(true);
    282         collection = (CollectionEntry) list.getSelectedValue();
    283         args = new String[4];
    284         args[0] = collection.getTitle();
    285         args[1] = collection.getName();
     240        collection = (CollectionConfiguration) list.getSelectedValue();
     241        args = new String[5];
     242        args[0] = collection.getName();
     243        args[1] = collection.getShortName();
    286244        args[2] = collection.getCreator();
    287         args[3] = collection.getDescription();
     245        args[3] = collection.getMaintainer();
     246        args[4] = collection.getDescription();
    288247        details.setText(get("Details", args));
    289         details.setCaretPosition(0);
    290248        }
    291249        else {
     
    309267        }
    310268    }
    311     }         
     269    }
    312270    /** The OK button listener implementation. */
    313     private class OKButtonListener 
     271    private class OKButtonListener
    314272    implements ActionListener {
    315273    /** Any implementation of ActionListener must include this method so we can be informed when the button is actioned.
     
    320278     */
    321279    public void actionPerformed(ActionEvent event) {
    322         // Delete the selected collection.
    323 
    324         // first of all we must release it from the local library
    325         if(Gatherer.config.exec_file != null) {
    326         ///ystem.err.println("Local Library Found!");
    327         Gatherer.g_man.preview_pane.configServer(GSDLSiteConfig.RELEASE_COMMAND + collection.getName());
    328         }
    329 
    330         File delete_me = new File(Utility.getCollectionDir(Gatherer.config.gsdl_path) + collection.getName() + File.separator);
     280                // Delete the selected collection.
     281        File delete_me = collection.getFile().getParentFile().getParentFile();
    331282        if(Utility.delete(delete_me)) {
    332         if (collection.getName().equals(Gatherer.c_man.getCollection().getName())) {
    333             current_coll_deleted = true;
    334         }
    335 
    336283        resultPrompt(true);
    337284        list_model.removeElement(collection);
     
    347294    }
    348295    }
    349 
    350     private class CollectionEntry {
    351 
    352     private String name = null;
    353     private CollectionConfiguration config = null;
    354 
    355     public CollectionEntry(String name, CollectionConfiguration config) {
    356         this.name = name;
    357         this.config = config;
    358     }
    359 
    360     public String getName() {
    361         return name;
    362     }
    363 
    364     public String getTitle() {
    365         return config.getName();
    366     }
    367 
    368     public String getCreator() {
    369         return config.getCreator();
    370     }
    371 
    372     public String getDescription() {
    373         return config.getDescription();
    374     }
    375    
    376     public String toString() {
    377         return config.getName();
    378        
    379     }
    380     }
    381296}
    382297
  • trunk/gli/src/org/greenstone/gatherer/file/FileManager.java

    r4383 r4675  
    4646import org.greenstone.gatherer.util.DragComponent;
    4747import org.greenstone.gatherer.util.SynchronizedTreeModelTools;
    48 /** Manages the moving of files within a separate thread. 
     48/** Manages the moving of files within a separate thread.
    4949 * @author John Thompson, Greenstone Digital Library, University of Waikato
    5050 * @version 2.3
     
    7070    // If source and target are different
    7171    else {
    72                 // If target is the UndoManager, we're deleting
     72        // If target is the UndoManager, we're deleting
    7373        if(target instanceof UndoManager) {
    7474        // If the source is the workspace then display an error message. Workspace is read only.
     
    141141    public void run() {
    142142        // Reset, and calculate progress bar size.
    143         queue.calculateSize(source_nodes);
     143        boolean cancelled = queue.calculateSize(source_nodes);
    144144        // Now we queue the job(s). Note that this may fail if a read only file is encountered and we have been asked to delete.
    145         for(int i = 0; source_nodes != null && i < source_nodes.length; i++) {
     145        for(int i = 0; !cancelled && source_nodes != null && i < source_nodes.length; i++) {
    146146        queue.addJob(id, source, source_nodes[i], target, target_node, type, true, true, true);
    147147        }
  • trunk/gli/src/org/greenstone/gatherer/file/FileQueue.java

    r4615 r4675  
    140140    }
    141141
    142     public void calculateSize(FileNode[] files) {
     142    /** Calculates the total deep file size of the selected file nodes.
     143    * @param files a FileNode[] of selected files
     144    * @return true if a cancel was signalled, false otherwise
     145    * @see org.greenstone.gatherer.file.FileManager.Task#run()
     146    */
     147    public boolean calculateSize(FileNode[] files) {
    143148    progress.reset();
    144149    progress.setString(get("FileActions.Calculating_Size"));
    145150    progress.setIndeterminate(true);
    146151    Vector remaining = new Vector();
    147     for(int i = 0; i < files.length; i++) {
     152    for(int i = 0; !cancel_action && i < files.length; i++) {
    148153        remaining.add(files[i]);
    149154    }
    150     while(remaining.size() > 0) {
     155    while(!cancel_action && remaining.size() > 0) {
    151156        FileNode node = (FileNode)remaining.remove(0);
    152157        if(node.isLeaf()) {
     
    154159        }
    155160        else {
    156         for(int i = 0; i < node.getChildCount(); i++) {
     161        for(int i = 0; !cancel_action && i < node.getChildCount(); i++) {
    157162            remaining.add(node.getChildAt(i));
    158163        }
     
    161166    progress.setString(get("No_Activity"));
    162167    progress.setIndeterminate(false);
     168    // Now we return if calculation was cancelled so that the FileManagers Task can skip the addJob phase correctly.
     169    if(cancel_action) {
     170        cancel_action = false; // reset
     171        return true;
     172    }
     173    else {
     174        return false;
     175    }
    163176    }
    164177
     
    171184    return file_status;
    172185    }
    173     /** Access to the job state label. */   
     186    /** Access to the job state label. */
    174187//      public JLabel getJobStatus() {
    175188//      return job_status;
     
    203216            ///ystem.err.println("Found job: " + job);
    204217            // The user can cancel this individual action at several places, so keep track if the state is 'ready' for the next step.
    205             boolean ready = true; 
     218            boolean ready = true;
    206219            FileNode origin_node = job.getOrigin();
    207220            FileNode destination_node = job.getDestination();
     
    394407                source_model.refresh(new TreePath(((FileNode)origin_node.getParent()).getPath()));
    395408                }
    396                                      
     409
    397410                // We can't have been cancelled, and we must have created a new FileNode during the above phase, before we can handle metadata.
    398411                if(!cancel_action && new_node != null) {
     
    403416                    GDMManager gdm = Gatherer.c_man.getCollection().gdm;
    404417                    // we just retrieve the metadata attached to the origin node...
    405                     ArrayList existing_metadata = gdm.getMetadata(source_file);
    406                     ///ystem.err.println("Existing metadata for " + origin_node + ": " + gdm.toString(existing_metadata));
     418                    ArrayList existing_metadata = gdm.getMetadataOnly(source_file);
     419                    //Gatherer.println("Existing metadata for " + origin_node + ": " + gdm.toString(existing_metadata));
    407420                    // then assign this remainder to the new folder.
    408421                    ///ystem.err.println("New metadata: " + gdm.toString(existing_metadata));
     
    533546                // We add an entry to the complete mappings to ensure this directory isn't added again
    534547                completed_folder_mappings.put(origin_node, recycle_folder_record);
    535                 ///ystem.err.println("Added completed directories mapping " + origin_node); 
    536                 // queue all of its children, (both filtered and non-filtered), but for deleting only. Don't queue jobs for a current move event, as they would be queued as part of copying. I have no idea way, per sec, however the children within the origin node are always invalid during deletion (there are several copies of some nodes?!?). I'll check that each child is only added once. 
     548                ///ystem.err.println("Added completed directories mapping " + origin_node);
     549                // queue all of its children, (both filtered and non-filtered), but for deleting only. Don't queue jobs for a current move event, as they would be queued as part of copying. I have no idea way, per sec, however the children within the origin node are always invalid during deletion (there are several copies of some nodes?!?). I'll check that each child is only added once.
    537550                ///ystem.err.println("Directory has " + origin_node.getChildCount() + " children.");
    538551                ///ystem.err.println("Directory actually has " + child_list.length + " children.");
     
    586599            progress.reset();
    587600            progress.setString(get("No_Activity"));
    588             yes_to_all = false;         
     601            yes_to_all = false;
    589602            completed_folder_mappings.clear();
    590603            recycle_folder_mappings.clear();
     
    599612        }
    600613        catch (Exception error) {
    601         Gatherer.printStackTrace(error); 
     614        Gatherer.printStackTrace(error);
    602615        }
    603616    }
     
    655668      * @see org.greenstone.gatherer.Gatherer
    656669      */
    657     public void copyFile(File source, File destination, LongProgressBar progress) 
     670    public void copyFile(File source, File destination, LongProgressBar progress)
    658671    throws FileAlreadyExistsException, FileNotFoundException, InsufficientSpaceException, IOException, UnknownFileErrorException {
    659672    if(source.isDirectory()) {
  • trunk/gli/src/org/greenstone/gatherer/gui/CollectionPane.java

    r4666 r4675  
    230230        collection_filter.setBackground(Color.lightGray);
    231231    }
    232          
     232
    233233    collection_tree.setEnabled(ready);
    234234    collection_filter.setEnabled(ready);
     
    242242    workspace_tree.setModel(workspace);
    243243    workspace_tree_sync.add(workspace_tree);
    244          
     244
    245245    // Enable or disable the control buttons
    246246    bin_button.setEnabled(ready);
     
    290290    fcb.setBackgroundNonSelectionColor(Gatherer.config.getColor("coloring.editable", false));
    291291    fcb.setTextNonSelectionColor(Gatherer.config.getColor("coloring.workspace_tree_foreground", false));
    292     fcb.setBackgroundSelectionColor(Gatherer.config.getColor("coloring.workspace_selection_background", false));
    293     fcb.setTextSelectionColor(Gatherer.config.getColor("coloring.workspace_selection_foreground", false));
     292    fcb.setBackgroundSelectionColor(Gatherer.config.getColor("coloring.collection_selection_background", false));
     293    fcb.setTextSelectionColor(Gatherer.config.getColor("coloring.collection_selection_foreground", false));
    294294    fcb = null;
    295295
     
    354354
    355355    JPanel file_pane = new JPanel();
    356     file_pane.setBackground(Color.white);
     356    //file_pane.setBackground(Color.white);
    357357    //JPanel job_pane = new JPanel();
    358358    //job_pane.setBackground(Color.white);
    359359    JPanel progress_pane = new JPanel();
    360     progress_pane.setBackground(Color.white);
     360    //progress_pane.setBackground(Color.white);
    361361    JLabel file_status = file_queue.getFileStatus();
    362362    //JLabel job_status = job_queue.getJobStatus();
     
    372372    bin_button.setPreferredSize(MIN_SIZE);
    373373    group.add(bin_button);
    374          
     374
    375375    // Layout Components.
    376376    workspace_pane.setLayout(new BorderLayout());
     
    689689    /** This provides a small prompt for gathering addition details about a special directory mapping such as its symbolic name. */
    690690    private class MappingPrompt
    691     extends JDialog 
     691    extends JDialog
    692692    implements ActionListener, KeyListener {
    693693    private boolean cancelled = false;
     
    723723        file_pane.add(file_label, BorderLayout.WEST);
    724724        file_pane.add(file_field, BorderLayout.CENTER);
    725                
     725
    726726        name_pane.setLayout(new BorderLayout());
    727727        name_pane.add(name_label, BorderLayout.WEST);
     
    773773    private class MouseListenerImpl
    774774    extends MouseAdapter {
    775     /** Any subclass of MouseAdapter can override this method to respond to mouse click events. In this case we want to open a pop-up menu if we detect a right mouse click over one of our registered components, and start an external application if someone double clicks on a certain file record. */ 
     775    /** Any subclass of MouseAdapter can override this method to respond to mouse click events. In this case we want to open a pop-up menu if we detect a right mouse click over one of our registered components, and start an external application if someone double clicks on a certain file record. */
    776776    public void mouseClicked(MouseEvent event) {
    777777        if(SwingUtilities.isRightMouseButton(event)) {
  • trunk/gli/src/org/greenstone/gatherer/gui/CreatePane.java

    r4673 r4675  
    5454/** This class provides a GUI view showing some statistics on your current collection, and options for building it. As the collection is built this initial view is replaced with one showing progress bars and a message log of the creation process. This log can be later accessed via the options tree located in the center of the initial pane. This class is also responsible for creating the GShellProgressMonitors that are then attatched to external shell processes, and calling the methods in the CollectionManager for actually importing and building the collection. <br><BR>
    5555 * <center><table width=80% border=2 cellspacing=0 cellpadding=2><tr><td align=center colspan=4>
    56  * The (i)mport and/or (b)uild options supported:</td></tr> 
     56 * The (i)mport and/or (b)uild options supported:</td></tr>
    5757 * <tr background=black><font color=white><td>Script</td><td>Associated Argument</td><td>Control</td><td>Comments</td></font></tr>
    5858 * <tr><td>b</td><td>-allclassifications</td><td>JCheckBox</td><td>&nbsp;</td></tr>
     
    8080 */
    8181public class CreatePane
    82     extends JPanel 
     82    extends JPanel
    8383    implements GShellListener {
    8484    /** Determines the current view that should be shown for this pane. */
     
    101101    private JButton cancel_button = null;
    102102    /** The label displaying the number of documents in this collection. */
    103     private JLabel document_count = null; 
     103    private JLabel document_count = null;
    104104    /** The label alongside the build progress bar gets some special treatment so... */
    105105    private JLabel progress_build_label = null;
     
    216216    ///ystem.err.println("Collection changed... ");
    217217    if(Gatherer.c_man != null && Gatherer.c_man.ready()) {
    218              
     218
    219219        if (!processing &&this.options_pane!=null) {
    220220        // we only do this if we are not processing - if we are processing, then we haven't added the new entry yet, and it will be added by another method
    221221        this.options_pane.resetLogList(); // saves any residual message
    222         } 
     222        }
    223223        Collection current_collection = Gatherer.c_man.getCollection();
    224224        if (current_collection != previous_collection) {
     
    239239    stats_area.setLayout(new GridLayout(1,1));
    240240    stats_area.add(document_count);
    241          
     241
    242242    JPanel left = new JPanel();
    243243    left.setBorder(BorderFactory.createEmptyBorder(0,5,5,5));
     
    275275    build_pane.setLayout(new BorderLayout());
    276276    build_pane.add(progress_build_label, BorderLayout.WEST);
    277     build_pane.add(build_monitor.getProgress(), BorderLayout.CENTER);     
     277    build_pane.add(build_monitor.getProgress(), BorderLayout.CENTER);
    278278
    279279    JPanel bar_area = new JPanel();
     
    463463        options_pane.addNewLog(OptionsPane.CANCELLED);
    464464        card_layout.show(main_pane, CONTROL);
    465                 // Set the stop flag in all the process monitor.
     465        // Set the stop flag in all the process monitor.
    466466        build_monitor.setStop(true);
    467467        copy_monitor.setStop(true);
    468468        import_monitor.setStop(true);
    469                 // Set removeold automatically.
    470         if(Gatherer.c_man.ready()) { // and it should be.
    471         Gatherer.c_man.getCollection().build_options.setImportValue("removeold", true, null);
    472         }
    473                 // Remove the collection lock.
    474         Gatherer.g_man.lockCollection(false, false);
     469        // Set removeold automatically.
     470        Gatherer.c_man.getCollection().build_options.setImportValue("removeold", true, null);
     471        // Remove the collection lock.
     472        //Gatherer.g_man.lockCollection(false, false);
    475473    }
    476474    }
    477475    /** The OptionTree is simply a tree structure that has a root node labelled "Options" and then has a child node for each available options screen. These screens are either combinations of the available import and build arguments, or a message log detailing the shell processes progress. */
    478476    private class OptionTree
    479     extends JTree 
     477    extends JTree
    480478    implements TreeSelectionListener {
    481479    /** The model behind the tree. */
     
    491489    /** The root node of the options tree, which has no associated options view. */
    492490    private OptionTreeNode options   = null;
    493     /** Constructor. 
     491    /** Constructor.
    494492     * @see org.greenstone.gatherer.gui.CreatePane.OptionTreeNode
    495493     */
     
    505503        log = new OptionTreeNode(get("Log"));
    506504        options = new OptionTreeNode(get("Options"));
    507                
     505
    508506        model = new DefaultTreeModel(options);
    509507        setModel(model);
     
    520518    public void valueChanged(TreeSelectionEvent event) {
    521519        TreePath path = null;
    522         OptionTreeNode node = null; 
     520        OptionTreeNode node = null;
    523521                //if(event != null) {
    524522        //path = event.getPath();
     
    565563    /** The <strong>OptionTree</strong> is built from these nodes, each of which has several methods used in creating the option panes.
    566564      */
    567     private class OptionTreeNode 
    568     extends DefaultMutableTreeNode 
     565    private class OptionTreeNode
     566    extends DefaultMutableTreeNode
    569567    implements Comparable {
    570568    /** The text label given to this node in the tree. */
  • trunk/gli/src/org/greenstone/gatherer/gui/GComboBox.java

    r4367 r4675  
    147147    UI ui = new UI();
    148148    setUI(ui);
    149     ui.setBackground(Color.white);
     149    ui.setButtonBackground();
    150150    // Initialization
    151151    this.background = Gatherer.config.getColor("coloring.collection_tree_background", false);
     
    163163        setBackground(background);
    164164        setForeground(foreground);
    165         setSelectionColor(selection_background); 
     165        setSelectionColor(selection_background);
    166166        setSelectedTextColor(selection_foreground);
    167167    }
     
    224224    }
    225225
    226     private class Renderer 
    227     extends JLabel 
     226    private class Renderer
     227    extends JLabel
    228228    implements ListCellRenderer {
    229229    public Renderer() {
     
    258258                scroller.setPreferredSize( popupBounds.getSize() );
    259259                scroller.setMinimumSize( popupBounds.getSize() );
    260                 list.invalidate();           
     260                list.invalidate();
    261261                int selectedIndex = comboBox.getSelectedIndex();
    262262                if ( selectedIndex == -1 ) {
    263263                list.clearSelection();
    264                 } 
     264                }
    265265                else {
    266266                list.setSelectedIndex( selectedIndex );
    267                 }           
     267                }
    268268                list.ensureIndexIsVisible( list.getSelectedIndex() );
    269269                setLightWeightPopupEnabled( comboBox.isLightWeightPopupEnabled() );
     
    276276    }
    277277
    278     public void setBackground(Color background) {
    279         arrowButton.setBackground(background);
     278    public void setButtonBackground() {
     279        arrowButton.setBackground(Gatherer.config.getColor("coloring.button_background", false));
    280280    }
    281281    }
  • trunk/gli/src/org/greenstone/gatherer/gui/GUIManager.java

    r4659 r4675  
    9999    /** The message pane is optional and contains the log of messages sent. */
    100100    public MessagePane message_pane = null;
    101      
     101
    102102    public MetaAuditFrame meta_audit;
    103103    /** The metaedit pane is used to assign, edit and remove metadata from files within the collection. */
     
    177177    else if(esrc == menu_bar.file_delete) {
    178178        DeleteCollectionPrompt dcp = new DeleteCollectionPrompt();
    179         boolean current_deleted = dcp.display();
     179        dcp.display();
    180180        dcp.destroy();
    181181        dcp = null;
    182         // need to close the current collection?
    183         if (current_deleted) {
    184         Gatherer.c_man.closeCollection();
    185         tab_pane.setSelectedComponent(collection_pane);
    186         }
    187182        System.gc();
    188183    }
     
    283278
    284279            int SIZE = 5000;
    285             Object[] array = new Object[SIZE]; 
    286             Runtime.getRuntime().gc(); 
     280            Object[] array = new Object[SIZE];
     281            Runtime.getRuntime().gc();
    287282            long start = Runtime.getRuntime().freeMemory();
    288283            for (int i = 0; i < SIZE; i++) {
     
    292287            long end = Runtime.getRuntime().freeMemory();
    293288            long difference = (( start -  end ) / SIZE);
    294             ///ystem.out.println(difference + " bytes used." );                           
     289            ///ystem.out.println(difference + " bytes used." );
    295290        }
    296291        }
     
    309304    }
    310305    else if(esrc == menu_bar.help_collect) {
    311         help.setView("5.0"); 
     306        help.setView("5.0");
    312307    }
    313308    else if(esrc == menu_bar.help_design) {
    314         help.setView("7.0"); 
     309        help.setView("7.0");
    315310    }
    316311    else if(esrc == menu_bar.help_general) {
    317         help.setView(""); 
     312        help.setView("");
    318313    }
    319314    else if(esrc == menu_bar.help_metaedit) {
     
    321316    }
    322317    else if(esrc == menu_bar.help_mirror) {
    323         help.setView("4.0"); 
     318        help.setView("4.0");
    324319    }
    325320    else if(esrc == menu_bar.help_preview) {
     
    411406                // Create the menu-bar and stick it up the top.
    412407        menu_bar = new MenuBar(new MenuListenerImpl());
    413         content_pane.add(menu_bar, BorderLayout.NORTH); 
    414                 // Create the tabbed pane and plop it in the center where it will 
     408        content_pane.add(menu_bar, BorderLayout.NORTH);
     409                // Create the tabbed pane and plop it in the center where it will
    415410                // expand to consume all available space like any good gas would.
    416411        tab_pane = new JTabbedPane();
     
    424419        tab_pane.setEnabledAt(tab_pane.indexOfComponent(browser_pane), Gatherer.config.get("workflow.browse", false));
    425420        }
    426                
     421
    427422        if(Gatherer.config.get("workflow.mirror", true)) {
    428423        mirror_pane = new MirrorPane(workspace_tree_sync);
     
    430425        tab_pane.addTab(get("Mirroring"), Utility.getImage("mirroring.gif"), mirror_pane);
    431426        tab_pane.setEnabledAt(tab_pane.indexOfComponent(mirror_pane), Gatherer.config.get("workflow.mirror", false));
    432         }               
     427        }
    433428
    434429        if(Gatherer.config.get("workflow.gather", true)) {
     
    445440        tab_pane.setEnabledAt(tab_pane.indexOfComponent(metaedit_pane), false);
    446441        }
    447                
     442
    448443        if(Gatherer.config.get("workflow.design", true)) {
    449444        config_pane = new GConfigPane();
     
    452447        tab_pane.setEnabledAt(tab_pane.indexOfComponent(config_pane), false);
    453448        }
    454                
     449
    455450        if(Gatherer.config.get("workflow.export", true)) {
    456451        tab_pane.addTab(get("Export"), Utility.getImage("export.gif"), export_pane);
    457452        tab_pane.setEnabledAt(tab_pane.indexOfComponent(export_pane), false);
    458453        }
    459                
     454
    460455        if(Gatherer.config.get("workflow.create", true)) {
    461456        create_pane = new CreatePane();
     
    464459        tab_pane.setEnabledAt(tab_pane.indexOfComponent(create_pane), false);
    465460        }
    466                
     461
    467462        if(Gatherer.config.get("workflow.preview", true)) {
    468463        preview_pane = new PreviewPane();
     
    542537    }
    543538
    544     /** Allows the system to programatically set the selected tab. 
     539    /** Allows the system to programatically set the selected tab.
    545540      * @param component The view you wish to make visable in the tab pane as a <strong>Component</strong>.
    546541      */
     
    609604        // If there is already a collection open, save and close it.
    610605        if(Gatherer.c_man.ready()) {
    611         showSaveCollectionBox(true, false);     
     606        showSaveCollectionBox(true, false);
    612607        // Wait until it is closed.
    613 //          try {
    614 //              while(Gatherer.c_man.ready()) {
    615 //              wait(10);
    616 //              }
    617 //          }
    618 //          catch(Exception error) {
    619 //              System.err.println("Exception: " + error);
    620 //              error.printStackTrace();
    621 //          }
     608        try {
     609            synchronized(this) {
     610                while(Gatherer.c_man.reallyReady()) {
     611                wait(10);
     612                }
     613            }
     614        }
     615        catch(Exception error) {
     616                Gatherer.println("Exception: " + error);
     617                Gatherer.printStackTrace(error);
     618        }
    622619        }
    623620        result = Gatherer.c_man.loadCollection(filename);
     
    653650        showSaveCollectionBox(true, false);
    654651        // Wait until it is closed.
    655 //          try {
    656 //              synchronized(this) {
    657 //              while(Gatherer.c_man.ready()) {
    658 //                  wait(10);
    659 //              }
    660 //              }
    661 //          }
    662 //          catch(Exception error) {
    663 //              System.err.println("Exception: " + error);
    664 //              error.printStackTrace();
    665 //          }
     652        try {
     653            synchronized(this) {
     654            while(Gatherer.c_man.reallyReady()) {
     655                wait(10);
     656            }
     657            }
     658        }
     659        catch(Exception error) {
     660            Gatherer.println("Exception: " + error);
     661            Gatherer.printStackTrace(error);
     662        }
    666663        }
    667664
     
    679676        extends Thread {
    680677    private NewCollectionDetailsPrompt ncd_prompt = null;
    681     private NewCollectionMetadataPrompt ncm_prompt = null; 
     678    private NewCollectionMetadataPrompt ncm_prompt = null;
    682679    public CreationTask(NewCollectionDetailsPrompt ncd_prompt, NewCollectionMetadataPrompt ncm_prompt) {
    683680        this.ncd_prompt = ncd_prompt;
     
    717714    //case SaveCollectionBox.SAVE_YES:
    718715    Gatherer.c_man.saveCollection(close_after, exit_after);
     716    // Wait until it is closed.
     717    try {
     718        synchronized(this) {
     719            while(Gatherer.c_man.reallyReady()) {
     720            wait(10);
     721            }
     722        }
     723    }
     724    catch(Exception error) {
     725        Gatherer.println("Exception: " + error);
     726        Gatherer.printStackTrace(error);
     727    }
     728
    719729    //content_pane.paintImmediately(bounds);
    720     return true; 
     730    return true;
    721731    //case SaveCollectionBox.SAVE_NO:
    722732    // Close collection.
     
    862872    }
    863873    }
    864     private class TabUpdater 
     874    private class TabUpdater
    865875    implements Runnable {
    866876    private boolean ready = false;
  • trunk/gli/src/org/greenstone/gatherer/gui/LockFileDialog.java

    r4459 r4675  
    5252    name_label.setPreferredSize(LABEL_SIZE);
    5353    TextFieldLabel name_field = new TextFieldLabel(name);
     54    name_field.setBackground(Gatherer.config.getColor("coloring.collection_tree_background", false));
    5455    JPanel person_pane = new JPanel();
    5556    JLabel person_label = new JLabel(get("User"));
    5657    person_label.setPreferredSize(LABEL_SIZE);
    5758    TextFieldLabel person_field = new TextFieldLabel(getValue("User"));
     59    person_field.setBackground(Gatherer.config.getColor("coloring.collection_tree_background", false));
    5860    JPanel machine_pane = new JPanel();
    5961    JLabel machine_label = new JLabel(get("Machine"));
    6062    machine_label.setPreferredSize(LABEL_SIZE);
    6163    TextFieldLabel machine_field = new TextFieldLabel(getValue("Machine"));
     64    machine_field.setBackground(Gatherer.config.getColor("coloring.collection_tree_background", false));
    6265    JPanel created_pane = new JPanel();
    6366    JLabel created_label = new JLabel(get("Date"));
    6467    created_label.setPreferredSize(LABEL_SIZE);
    6568    TextFieldLabel created_field = new TextFieldLabel(getValue("Date"));
     69    created_field.setBackground(Gatherer.config.getColor("coloring.collection_tree_background", false));
    6670    JLabel central_label = new JLabel(get("Lockfile_Message_Two"));
    6771    JPanel button_pane = new JPanel();
  • trunk/gli/src/org/greenstone/gatherer/gui/MetaEditPane.java

    r4667 r4675  
    406406    // Change the default colours of this filters combobox.
    407407    GComboBox fcb = filter.getComboBox();
    408     fcb.setBackgroundNonSelectionColor(Gatherer.config.getColor("coloring.editable", false));
     408    fcb.setBackgroundNonSelectionColor(Color.white);
    409409    fcb.setTextNonSelectionColor(Gatherer.config.getColor("coloring.collection_tree_foreground", false));
    410410    fcb.setBackgroundSelectionColor(Gatherer.config.getColor("coloring.collection_selection_background", false));
  • trunk/gli/src/org/greenstone/gatherer/gui/NewCollectionDetailsPrompt.java

    r4664 r4675  
    112112    description_label.setOpaque(false);
    113113    description = new JTextArea();
    114     description.setBackground(Gatherer.config.getColor("coloring.editable", false));
    115114    description.setRows(5);
    116115
  • trunk/gli/src/org/greenstone/gatherer/gui/NewCollectionMetadataPrompt.java

    r4630 r4675  
    1919import org.w3c.dom.*;
    2020
    21 public class NewCollectionMetadataPrompt 
     21public class NewCollectionMetadataPrompt
    2222    extends ModalDialog {
    2323
     
    4545        if(name.endsWith(".mds")) {
    4646        sets.add(new MetadataSet(possible_mdses[i]));
    47         }               
    48     }         
     47        }
     48    }
    4949
    5050    // Creation
    5151    JPanel content_pane = (JPanel) getContentPane();
    5252
    53     JLabel instructions_label = new JLabel(get("Metadata_Instructions"));
     53    JPanel instructions_panel = new JPanel();
     54    JLabel instructions_label1 = new JLabel(get("Metadata_Instructions1"));
     55    JLabel instructions_label2 = new JLabel(get("Metadata_Instructions2"));
    5456
    5557    JPanel center_pane = new JPanel();
     
    7678    sets_list.addListSelectionListener(new MetadataListSelectionListener());
    7779    // Display
     80    instructions_panel.setLayout(new GridLayout(2,1));
     81    instructions_panel.add(instructions_label1);
     82    instructions_panel.add(instructions_label2);
     83
    7884    sets_list_pane.setLayout(new BorderLayout());
    7985    sets_list_pane.add(sets_list_label, BorderLayout.NORTH);
     
    96102    content_pane.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
    97103    content_pane.setLayout(new BorderLayout());
    98     content_pane.add(instructions_label, BorderLayout.NORTH);
     104    content_pane.add(instructions_panel, BorderLayout.NORTH);
    99105    content_pane.add(center_pane, BorderLayout.CENTER);
    100106    content_pane.add(button_pane, BorderLayout.SOUTH);
  • trunk/gli/src/org/greenstone/gatherer/gui/OptionsPane.java

    r4596 r4675  
    5151import org.greenstone.gatherer.util.Utility;
    5252import org.w3c.dom.*;
    53 /** This class serves as the data holder for all subclasses of option panes, such as Import options or All options. It also contains methods for creating each of the option lines as they would appear in the subpane. Futhermore it has a method for considering all the arguments and generating a <strong>String[]</strong> to allow you to pass them to the <strong>GShell</strong>. 
     53/** This class serves as the data holder for all subclasses of option panes, such as Import options or All options. It also contains methods for creating each of the option lines as they would appear in the subpane. Futhermore it has a method for considering all the arguments and generating a <strong>String[]</strong> to allow you to pass them to the <strong>GShell</strong>.
    5454 * @author John Thompson, Greenstone Digital Library, University of Waikato
    5555 * @version 2.2
     
    7575    static final public char UNSUCCESSFUL = 'u';
    7676    static final public char CANCELLED = 'c';
    77    
     77
    7878    static private int BUILD = 0;
    7979    static private int IMPORT = 1;
     
    8585    static private Dimension SPINNER_SIZE = new Dimension(100, 25);
    8686    static private String DESCRIPTION_SEP = " + ";
    87    
    88    
     87
     88
    8989     /** 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. */
    9090    public OptionsPane(JTextArea log, BuildOptions build_options) {
     
    9595    }
    9696
    97     /** creates a new log from the text in log. The new file is named 
     97    /** creates a new log from the text in log. The new file is named
    9898     * build_log.<current time>.txt. A new FileEntry is added to teh log list
    9999     * and made selected. A fresh listener is added to teh document */
    100100    public void addNewLog(char success) {
    101101    ///ystem.out.println("add new log");
    102        
     102
    103103    // create the file name
    104104    long time = System.currentTimeMillis();
     
    153153    }
    154154    return pane;
    155     } 
     155    }
    156156    /** This method creates the panel with all the import only options on it.
    157157      * @return A <strong>JPanel</strong> which can be used to display all the import only options.
     
    189189    if (log_pane == null) {
    190190        log_pane = new JPanel(new BorderLayout());
    191          
     191
    192192        // Build a list of the log files available, ordering by last modified. Log files are like build_log.date.txt
    193193        DefaultListModel contents = new DefaultListModel();
     
    213213        }
    214214        }
    215          
    216         log_list = new JList(contents); 
     215
     216        log_list = new JList(contents);
    217217        log_list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    218218        log_list.setLayoutOrientation(JList.VERTICAL);
    219219        log_list.setVisibleRowCount(3);
    220220        log_list.addListSelectionListener(new LogListListener());
    221          
     221
    222222        JScrollPane list_scroller = new JScrollPane(log_list);
    223          
     223
    224224        // If log is not empty and we have something in displayed_log - make that element selected
    225225        if (log_display.getText().length()>0 && displayed_log != null) {
     
    228228            log_list.setSelectedIndex(index);
    229229        }
    230              
     230
    231231        }
    232232        log_pane.add(new JScrollPane(log_display), BorderLayout.CENTER);
     
    261261    return Gatherer.dictionary.get(key, args);
    262262    }
    263     /** Attempts to discover the latest document count. 
     263    /** Attempts to discover the latest document count.
    264264      * @return An <strong>int</strong> detailing the number of documents in this collection.
    265265     */
     
    273273    return 1;
    274274    }
    275    
     275
    276276    /** Loads a new log into the log text - saves the currently showing one,
    277277     * and loads the new one, adding a fresh listener to the document
    278      * Note, we need to remove any listener before making the changes, then 
    279      * add a listener back in 
     278     * Note, we need to remove any listener before making the changes, then
     279     * add a listener back in
    280280     */
    281281    public void loadSelectedLog(FileEntry fe) {
     
    286286        log_display.getDocument().removeDocumentListener(log_change_listener);
    287287    }
    288    
     288
    289289    displayed_log = fe;
    290290    if (fe != null) {
     
    295295    is_log_changed=false;
    296296    log_display.getDocument().addDocumentListener(log_change_listener);
    297    
     297
    298298    }
    299299
    300300    /** Neutralizes the log list - saves any unsaved changes to the current log
    301      * clears the log text, unselects the log list, and adds a fresh listener 
    302      * to the log's document 
    303      * Note, we need to remove any listener before making the changes, then 
     301     * clears the log text, unselects the log list, and adds a fresh listener
     302     * to the log's document
     303     * Note, we need to remove any listener before making the changes, then
    304304     * add a listener back in */
    305305    public void resetLogList() {
     
    317317    is_log_changed=false;
    318318    log_display.getDocument().addDocumentListener(log_change_listener);
    319    
     319
    320320    }
    321321
    322322    /** saves the current text in log to the File specified */
    323323    public void saveLogFile(File file) {
    324    
     324
    325325    try {
    326326        BufferedWriter out = new BufferedWriter(new FileWriter(file)); // uses the default encoding
     
    331331        String token = t.nextToken();
    332332        if (token.equals("\n")) {
    333             out.newLine(); 
     333            out.newLine();
    334334        } else {
    335335            out.write(token, 0, token.length());
    336336        }
    337        
     337
    338338        }
    339339        out.close();
    340        
     340
    341341    } catch(Exception e) {
    342342        System.out.println("Error in saving log file: "+file.toString());
    343343        e.printStackTrace();
    344344    }
    345    
    346    
     345
     346
    347347    }
    348348
     
    550550    /** Constructor. */
    551551    public EnabledListener(JComponent target) {
    552         this.target = target;   
     552        this.target = target;
    553553    }
    554554    /** Any implementation of ActionListener must include this method so that we can be informed when an action has been performed on or registered check box, prompting us to change the state of the other controls as per the users request.
     
    587587
    588588    /** holds a File which has a particular naming convention
    589      * build_log.date.txt 
     589     * build_log.date.txt
    590590     * also keeps a Date corresponding to the date in its name*/
    591591    private class FileEntry {
    592    
     592
    593593    private Date date=null;
    594594    private File file=null;
     
    598598        this.date = getDateFromFileName();
    599599        this.display = createDisplayText();
    600        
     600
    601601    }
    602602
     
    606606        return date.compareTo(d);
    607607    }
    608    
     608
    609609    public Date getDate() {
    610610        return this.date;
     
    622622        BufferedReader in = new BufferedReader(new FileReader(this.file));
    623623        String line;
    624        
     624
    625625        while ((line = in.readLine()) != null) {
    626626            contents.append(line);
     
    632632        } catch (IOException ioe) {
    633633        System.err.println("Error: exception occurred when trying to read in file "+this.file.toString()+", "+ioe.getMessage());
    634        
    635         }
    636        
     634
     635        }
     636
    637637        return contents.toString();
    638638    }
    639639    /** we only want the date out of the file name, not the whole path */
    640640    public String toString() {
    641         return this.display; 
     641        return this.display;
    642642    }
    643643    /** creates the display text for the list */
     
    645645        StringBuffer d = new StringBuffer();
    646646        d.append(date.toString());
    647         char success= this.file.getName().charAt(23);
    648         switch (success) {
    649         case OptionsPane.SUCCESSFUL:
    650         d.append(get("Successful"));
    651         break;
    652         case OptionsPane.UNSUCCESSFUL:
    653         d.append(get("Unsuccessful"));
    654         break;
    655         case OptionsPane.CANCELLED:
    656         d.append(get("Cancelled"));
    657         break;
    658         }
     647        //char success= this.file.getName().charAt(23);
     648        String filename = this.file.getName();
     649        int index = filename.lastIndexOf(".") - 1;
     650        if(index >= 0) {
     651            char success = filename.charAt(index);
     652            switch (success) {
     653            case OptionsPane.SUCCESSFUL:
     654            d.append(get("Successful"));
     655            break;
     656            case OptionsPane.UNSUCCESSFUL:
     657            d.append(get("Unsuccessful"));
     658            break;
     659            case OptionsPane.CANCELLED:
     660            d.append(get("Cancelled"));
     661            break;
     662            }
     663        }
    659664        return d.toString();
    660665    }
     
    675680    }
    676681
    677    
     682
    678683    }
    679684
    680685    /** A DocumentListener that listens for changes in the log_display document
    681686     * if a change is registered, the flag is_log_changed is set to true,
    682      * and the listener removes itself from log_display 
     687     * and the listener removes itself from log_display
    683688     * Because we only want to register user's changes, the listener must be removed before the system makes any changes, and then put back. For example, each time we switchlogs to display, a remove event and an insert event are sent. We dont want to register these as changes to the document, so the listener must be removed before the switch, and added back afterwards */
    684689    private class LogChangeListener implements DocumentListener {
     
    703708    }
    704709    }
    705    
    706     /** a ListSelectionListener that triggers the load of a newly selected 
     710
     711    /** a ListSelectionListener that triggers the load of a newly selected
    707712    log */
    708713    private class LogListListener implements ListSelectionListener {
    709714
    710715    public void valueChanged(ListSelectionEvent e) {
    711         if (!e.getValueIsAdjusting()) { // we get two events for one change in list selection - use the false one ( the second one) 
     716        if (!e.getValueIsAdjusting()) { // we get two events for one change in list selection - use the false one ( the second one)
    712717        JList source  = (JList)e.getSource();
    713718        FileEntry fe = (FileEntry) source.getSelectedValue();
  • trunk/gli/src/org/greenstone/gatherer/gui/PreviewPane.java

    r4600 r4675  
    172172        view.setLoadSynchronously(false);
    173173        ///ystem.err.println("Complete.");
    174         url = null;       
    175     }
    176     catch(MalformedURLException error) {
     174        url = null;
     175    }
     176    catch(Exception error) {
    177177        ///ystem.err.println("Bad URL.");
    178178    }
  • trunk/gli/src/org/greenstone/gatherer/undo/UndoManager.java

    r4524 r4675  
    5858import org.greenstone.gatherer.util.DragGroup;
    5959import org.greenstone.gatherer.util.Utility;
    60 /** Manages the rather complex task of undoing and redoing actions. It does this by storing two queues, undo and redo, containing undo jobs which encapsulate all the information needed to undo or redo an action. It is also important to note that the manage creates a temporary directory, and then places any deleted files in this directory, and saves their associated metadata with them, for the life of the session. This is to facilitate the restoring of deleted files. 
    61  * @author John Thompson, Greenstone Digital Library, University of Waikato 
     60/** Manages the rather complex task of undoing and redoing actions. It does this by storing two queues, undo and redo, containing undo jobs which encapsulate all the information needed to undo or redo an action. It is also important to note that the manage creates a temporary directory, and then places any deleted files in this directory, and saves their associated metadata with them, for the life of the session. This is to facilitate the restoring of deleted files.
     61 * @author John Thompson, Greenstone Digital Library, University of Waikato
    6262 * @version 2.3c
    6363 */
     
    270270        redo.push(job);
    271271    }
    272     } 
     272    }
    273273
    274274    public void fileMoved(long id, DragComponent source_model, FileNode source_parent, DragComponent target_model, FileNode target_parent, FileNode record, boolean undo_event) {
     
    291291    public ArrayList getMetadata(File file) {
    292292    ///ystem.err.println("UndoMetadata: " + file.getAbsolutePath());
    293     return obsolete_metadata.getMetadata(file.getAbsolutePath(), true, new ArrayList(), file);
     293    return obsolete_metadata.getMetadata(file.getAbsolutePath(), true, new ArrayList(), file, false);
    294294    }
    295295
     
    392392        this.type = type;
    393393    }
    394          
     394
    395395    public void action(boolean is_undo, FileQueue file_queue) {
    396396                // Retrieve the lastest version of each file record
     
    414414        latest_source_parent = source_parent;
    415415        }
    416                 // Heres the fraction, too much friction. 
     416                // Heres the fraction, too much friction.
    417417        switch(type) {
    418         case FILE_COPY:                 
     418        case FILE_COPY:
    419419        // To undo a file copy we issue a delete file action on the destination file record.
    420420        file_queue.addJob(id, target_model, latest_record, source_model, latest_source_parent, FileJob.DELETE, !is_undo, true, false);
     
    424424        file_queue.addJob(id, target_model, latest_record, source_model, latest_source_parent, FileJob.MOVE, !is_undo, true, false);
    425425        break;
    426         case FILE_MOVE:         
     426        case FILE_MOVE:
    427427        // This may be a legitimate move, or may be a side effect of an undelete. If the formed source model and parent will be non-null.
    428428        if(source_model != null && source_parent != null) {
     
    449449    }
    450450
    451     private class UndoJobAdder 
     451    private class UndoJobAdder
    452452    implements Runnable {
    453453    private boolean undo_event;
     
    478478    }
    479479
    480     private class UndoStack 
     480    private class UndoStack
    481481    extends LinkedList {
    482482    private boolean enabled = false;
     
    491491        if(enabled) {
    492492        setEnabled(false);
    493         }               
     493        }
    494494    }
    495495    public UndoJob getJob(long id) {
Note: See TracChangeset for help on using the changeset viewer.