Top Description Fields Constructors Methods
org.eclipse.swt.widgets

public Class TaskItem

extends Item
Class Inheritance
Imports
org.eclipse.swt.*, org.eclipse.swt.graphics.*

Instances of this class represent a task item.
Styles:
(none)
Events:
(none)
Since
3.6
See Also
Sample code and further information

Field Summary

Modifier and TypeField and Description
pack-priv Image
pack-priv String
pack-priv TaskBar
pack-priv int
pack-priv static final int
pack-priv int
pack-priv Shell
Inherited from org.eclipse.swt.widgets.Item:
ELLIPSISimagetextTEXT_LIMIT

Constructor Summary

AccessConstructor and Description
pack-priv
TaskItem(TaskBar
a composite control which will be the parent of the new instance (cannot be null)
parent
,
int
the style of control to construct
style
)

Constructs a new instance of this class given its parent (which must be a Tray) and a style value describing its behavior and appearance.

Method Summary

Modifier and TypeMethod and Description
protected void
checkSubclass()

Overrides org.eclipse.swt.widgets.Item.checkSubclass.

Checks that this class can be subclassed.
pack-priv void
public Menu

Returns:

the receiver's menu
getMenu
()

Returns the receiver's pop up menu if it has one, or null if it does not.

public Image

Returns:

the receiver's overlay image
getOverlayImage
()

Returns the receiver's overlay image if it has one, or null if it does not.

public String

Returns:

the receiver's overlay text
getOverlayText
()

Returns the receiver's overlay text, which will be an empty string if it has never been set.

public TaskBar

Returns:

the receiver's parent
getParent
()

Returns the receiver's parent, which must be a TaskBar.

public int

Returns:

the receiver's progress
getProgress
()

Returns the receiver's progress.

public int

Returns:

the receiver's progress state
getProgressState
()

Returns the receiver's progress state.

pack-priv void
pack-priv void
public void
setMenu(Menu
the new pop up menu
menu
)

Sets the receiver's pop up menu to the argument.

public void
setOverlayImage(Image
the new overlay image (may be null)
overlayImage
)

Sets the receiver's overlay image, which may be null indicating that no image should be displayed.

public void
setOverlayText(String
the new overlay text
overlayText
)

Sets the receiver's overlay text.

public void
setProgress(int
the new progress
progress
)

Sets the receiver's progress, the progress represents a percentage and should be in range from 0 to 100.

public void
setProgressState(int
the new progress state
progressState
)

Sets the receiver's progress state, the state can be one of the following:

Inherited from org.eclipse.swt.widgets.Item:
getImagegetNameTextgetTextsetImagesetTextupdateTextDirection

Field Detail

overlayImageback to summary
pack-priv Image overlayImage
overlayTextback to summary
pack-priv String overlayText
parentback to summary
pack-priv TaskBar parent
progressback to summary
pack-priv int progress
PROGRESS_MAXback to summary
pack-priv static final int PROGRESS_MAX
progressStateback to summary
pack-priv int progressState
shellback to summary
pack-priv Shell shell

Constructor Detail

TaskItemback to summary
pack-priv TaskItem(TaskBar parent, int style)

Constructs a new instance of this class given its parent (which must be a Tray) and a style value describing its behavior and appearance. The item is added to the end of the items maintained by its parent.

The style value is either one of the style constants defined in class SWT which is applicable to instances of this class, or must be built by bitwise OR'ing together (that is, using the int "|" operator) two or more of those SWT style constants. The class description lists the style constants that are applicable to the class. Style bits are also inherited from superclasses.

Parameters
parent:TaskBar

a composite control which will be the parent of the new instance (cannot be null)

style:int

the style of control to construct

Exceptions
IllegalArgumentException:
  • ERROR_NULL_ARGUMENT - if the parent is null
SWTException:
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent
  • ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass
See Also
SWT, Widget#checkSubclass, Widget#getStyle

Method Detail

checkSubclassback to summary
protected void checkSubclass()

Overrides org.eclipse.swt.widgets.Item.checkSubclass.

Doc from org.eclipse.swt.widgets.Widget.checkSubclass.

Checks that this class can be subclassed.

The SWT class library is intended to be subclassed only at specific, controlled points (most notably, Composite and Canvas when implementing new widgets). This method enforces this rule unless it is overridden.

Important Note

By providing an implementation of this method that allows a subclass of a class which does not normally allow subclassing to be created, the implementer agrees to be fully responsible for the fact that any such subclass will likely fail between SWT releases and will be strongly platform specific. No support is provided for user-written classes which are implemented in this fashion.

The ability to subclass outside of the allowed SWT classes is intended purely to enable those not on the SWT development team to implement patches in order to get around specific limitations in advance of when those limitations can be addressed by the team. Subclassing should not be attempted without an intimate and detailed understanding of the hierarchy.

Annotations
@Override
destroyWidgetback to summary
pack-priv void destroyWidget()

Overrides org.eclipse.swt.widgets.Widget.destroyWidget.

Annotations
@Override
getMenuback to summary
public Menu getMenu()

Returns the receiver's pop up menu if it has one, or null if it does not.

Returns:Menu

the receiver's menu

Exceptions
SWTException:
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
getOverlayImageback to summary
public Image getOverlayImage()

Returns the receiver's overlay image if it has one, or null if it does not.

Returns:Image

the receiver's overlay image

Exceptions
SWTException:
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
getOverlayTextback to summary
public String getOverlayText()

Returns the receiver's overlay text, which will be an empty string if it has never been set.

Returns:String

the receiver's overlay text

Exceptions
SWTException:
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
getParentback to summary
public TaskBar getParent()

Returns the receiver's parent, which must be a TaskBar.

Returns:TaskBar

the receiver's parent

Exceptions
SWTException:
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
getProgressback to summary
public int getProgress()

Returns the receiver's progress.

Returns:int

the receiver's progress

Exceptions
SWTException:
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
getProgressStateback to summary
public int getProgressState()

Returns the receiver's progress state.

Returns:int

the receiver's progress state

Exceptions
SWTException:
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
releaseHandleback to summary
pack-priv void releaseHandle()

Overrides org.eclipse.swt.widgets.Widget.releaseHandle.

Annotations
@Override
releaseWidgetback to summary
pack-priv void releaseWidget()

Overrides org.eclipse.swt.widgets.Item.releaseWidget.

Annotations
@Override
setMenuback to summary
public void setMenu(Menu menu)

Sets the receiver's pop up menu to the argument. The way the menu is shown is platform specific.

This feature might not be available for the receiver on all platforms. The application code can check if it is supported by calling the respective get method. When the feature is not available, the get method will always return the NULL.

For better cross platform support, the application code should set this feature on the TaskItem for application.
On Windows, this feature will only work on RCP applications.

The menu should be fully created before this method is called. Dynamic changes to the menu after the method is called will not be reflected in the native menu.

Parameters
menu:Menu

the new pop up menu

Exceptions
IllegalArgumentException:
  • ERROR_MENU_NOT_POP_UP - the menu is not a pop up menu
  • ERROR_INVALID_ARGUMENT - if the menu has been disposed
SWTException:
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
setOverlayImageback to summary
public void setOverlayImage(Image overlayImage)

Sets the receiver's overlay image, which may be null indicating that no image should be displayed. The bounds for the overlay image is determined by the platform and in general it should be a small image.

This feature might not be available for the receiver on all platforms. The application code can check if it is supported by calling the respective get method. When the feature is not available, the get method will always return the NULL.

For better cross platform support, the application code should first try to set this feature on the TaskItem for the main shell then on the TaskItem for the application.

Parameters
overlayImage:Image

the new overlay image (may be null)

Exceptions
IllegalArgumentException:
  • ERROR_INVALID_ARGUMENT - if the overlayImage has been disposed
SWTException:
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
setOverlayTextback to summary
public void setOverlayText(String overlayText)

Sets the receiver's overlay text. The space available to display the overlay text is platform dependent and in general it should be no longer than a few characters.

This feature might not be available for the receiver on all platforms. The application code can check if it is supported by calling the respective get method. When the feature is not available, the get method will always return an empty string.

For better cross platform support, the application code should first try to set this feature on the TaskItem for the main shell then on the TaskItem for the application.

Parameters
overlayText:String

the new overlay text

Exceptions
IllegalArgumentException:
  • ERROR_NULL_ARGUMENT - if the overlayText is null
SWTException:
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
setProgressback to summary
public void setProgress(int progress)

Sets the receiver's progress, the progress represents a percentage and should be in range from 0 to 100. The progress is only shown when the progress state is different than SWT#DEFAULT.

This feature might not be available for the receiver on all platforms. The application code can check if it is supported by calling the respective get method. When the feature is not available, the get method will always return zero.

For better cross platform support, the application code should first try to set this feature on the TaskItem for the main shell then on the TaskItem for the application.

Parameters
progress:int

the new progress

Exceptions
SWTException:
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
#see setProgressState(int)
setProgressStateback to summary
public void setProgressState(int progressState)

Sets the receiver's progress state, the state can be one of the following:

The percentage of progress shown by the states SWT#NORMAL, SWT#PAUSED, SWT#ERROR is set with setProgress().
The state SWT#DEFAULT indicates that no progress should be shown.

This feature might not be available for the receiver on all platforms. The application code can check if it is supported by calling the respective get method. When the feature is not available, the get method will always return SWT#DEFAULT.

For better cross platform support, the application code should first try to set this feature on the TaskItem for the main shell then on the TaskItem for the application.

Parameters
progressState:int

the new progress state

Exceptions
SWTException:
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
#see setProgress(int)