Changeset 4739 in josm
- Timestamp:
- 2011-12-29T13:04:12+01:00 (13 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/MapStatus.java
r4718 r4739 126 126 } 127 127 128 public void set Title(String text) {128 public void setCurrentAction(String text) { 129 129 this.title = text; 130 130 updateText(); -
trunk/src/org/openstreetmap/josm/gui/PleaseWaitDialog.java
r4718 r4739 112 112 } 113 113 114 public void setCurrentAction(String text) { 115 currentAction.setText(text); 116 } 117 114 118 /** 115 119 * Appends a log message to the progress dialog. If the log area isn't visible yet … … 166 170 * 167 171 * @param callback the cancel callback 168 */ 172 */ 169 173 public void setInBackgroundCallback(ActionListener callback) { 170 174 if (callback == null) { -
trunk/src/org/openstreetmap/josm/gui/progress/PleaseWaitProgressMonitor.java
r4718 r4739 21 21 public class PleaseWaitProgressMonitor extends AbstractProgressMonitor { 22 22 23 24 25 23 /** 24 * Implemented by both foreground dialog and background progress dialog (in status bar) 25 */ 26 26 public interface ProgressMonitorDialog { 27 27 void setVisible(boolean visible); 28 28 void updateProgress(int progress); 29 29 void setCustomText(String text); 30 void set Title(String text);30 void setCurrentAction(String text); 31 31 void setIndeterminate(boolean newValue); 32 void appendLogMessage(String message); 32 void appendLogMessage(String message); //TODO Not implemented properly in background monitor, log message will get lost if progress runs in background 33 33 } 34 34 35 35 public static final int PROGRESS_BAR_MAX = 100; 36 36 private final Window dialogParent; 37 37 38 private int currentProgressValue = 0; 39 private String customText; 40 private String title; 41 private boolean indeterminate; 38 42 39 43 private boolean isInBackground; … … 110 114 ProgressMonitorDialog dialog = getDialog(); 111 115 if (dialog != null) { 116 reset(); 112 117 dialog.setVisible(true); 113 118 } … … 179 184 protected void doSetCustomText(final String title) { 180 185 checkState(State.IN_TASK, State.IN_SUBTASK); 186 this.customText = title; 181 187 doInEDT(new Runnable() { 182 188 public void run() { … … 192 198 protected void doSetTitle(final String title) { 193 199 checkState(State.IN_TASK, State.IN_SUBTASK); 200 this.title = title; 194 201 doInEDT(new Runnable() { 195 202 public void run() { 196 203 ProgressMonitorDialog dialog = getDialog(); 197 204 if (dialog != null) { 198 dialog.set Title(title);205 dialog.setCurrentAction(title); 199 206 } 200 207 } … … 204 211 @Override 205 212 protected void doSetIntermediate(final boolean value) { 213 this.indeterminate = value; 206 214 doInEDT(new Runnable() { 207 215 public void run() { … … 210 218 ProgressMonitorDialog dialog = getDialog(); 211 219 if (dialog != null) { 212 dialog.setIndeterminate(value && PleaseWaitProgressMonitor.this.dialog.progress.getValue()== 0);220 dialog.setIndeterminate(value && currentProgressValue == 0); 213 221 } 214 222 } … … 226 234 } 227 235 }); 236 } 237 238 public void reset() { 239 if (dialog != null) { 240 dialog.setTitle(title); 241 dialog.setCustomText(customText); 242 dialog.updateProgress(currentProgressValue); 243 dialog.setIndeterminate(indeterminate && currentProgressValue == 0); 244 } 245 BackgroundProgressMonitor backgroundMonitor = null; 246 MapFrame map = Main.map; 247 if (map != null) { 248 backgroundMonitor = map.statusLine.progressMonitor; 249 } 250 if (backgroundMonitor != null) { 251 backgroundMonitor.setCurrentAction(title); 252 backgroundMonitor.setCustomText(customText); 253 backgroundMonitor.updateProgress(currentProgressValue); 254 backgroundMonitor.setIndeterminate(indeterminate && currentProgressValue == 0); 255 } 256 228 257 } 229 258 … … 253 282 public void run() { 254 283 dialog.setInBackgroundPossible(PleaseWaitProgressMonitor.this.taskId != null && Main.isDisplayingMapView()); 284 reset(); 255 285 getDialog(); 256 286 }
Note:
See TracChangeset
for help on using the changeset viewer.