Skip to content

Commit

Permalink
refactor: replace deprecated code and other minor code warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
ashleycaselli committed Dec 18, 2024
1 parent de463ec commit 655cd7e
Show file tree
Hide file tree
Showing 31 changed files with 3,423 additions and 3,552 deletions.
110 changes: 58 additions & 52 deletions src/main/java/org/topbraid/jenax/progress/ProgressMonitor.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,60 +21,66 @@
/**
* Inspired by the Eclipse IProgressMonitor, this interface supports monitoring long-running processes with intermediate
* status messages and the ability to cancel.
*
*
* @author Holger Knublauch
*/
public interface ProgressMonitor {

/**
* Typically used by the (long-running) process to determine whether the user has requested cancellation.
* The process should then find a suitable, clean termination.
* @return true if cancel was requested
*/
boolean isCanceled();


/**
* Informs the progress monitor that a new task has been started, with a given number of expected steps.
* A UI connected to the ProgressMonitor would typically display something like a progress bar and the task name.
* @param label the name of the task
* @param totalWork the number of steps (see <code>worked</code>) that is expected to be needed to complete the task
*/
void beginTask(String label, int totalWork);


/**
* Informs the progress monitor that all is completed.
*/
void done();


/**
* Typically called from a parallel thread triggered by the user, this informs the progress monitor that it needs to
* return <code>true</code> for <code>isCanceled</code>.
* Once a process has been canceled, it should not be un-canceled.
* @param value true if canceled
*/
void setCanceled(boolean value);


/**
* Changes the name or label of the current task.
* @param value
*/
void setTaskName(String value);


/**
* Sets the label that serves as sub-task, typically printed under the main task name.
* @param label the subtask label
*/
void subTask(String label);


/**
* Informs the progress monitor that one or more steps have been completed towards the current task (see <code>beginTask</code>).
* @param amount the number of steps completed
*/
void worked(int amount);
/**
* Typically used by the (long-running) process to determine whether the user has requested cancellation.
* The process should then find a suitable, clean termination.
*
* @return true if cancel was requested
*/
boolean isCanceled();


/**
* Informs the progress monitor that a new task has been started, with a given number of expected steps.
* A UI connected to the ProgressMonitor would typically display something like a progress bar and the task name.
*
* @param label the name of the task
* @param totalWork the number of steps (see <code>worked</code>) that is expected to be needed to complete the task
*/
void beginTask(String label, int totalWork);


/**
* Informs the progress monitor that all is completed.
*/
void done();


/**
* Typically called from a parallel thread triggered by the user, this informs the progress monitor that it needs to
* return <code>true</code> for <code>isCanceled</code>.
* Once a process has been canceled, it should not be un-canceled.
*
* @param value true if canceled
*/
void setCanceled(boolean value);


/**
* Changes the name or label of the current task.
*
* @param value the task name
*/
void setTaskName(String value);


/**
* Sets the label that serves as sub-task, typically printed under the main task name.
*
* @param label the subtask label
*/
void subTask(String label);


/**
* Informs the progress monitor that one or more steps have been completed towards the current task (see <code>beginTask</code>).
*
* @param amount the number of steps completed
*/
void worked(int amount);
}
Loading

0 comments on commit 655cd7e

Please sign in to comment.