Class FWProgressTask

java.lang.Object
net.simplace.pipe.progress.FWProgressTask
All Implemented Interfaces:
Comparable<FWProgressTask>

public class FWProgressTask extends Object implements Comparable<FWProgressTask>
A task that is displayed in the progress view (FWProgressViewPanel), usually one step of a pipeline (see progressid of a processor). It has a text label, optionally an image shown at a fixed position (progress_x/progress_y), a state (see FWProgressTask.State), a percentage and a message. A progress id with a parameter token is replaced from the parameters when the task starts.
Author:
Andreas Enders, Sebastian Brocks, Martin Schmitz
Changes:
  • MS-01, 11.05.2009 (Martin Schmitz)
    Tries to avoid memory incriminating object references. Instead of holding the whole Observable, on store its ID (for which the Observable is needed at all).
  • Constructor Details

    • FWProgressTask

      public FWProgressTask(String aProgressID, String aX, String aY, String aSystemID)
      Parameters:
      aProgressID - progress id, also used as localisation key of the label and as image name
      aX - x position of the image in the progress image panel, or null for no image
      aY - y position of the image in the progress image panel, or null for no image
      aSystemID - id of the system (selects the locale bundle), or null
  • Method Details

    • getTextLabel

      public JLabel getTextLabel()
      get the textlabel for this task may be null if this task doesn't need a textual description
      Returns:
      the JLabel
    • getImageLabel

      public JLabel getImageLabel()
      get the imagelabel for this task
      Returns:
      the JLabel
    • getProgressID

      public String getProgressID()
      Returns:
      the progress id
    • isImageUsed

      public boolean isImageUsed()
      Returns:
      true if the task has an image label
    • getMessage

      public String getMessage()
      Returns:
      the message of the task; if none is set, the localised text for the current state (${_PERCENT_DONE_} replaced while progressing)
    • setMessage

      public void setMessage(String aMessage)
      Parameters:
      aMessage - the message to show
    • setFixedLabel

      public void setFixedLabel(String aFixedLabel)
      Sets a fixed label text (instead of the localised progress id) and updates the labels.
      Parameters:
      aFixedLabel - the label text
    • setStateProgressing

      public void setStateProgressing(int aPercentDone, String aMessage)
      Sets the state to progressing. Values outside 0-100 are clamped. A value of 0 keeps the current percentage (callers pass 0 to update only the message).
      Parameters:
      aPercentDone - progress in percent (0-100), 0 to keep the current percentage
      aMessage - message to show
    • getPercentDone

      public int getPercentDone()
      Returns:
      the percentDone (0-100)
    • getNumberInRange

      public int getNumberInRange()
      Returns:
      the number of the Task in the range of Tasks to be performed
    • setNumberInRange

      public void setNumberInRange(int aNumberInRange)
      Sets the number of the task in the range of tasks to be performed.
      Parameters:
      aNumberInRange - position of the task (used for sorting)
    • getStateOfTask

      public String getStateOfTask()
      Returns:
      the state of the task, one of the constants in FWProgressTask.State
    • setStateOfTask

      public void setStateOfTask(String aStatusOfTask, net.simplace.core.FWObservable aParameterMap)
      Sets the state of the task and clears the message. Parameter tokens in the progress id (or in the label text) are replaced from the parameters; on start the labels are recreated, on success the percentage is set to 100.
      Parameters:
      aStatusOfTask - the new state, one of the constants in FWProgressTask.State
      aParameterMap - parameters for the token replacement, or null
    • getClonedTask

      public FWProgressTask getClonedTask()
      Returns:
      a new task with the same progress id, image position and system id (initial state)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • compareTo

      public int compareTo(FWProgressTask aO)
      Specified by:
      compareTo in interface Comparable<FWProgressTask>