|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object edu.northwestern.at.utils.swing.ProgressLabelAdapter
public class ProgressLabelAdapter
Wraps a JLabel with a progress reporter.
Field Summary | |
---|---|
protected boolean |
cancelled
True if progress panel cancelled. |
protected java.awt.event.ActionListener |
cancelPressed
Handle Cancel button pressed. |
protected int |
currentBarValue
Current progress bar value. |
protected static long |
defaultStartupDelay
Default startup delay = 1.5 seconds. |
protected javax.swing.JLabel |
label
Label for explanatory message. |
protected java.awt.Color |
labelColor
The label color. |
protected java.lang.String |
labelText
The current value of the explanatory message. |
protected int |
labelWidth
Nice wide label size. |
protected int |
maxBar
Maximum value for progress bar. |
protected int |
minBar
Minimum value for progress bar. |
protected boolean |
nowIndeterminate
True if the progress display is indeterminate. |
protected boolean |
nowVisible
True if the progress display is visible. |
static int |
ONE_SECOND
One second in thousandths of a second. |
protected javax.swing.JLabel |
progressLabel
Label displaying how far work has progressed. |
protected static java.lang.String[] |
spinChars
Display characters for indeterminate mode. |
protected int |
spinCount
Spin count for indeterminate mode. |
protected long |
startupDelay
How many milliseconds to wait before displaying dialog. |
protected long |
startupTime
Startup time for dialog. |
protected javax.swing.Timer |
timer
The timer used to update the display a one second intervals. |
protected javax.swing.JLabel |
titleLabel
Title. |
protected java.lang.String |
titleText
The current value of the title. |
Constructor Summary | |
---|---|
ProgressLabelAdapter(javax.swing.JLabel progressLabel,
java.lang.String title,
java.lang.String initLabel,
int minBar,
int maxBar,
long startupDelay)
Create progress label adapter. |
Method Summary | |
---|---|
void |
close()
Close. |
protected void |
doCancel()
Action to take when cancel button pressed. |
protected void |
doClose()
Action to take when panel closed. |
java.awt.event.ActionListener |
getCancelPressedAction()
Return cancel action listener. |
int |
getCurrentBarValue()
Get the current bar value. |
int |
getMaximumBarValue()
Get the maximum bar value. |
boolean |
isCancelled()
See if progress panel cancelled. |
void |
makeVisible(boolean visible)
Make the dialog visible or invisble. |
void |
setIndeterminate(boolean isIndeterminate)
Set tbe progress bar determinate/indeterminate state. |
void |
setLabelColor(java.awt.Color color)
Set the progress label text color. |
void |
setMaximumBarValue(int maxBar)
Set maximum bar value. |
void |
setStartupTime(long startupTime)
Set the startup time. |
void |
setTitle(java.lang.String title)
Set the title. |
void |
updateProgress(int newBarValue)
Update progress display. |
void |
updateProgress(int newBarValue,
java.lang.String newLabelText)
Update progress display. |
void |
updateProgress(java.lang.String newLabelText)
Update progress display. |
protected void |
updateProgressDisplay()
Updates the progress display. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected int minBar
protected int maxBar
protected javax.swing.JLabel titleLabel
protected java.lang.String titleText
protected javax.swing.JLabel label
protected java.lang.String labelText
protected java.awt.Color labelColor
protected javax.swing.JLabel progressLabel
protected int currentBarValue
protected boolean cancelled
protected static long defaultStartupDelay
protected long startupDelay
protected long startupTime
protected int labelWidth
protected boolean nowVisible
protected boolean nowIndeterminate
protected int spinCount
protected static final java.lang.String[] spinChars
protected javax.swing.Timer timer
public static final int ONE_SECOND
protected java.awt.event.ActionListener cancelPressed
Constructor Detail |
---|
public ProgressLabelAdapter(javax.swing.JLabel progressLabel, java.lang.String title, java.lang.String initLabel, int minBar, int maxBar, long startupDelay)
progressLabel
- Label wrapped for displaying progress.title
- Title for progress display.initLabel
- Initial text of label.minBar
- Minimum value for progress bar.maxBar
- Maximum value for progress bar.startupDelay
- Startup delay. Dialog will not appear
until this many milliseconds have passed
since creation of dialog. Method Detail |
---|
public void setTitle(java.lang.String title)
setTitle
in interface ProgressReporter
title
- The title. protected void doCancel()
Override this in derived subclasses to take a specified action when the cancel button is pressed. The only required action is to set the class variable "cancelled" to true.
public java.awt.event.ActionListener getCancelPressedAction()
Use to create a cancel button externally.
protected void doClose()
Override this in derived subclasses to take a specified action when the panel is closed.
public boolean isCancelled()
isCancelled
in interface ProgressReporter
public void setStartupTime(long startupTime)
setStartupTime
in interface ProgressReporter
startupTime
- The startup time in milliseconds. public void updateProgress(int newBarValue, java.lang.String newLabelText)
updateProgress
in interface ProgressReporter
newBarValue
- New value for progress bar.
If negative, the current value remains
unchanged.newLabelText
- New label text. If null, the current
label text is unchanged. public void updateProgress(int newBarValue)
updateProgress
in interface ProgressReporter
newBarValue
- New value for progress bar. public void updateProgress(java.lang.String newLabelText)
updateProgress
in interface ProgressReporter
newLabelText
- New label text. If null, the current
label text is unchanged. public void setLabelColor(java.awt.Color color)
setLabelColor
in interface ProgressReporter
color
- Text color for progress label. public void setMaximumBarValue(int maxBar)
setMaximumBarValue
in interface ProgressReporter
maxBar
- The new maximum bar value. public int getCurrentBarValue()
getCurrentBarValue
in interface ProgressReporter
public int getMaximumBarValue()
getMaximumBarValue
in interface ProgressReporter
public void setIndeterminate(boolean isIndeterminate)
setIndeterminate
in interface ProgressReporter
isIndeterminate
- true if indeterminate, false otherwise. public void makeVisible(boolean visible)
makeVisible
in interface ProgressReporter
visible
- true to show dialog, false to hide. public void close()
close
in interface ProgressReporter
protected void updateProgressDisplay()
UpdateProgress is guaranteed to run on the AWT event thread since it is called from the timer's actionPerformed handler method.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |