|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.ccg.swing.TailViewer
public class TailViewer
Swing tool capable of browsing the contents of large ASCII text files.
This class helps one construct a Swing component that can be used to efficiently view (not edit) VERY large ASCII files. To use this class, follow these basic guidelines:
specify a
FileLineIndex object).
graphical component and add
it to your GUI.
Take a look at Tail.java to see how to make use of this class.
This object will take care of the following for you:
It should be noted, that this object does not automate the
process of checking for file updates (it just receives
notifications when a update occurs). You will probably want to use
the setUpdateMillis method -
or periodically invoke the tailUpdate method on the FileLineIndex
object you associate with this object.
In addition, there is a static main method provided (mainly for
test purposes), but it allows you to try it out (so you can see how
the component behaves). You run the test program in the following
manner:
java com.ccg.swing.TailViewer FILE
If the FILE specified is modified (while you are viewing it), your display should automatically update to the new end of the file (unless you've started scrolling - or paused the display).
FileLineIndex| Constructor Summary | |
|---|---|
TailViewer()
|
|
| Method Summary | |
|---|---|
JComponent |
getComponent()
Get the visible JComponent which allows the
user to view the displayed area. |
FileLineIndex |
getFileLineIndex()
Get the indexed file to view in the component. |
long |
getLineCount()
Get the number of lines available to be shown (number of lines in the file). |
boolean |
isLineInfoShown()
Indicates whether tool tips are shown to indicate the position in the file. |
boolean |
isPaused()
Is the display in a "paused" state set? |
static void |
main(String[] args)
Main entry point into the test application. |
void |
setFileLineIndex(FileLineIndex val)
Set the indexed file to view in the component. |
void |
setLineInfoShown(boolean val)
Set tool tips shown to indicate the position in the file?. |
void |
setPaused(boolean val)
Set the display in a "paused" state. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public TailViewer()
| Method Detail |
|---|
public void setFileLineIndex(FileLineIndex val)
indexed file to view in the component.
val - The FileLineIndex value to assign (must NOT be null).public FileLineIndex getFileLineIndex()
indexed file to view in the component.
setFileLineIndex(com.ccg.io.FileLineIndex)public long getLineCount()
public void setPaused(boolean val)
val - Pass true if you want to "pause" the text displayed, pass
false if you want to return to a "live" update of the tail of
the file.isPaused()public boolean isPaused()
setPaused(boolean)public void setLineInfoShown(boolean val)
val - New boolean value to assign.isLineInfoShown()public boolean isLineInfoShown()
setLineInfoShown(boolean)public static void main(String[] args)
This method allows you to try the class out from the command
line (to see how it behaves). To use, invoke from the command
line via:
java com.ccg.swing.TailViewer FILE
If the FILE specified is modified (while you are viewing it), your display should automatically update to the new end of the file (unless you've started scrolling - or paused the display).
args - Array of command line arguments.
public JComponent getComponent()
throws IllegalStateException
JComponent which allows the
user to view the displayed area.
IllegalStateException - If you forget to set the file to be
viewed prior to invoking this method.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||