| java.lang.Object ti.swing.console.ConsoleBuffer
ConsoleBuffer | class ConsoleBuffer implements InputHandler,java.awt.image.ImageObserver,java.io.Serializable(Code) | | The console-buffer is the actual "core" of the console, leaving all the
details of being a swing component (resizing, scrollbar, etc.) to the
public class
Console . All synchronization happens here, for
modifying the state of the buffer, and rendering the buffer.
This really could be an inner-class, as it is "owned" by the console that
creates it, but that one file would be too big.
author: Rob Clark version: 0.0 |
Method Summary | |
public synchronized void | addRegion(Region r) Add a region mapped over a section of character stream. | public synchronized void | append(char[] cbuf, int off, int len) Append characters to the end of the character stream. | public void | close() | public Object | getBufferLock() | int | getColumnCount() Get the number of columns in the buffer. | public synchronized char[] | getData(int offset, int len) Get the data within the specified region. | public synchronized int | getOffset() Get the current offset of the last character in the character stream. | public Iterator | getRegions(int offset, int len) Get an iterator of the regions containing the specified range. | int | getRowCount() Get the number of rows in the buffer. | public boolean | imageUpdate(Image img, int infoflags, int x, int y, int width, int height) | public synchronized void | lock() Lock the console from repaints. | final boolean | locked() | synchronized void | paintBuffer(Graphics g) Render the buffer into the provided graphics, starting at the origin. | public synchronized void | removeRegion(Region r) Remove a region. | synchronized void | setColumnCount(int ncols) Set the number of columns in the buffer. | void | setRowCount(int nrows) Set the number of rows in the buffer. | int | toOffset(int row, int col) Convert the specified row/column coordinate to an offset into the
character stream. | Point | toPoint(int offset) Convert the specified offset into a row/column coordinate. | public synchronized void | unlock() Unlock the console, rerendering if needed. | public synchronized void | zap(int num) Delete characters from end of character stream. |
ConsoleBuffer | ConsoleBuffer(Console console, int nrows, int ncols)(Code) | | Class Constructor.
|
addRegion | public synchronized void addRegion(Region r)(Code) | | Add a region mapped over a section of character stream. If the section
of the character stream over which the region is mapped has scrolled off
the top of the fixed size row buffer, the region will be automatically
removed.
Parameters: r - region to add See Also: ConsoleBuffer.removeRegion |
append | public synchronized void append(char[] cbuf, int off, int len)(Code) | | Append characters to the end of the character stream.
Parameters: cbuf - the character buffer Parameters: off - the offset into cbuf to first character to append Parameters: len - the number of characters to append |
close | public void close()(Code) | | Close method
|
getBufferLock | public Object getBufferLock()(Code) | | Get an object on which to synchronize access to the buffer
an object suitable for synchronizing buffer access See Also: ConsoleBuffer.getRegions |
getColumnCount | int getColumnCount()(Code) | | Get the number of columns in the buffer.
number of columns |
getData | public synchronized char[] getData(int offset, int len)(Code) | | Get the data within the specified region. If the requested region has
scrolled past the top of the buffer, the returned data may be truncated.
Parameters: offset - the begining of the range Parameters: len - the length of the range in characters the data |
getOffset | public synchronized int getOffset()(Code) | | Get the current offset of the last character in the character stream.
an offset |
getRegions | public Iterator getRegions(int offset, int len)(Code) | | Get an iterator of the regions containing the specified range. Access
to the iterator must be synchronized on the buffer-lock, to prevent
concurrent modification problems. For example:
synchronized( ih.getBufferLock() )
{
for( Iterator itr=ih.getRegions( off, len ); itr.hasNext(); )
{
...
}
}
Parameters: offset - the begining of the range Parameters: len - the length of the range in characters an iterator of Region See Also: ConsoleBuffer.getBufferLock |
getRowCount | int getRowCount()(Code) | | Get the number of rows in the buffer.
number of rows |
imageUpdate | public boolean imageUpdate(Image img, int infoflags, int x, int y, int width, int height)(Code) | | |
locked | final boolean locked()(Code) | | Is the console locked from rerendering?
true if rerendering shouldn't happen yet |
paintBuffer | synchronized void paintBuffer(Graphics g)(Code) | | Render the buffer into the provided graphics, starting at the origin.
|
setColumnCount | synchronized void setColumnCount(int ncols)(Code) | | Set the number of columns in the buffer.
Parameters: ncols - number of columns |
setRowCount | void setRowCount(int nrows)(Code) | | Set the number of rows in the buffer.
Parameters: nrows - number of rows |
toOffset | int toOffset(int row, int col)(Code) | | Convert the specified row/column coordinate to an offset into the
character stream.
Parameters: row - row coordinate Parameters: col - column coordinate offset into document stream |
toPoint | Point toPoint(int offset)(Code) | | Convert the specified offset into a row/column coordinate. The
x value of the returned point is the column, and the y value is
the row.
Parameters: offset - the offset into document stream the row/col coordinate |
zap | public synchronized void zap(int num)(Code) | | Delete characters from end of character stream.
Parameters: num - the number of characters to delete |
|
|