Java Doc for ConsoleDocument.java in  » IDE » DrJava » edu » rice » cs » util » text » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » IDE » DrJava » edu.rice.cs.util.text 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   edu.rice.cs.util.text.ConsoleDocument

All known Subclasses:   edu.rice.cs.drjava.model.repl.InteractionsDocument,
ConsoleDocument
public class ConsoleDocument implements ConsoleDocumentInterface(Code)
A GUI-toolkit agnostic interface to a console document. This class assumes that the embedded document supports readers/writers locking and uses that locking protocol to ensure the integrity of the data added in this class
version:
   $Id: ConsoleDocument.java 4255 2007-08-28 19:17:37Z mgricken $

Inner Class :class ConsoleEditCondition extends DocumentEditCondition

Field Summary
final public static  StringDEFAULT_CONSOLE_PROMPT
     The default prompt to use in the console.
final public static  StringDEFAULT_STYLE
     Default text style.
final public static  StringSYSTEM_ERR_STYLE
    
final public static  StringSYSTEM_IN_STYLE
    
final public static  StringSYSTEM_OUT_STYLE
    
protected volatile  Runnable_beep
     A runnable command to use for a notification beep.
protected volatile  DrJavaBook_book
    
final protected  ConsoleDocumentInterface_document
     The embedded document storing the text and _hasPrompt property for this console model.
protected volatile  String_prompt
     String to use for the prompt.

Constructor Summary
public  ConsoleDocument(ConsoleDocumentInterface doc)
     Creates a new ConsoleDocument with the given embedded ConsoleDocumentInterface (a SwingDocument in native DrJava).

Method Summary
protected  void_clearCurrentInputText()
     Removes the text from the current prompt to the end of the document.
public  void_forceInsertText(int offs, String str, String style)
     Inserts a string into the document exactly like forceInsertText above except that it assumes the WriteLock is already held.
public  void_insertText(int offs, String str, String style)
     Inserts a string into the document at the given offset and named style, if the edit condition allows it., as above.
public  void_removeText(int offs, int len)
     Removes a portion of the document, if the edit condition allows it, as above.
public  voidacquireReadLock()
     Swing-style acquireReadLock().
public  voidacquireWriteLock()
     Swing-style writeLock().
public  voidappend(String str, String style)
     Appends a string to this in the given named style, if the edit condition allows it.
Parameters:
  str - String to be inserted
Parameters:
  style - Name of the style to use.
public  voidcleanUpPrintJob()
     Clears the pageable object used to hold the print job.
public  voidclearCurrentInput()
     Clears the current input text.
public  voiddisablePrompt()
     Disables the prompt in this document.
public  voidforceInsertText(int offs, String str, String style)
     Inserts a string into the document at the given offset and style, regardless of the edit condition.
Parameters:
  offs - Offset into the document
Parameters:
  str - String to be inserted
Parameters:
  style - Name of the style to use.
public  voidforceRemoveText(int offs, int len)
     Removes a portion of the document, regardless of the edit condition.
public  StringgetCurrentInput()
     Returns the string that the user has entered at the current prompt.
public  StringgetDefaultStyle()
    
public  StringgetDocText(int offs, int len)
     Returns a portion of the document.
public  DocumentEditConditiongetEditCondition()
     Gets the object which determines whether an insert/remove edit should be applied based on the inputs.
public  intgetLength()
     Returns the length of the document.
public  PageablegetPageable()
     Returns the Pageable object for printing.
public  StringgetPrompt()
     Accessor for the string used for the prompt.
public  intgetPromptPos()
     Returns the first location in the document where editing is allowed.
public  StringgetText()
     Returns the entire text of the document.
public  booleanhasPrompt()
     true iff this document has a prompt and is ready to accept input.
public  voidinsertBeforeLastPrompt(String text, String style)
     Inserts the given string with the given attributes just before the most recent prompt.
public  voidinsertNewLine(int pos)
     Inserts a new line at the given position.
public  voidinsertPrompt()
     Prints a prompt for a new input.
public  voidinsertText(int offs, String str, String style)
     Inserts a string into the document at the given offset and named style, if the edit condition allows it.
Parameters:
  offs - Offset into the document
Parameters:
  str - String to be inserted
Parameters:
  style - Name of the style to use.
public  voidpreparePrintJob()
     This method tells the document to prepare all the DrJavaBook and PagePrinter objects.
public  voidprint()
     Prints the given document by bringing up a "Print" window.
public  voidreleaseReadLock()
     Swing-style releaseReadLock().
public  voidreleaseWriteLock()
     Swing-style writeUnlock().
public  voidremoveText(int offs, int len)
     Removes a portion of the document, if the edit condition (including promptPos) allows it.
public  voidreset(String banner)
     Resets the document to a clean state.
public  voidsetBeep(Runnable beep)
     Sets a runnable action to use as a beep.
public  voidsetEditCondition(DocumentEditCondition condition)
     Provides an object which can determine whether an insert or remove edit should be applied, based on the inputs.
public  voidsetHasPrompt(boolean val)
    
public  voidsetPrompt(String prompt)
     Sets the string to use for the prompt.
public  voidsetPromptPos(int newPos)
     Sets the prompt position.

Field Detail
DEFAULT_CONSOLE_PROMPT
final public static String DEFAULT_CONSOLE_PROMPT(Code)
The default prompt to use in the console.



DEFAULT_STYLE
final public static String DEFAULT_STYLE(Code)
Default text style.



SYSTEM_ERR_STYLE
final public static String SYSTEM_ERR_STYLE(Code)
Style for System.err



SYSTEM_IN_STYLE
final public static String SYSTEM_IN_STYLE(Code)
Style for System.in



SYSTEM_OUT_STYLE
final public static String SYSTEM_OUT_STYLE(Code)
Style for System.out



_beep
protected volatile Runnable _beep(Code)
A runnable command to use for a notification beep.



_book
protected volatile DrJavaBook _book(Code)
The book object used for printing that represents several pages



_document
final protected ConsoleDocumentInterface _document(Code)
The embedded document storing the text and _hasPrompt property for this console model.



_prompt
protected volatile String _prompt(Code)
String to use for the prompt.




Constructor Detail
ConsoleDocument
public ConsoleDocument(ConsoleDocumentInterface doc)(Code)
Creates a new ConsoleDocument with the given embedded ConsoleDocumentInterface (a SwingDocument in native DrJava).
Parameters:
  doc - the embedded ConsoleDocumentInterface object




Method Detail
_clearCurrentInputText
protected void _clearCurrentInputText()(Code)
Removes the text from the current prompt to the end of the document.



_forceInsertText
public void _forceInsertText(int offs, String str, String style) throws EditDocumentException(Code)
Inserts a string into the document exactly like forceInsertText above except that it assumes the WriteLock is already held.



_insertText
public void _insertText(int offs, String str, String style) throws EditDocumentException(Code)
Inserts a string into the document at the given offset and named style, if the edit condition allows it., as above. Assumes WriteLock is held.



_removeText
public void _removeText(int offs, int len) throws EditDocumentException(Code)
Removes a portion of the document, if the edit condition allows it, as above. Assumes that WriteLock is held.



acquireReadLock
public void acquireReadLock()(Code)
Swing-style acquireReadLock().



acquireWriteLock
public void acquireWriteLock()(Code)
Swing-style writeLock().



append
public void append(String str, String style) throws EditDocumentException(Code)
Appends a string to this in the given named style, if the edit condition allows it.
Parameters:
  str - String to be inserted
Parameters:
  style - Name of the style to use. Must have been added using addStyle.
throws:
  EditDocumentException - if the offset is illegal



cleanUpPrintJob
public void cleanUpPrintJob()(Code)
Clears the pageable object used to hold the print job.



clearCurrentInput
public void clearCurrentInput()(Code)
Clears the current input text.



disablePrompt
public void disablePrompt()(Code)
Disables the prompt in this document.



forceInsertText
public void forceInsertText(int offs, String str, String style) throws EditDocumentException(Code)
Inserts a string into the document at the given offset and style, regardless of the edit condition.
Parameters:
  offs - Offset into the document
Parameters:
  str - String to be inserted
Parameters:
  style - Name of the style to use. Must have been added using addStyle.
throws:
  EditDocumentException - if the offset is illegal



forceRemoveText
public void forceRemoveText(int offs, int len) throws EditDocumentException(Code)
Removes a portion of the document, regardless of the edit condition.
Parameters:
  offs - Offset to start deleting from
Parameters:
  len - Number of characters to remove
throws:
  EditDocumentException - if the offset or length are illegal



getCurrentInput
public String getCurrentInput()(Code)
Returns the string that the user has entered at the current prompt. May contain newline characters.



getDefaultStyle
public String getDefaultStyle()(Code)



getDocText
public String getDocText(int offs, int len) throws EditDocumentException(Code)
Returns a portion of the document.
Parameters:
  offs - First offset of the desired text
Parameters:
  len - Number of characters to return
throws:
  EditDocumentException - if the offset or length are illegal



getEditCondition
public DocumentEditCondition getEditCondition()(Code)
Gets the object which determines whether an insert/remove edit should be applied based on the inputs. the DocumentEditCondition to determine legality of inputs



getLength
public int getLength()(Code)
Returns the length of the document.



getPageable
public Pageable getPageable() throws IllegalStateException(Code)
Returns the Pageable object for printing. A Pageable representing this document.



getPrompt
public String getPrompt()(Code)
Accessor for the string used for the prompt.



getPromptPos
public int getPromptPos()(Code)
Returns the first location in the document where editing is allowed.



getText
public String getText()(Code)
Returns the entire text of the document. Identical to getText() in AbstractDocumentInterface.
throws:
  EditDocumentException - if the offset or length are illegal



hasPrompt
public boolean hasPrompt()(Code)
true iff this document has a prompt and is ready to accept input.



insertBeforeLastPrompt
public void insertBeforeLastPrompt(String text, String style)(Code)
Inserts the given string with the given attributes just before the most recent prompt.
Parameters:
  text - String to insert
Parameters:
  style - name of style to format the string



insertNewLine
public void insertNewLine(int pos)(Code)
Inserts a new line at the given position.
Parameters:
  pos - Position to insert the new line



insertPrompt
public void insertPrompt()(Code)
Prints a prompt for a new input.



insertText
public void insertText(int offs, String str, String style) throws EditDocumentException(Code)
Inserts a string into the document at the given offset and named style, if the edit condition allows it.
Parameters:
  offs - Offset into the document
Parameters:
  str - String to be inserted
Parameters:
  style - Name of the style to use. Must have been added using addStyle.
throws:
  EditDocumentException - if the offset is illegal



preparePrintJob
public void preparePrintJob()(Code)
This method tells the document to prepare all the DrJavaBook and PagePrinter objects.



print
public void print() throws PrinterException(Code)
Prints the given document by bringing up a "Print" window.



releaseReadLock
public void releaseReadLock()(Code)
Swing-style releaseReadLock().



releaseWriteLock
public void releaseWriteLock()(Code)
Swing-style writeUnlock().



removeText
public void removeText(int offs, int len) throws EditDocumentException(Code)
Removes a portion of the document, if the edit condition (including promptPos) allows it.
Parameters:
  offs - Offset to start deleting from
Parameters:
  len - Number of characters to remove
throws:
  EditDocumentException - if the offset or length are illegal



reset
public void reset(String banner)(Code)
Resets the document to a clean state.



setBeep
public void setBeep(Runnable beep)(Code)
Sets a runnable action to use as a beep.
Parameters:
  beep - Runnable beep command



setEditCondition
public void setEditCondition(DocumentEditCondition condition)(Code)
Provides an object which can determine whether an insert or remove edit should be applied, based on the inputs.
Parameters:
  condition - Object to determine legality of inputs



setHasPrompt
public void setHasPrompt(boolean val)(Code)



setPrompt
public void setPrompt(String prompt)(Code)
Sets the string to use for the prompt.
Parameters:
  prompt - String to use for the prompt.



setPromptPos
public void setPromptPos(int newPos)(Code)
Sets the prompt position. Only used in tests.
Parameters:
  newPos - the new position.



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.