Changeset 6205


Ignore:
Timestamp:
2003-12-10T16:37:07+13:00 (20 years ago)
Author:
jmt12
Message:

Stop button is now only enabled when an action is occuring

File:
1 edited

Legend:

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

    r6175 r6205  
    5656    /** A temporary mapping from currently existing FileNode folder to their equivelent FileNode folder within the undo managers tree. */
    5757    private HashMap completed_folder_mappings = new HashMap();
     58
     59    /** The button which controls the stopping of the file queue. */
     60    private JButton stop_button = null;
     61
    5862    /** 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. */
    5963    private boolean return_immediately = false;
     
    203207        if (job != null) {
    204208            ///ystem.err.println("Found job: " + job);
     209            // Enabled stop button
     210            stop_button.setEnabled(true);
    205211            // The user can cancel this individual action at several places, so keep track if the state is 'ready' for the next step.
    206212            boolean ready = true;
     
    595601        }
    596602        else {
     603            // Disable stop button
     604            if(stop_button != null) {
     605            stop_button.setEnabled(false);
     606            }
    597607            synchronized(this) {
    598608            ///ystem.err.println("Queue size = " + queue.size());
     
    623633    }
    624634    }
     635   
     636    /** Register the button that will be responsible for stopping executing file actions.
     637     * @param button a JButton
     638     */
     639    public void registerStopButton(JButton stop_button) {
     640    this.stop_button = stop_button;
     641    }
     642
    625643    /** A second lock is necessary to prevent the thread waiting, because its notify occured momentarily before it waited. If the flag is set then the thread can't wait, but loops around. This may chew processor time so should only be used if you are certain files are about to be placed on the queue.
    626644     * @param wait_allowed The new state of the wait_allowed flag, as a boolean.
Note: See TracChangeset for help on using the changeset viewer.