Java Doc for EditorOperator.java in  » IDE-Netbeans » visualweb.api.designer » org » netbeans » modules » visualweb » gravy » 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 Netbeans » visualweb.api.designer » org.netbeans.modules.visualweb.gravy 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


org.netbeans.modules.visualweb.gravy.TopComponentOperator
   org.netbeans.modules.visualweb.gravy.EditorOperator

EditorOperator
public class EditorOperator extends TopComponentOperator (Code)
Handle an editor top component in NetBeans IDE. It enables to get, select, insert or delete text, move caret, work with annotations and with toolbar buttons. Majority of operations is done by JEditorPane API calls. If you want to do operations by key navigation, use methods of JEditorPaneOperator instance by EditorOperator.txtEditorPane() . For example, call txtEditorPane().changeCaretPosition(int) instead of EditorOperator.setCaretPosition(int) .

Usage:

 EditorOperator eo = new EditorOperator(filename);
 eo.setCaretPositionToLine(10);
 eo.insert("// My new comment\n");
 eo.select("// My new comment");
 eo.deleteLine(10);
 eo.getToolbarButton("Toggle Bookmark").push();
 // discard changes and close
 eo.close(false);
 // save changes and close
 eo.close(true);
 // try to close all opened documents (confirmation dialog may appear)
 eo.closeAllDocuments();
 // close all opened documents and discard all changes
 eo.closeDiscardAll();
 

author:
   Jiri.Skrivanek@sun.com



Constructor Summary
public  EditorOperator(String filename)
     Waits for the first opened editor with given name.
public  EditorOperator(String filename, int index)
     Waits for index-th opened editor with given name.
public  EditorOperator(ContainerOperator contOper, String filename)
     Waits for first open editor with given name in specified container.
public  EditorOperator(ContainerOperator contOper, String filename, int index)
     Waits for index-th opened editor with given name in specified container.

Method Summary
public  JComboBoxOperatorcboQuickBrowse()
     Returns operator of combo box showing members of the class.
public  voidclose(boolean save)
     Closes this editor by IDE API call and depending on given flag it saves or discards changes.
static  voidclose(TopComponent tc, boolean save)
     Closes top component.
public  voidcloseAndCancelByPopup()
    
public static  voidcloseDiscardAll()
     Closes all opened documents and discards all changes by IDE API calls.
public  booleancontains(String text)
     Checks if editor window contains text specified as parameter text.
public  voiddelete(int offset, int length)
     Deletes given number of characters from specified possition.
public  voiddelete(int length)
     Deletes given number of characters from current caret possition.
public  voiddelete(int lineNumber, int column1, int column2)
     Deletes characters between column1 and column2 (both are included) on the specified line.
public  voiddeleteLine(int line)
     Delete specified line.
public static  StringgetAnnotationShortDescription(Object annotation)
     Returns a short description of annotation.
public static  StringgetAnnotationType(Object annotation)
     Returns a string uniquely identifying annotation.
public  Object[]getAnnotations(int lineNumber)
     Gets an array of annotations attached to given line.
public  Object[]getAnnotations()
     Gets all annotations for current editor (Document).
public  intgetLineNumber()
     Returns current line number.
public  StringgetText()
     Gets text from the currently opened Editor window.
public  StringgetText(int lineNumber)
     Gets text from specified line.
public  JButtonOperatorgetToolbarButton(String buttonTooltip)
     Return JButtonOperator representing a toolbar button found by given tooltip within the Source Editor.
public  JButtonOperatorgetToolbarButton(int index)
     Return JButtonOperator representing index-th toolbar button within the Source Editor.
public  voidinsert(String text)
     Inserts text to current position.
public  voidinsert(String text, int lineNumber, int column)
     Inserts text to position specified by line number and column.
public  booleanisModified()
    
public  JLabelOperatorlblInputMode()
     Returns operator of label showing current input mode (INS/OVR - insert/overwrite).
public  JLabelOperatorlblRowColumn()
     Returns operator of label showing current row and column at the left corner of the Source Editor window.
public  JLabelOperatorlblStatusBar()
     Returns operator of status bar at the bottom of the Source Editor.
public  voidpushDownArrowKey()
    
public  voidpushEndKey()
    
public  voidpushHomeKey()
    
public  voidpushKey(int keyCode)
     Pushes key of requested key code.
public  voidpushTabKey()
    
public  voidpushToolbarPopupMenu(String popupPath)
     Pushes popup menu on toolbar.
public  voidpushUpArrowKey()
    
public  voidreplace(String oldText, String newText)
     Replaces first occurence of oldText by newText.
public  voidreplace(String oldText, String newText, int index)
     Replaced index-th occurence of oldText by newText.
public  voidsave()
     Performs save action with optional verification.
public  voidselect(int lineNumber)
     Selects whole line specified by its number.
public  voidselect(int line1, int line2)
     Selects text between line1 and line2 (both are included).
public  voidselect(int lineNumber, int column1, int column2)
     Selects text in specified line on position defined by column1 and column2 (both are included).
public  voidselect(String text, int index)
     Selects index-th occurence of given text.
public  voidselect(String text)
     Selects first occurence of given text.
public  voidsetCaretPosition(int lineNumber, int column)
    
public  voidsetCaretPosition(int position)
     Sets caret to desired position.
public  voidsetCaretPosition(String text, int index, boolean before)
     Sets caret position before or after index-th occurence of given string.
public  voidsetCaretPosition(String text, boolean before)
     Sets caret position before or after first occurence of given string.
public  voidsetCaretPositionRelative(int relativeMove)
     Sets caret position relatively to current position.
public  voidsetCaretPositionToEndOfLine(int lineNumber)
     Sets caret position to the end of specified line.
public  voidsetCaretPositionToLine(int lineNumber)
     Sets caret position to the beginning of specified line.
public  voidsetQuickBrowse(String item)
     Selects item in quick browse combo box.
public  JEditorPaneOperatortxtEditorPane()
     Returns operator of currently shown editor pane.
public  voidverify()
    
public  voidwaitModified(boolean modified)
     Waits for given modified state of edited source.


Constructor Detail
EditorOperator
public EditorOperator(String filename)(Code)
Waits for the first opened editor with given name. If not active, it is activated.
Parameters:
  filename - name of file showed in the editor (it used to be label of tab)



EditorOperator
public EditorOperator(String filename, int index)(Code)
Waits for index-th opened editor with given name. If not active, it is activated.
Parameters:
  filename - name of file showed in the editor (it used to be label of tab)
Parameters:
  index - index of editor to be find



EditorOperator
public EditorOperator(ContainerOperator contOper, String filename)(Code)
Waits for first open editor with given name in specified container. If not active, it is activated.
Parameters:
  contOper - container where to search
Parameters:
  filename - name of file showed in the editor (it used to be label of tab)



EditorOperator
public EditorOperator(ContainerOperator contOper, String filename, int index)(Code)
Waits for index-th opened editor with given name in specified container. If not active, it is activated.
Parameters:
  contOper - container where to search
Parameters:
  filename - name of file showed in the editor (it used to be label of tab)
Parameters:
  index - index of editor to be find




Method Detail
cboQuickBrowse
public JComboBoxOperator cboQuickBrowse()(Code)
Returns operator of combo box showing members of the class. It is applicable only for Java objects. JComboBoxOperator instance of members combo box



close
public void close(boolean save)(Code)
Closes this editor by IDE API call and depending on given flag it saves or discards changes.
Parameters:
  save - true - save changes, false - discard changes



close
static void close(TopComponent tc, boolean save)(Code)
Closes top component. It saves it or not depending on given flag. Other top components like VCS outputs are closed directly. It is package private because it is also used by EditorWindowOperator.



closeAndCancelByPopup
public void closeAndCancelByPopup()(Code)



closeDiscardAll
public static void closeDiscardAll()(Code)
Closes all opened documents and discards all changes by IDE API calls. It works also if no file is modified, so it is a safe way how to close documents and no block further execution.



contains
public boolean contains(String text)(Code)
Checks if editor window contains text specified as parameter text.
Parameters:
  text - text to compare to true if text was found, false otherwise



delete
public void delete(int offset, int length)(Code)
Deletes given number of characters from specified possition. Position of caret will not change.
Parameters:
  offset - position inside document (0 means the beginning)
Parameters:
  length - number of characters to be deleted



delete
public void delete(int length)(Code)
Deletes given number of characters from current caret possition. Position of caret will not change.
Parameters:
  length - number of characters to be deleted



delete
public void delete(int lineNumber, int column1, int column2)(Code)
Deletes characters between column1 and column2 (both are included) on the specified line.
Parameters:
  lineNumber - number of line (beggining from 1)
Parameters:
  column1 - column position where to start deleting (beggining from 1)
Parameters:
  column2 - column position where to stop deleting (beggining from 1)



deleteLine
public void deleteLine(int line)(Code)
Delete specified line. Position of caret will not change.
Parameters:
  line - number of line (beggining from 1)



getAnnotationShortDescription
public static String getAnnotationShortDescription(Object annotation)(Code)
Returns a short description of annotation. It is localized.
Parameters:
  annotation - instance of org.openide.text.Annotation a short description of annotation according to current locale



getAnnotationType
public static String getAnnotationType(Object annotation)(Code)
Returns a string uniquely identifying annotation. For editor bookmark it is for example org.netbeans.modules.editor.NbEditorKit.BOOKMARK_ANNOTATION_TYPE.
Parameters:
  annotation - instance of org.openide.text.Annotation a string uniquely identifying annotation
See Also:   EditorOperator.getAnnotations()
See Also:   EditorOperator.getAnnotations(int)



getAnnotations
public Object[] getAnnotations(int lineNumber)(Code)
Gets an array of annotations attached to given line.
Parameters:
  lineNumber - number of line (beggining from 1) an array of org.openide.text.Annotation instances
See Also:   EditorOperator.getAnnotationShortDescription
See Also:   EditorOperator.getAnnotationType



getAnnotations
public Object[] getAnnotations()(Code)
Gets all annotations for current editor (Document). array of org.openide.text.Annotation containing all annotationsattached to this editor.
See Also:   EditorOperator.getAnnotationShortDescription
See Also:   EditorOperator.getAnnotationType



getLineNumber
public int getLineNumber()(Code)
Returns current line number. number of line where the caret stays (first line == 1)



getText
public String getText()(Code)
Gets text from the currently opened Editor window. a string representing whole content of the Editor window(including new line characters)



getText
public String getText(int lineNumber)(Code)
Gets text from specified line. It might fail on the last line of a file because of issues http://www.netbeans.org/issues/show_bug.cgi?id=24434 and http://www.netbeans.org/issues/show_bug.cgi?id=24433.
Parameters:
  lineNumber - number of line (beggining from 1) a string representing content of the line including new linecharacter



getToolbarButton
public JButtonOperator getToolbarButton(String buttonTooltip)(Code)
Return JButtonOperator representing a toolbar button found by given tooltip within the Source Editor.
Parameters:
  buttonTooltip - tooltip of toolbar button JButtonOperator instance of found toolbar button



getToolbarButton
public JButtonOperator getToolbarButton(int index)(Code)
Return JButtonOperator representing index-th toolbar button within the Source Editor.
Parameters:
  index - index of toolbar button to find JButtonOperator instance of found toolbar button



insert
public void insert(String text)(Code)
Inserts text to current position. Caret will stand at the end of newly inserted text.
Parameters:
  text - a string to be inserted



insert
public void insert(String text, int lineNumber, int column)(Code)
Inserts text to position specified by line number and column. Caret will stand at the end of newly inserted text.
Parameters:
  text - a string to be inserted
Parameters:
  lineNumber - number of line (beggining from 1)
Parameters:
  column - column position (beggining from 1)



isModified
public boolean isModified()(Code)
Returns current modify state of edited source boolean true when edited source is modified



lblInputMode
public JLabelOperator lblInputMode()(Code)
Returns operator of label showing current input mode (INS/OVR - insert/overwrite). JLabelOperator instance of input mode label



lblRowColumn
public JLabelOperator lblRowColumn()(Code)
Returns operator of label showing current row and column at the left corner of the Source Editor window. JLabelOperator instance of row:column label



lblStatusBar
public JLabelOperator lblStatusBar()(Code)
Returns operator of status bar at the bottom of the Source Editor. JLabelOperator instance of status bar



pushDownArrowKey
public void pushDownArrowKey()(Code)
Pushes Down key (KeyEvent.VK_DOWN)



pushEndKey
public void pushEndKey()(Code)
Pushes End key (KeyEvent.VK_END)



pushHomeKey
public void pushHomeKey()(Code)
Pushes Home key (KeyEvent.VK_HOME)



pushKey
public void pushKey(int keyCode)(Code)
Pushes key of requested key code.



pushTabKey
public void pushTabKey()(Code)
Pushes Tab key (KeyEvent.VK_TAB)



pushToolbarPopupMenu
public void pushToolbarPopupMenu(String popupPath)(Code)
Pushes popup menu on toolbar. It doesn't matter on which position it is invoked, everytime it is the same. That's why popup menu is invoked on the toolbar button with index 0. To switch toolbar on use Options -> Editing -> Editor Settings -> Toolbar Visible -> true.
Parameters:
  popupPath - path to menu item (e.g. "Toolbar Visible")



pushUpArrowKey
public void pushUpArrowKey()(Code)
Pushes Up key (KeyEvent.VK_UP)



replace
public void replace(String oldText, String newText)(Code)
Replaces first occurence of oldText by newText.
Parameters:
  oldText - text to be replaced
Parameters:
  newText - text to write instead



replace
public void replace(String oldText, String newText, int index)(Code)
Replaced index-th occurence of oldText by newText.
Parameters:
  oldText - text to be replaced
Parameters:
  newText - text to write instead
Parameters:
  index - index of oldText occurence (first occurence has index 0)



save
public void save()(Code)
Performs save action with optional verification.



select
public void select(int lineNumber)(Code)
Selects whole line specified by its number. Caret will stand at the next available line.
Parameters:
  lineNumber - number of line (beggining from 1)



select
public void select(int line1, int line2)(Code)
Selects text between line1 and line2 (both are included). Caret will stand behing the selection (at the next line if available).
Parameters:
  line1 - number of line where to begin (beggining from 1)
Parameters:
  line2 - number of line where to finish (beggining from 1)



select
public void select(int lineNumber, int column1, int column2)(Code)
Selects text in specified line on position defined by column1 and column2 (both are included). Caret will stand at the end of the selection.
Parameters:
  lineNumber - number of line (beggining from 1)
Parameters:
  column1 - column position where selection starts (beggining from 1)
Parameters:
  column2 - column position where selection ends (beggining from 1)



select
public void select(String text, int index)(Code)
Selects index-th occurence of given text.
Parameters:
  text - text to be selected
Parameters:
  index - index of text occurence (first occurence has index 0)
See Also:   EditorOperator.select(String)



select
public void select(String text)(Code)
Selects first occurence of given text.
Parameters:
  text - text to be selected
See Also:   EditorOperator.select(String,int)



setCaretPosition
public void setCaretPosition(int lineNumber, int column)(Code)
Sets caret position to specified line and column
Parameters:
  lineNumber - line number where to set caret
Parameters:
  column - column where to set caret (1 means beginning of the row)



setCaretPosition
public void setCaretPosition(int position)(Code)
Sets caret to desired position.
Parameters:
  position - a position to set caret to (number of characters fromthe beggining of the file - 0 means beginning of the file).



setCaretPosition
public void setCaretPosition(String text, int index, boolean before)(Code)
Sets caret position before or after index-th occurence of given string.
Parameters:
  text - text to be searched
Parameters:
  index - index of text occurence (first occurence has index 0)
Parameters:
  before - if true put caret before text, otherwise after.



setCaretPosition
public void setCaretPosition(String text, boolean before)(Code)
Sets caret position before or after first occurence of given string.
Parameters:
  text - text to be searched
Parameters:
  before - if true put caret before text, otherwise after.



setCaretPositionRelative
public void setCaretPositionRelative(int relativeMove)(Code)
Sets caret position relatively to current position.
Parameters:
  relativeMove - count of charaters to move caret



setCaretPositionToEndOfLine
public void setCaretPositionToEndOfLine(int lineNumber)(Code)
Sets caret position to the end of specified line. Lines are numbered from 1, so setCaretPosition(1) will set caret to the end of the first line.
Parameters:
  lineNumber - number of line (beggining from 1)



setCaretPositionToLine
public void setCaretPositionToLine(int lineNumber)(Code)
Sets caret position to the beginning of specified line. Lines are numbered from 1, so setCaretPosition(1) will set caret to the beginning of the first line.
Parameters:
  lineNumber - number of line (beggining from 1)



setQuickBrowse
public void setQuickBrowse(String item)(Code)
Selects item in quick browse combo box.
Parameters:
  item - itme to be selected



txtEditorPane
public JEditorPaneOperator txtEditorPane()(Code)
Returns operator of currently shown editor pane. JTabbedPaneOperator instance of editor pane



verify
public void verify()(Code)
Performs verification by accessing all sub-components



waitModified
public void waitModified(boolean modified)(Code)
Waits for given modified state of edited source.
Parameters:
  modified - boolean true waits for file state change to modified, false for change tounmodified (saved).Throws TimeoutExpiredException when EditorOperator.WaitModifiedTimeout expires.



Methods inherited from org.netbeans.modules.visualweb.gravy.TopComponentOperator
public void close()(Code)(Java Doc)
public void closeDiscard()(Code)(Java Doc)
protected static JComponent findTopComponent(ContainerOperator cont, String name, int index, ComponentChooser subchooser)(Code)(Java Doc)
public void save()(Code)(Java Doc)
public void waitClosed()(Code)(Java Doc)
protected static JComponent waitTopComponent(String name, int index)(Code)(Java Doc)
protected static JComponent waitTopComponent(ContainerOperator cont, String name, int index, ComponentChooser subchooser)(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.