Changeset 8595


Ignore:
Timestamp:
2004-11-18T11:56:29+13:00 (19 years ago)
Author:
mdewsnip
Message:

Removed more dead code.

Location:
trunk/gli/src/org/greenstone/gatherer
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/gli/src/org/greenstone/gatherer/file/FileManager.java

    r8576 r8595  
    6868     */
    6969    public FileManager() {
    70     queue = new FileQueue(false);
     70    queue = new FileQueue();
    7171    queue.start();
    7272    }
  • trunk/gli/src/org/greenstone/gatherer/file/FileQueue.java

    r8576 r8595  
    4040import org.greenstone.gatherer.metadata.MetadataValue;
    4141import org.greenstone.gatherer.metadata.MetadataXMLFileManager;
    42 import org.greenstone.gatherer.util.ArrayTools;
    4342import org.greenstone.gatherer.util.DragComponent;
    4443import org.greenstone.gatherer.util.SynchronizedTreeModelTools;
     
    5150public class FileQueue
    5251    extends Thread
    53     implements TreeSelectionListener {
     52{
    5453    /** When someone requests the movement queue to be dumped this cancel flag is set to true. */
    5554    private boolean cancel_action = false;
    56     /** A temporary mapping from currently existing FileNode folder to their equivelent FileNode folder within the undo managers tree. */
    57     private HashMap completed_folder_mappings = new HashMap();
    5855
    5956    /** The button which controls the stopping of the file queue. */
    6057    private JButton stop_button = null;
    6158
    62     /** true to cause this file queue to return from run() as soon as there are no jobs left on the queue. Useful for undo jobs which must occur before a specific action. */
    63     private boolean return_immediately = false;
    64     /** We are only allowed to wait under specific circumstances. */
    65     /* private boolean wait_allowed = true; */
    6659    /** true if the user has selected yes to all from a file 'clash' dialog. */
    6760    private boolean yes_to_all = false;
    68     /** A temporary mapping from currently existing FileNodes to the potential FileNode folder within the undo managers tree. */
    69     private HashMap recycle_folder_mappings = new HashMap();
    7061    /** A label explaining the current moving files status. */
    7162    private JLabel file_status = null;
    7263    /** A list containing a queue of waiting movement jobs. */
    73     private ArrayList queue;
     64    private ArrayList queue = null;
    7465    /** A progress bar which shows how many bytes, out of the total size of bytes, has been moved. */
    7566    private LongProgressBar progress = null;
    76     /** The last piece of text shown on the file status label, just incase we are displaying a very temporary message. */
    77     private String previous = null;
     67
     68
    7869    /** Constructor.
    79      * @param return_immediately true to cause this file queue to return from run() as soon as there are no jobs left on the queue.
    80      * @see org.greenstone.gatherer.Configuration
    81      * @see org.greenstone.gatherer.gui.Coloring
    82      * @see org.greenstone.gatherer.gui.LongProgressBar
    83      */
    84     public FileQueue(boolean return_immediately) {
    85     this.return_immediately = return_immediately;
     70     */
     71    public FileQueue() {
    8672    this.queue = new ArrayList();
    87     String args[] = new String[2];
    88     args[0] = "0";
    89     args[1] = "0";
    9073    file_status = new JLabel();
    91     Dictionary.setText(file_status, "FileActions.Selected", args);
     74    Dictionary.setText(file_status, "FileActions.No_Activity");
    9275    progress = new LongProgressBar();
    9376    progress.setBackground(Configuration.getColor("coloring.collection_tree_background", false));
     
    9578    progress.setString(Dictionary.get("FileActions.No_Activity"));
    9679    progress.setStringPainted(true);
    97     args = null;
    9880    }
    9981
     
    381363                    if(job.undoable) {
    382364                        job.undoable = false;
    383                         if(job.type == FileJob.COPY) {
    384                         // A copy is undone with a delete, so it doesn't really matter where the file originally came from (we're not moving it back there, but into the recycle bin). You may also notice we don't make use of the target parent record. This is because no undo action needs this information, and even if it did it could simply ask for records parent!
    385                         // Gatherer.c_man.undo.addUndo(job.ID(), UndoManager.FILE_COPY, null, null, job.target, new_record, job.undo);
    386                         }
    387                         else {
    388                         // Movements however do need a source and source parent so the file can be moved back to the correct place.
    389                         // Gatherer.c_man.undo.addUndo(job.ID(), UndoManager.FILE_MOVE, job.source, (FileNode)origin_node.getParent(), job.target, new_record, job.undo);
    390                         }
    391365                    }
    392366                    new_record = null;
     
    408382                    if(job.undoable) {
    409383                        job.undoable = false;
    410                         if(job.type == FileJob.COPY) {
    411                         // A copy is undone with a delete, so it doesn't really matter where the file originally came from (we're not moving it back there, but into the recycle bin). You may also notice we don't make use of the target parent record. This is because no undo action needs this information, and even if it did it could simply ask for records parent!
    412                         }
    413                         else {
    414                         // Movements however do need a source and source parent so the file can be moved back to the correct place.
    415                         }
    416384                    }
    417385                    }
     
    517485            // Else the source is a directory and it has children remaining
    518486            else if(child_list != null && child_list.length > 0) {
    519                 ///ystem.err.print("Nonempty directory -> ");
    520                 ///atherer.println("Directory is non-empty. Remove children first.");
    521487                FileNode recycle_folder_record = null;
    522488                // Don't worry about all this for true file move actions.
    523489                if(job.type == FileJob.DELETE) {
    524490                // 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.
    525                 ///ystem.err.println("Directory has " + origin_node.getChildCount() + " children.");
    526                 ///ystem.err.println("Directory actually has " + child_list.length + " children.");
    527491                origin_node.refresh();
    528                 ///atherer.println("Directory has " + origin_node.getChildCount() + " children.");
    529                 ///atherer.println("Directory actually has " + child_list.length + " children.");
    530492                for(int i = 0; i < origin_node.size(); i++) {
    531493                    FileNode child_record = (FileNode) origin_node.get(i);
    532494                    ///atherer.println("Queuing: " + child_record);
    533495                    addJob(job.ID(), job.source, child_record, job.target, destination_node, FileJob.DELETE, job.undo, false, false, position);
    534                     //if(recycle_folder_record != null) {
    535                     //  recycle_folder_mappings.put(child_record, recycle_folder_record);
    536                     //}
    537496                } 
    538497                }
     
    579538            progress.setString(Dictionary.get("FileActions.No_Activity"));
    580539            yes_to_all = false;
    581             completed_folder_mappings.clear();
    582             recycle_folder_mappings.clear();
    583 
    584             // Now wait if applicable.
    585             if(return_immediately) {
    586                 return;
    587             }
    588             ///ystem.err.println("Waiting");
    589540            wait();
    590541            }
     
    604555    }
    605556
    606     /** Called when the user makes some selection in one of the trees we are listening to. From this we update the status details. */
    607     public void valueChanged(TreeSelectionEvent event) {
    608     JTree tree = (JTree) event.getSource();
    609     if(tree.getSelectionCount() > 0) {
    610         TreePath selection[] = tree.getSelectionPaths();
    611         int file_count = 0;
    612         int dir_count = 0;
    613         for(int i = 0; i < selection.length; i++) {
    614         TreeNode record = (TreeNode) selection[i].getLastPathComponent();
    615         if(record.isLeaf()) {
    616             file_count++;
    617         }
    618         else {
    619             dir_count++;
    620         }
    621         record = null;
    622         }
    623         selection = null;
    624     }
    625     tree = null;
    626     }
    627557
    628558    synchronized private void clearJobs() {
  • trunk/gli/src/org/greenstone/gatherer/gui/GatherPane.java

    r8588 r8595  
    199199        FileNode node = (FileNode) collection_tree.getModel().getRoot();
    200200        Gatherer.f_man.newFolder(collection_tree, node);
    201         //JOptionPane.showMessageDialog(Gatherer.g_man, Dictionary.get("FileActions.No_Parent_For_New_Folder"), Dictionary.get("General.Error"), JOptionPane.ERROR_MESSAGE);
    202201        }
    203202    }
     
    234233    workspace_tree.addMouseListener(Gatherer.g_man.foa_listener);
    235234    workspace_tree.addTreeExpansionListener(Gatherer.g_man.foa_listener);
    236     workspace_tree.addTreeSelectionListener(file_queue);
    237235    workspace_tree.putClientProperty("JTree.lineStyle", "Angled");
    238236    workspace_tree.setBackgroundNonSelectionColor(Configuration.getColor("coloring.workspace_tree_background", false));
     
    255253    collection_pane.setSize(TREE_SIZE);
    256254
    257     //args = new String[1];
    258     //args[0] = Dictionary.get("Collection.No_Collection");
    259255    collection_label = new JLabel();
    260256    collection_label.setOpaque(true);
     
    262258
    263259    collection = Gatherer.c_man.getRecordSet();
    264     if(collection != null) {
     260    if (collection != null) {
    265261        collection_tree = new DragTree(Utility.COLLECTION_TREE, collection, null, true);
    266262        collection_tree.setEnabled(true);
     
    275271    collection_tree.addMouseListener(mouse_listener);
    276272    collection_tree.addMouseListener(Gatherer.g_man.foa_listener);
    277     collection_tree.addTreeSelectionListener(file_queue);
    278273    collection_tree.addTreeExpansionListener(Gatherer.g_man.foa_listener);
    279274    collection_tree.putClientProperty("JTree.lineStyle", "Angled");
     
    283278    collection_tree.setTextSelectionColor(Configuration.getColor("coloring.collection_selection_foreground", false));
    284279    collection_tree.setRootVisible(false);
    285     //collection_tree.setRootVisible(true);
    286280
    287281    collection_scroll = new JScrollPane(collection_tree);
    288282
    289283    collection_filter = Gatherer.g_man.getFilter(collection_tree);
    290     if(collection != null) {
     284    if (collection != null) {
    291285        collection_filter.setBackground(Configuration.getColor("coloring.collection_heading_background", false));
    292286    }
     
    306300
    307301    JPanel file_pane = new JPanel();
    308     //file_pane.setBackground(Color.white);
    309     //JPanel job_pane = new JPanel();
    310     //job_pane.setBackground(Color.white);
    311302    JPanel progress_pane = new JPanel();
    312     //progress_pane.setBackground(Color.white);
    313303    JLabel file_status = file_queue.getFileStatus();
    314     //JLabel job_status = job_queue.getJobStatus();
    315304
    316305    JProgressBar progress_bar = file_queue.getProgressBar();
     
    341330    tree_pane.setDividerLocation(TREE_SIZE.width - 10);
    342331
    343     //job_pane.setBorder(BorderFactory.createEmptyBorder(2,2,2,2));
    344     //job_pane.setLayout(new BorderLayout());
    345     //job_pane.add(job_status, BorderLayout.CENTER);
    346 
    347332    file_pane.setBorder(BorderFactory.createEmptyBorder(2,2,2,2));
    348333    file_pane.setLayout(new BorderLayout());
     
    356341    inner_pane.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(10,10,10,10), BorderFactory.createLoweredBevelBorder()));
    357342    inner_pane.setLayout(new GridLayout(2,1));
    358     //inner_pane.add(job_pane);
    359343    inner_pane.add(file_pane);
    360344    inner_pane.add(progress_pane);
     
    364348
    365349    control_pane.setLayout(new BorderLayout());
    366     //control_pane.add(new_folder, BorderLayout.WEST);
    367350    control_pane.add(inner_pane, BorderLayout.CENTER);
    368351    control_pane.add(button_pane, BorderLayout.EAST);
Note: See TracChangeset for help on using the changeset viewer.