org.crosswire.common.progress.swing
Class JobsProgressBar.JobData

java.lang.Object
  extended by org.crosswire.common.progress.swing.JobsProgressBar.JobData
All Implemented Interfaces:
EventListener, WorkListener
Enclosing class:
JobsProgressBar

private static class JobsProgressBar.JobData
extends Object
implements WorkListener

A simple struct to group information about a Job


Field Summary
private  JButton cancelButton
           
private  Component comp
           
private  int index
           
private  Progress job
           
private  JProgressBar progress
           
 
Constructor Summary
JobsProgressBar.JobData(Progress job, int index, JProgressBar progress)
          Simple ctor
 
Method Summary
private  JButton createCancelButton()
          Create a cancel button that only shows the cancel icon.
private  Component decorateProgressBar()
          Decorate the progress bar if the job can be interrupted.
 JButton getCancelButton()
           
 Component getComponent()
           
(package private)  int getIndex()
          Accessor for the index
(package private)  Progress getJob()
          Accessor for the Job
(package private)  JProgressBar getProgress()
          Accessor for the Progress Bar
(package private)  void invalidate()
          ensure we can't be used again
 void workProgressed(WorkEvent ev)
          This method is called to indicate that some progress has been made.
 void workStateChanged(WorkEvent evt)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

job

private Progress job

index

private int index

progress

private JProgressBar progress

comp

private Component comp

cancelButton

private JButton cancelButton
Constructor Detail

JobsProgressBar.JobData

JobsProgressBar.JobData(Progress job,
                        int index,
                        JProgressBar progress)
Simple ctor

Method Detail

invalidate

void invalidate()
ensure we can't be used again


getJob

Progress getJob()
Accessor for the Job


getProgress

JProgressBar getProgress()
Accessor for the Progress Bar


getComponent

public Component getComponent()

getCancelButton

public JButton getCancelButton()
Returns:
Returns the cancelButton.

getIndex

int getIndex()
Accessor for the index


workStateChanged

public void workStateChanged(WorkEvent evt)
Specified by:
workStateChanged in interface WorkListener

workProgressed

public void workProgressed(WorkEvent ev)
Description copied from interface: WorkListener
This method is called to indicate that some progress has been made. The amount of progress is indicated by ev.getPercent()

Specified by:
workProgressed in interface WorkListener
Parameters:
ev - Describes the progress

createCancelButton

private JButton createCancelButton()
Create a cancel button that only shows the cancel icon. When the button is pressed the job is interrupted.

Returns:
a custom cancel button

decorateProgressBar

private Component decorateProgressBar()
Decorate the progress bar if the job can be interrupted. We put the cancel button in a 1 row, 2 column grid where the button is in a minimally sized fixed cell and the progress meter follows in a horizontally stretchy cell


Copyright ยจ 2003-2007