- Timestamp:
- 2003-05-27T15:40:47+12:00 (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/shell/GBasicProgressMonitor.java
r4293 r4364 60 60 */ 61 61 public class GBasicProgressMonitor 62 63 64 65 66 67 68 69 70 71 62 extends JProgressBar 63 implements GShellProgressMonitor { 64 /** Whether the process has been asked to stop. */ 65 private boolean stop = false; 66 /** Constructor **/ 67 public GBasicProgressMonitor() { 68 super(); 69 //this.setIcon(ready); 70 } 71 /** Don't do anything if we are given a progress bar, we have our own. 72 72 * @param progress_bar A JProgressBar 73 73 */ 74 75 76 74 public void addProgressBar(JProgressBar progress_bar) { 75 } 76 /** Determine the script exit value according to the progress monitor. This gets around a problem where several script failures actually result with a successful exit value. 77 77 * @return A <i>int</i> with a value of zero if and only if the script was successful. 78 78 */ 79 80 81 82 83 79 public int exitValue() { 80 // Always return true as we don't know any better. 81 return 0; 82 } 83 /** As we are probably accessing this via an interface we need to gain 84 84 * access to the component itself. 85 85 */ 86 87 88 89 86 public Component getProgress() { 87 return this; 88 } 89 /** Method to determine the state of the stop flag, which may be set by the visual component that created this monitor. 90 90 * @return A <strong>boolean</strong> indicating if the process has been asked to stop. 91 91 */ 92 93 94 95 96 97 98 99 92 public boolean hasSignalledStop() { 93 return stop; 94 } 95 /** Inform the progress bar that it should programatically increment progress by one step. */ 96 public void increment() { 97 // We can't do anything about this. 98 } 99 /** The parse method is how more complex progress bars figure out how far they have progressed. However we don't. 100 100 * @param line A String representing the latest line of output from 101 101 * the external process we are monitoring. 102 102 */ 103 104 105 103 public void parse(String line) { 104 } 105 /** Since the creator of this process monitor is actually in the GUI, this class provides the simpliest way to send a cancel process message between the two. 106 106 * @param state The desired state of the stop flag as a <strong>boolean</strong>. 107 107 */ 108 109 110 111 108 public void setStop(boolean state) { 109 stop = state; 110 } 111 /** This method tells this class that the job it is showing the progress 112 112 * for has begun. 113 113 */ 114 115 116 117 118 114 public void start() { 115 //this.setIcon(busy); 116 setIndeterminate(true); 117 } 118 /** This method tells this class that the job it is showing the progress 119 119 * for has come to an end. 120 120 */ 121 122 123 124 121 public void stop() { 122 //this.setIcon(ready); 123 setIndeterminate(false); 124 } 125 125 }
Note:
See TracChangeset
for help on using the changeset viewer.