Java Doc for SwingDocument.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) 


javax.swing.text.DefaultStyledDocument
   edu.rice.cs.util.text.SwingDocument

All known Subclasses:   edu.rice.cs.drjava.model.AbstractDJDocument,
SwingDocument
public class SwingDocument extends DefaultStyledDocument implements EditDocumentInterface,AbstractDocumentInterface(Code)
A swing implementation of the toolkit-independent EditDocumentInterface. This document must use the readers/writers locking protocol established in its superclasses. TODO: create a separate DummySwingDocument class for testing and make SwingDocument abstract.
version:
   $Id: SwingDocument.java 4255 2007-08-28 19:17:37Z mgricken $


Field Summary
protected  DocumentEditCondition_condition
     Determines which edits are legal on this document.
final protected  Hashtable<String, AttributeSet>_styles
    
final protected static  Object_wrappedPosListLock
     Lock used to protect _wrappedPosListLock in DefinitionsDocument.

Constructor Summary
public  SwingDocument()
     Creates a new document adapter for a Swing StyledDocument.

Method Summary
public  void_forceInsertText(int offs, String str, String style)
     Behaves exactly like forceInsertText except for assuming that WriteLock is already held.
public  void_insertText(int offs, String str, String style)
    
public  void_removeText(int offs, int len)
     Removes a portion of the document, if the edit condition allows it, as above.
public  voidacquireReadLock()
    
public  voidacquireWriteLock()
     Swing-style writeLock().
public  voidaddColoring(int start, int end, String style)
     Adds the given coloring style to the styles list.
public  voidappend(String str, AttributeSet set)
     Appends given string with specified attributes to end of this document.
public  voidappend(String str, String style)
     Appends given string with specified named style to end of this document.
public  voidclear()
    
public  PositioncreateUnwrappedPosition(int offs)
     Performs the default behavior for createPosition in DefaultStyledDocument.
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  StringgetDefaultStyle()
    
public  AttributeSetgetDocStyle(String name)
     Returns the style with the given name, or null if no such named style exists.
public  StringgetDocText(int offs, int len)
     Returns a portion of the document.
public  DocumentEditConditiongetEditCondition()
     Gets the object which can determine whether an insert or remove edit should be applied, based on the inputs.
public  PageablegetPageable()
    
public  StringgetText()
     Returns entire text of this document.
public  voidinsertString(int offs, String str, AttributeSet set)
     Overrides superclass's insertString to impose the edit condition.
public  voidinsertText(int offs, String str, String style)
     Inserts a string into the document at the given offset and 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  voidprint()
    
public  voidreleaseReadLock()
    
public  voidreleaseWriteLock()
     Swing-style writeUnlock().
public  voidremove(int offs, int len)
     Overrides superclass's remove to impose the edit condition.
public  voidremoveText(int offs, int len)
     Removes a portion of the document, if the edit condition allows it.
public  voidsetDocStyle(String name, AttributeSet s)
     Adds the given AttributeSet as a style with the given name.
public  voidsetEditCondition(DocumentEditCondition condition)
     Provides an object which can determine whether an insert or remove edit should be applied, based on the inputs.

Field Detail
_condition
protected DocumentEditCondition _condition(Code)
Determines which edits are legal on this document.



_styles
final protected Hashtable<String, AttributeSet> _styles(Code)
Maps names to attribute sets



_wrappedPosListLock
final protected static Object _wrappedPosListLock(Code)
Lock used to protect _wrappedPosListLock in DefinitionsDocument. Placed here to ensure that it initialized before use!




Constructor Detail
SwingDocument
public SwingDocument()(Code)
Creates a new document adapter for a Swing StyledDocument. TODO: convert _styles and _condition to lazily initialized volatiles as soon as support for Java 1.4 is dropped and the double-check idiom is safe.




Method Detail
_forceInsertText
public void _forceInsertText(int offs, String str, String style)(Code)
Behaves exactly like forceInsertText except for assuming that WriteLock is already held.



_insertText
public void _insertText(int offs, String str, String style)(Code)



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



acquireReadLock
public void acquireReadLock()(Code)



acquireWriteLock
public void acquireWriteLock()(Code)
Swing-style writeLock(). Must be renamed because inherited writeLock is final.



addColoring
public void addColoring(int start, int end, String style)(Code)
Adds the given coloring style to the styles list. Not supported in SwingDocument.



append
public void append(String str, AttributeSet set)(Code)
Appends given string with specified attributes to end of this document.



append
public void append(String str, String style)(Code)
Appends given string with specified named style to end of this document.



clear
public void clear()(Code)



createUnwrappedPosition
public Position createUnwrappedPosition(int offs) throws BadLocationException(Code)
Performs the default behavior for createPosition in DefaultStyledDocument.



forceInsertText
public void forceInsertText(int offs, String str, String style)(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)(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



getDefaultStyle
public String getDefaultStyle()(Code)
A SwingDocument instance does not have a default style



getDocStyle
public AttributeSet getDocStyle(String name)(Code)
Returns the style with the given name, or null if no such named style exists.



getDocText
public String getDocText(int offs, int len)(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 can determine whether an insert or remove edit should be applied, based on the inputs. an Object to determine legality of inputs



getPageable
public Pageable getPageable()(Code)



getText
public String getText()(Code)
Returns entire text of this document.



insertString
public void insertString(int offs, String str, AttributeSet set) throws BadLocationException(Code)
Overrides superclass's insertString to impose the edit condition. The AttributeSet is ignored in the condition, which sees a null style name.



insertText
public void insertText(int offs, String str, String style)(Code)
Inserts a string into the document at the given offset and 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



print
public void print()(Code)



releaseReadLock
public void releaseReadLock()(Code)



releaseWriteLock
public void releaseWriteLock()(Code)
Swing-style writeUnlock(). Must be renamed because inherited writeUnlock is final.



remove
public void remove(int offs, int len) throws BadLocationException(Code)
Overrides superclass's remove to impose the edit condition.



removeText
public void removeText(int offs, int len)(Code)
Removes a portion of the document, if the edit condition 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



setDocStyle
public void setDocStyle(String name, AttributeSet s)(Code)
Adds the given AttributeSet as a style with the given name. It can then be used in insertString.
Parameters:
  name - Name of the style, to be passed to insertString
Parameters:
  s - AttributeSet to use for the style



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



Fields inherited from javax.swing.text.DefaultStyledDocument
final public static int BUFFER_SIZE_DEFAULT(Code)(Java Doc)
protected ElementBuffer buffer(Code)(Java Doc)

Methods inherited from javax.swing.text.DefaultStyledDocument
public void addDocumentListener(DocumentListener listener)(Code)(Java Doc)
public Style addStyle(String nm, Style parent)(Code)(Java Doc)
protected void create(ElementSpec[] data)(Code)(Java Doc)
protected AbstractElement createDefaultRoot()(Code)(Java Doc)
public Color getBackground(AttributeSet attr)(Code)(Java Doc)
public Element getCharacterElement(int pos)(Code)(Java Doc)
public Element getDefaultRootElement()(Code)(Java Doc)
public Font getFont(AttributeSet attr)(Code)(Java Doc)
public Color getForeground(AttributeSet attr)(Code)(Java Doc)
public Style getLogicalStyle(int p)(Code)(Java Doc)
public Element getParagraphElement(int pos)(Code)(Java Doc)
public Style getStyle(String nm)(Code)(Java Doc)
public Enumeration getStyleNames()(Code)(Java Doc)
protected void insert(int offset, ElementSpec[] data) throws BadLocationException(Code)(Java Doc)
protected void insertUpdate(DefaultDocumentEvent chng, AttributeSet attr)(Code)(Java Doc)
public void removeDocumentListener(DocumentListener listener)(Code)(Java Doc)
public void removeElement(Element elem)(Code)(Java Doc)
public void removeStyle(String nm)(Code)(Java Doc)
protected void removeUpdate(DefaultDocumentEvent chng)(Code)(Java Doc)
public void setCharacterAttributes(int offset, int length, AttributeSet s, boolean replace)(Code)(Java Doc)
public void setLogicalStyle(int pos, Style s)(Code)(Java Doc)
public void setParagraphAttributes(int offset, int length, AttributeSet s, boolean replace)(Code)(Java Doc)
protected void styleChanged(Style style)(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.