Java Doc for Formatter.java in  » Swing-Library » abeille-forms-designer » org » netbeans » editor » 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 » Swing Library » abeille forms designer » org.netbeans.editor 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.netbeans.editor.Formatter

All known Subclasses:   org.netbeans.editor.ext.ExtFormatter,
Formatter
public class Formatter implements SettingsChangeListener(Code)
Various services related to indentation and text formatting are located here. Each kit can have different formatter so the first action should be getting the right formatter for the given kit by calling Formatter.getFormatter(kitClass).
author:
   Miloslav Metelka
version:
   1.00



Constructor Summary
public  Formatter(Class kitClass)
     Construct new formatter.

Method Summary
public  voidchangeBlockIndent(BaseDocument doc, int startPos, int endPos, int shiftCnt)
     Increase/decrease indentation of the block of the code.
public  voidchangeRowIndent(BaseDocument doc, int pos, int newIndent)
     Change the indent of the given row.
public  WritercreateWriter(Document doc, int offset, Writer writer)
     Creates a writer that formats text that is inserted into it.
public  booleanexpandTabs()
    
public static synchronized  FormattergetFormatter(Class kitClass)
    
static  StringgetIndentString(int indent, boolean expandTabs, int tabSize)
    
public  StringgetIndentString(BaseDocument doc, int indent)
    
public  StringgetIndentString(int indent)
     Get the string that is appropriate for the requested indentation.
public  ClassgetKitClass()
     Get the kit-class for which this formatter is constructed.
public  intgetShiftWidth()
     Get the width of one indentation level for non-BaseDocument documents. The algorithm first checks whether there's a value for the INDENT_SHIFT_WIDTH setting.
public  intgetSpacesPerTab()
     Get the number of spaces that should be inserted into the document instead of one typed tab.
public  intgetTabSize()
     Get the number of spaces the TAB character ('\t') visually represents for non-BaseDocument documents.
public  intindentLine(Document doc, int offset)
     Indents the current line.
public  intindentNewLine(Document doc, int offset)
     Inserts new line at given position and indents the new line with spaces.
public  voidinsertTabString(BaseDocument doc, int dotPos)
     Modify the line to move the text starting at dotPos one tab column to the right.
public  intreformat(BaseDocument doc, int startOffset, int endOffset)
     Reformat a block of code.
public  voidsetExpandTabs(boolean expandTabs)
    
public static synchronized  voidsetFormatter(Class kitClass, Formatter formatter)
     Set the formatter for the given kit-class.
public  voidsetShiftWidth(int shiftWidth)
     Set the width of one indentation level for non-BaseDocument documents.
public  voidsetSpacesPerTab(int spacesPerTab)
    
public  voidsetTabSize(int tabSize)
     Set the number of spaces the TAB character ('\t') visually represents for non-BaseDocument documents.
public  voidsettingsChange(SettingsChangeEvent evt)
    
public  voidshiftLine(BaseDocument doc, int dotPos, boolean right)
    


Constructor Detail
Formatter
public Formatter(Class kitClass)(Code)
Construct new formatter.
Parameters:
  kitClass - the class of the kit for which this formatter is beingconstructed.




Method Detail
changeBlockIndent
public void changeBlockIndent(BaseDocument doc, int startPos, int endPos, int shiftCnt) throws BadLocationException(Code)
Increase/decrease indentation of the block of the code. Document is atomically locked during the operation.
Parameters:
  doc - document to operate on
Parameters:
  startPos - starting line position
Parameters:
  endPos - ending line position
Parameters:
  shiftCnt - positive/negative count of shiftwidths by which indentationshould be shifted right/left



changeRowIndent
public void changeRowIndent(BaseDocument doc, int pos, int newIndent) throws BadLocationException(Code)
Change the indent of the given row. Document is atomically locked during this operation.



createWriter
public Writer createWriter(Document doc, int offset, Writer writer)(Code)
Creates a writer that formats text that is inserted into it. The writer should not modify the document but use the provided writer to write to. Usually the underlaying writer will modify the document itself and optionally it can remember the current position in document. That is why the newly created writer should do no buffering.

The provided document and pos are only informational, should not be modified but only used to find correct indentation strategy.
Parameters:
  doc - document
Parameters:
  offset - position to begin inserts at
Parameters:
  writer - writer to write to new writer that will format written text and pass it into thewriter




expandTabs
public boolean expandTabs()(Code)
Should the typed tabs be expanded to the spaces?



getFormatter
public static synchronized Formatter getFormatter(Class kitClass)(Code)
Get the formatter for the given kit-class



getIndentString
static String getIndentString(int indent, boolean expandTabs, int tabSize)(Code)



getIndentString
public String getIndentString(BaseDocument doc, int indent)(Code)



getIndentString
public String getIndentString(int indent)(Code)
Get the string that is appropriate for the requested indentation. The returned string respects the expandTabs() and the getTabSize() and will contain either spaces only or fully or partially tabs as necessary.



getKitClass
public Class getKitClass()(Code)
Get the kit-class for which this formatter is constructed.



getShiftWidth
public int getShiftWidth()(Code)
Get the width of one indentation level for non-BaseDocument documents. The algorithm first checks whether there's a value for the INDENT_SHIFT_WIDTH setting. If so it uses it, otherwise it uses getSpacesPerTab()
See Also:    setShiftWidth()
See Also:    getSpacesPerTab()



getSpacesPerTab
public int getSpacesPerTab()(Code)
Get the number of spaces that should be inserted into the document instead of one typed tab.



getTabSize
public int getTabSize()(Code)
Get the number of spaces the TAB character ('\t') visually represents for non-BaseDocument documents. It shouldn't be used for BaseDocument based documents. The reason for that is that the returned value reflects the value of the setting for the kit class over which this formatter was constructed. However it's possible that the kit class of the document being formatted is different than the kit of the formatter. For example java document could be formatted by html formatter. Therefore BaseDocument.getTabSize() must be used for BaseDocuments to reflect the document's own tabsize.
See Also:    BaseDocument.getTabSize()



indentLine
public int indentLine(Document doc, int offset)(Code)
Indents the current line. Should not affect any other lines.
Parameters:
  doc - the document to work on
Parameters:
  offset - the offset of a character on the line new offset of the original character



indentNewLine
public int indentNewLine(Document doc, int offset)(Code)
Inserts new line at given position and indents the new line with spaces.
Parameters:
  doc - the document to work on
Parameters:
  offset - the offset of a character on the line new offset to place cursor to



insertTabString
public void insertTabString(BaseDocument doc, int dotPos) throws BadLocationException(Code)
Modify the line to move the text starting at dotPos one tab column to the right. Whitespace preceeding dotPos may be replaced by a TAB character if tabs expanding is on.
Parameters:
  doc - document to operate on
Parameters:
  dotPos - insertion point



reformat
public int reformat(BaseDocument doc, int startOffset, int endOffset) throws BadLocationException(Code)
Reformat a block of code.
Parameters:
  doc - document to work with
Parameters:
  startOffset - offset at which the formatting starts
Parameters:
  endOffset - offset at which the formatting ends length of the reformatted code



setExpandTabs
public void setExpandTabs(boolean expandTabs)(Code)



setFormatter
public static synchronized void setFormatter(Class kitClass, Formatter formatter)(Code)
Set the formatter for the given kit-class.
Parameters:
  kitClass - class of the kit for which the formatter is being assigned.
Parameters:
  formatter - new formatter for the given kit



setShiftWidth
public void setShiftWidth(int shiftWidth)(Code)
Set the width of one indentation level for non-BaseDocument documents. It doesn't affect BaseDocument based documents.
See Also:    getShiftWidth()



setSpacesPerTab
public void setSpacesPerTab(int spacesPerTab)(Code)



setTabSize
public void setTabSize(int tabSize)(Code)
Set the number of spaces the TAB character ('\t') visually represents for non-BaseDocument documents. It doesn't affect BaseDocument based documents.
See Also:    getTabSize()
See Also:    BaseDocument.setTabSize()



settingsChange
public void settingsChange(SettingsChangeEvent evt)(Code)



shiftLine
public void shiftLine(BaseDocument doc, int dotPos, boolean right) throws BadLocationException(Code)
Shift line either left or right



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.