[jsword-svn] common/java/swing/org/crosswire/common/progress/swing s
jswordcvs at crosswire.org
jswordcvs at crosswire.org
Sun May 8 18:28:45 MST 2005
Update of /cvs/jsword/common/java/swing/org/crosswire/common/progress/swing
In directory www.crosswire.org:/tmp/cvs-serv5945/java/swing/org/crosswire/common/progress/swing
Modified Files:
JobsViewPane.java
Log Message:
Moved unused code to limbo.
Upgraded support-tools: checkstyle, pmd and findbugs to most recent.
Addressed over 100 issues reported by findbugs and checkstyle.
Resulted in major refactoring of GBFFilter.
Net result is that code size is significantly smaller.
Index: JobsViewPane.java
===================================================================
RCS file: /cvs/jsword/common/java/swing/org/crosswire/common/progress/swing/JobsViewPane.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** JobsViewPane.java 3 Apr 2005 04:07:36 -0000 1.9
--- JobsViewPane.java 9 May 2005 01:28:42 -0000 1.10
***************
*** 105,139 ****
public synchronized void workProgressed(final WorkEvent ev)
{
! SwingUtilities.invokeLater(new Runnable()
! {
! public void run()
! {
! Job job = ev.getJob();
!
! if (!jobs.containsKey(job))
! {
! // do we need an 'empty' label
! if (jobs.isEmpty())
! {
! removeEmptyLabel();
! }
!
! addJob(job);
! }
!
! updateJob(job);
!
! if (job.isFinished())
! {
! removeJob(job);
!
! // do we need an 'empty' label
! if (jobs.isEmpty())
! {
! addEmptyLabel();
! }
! }
! }
! });
}
--- 105,109 ----
public synchronized void workProgressed(final WorkEvent ev)
{
! SwingUtilities.invokeLater(new JobRunner(this, ev));
}
***************
*** 166,176 ****
cancel.setEnabled(false);
}
! cancel.addActionListener(new ActionListener()
! {
! public void actionPerformed(ActionEvent ev)
! {
! job.interrupt();
! }
! });
jobsPanel.add(label, new GridBagConstraints(0, i, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0));
--- 136,140 ----
cancel.setEnabled(false);
}
! cancel.addActionListener(new CancelListener(job));
jobsPanel.add(label, new GridBagConstraints(0, i, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0));
***************
*** 298,301 ****
--- 262,339 ----
/**
+ *
+ */
+ private static final class JobRunner implements Runnable
+ {
+ /**
+ * @param jvp
+ * @param ev
+ */
+ public JobRunner(JobsViewPane jvp, WorkEvent ev)
+ {
+ pane = jvp;
+ event = ev;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Runnable#run()
+ */
+ public void run()
+ {
+ Job job = event.getJob();
+
+ if (!pane.jobs.containsKey(job))
+ {
+ // do we need an 'empty' label
+ if (pane.jobs.isEmpty())
+ {
+ pane.removeEmptyLabel();
+ }
+
+ pane.addJob(job);
+ }
+
+ pane.updateJob(job);
+
+ if (job.isFinished())
+ {
+ pane.removeJob(job);
+
+ // do we need an 'empty' label
+ if (pane.jobs.isEmpty())
+ {
+ pane.addEmptyLabel();
+ }
+ }
+ }
+
+ private JobsViewPane pane;
+ private WorkEvent event;
+ }
+
+ /**
+ * Listen for cancel events and do the cancel.
+ */
+ private static final class CancelListener implements ActionListener
+ {
+ /**
+ * @param theJob
+ */
+ public CancelListener(Job theJob)
+ {
+ job = theJob;
+ }
+
+ /* (non-Javadoc)
+ * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
+ */
+ public void actionPerformed(ActionEvent ev)
+ {
+ job.interrupt();
+ }
+
+ private Job job;
+ }
+ /**
* A simple struct to group information about a Job
*/
More information about the jsword-svn
mailing list