net.sourceforge.java.util.jobs
Class JobStatusTableContentProvider

java.lang.Object
  extended bynet.sourceforge.java.util.jobs.JobStatusTableContentProvider
All Implemented Interfaces:
EventListener, IContentProvider, ILanguageResourceChangeListener, IStructuredContentProvider

public class JobStatusTableContentProvider
extends Object
implements IStructuredContentProvider, ILanguageResourceChangeListener

Manages a collection of JobStatus objects and supplies the data to a JFace TableViewer instance.

Author:
Sebastian Machhausen

Field Summary
static String[] COLUMN_IDENTIFIERS
           The column identifiers used
static int DURATION_COLUMN
          The index of thecolumn to display the duration of a IJob
private  List jobStatusList
           The List of JobStatus objects
static int NAME_COLUMN
           The index of the column to display the name of an IJob
static int PRIORITY_COLUMN
           The index of the priority column which shows an Image representing an IJob priority
static int PROGRESS_COLUMN
           The index of the column to display the progress of a running IJob
static int START_TIME_COLUMN
           The index of the column to display the start time of an IJob
static int STATUS_COLUMN
           The index of the column to display the status of a IJob
private  TableViewer viewer
           The TableViewer served
 
Constructor Summary
JobStatusTableContentProvider(TableViewer viewer)
           Creates a new JobStatusTableContentProvider.
 
Method Summary
 void addJob(JobStatus status)
           Adds the specified JobStatus to this JobStatusTableContentProvider.
private  void createReaper()
           Creates an IdleJobStatusReaper and binds it to this JobStatusTableContentProvider.
 void defaultLanguageChanged(LanguageResourceChangeEvent lrce)
           Called whenever the default language changes.
 void dispose()
           Disposes of this content provider.
 Object[] getElements(Object inputElement)
           Returns the elements to display in the viewer when its input is set to the given element.
 JobStatus[] getJobStates()
           Gets all JobStatus objects currently managed by this JobStatusTableContentProvider.
 void inputChanged(Viewer viewer, Object oldInput, Object newInput)
           Notifies this content provider that the given viewer's input has been switched to a different element.
 void removeJob(JobStatus status)
           Removes the specified JobStatus from this JobStatusTableContentProvider.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PRIORITY_COLUMN

public static final int PRIORITY_COLUMN

The index of the priority column which shows an Image representing an IJob priority

See Also:
Constant Field Values

START_TIME_COLUMN

public static final int START_TIME_COLUMN

The index of the column to display the start time of an IJob

See Also:
Constant Field Values

NAME_COLUMN

public static final int NAME_COLUMN

The index of the column to display the name of an IJob

See Also:
Constant Field Values

PROGRESS_COLUMN

public static final int PROGRESS_COLUMN

The index of the column to display the progress of a running IJob

See Also:
Constant Field Values

DURATION_COLUMN

public static final int DURATION_COLUMN
The index of thecolumn to display the duration of a IJob

See Also:
Constant Field Values

STATUS_COLUMN

public static final int STATUS_COLUMN

The index of the column to display the status of a IJob

See Also:
Constant Field Values

COLUMN_IDENTIFIERS

public static final String[] COLUMN_IDENTIFIERS

The column identifiers used


jobStatusList

private List jobStatusList

The List of JobStatus objects


viewer

private TableViewer viewer

The TableViewer served

Constructor Detail

JobStatusTableContentProvider

public JobStatusTableContentProvider(TableViewer viewer)

Creates a new JobStatusTableContentProvider.

Parameters:
viewer - the TableViewer to serve
Method Detail

defaultLanguageChanged

public void defaultLanguageChanged(LanguageResourceChangeEvent lrce)

Called whenever the default language changes.

Specified by:
defaultLanguageChanged in interface ILanguageResourceChangeListener
Parameters:
lrce - the triggered LanguageResourceChangeEvent

addJob

public void addJob(JobStatus status)

Adds the specified JobStatus to this JobStatusTableContentProvider.

Parameters:
status - the JobStatus to add

removeJob

public void removeJob(JobStatus status)

Removes the specified JobStatus from this JobStatusTableContentProvider.

Parameters:
status - the JobStatus to remove

getJobStates

public JobStatus[] getJobStates()

Gets all JobStatus objects currently managed by this JobStatusTableContentProvider.

Returns:
the JobStatus objects currently managed by this JobStatusTableContentProvider

getElements

public Object[] getElements(Object inputElement)

Returns the elements to display in the viewer when its input is set to the given element. These elements can be presented as rows in a table, items in a list, etc. The result is not modified by the viewer.

Specified by:
getElements in interface IStructuredContentProvider
Parameters:
inputElement - the input element
Returns:
the array of elements to display in the viewer
See Also:
IStructuredContentProvider.getElements(java.lang.Object)

dispose

public void dispose()

Disposes of this content provider. This is called by the viewer when it is disposed.

The viewer should not be updated during this call, as it is in the process of being disposed.

Specified by:
dispose in interface IContentProvider
See Also:
IContentProvider.dispose()

inputChanged

public void inputChanged(Viewer viewer,
                         Object oldInput,
                         Object newInput)

Notifies this content provider that the given viewer's input has been switched to a different element.

A typical use for this method is registering the content provider as a listener to changes on the new input (using model-specific means), and deregistering the viewer from the old input. In response to these change notifications, the content provider should update the viewer (see the add, remove, update and refresh methods on the viewers).

The viewer should not be updated during this call, as it might be in the process of being disposed.

Specified by:
inputChanged in interface IContentProvider
Parameters:
viewer - the viewer
oldInput - the old input element, or null if the viewer did not previously have an input
newInput - the new input element, or null if the viewer does not have an input
See Also:
IContentProvider.inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)

createReaper

private void createReaper()

Creates an IdleJobStatusReaper and binds it to this JobStatusTableContentProvider.