net.sf.ij_plugins.ui

progress

package progress

Package progress contains tools for reporting progress of computations. Classes can report progress extending trait net.sf.ij_plugins.ui.progress.ProgressReporter. Progress can be observed extendfing trait net.sf.ij_plugins.ui.progress.ProgressListener.

Example usage:

class CounterWithProgress(marker: Char) extends ProgressReporter {
  def count(max: Int) {
    val progressIncrement = Math.max(max / 10, 1)

    println("Counting " + max + " '" + marker + "'.")

    for (i <- 1 to max) {
      print(marker)
      if (i % progressIncrement == 0) notifyProgressListeners(i, max)
    }

    println("\nCounting done.")
  }
}

object ProgressReporterExample extends App {
  // Create counter
  val counter = new CounterWithProgress('+')

  // Add progress listener
  counter.addProgressListener(e => println(f"\nProgress notification: ${e.progressPercent}%3.0f%%"))

  // Count
  counter.count(100)
}
Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. progress
  2. AnyRef
  3. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Type Members

  1. class ProgressEvent extends AnyRef

    Event used to notify listeners about current value of progress.

  2. trait ProgressListener extends AnyRef

    Listens to net.sf.ij_plugins.ui.progress.ProgressEvent generated by a net.sf.ij_plugins.ui.progress.ProgressReporter.

  3. trait ProgressReporter extends AnyRef

    Reports progress of an operation to its listeners.

Inherited from AnyRef

Inherited from Any

Ungrouped