Eclipse Platform
2.0

org.eclipse.jface.wizard
Class ProgressMonitorPart

java.lang.Object
  |
  +--org.eclipse.swt.widgets.Widget
        |
        +--org.eclipse.swt.widgets.Control
              |
              +--org.eclipse.swt.widgets.Scrollable
                    |
                    +--org.eclipse.swt.widgets.Composite
                          |
                          +--org.eclipse.jface.wizard.ProgressMonitorPart
All Implemented Interfaces:
Drawable, IProgressMonitor

public class ProgressMonitorPart
extends Composite
implements IProgressMonitor

A standard implementation of an IProgressMonitor. It consists of a label displaying the task and subtask name, and a progress indicator to show progress. In contrast to ProgressMonitorDialog this class only implements IProgressMonitor.


Field Summary
protected  Control fCancelComponent
           
protected  Listener fCancelListener
           
protected  boolean fIsCanceled
           
protected  Label fLabel
           
protected  ProgressIndicator fProgressIndicator
           
protected  String fSubTaskName
           
protected  String fTaskName
           
 
Fields inherited from class org.eclipse.swt.widgets.Control
handle
 
Fields inherited from interface org.eclipse.core.runtime.IProgressMonitor
UNKNOWN
 
Constructor Summary
ProgressMonitorPart(Composite parent, Layout layout)
          Creates a ProgressMonitorPart.
ProgressMonitorPart(Composite parent, Layout layout, int progressIndicatorHeight)
          Creates a ProgressMonitorPart.
 
Method Summary
 void attachToCancelComponent(Control cancelComponent)
          Attaches the progress monitor part to the given cancel component.
 void beginTask(String name, int totalWork)
          Implements IProgressMonitor.beginTask.
 void done()
          Implements IProgressMonitor.done.
protected static String escapeMetaCharacters(String in)
          Escapes any occurrence of '&' in the given String so that it is not considered as a mnemonic character in SWT ToolItems, MenuItems, Button and Labels.
protected  void initialize(Layout layout, int progressIndicatorHeight)
          Creates the progress monitor's UI parts and layouts them according to the given layout.
 void internalWorked(double work)
          Implements IProgressMonitor.internalWorked.
 boolean isCanceled()
          Implements IProgressMonitor.isCanceled.
 void removeFromCancelComponent(Control cc)
          Detached the progress monitor part to the given cancel component
 void setCanceled(boolean b)
          Implements IProgressMonitor.setCanceled.
 void setFont(Font font)
          Sets the progress monitor part's font.
 void setTaskName(String name)
          Sets the task name to the given value.
 void subTask(String name)
          Implements IProgressMonitor.subTask.
protected  void updateLabel()
          Updates the label with the current task and subtask names.
 void worked(int work)
          Implements IProgressMonitor.worked.
 
Methods inherited from class org.eclipse.swt.widgets.Composite
checkSubclass, computeSize, getChildren, getLayout, getTabList, layout, layout, setFocus, setLayout, setTabList
 
Methods inherited from class org.eclipse.swt.widgets.Scrollable
computeTrim, getClientArea, getHorizontalBar, getVerticalBar
 
Methods inherited from class org.eclipse.swt.widgets.Control
addControlListener, addFocusListener, addHelpListener, addKeyListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addPaintListener, addTraverseListener, computeSize, forceFocus, getAccessible, getBackground, getBorderWidth, getBounds, getDisplay, getEnabled, getFont, getForeground, getLayoutData, getLocation, getMenu, getParent, getShell, getSize, getToolTipText, getVisible, internal_dispose_GC, internal_new_GC, isDisposed, isEnabled, isFocusControl, isReparentable, isVisible, moveAbove, moveBelow, pack, pack, redraw, redraw, removeControlListener, removeFocusListener, removeHelpListener, removeKeyListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removePaintListener, removeTraverseListener, setBackground, setBounds, setBounds, setCapture, setCursor, setEnabled, setForeground, setLayoutData, setLocation, setLocation, setMenu, setParent, setRedraw, setSize, setSize, setToolTipText, setVisible, toControl, toDisplay, traverse, update
 
Methods inherited from class org.eclipse.swt.widgets.Widget
addDisposeListener, addListener, checkWidget, dispose, getData, getData, getStyle, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, setData, setData, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

fLabel

protected Label fLabel

fTaskName

protected String fTaskName

fSubTaskName

protected String fSubTaskName

fProgressIndicator

protected ProgressIndicator fProgressIndicator

fCancelComponent

protected Control fCancelComponent

fIsCanceled

protected boolean fIsCanceled

fCancelListener

protected Listener fCancelListener
Constructor Detail

ProgressMonitorPart

public ProgressMonitorPart(Composite parent,
                           Layout layout)
Creates a ProgressMonitorPart.

Parameters:
parent - The SWT parent of the part.
layout - The SWT grid bag layout used by the part. A client can supply the layout to control how the progress monitor part is layed out. If null is passed the part uses its default layout.

ProgressMonitorPart

public ProgressMonitorPart(Composite parent,
                           Layout layout,
                           int progressIndicatorHeight)
Creates a ProgressMonitorPart.

Parameters:
parent - The SWT parent of the part.
layout - The SWT grid bag layout used by the part. A client can supply the layout to control how the progress monitor part is layed out. If null is passed the part uses its default layout.
progressIndicatorHeight - The height of the progress indicator in pixel.
Method Detail

attachToCancelComponent

public void attachToCancelComponent(Control cancelComponent)
Attaches the progress monitor part to the given cancel component.


beginTask

public void beginTask(String name,
                      int totalWork)
Implements IProgressMonitor.beginTask.

Specified by:
beginTask in interface IProgressMonitor
Parameters:
name - the name (or description) of the main task
totalWork - the total number of work units into which the main task is been subdivided. If the value is UNKNOWN the implemenation is free to indicate progress in a way which doesn't require the total number of work units in advance.
See Also:
IProgressMonitor.beginTask(java.lang.String, int)

done

public void done()
Implements IProgressMonitor.done.

Specified by:
done in interface IProgressMonitor
See Also:
IProgressMonitor.done()

escapeMetaCharacters

protected static String escapeMetaCharacters(String in)
Escapes any occurrence of '&' in the given String so that it is not considered as a mnemonic character in SWT ToolItems, MenuItems, Button and Labels.


initialize

protected void initialize(Layout layout,
                          int progressIndicatorHeight)
Creates the progress monitor's UI parts and layouts them according to the given layout. If the layou is null the part's default layout is used.


internalWorked

public void internalWorked(double work)
Implements IProgressMonitor.internalWorked.

Specified by:
internalWorked in interface IProgressMonitor
See Also:
IProgressMonitor.internalWorked(double)

isCanceled

public boolean isCanceled()
Implements IProgressMonitor.isCanceled.

Specified by:
isCanceled in interface IProgressMonitor
Returns:
true if cancellation has been requested, and false otherwise
See Also:
IProgressMonitor.isCanceled()

removeFromCancelComponent

public void removeFromCancelComponent(Control cc)
Detached the progress monitor part to the given cancel component


setCanceled

public void setCanceled(boolean b)
Implements IProgressMonitor.setCanceled.

Specified by:
setCanceled in interface IProgressMonitor
Parameters:
b - true indicates that cancelation has been requested (but not necessarily acknowledged); false clears this flag
See Also:
IProgressMonitor.setCanceled(boolean)

setFont

public void setFont(Font font)
Sets the progress monitor part's font.

Overrides:
setFont in class Control
Parameters:
font - the new font (or null)

setTaskName

public void setTaskName(String name)
Description copied from interface: IProgressMonitor
Sets the task name to the given value. This method is used to restore the task label after a nested operation was executed. Normally there is no need for clients to call this method.

Specified by:
setTaskName in interface IProgressMonitor
Parameters:
name - the name (or description) of the main task
See Also:
IProgressMonitor.setTaskName(java.lang.String)

subTask

public void subTask(String name)
Implements IProgressMonitor.subTask.

Specified by:
subTask in interface IProgressMonitor
Parameters:
name - the name (or description) of the subtask
See Also:
IProgressMonitor.subTask(java.lang.String)

updateLabel

protected void updateLabel()
Updates the label with the current task and subtask names.


worked

public void worked(int work)
Implements IProgressMonitor.worked.

Specified by:
worked in interface IProgressMonitor
Parameters:
work - the number of work units just completed
See Also:
IProgressMonitor.worked(int)

Eclipse Platform
2.0

Copyright (c) IBM Corp. and others 2000, 2002. All Rights Reserved.