|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.ccg.net.LineReceiverMonitor
public class LineReceiverMonitor
A Swing monitor for the LineReceiver class.
This class allows creates a graphical representation of a LineReceiver object. To use this class, uses the
following steps:
Assocaite a LineReceiver with the object.
graphical component
component to your application.
update method so that
information will be transferred (refreshed) on the graphical
component (you can use a Timer object to help
with this).
I really need to create a full working example program for this - one of these days. If you have access to the com.glatmos.disp package, you can check out the NetStatus*.java files to see how this is put to use.
LineReceiver| Constructor Summary | |
|---|---|
LineReceiverMonitor()
Constructs a new LineReceiverMonitor. |
|
| Method Summary | |
|---|---|
String |
formatInteger(long v)
Produce a integer format for a number. |
String |
formatTime(long millis)
Format a date/time stamp. |
String |
formatTimeSpan(long millis)
Format a duration (span of time). |
JComponent |
getComponent()
Get the graphical component which displays
the status information. |
DateFormat |
getDateFormat()
Get the date/time formatter to use for time stamps. |
LineReceiver |
getLineReceiver()
Get the LineReceiver object which will be
associated. |
protected JComponent[] |
getTabPanels()
Create and return the array of panels to be displayed. |
void |
run()
Does the actual transfer of information. |
void |
setDateFormat(DateFormat val)
Set the date/time formatter to use for time stamps. |
void |
setLineReceiver(LineReceiver val)
Set the LineReceiver object which will be
associated. |
void |
update()
Safely transfer values from the object to the AWT component. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public LineReceiverMonitor()
setLineReceiver(com.ccg.net.LineReceiver),
update()| Method Detail |
|---|
public void update()
This method transfers the current values from the associated
LineReceiver object in a safe manner.
If you call this method outside of the Swing dispatch thread, we
will automatically schedule the update to occur as soon as
possible.
Derived classes will want to override the run() method.
public void setLineReceiver(LineReceiver val)
LineReceiver object which will be
associated.
val - New LineReceiver value to assign.getLineReceiver()public LineReceiver getLineReceiver()
LineReceiver object which will be
associated.
setLineReceiver(com.ccg.net.LineReceiver)public void run()
This method transfers information from the assoicated LineReceiver object to the GUI
components. If this isn't possible (they haven't been realized
yet), then nothing is done.
This method should ONLY be used by Swing dispatched events. It
is safer to use the update() method which works
from ALL threads.
However, if you derive a class from this one (perhaps to add
your on panel), you will want to override this method (and not
the update() method so that you can transfer the
values to your component.
run in interface Runnableupdate()public JComponent getComponent()
component which displays
the status information.
update()protected JComponent[] getTabPanels()
This method creates all of the components which will be used to display information. Each entry in the array will appear on its own tabbed pane (however, if you return a array of length 1, then a tabbed pane won't be required).
Derived classes can override the default set of panels and either choose to completely replace them, or add to them.
name of the component will appear
on the tab.public String formatTimeSpan(long millis)
This method formats a time span such that the units change as the span grows longer (from seconds, to minutes, to hours, to days).
millis - Number of elapsed milliseconds
public String formatInteger(long v)
This method is used to format whole numbers.
v - Value to format as a integer
public String formatTime(long millis)
This method can be used to format a date/time stamp. The
date/time format can be customized. NOTE,
if you pass a value of 0 or less, this method will return "-"
(assuming that you don't have a time stamp yet).
millis - Standard Java millisecond time stamp
getDateFormat()public void setDateFormat(DateFormat val)
date/time formatter to use for time stamps.
val - New DateFormat value to assign.getDateFormat()public DateFormat getDateFormat()
date/time formatter to use for time stamps.
setDateFormat(java.text.DateFormat)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||