com.togethersoft.openapi.ide.progress
Interface IdeProgressIndicator


public interface IdeProgressIndicator

Creates and provides access to previously created progress indicators.

Each progress indicator is represented by the IdeProgress instance.

At the moment of creation, a progress indicator gets an ID specified by the programmer. This ID can be used later for obtaining a specific progress indicator by getProgress method.

This interface provides two methods for creating and starting a progress indicator. The difference is that it is possible to specify a delay before showing a progress indicator after it has been started. If a process is finished before this amount of time, then progress indicator will not be shown at all.

Author:
TogetherSoft

Method Summary
 IdeProgressgetProgress(Object transaction)
           Returns IdeProgress for the specified ID.
 java.awt.ComponentgetUIComponent()
           Returns AWT component that represents this progress indicator.
 IdeProgressstart(Object transaction, boolean cancelable, int total, String messageFormat)
           Creates and starts a progress indicator.
 IdeProgressstart(Object transaction, boolean cancelable, int total, String messageFormat, int delay)
           Creates and starts a delayed progress indicator.

Method Detail

getProgress

public IdeProgress getProgress(Object transaction)
Returns IdeProgress for the specified ID.
Parameters:
transaction - Object identifier
Returns: IdeProgress
See Also:
IdeProgress

getUIComponent

public java.awt.Component getUIComponent()
Returns AWT component that represents this progress indicator.

start

public IdeProgress start(Object transaction, boolean cancelable, int total, String messageFormat)
Creates and starts a progress indicator. The created indicator will be shown immediately.
Parameters:
transaction - Object ID for a new progress indicator
cancelable - boolean flag. If true then the Cancel button will be shown at the bottom of the application window and it would be possible to cancel the process by hitting Cancel; otherwise, the process may not be cancelled and should be waited until completion.
total - int number of steps in a process
messageFormat - String in the java.text.MessageFormat's format to be displayed as a title in the progress indicator. An array of Objects supplied for it is:
   [0] = Integer. Contains the current step of a process. Can be set via
 IdeProgress.setCount method.
   [1] = Integer. Contains the total number of steps in a process.
   [2] = String. Contains a description of the current step. Can be set via
 IdeProgress.setStep method.
   [3] = Double. Contains the current_step/total_of_steps value. Very useful for displaing as a percentage
 of completion.
For example,

 IdeProgress progress = progressIndicator.start("myID", true, 300, "Current step: {0, number, integer}. Total steps: {1, number, integer}. Name of the current step: {2}. {3, number, percent} completed");
creates a cancelable progress indicator with the ID "myID", with the 300 steps, with a progress message of "Current step: <step>. Total steps: <total steps>. Name of the current step: <name of the current step>. <perecent> completed"

If messageFormat string is null, then you will have to explicitly specify the current progress message via IdeProgress.setStep method. Note that you won't be able to use MessageFormat's format.

Returns: a started IdeProgress
See Also:
IdeProgress, start(java.lang.Object,boolean,int,java.lang.String,int)

start

public IdeProgress start(Object transaction, boolean cancelable, int total, String messageFormat, int delay)
Creates and starts a delayed progress indicator. The created indicator will be shown only after the specified amount of time. If a process is completed after this time, the progress indicator will not be shown.
Parameters:
transaction - the Object ID for a new progress indicator
cancelable - If true then the Cancel button will be shown at the bottom of the application window and it would be possible to cancel the process by hitting Cancel; otherwise, you won't be able to cancel the process and will have to wait until its completion.
total - the integer with a number of steps in a process
messageFormat - The string in the java.text.MessageFormat's format for displaing as a title in the progress indicator. An array of Objects supplied for it is:
   [0] = Integer. Contains the current step of a process. Can be set via
 IdeProgress.setCount method.
   [1] = Integer. Contains the total of steps in a process.
   [2] = String. Contains a description of the current step. Can be set via
 IdeProgress.setStep method.
   [3] = Double. Contains the current_step/total_of_steps value. Very useful for displaing as a percentage
 of completion.
For example,

 IdeProgress progress = progressIndicator.start("myID", true, 300, "Current step: {0, number, integer}. Total steps: {1, number, integer}. Name of the current step: {2}. {3, number, percent} completed", 1000);
creates a cancelable progress indicator with the ID "myID", with the 300 steps, with a progress message of "Current step: <step>. Total steps: <total steps>. Name of the current step: <name of the current step>. <perecent> completed". A progress indicator will be shown a second after the start of a process.

If messageFormat string is null, then you will have to explicitly specify the current progress message via IdeProgress.setStep method. Note that you won't be able to use MessageFormat's format.

delay - specifies the amount of time in milliseconds to wait before showing a progress indicator
Returns: a started IdeProgress
See Also:
IdeProgress, start(java.lang.Object,boolean,int,java.lang.String)