org.fraid.io.gui
Class BoxReader

java.lang.Object
  extended by java.io.Reader
      extended by org.fraid.io.gui.BoxReader
All Implemented Interfaces:
java.io.Closeable, java.lang.Readable

public class BoxReader
extends java.io.Reader

A Reader which reads from a textArea. Has command history and marks matching brackets.


Field Summary
protected  javax.swing.JTextArea mBox
           
protected  java.lang.StringBuffer mBuffer
           
protected  java.util.Vector<java.lang.String> mCommandBuffer
           
protected  int mCommandBufferSize
           
protected  int mCurrentCommandIndex
           
protected  javax.swing.JPanel mPanel
           
protected  javax.swing.JDialog mReaderDialog
           
protected  java.lang.Object mReadLock
           
protected  boolean mReadyForRead
           
protected  javax.swing.JScrollPane mTextScroller
           
 
Fields inherited from class java.io.Reader
lock
 
Constructor Summary
BoxReader()
          Creates a new BoxReader instance.
 
Method Summary
protected  void addBindings()
          Bind keys.
 void addToCommandBuffer(java.lang.String aCommand)
          Describe addToCommandBuffer method here.
 void close()
          The stream's close method.
 void consumeText(java.lang.String aText)
          Display and send aText.
 javax.swing.JTextArea getBox()
          Get the text area.
 javax.swing.JPanel getPanel()
          Get the panel.
 javax.swing.JScrollPane getScrollPane()
          Get the scroll pane.
 javax.swing.JTextArea getTextArea()
          Returns the current text area.
 void help()
          Show a help dialog.
 int read(char[] cbuf, int off, int len)
          The stream's read method.
 void sendContent(java.lang.String aText)
          Send the buffer's content.
 void showDialog()
          Show a dialog with a BoxReader.
 
Methods inherited from class java.io.Reader
mark, markSupported, read, read, read, ready, reset, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mReaderDialog

protected javax.swing.JDialog mReaderDialog

mPanel

protected javax.swing.JPanel mPanel

mTextScroller

protected javax.swing.JScrollPane mTextScroller

mBuffer

protected java.lang.StringBuffer mBuffer

mBox

protected javax.swing.JTextArea mBox

mReadLock

protected java.lang.Object mReadLock

mReadyForRead

protected boolean mReadyForRead

mCommandBuffer

protected java.util.Vector<java.lang.String> mCommandBuffer

mCommandBufferSize

protected int mCommandBufferSize

mCurrentCommandIndex

protected int mCurrentCommandIndex
Constructor Detail

BoxReader

public BoxReader()
Creates a new BoxReader instance.

Method Detail

getTextArea

public javax.swing.JTextArea getTextArea()
Returns the current text area.

Returns:
a JTextArea value

getScrollPane

public javax.swing.JScrollPane getScrollPane()
Get the scroll pane.

Returns:
a JScrollPane value

getPanel

public javax.swing.JPanel getPanel()
Get the panel.

Returns:
a JPanel value

read

public int read(char[] cbuf,
                int off,
                int len)
The stream's read method.

Specified by:
read in class java.io.Reader
Parameters:
cbuf - a char[] value
off - an int value
len - an int value
Returns:
an int value

close

public void close()
The stream's close method.

Specified by:
close in interface java.io.Closeable
Specified by:
close in class java.io.Reader

addToCommandBuffer

public void addToCommandBuffer(java.lang.String aCommand)
Describe addToCommandBuffer method here.

Parameters:
aCommand - a String value

getBox

public javax.swing.JTextArea getBox()
Get the text area.

Returns:
a JTextArea value

consumeText

public void consumeText(java.lang.String aText)
Display and send aText.

Parameters:
aText - a String value

help

public void help()
Show a help dialog.


sendContent

public void sendContent(java.lang.String aText)
Send the buffer's content.


showDialog

public void showDialog()
Show a dialog with a BoxReader.


addBindings

protected void addBindings()
Bind keys.



Fraid (system and language). (C) 2003-2007 Ivaylo Iliev
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.