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


java.awt.Rectangle
   org.netbeans.modules.visualweb.text.DesignerCaret

DesignerCaret
class DesignerCaret extends Rectangle implements FocusListener,MouseListener,MouseMotionListener(Code)
Caret to use in flow mode editing in the designer. Derived from Swing's DesignerCaret code but changed integer dot/mark based code to use DOM Range objects, changed document update semantics, and mouse operations since we can't blindly listen for mouse clicks we have to take directions from the SelectionManager.
author:
   Timothy Prinzing
author:
   Tor Norbye

Inner Class :class SafeScroller implements Runnable
Inner Class :class Handler implements ActionListener,ClipboardOwner,DomDocumentListener

Field Summary
 booleanasync
     flag to indicate if async updates should move the caret.
 DesignerPaneBasecomponent
    
 booleanflashOn
    
 Timerflasher
    
 PointmagicCaretPosition
    
 DomRangerange
    
 ObjectselectionTag
    
 booleanselectionVisible
    
 booleanvisible
    

Constructor Summary
public  DesignerCaret()
     Constructs a default caret.

Method Summary
protected  voidadjustVisibility(Rectangle nloc)
     Scrolls the associated view (if necessary) to make the caret visible.
 voidchangeCaretPosition(DomPosition dot)
     Sets the caret position (dot) to a new location.
protected synchronized  voiddamage(Rectangle r)
     Damages the area surrounding the caret to cause it to be repainted in a new location.
public  voiddeinstall(DesignerPaneBase c)
     Called when the UI is being removed from the interface of a JTextComponent.
public  voiddetachDom()
    
public  booleanequals(Object obj)
     Compares this object to the specified object.
public  voidfocusGained(FocusEvent e)
     Called when the component containing the caret gains focus.
public  voidfocusLost(FocusEvent e)
     Called when the component containing the caret loses focus.
 booleangetAsynchronousMovement()
     Get the flag that determines whether or not asynchronous updates will move the caret.
public  intgetBlinkRate()
     Gets the caret blink rate. the delay in milliseconds.
final protected  DesignerPaneBasegetComponent()
     Gets the text editor component that this caret is is bound to.
public  DomPositiongetDot()
     Fetches the current position of the caret.
public  DomPositiongetFirstPosition()
     Return the first endpoint of the range in the document.
public  DomPositiongetLastPosition()
     Return the second/last endpoint of the range in the document.
public  PointgetMagicCaretPosition()
     Gets the saved caret position.
public  DomPositiongetMark()
     Fetches the current position of the mark.
public  DomRangegetRange()
    
 StringgetSelectedText()
    
 voidhandleMoveDot(DomPosition dot)
    
 voidhandleSetDot(DomPosition dot)
    
public  booleanhasSelection()
     Return true iff we have a selection - or put differently, if the dot is at a different location than the mark.
public  voidinstall(DesignerPaneBase c)
     Called when the UI is being installed into the interface of a JTextComponent.
public  booleanisReadOnlyRegion()
    
public  booleanisSelectionVisible()
     Checks whether the current selection is visible.
public  booleanisVisible()
     Determines if the caret is currently visible.
public  voidmouseClicked(MouseEvent e)
     Called when the mouse is clicked.
public  voidmouseDragged(MouseEvent e)
     Moves the caret position according to the mouse pointer's current location.
public  voidmouseEntered(MouseEvent e)
     Called when the mouse enters a region.
public  voidmouseExited(MouseEvent e)
     Called when the mouse exits a region.
public  voidmouseMoved(MouseEvent e)
     Called when the mouse is moved.
public  voidmousePressed(MouseEvent e)
     If button 1 is pressed, this is implemented to request focus on the associated text component, and to set the caret position.
public  voidmouseReleased(MouseEvent e)
     Called when the mouse is released.
public  voidmoveDot(DomPosition dot)
     Moves the caret position to some other position.
public  voidpaint(Graphics g)
     Renders the caret as a vertical line.
public  booleanremoveNextChar()
    
public  booleanremovePreviousChar()
    
 voidremoveSelection()
    
final protected synchronized  voidrepaint()
     Cause the caret to be painted.
 voidrepaintNewCaret()
     Repaints the new caret position, with the assumption that this is happening on the event thread so that calling modelToView is safe.
final protected synchronized  voidrepaintSelection()
     Cause the selection region to be painted.
 booleanreplaceSelection(String content)
    
 voidsetAsynchronousMovement(boolean m)
     Set the flag that determines whether or not asynchronous updates will move the caret.
public  voidsetBlinkRate(int rate)
     Sets the caret blink rate.
public  voidsetDot(DomPosition dot)
     Sets the caret position and mark to some position.
public  voidsetMagicCaretPosition(Point p)
     Saves the current caret position.
public  voidsetSelectionVisible(boolean vis)
     Changes the selection visibility.
public  voidsetVisible(boolean e)
     Sets the caret visibility, and repaints the caret.
public  StringtoString()
    

Field Detail
async
boolean async(Code)
flag to indicate if async updates should move the caret.



component
DesignerPaneBase component(Code)



flashOn
boolean flashOn(Code)



flasher
Timer flasher(Code)



magicCaretPosition
Point magicCaretPosition(Code)



range
DomRange range(Code)



selectionTag
Object selectionTag(Code)



selectionVisible
boolean selectionVisible(Code)



visible
boolean visible(Code)




Constructor Detail
DesignerCaret
public DesignerCaret()(Code)
Constructs a default caret.




Method Detail
adjustVisibility
protected void adjustVisibility(Rectangle nloc)(Code)
Scrolls the associated view (if necessary) to make the caret visible. Since how this should be done is somewhat of a policy, this method can be reimplemented to change the behavior. By default the scrollRectToVisible method is called on the associated component.
Parameters:
  nloc - the new position to scroll to



changeCaretPosition
void changeCaretPosition(DomPosition dot)(Code)
Sets the caret position (dot) to a new location. This causes the old and new location to be repainted. It also makes sure that the caret is within the visible region of the view, if the view is scrollable.



damage
protected synchronized void damage(Rectangle r)(Code)
Damages the area surrounding the caret to cause it to be repainted in a new location. If paint() is reimplemented, this method should also be reimplemented. This method should update the caret bounds (x, y, width, and height).
Parameters:
  r - the current location of the caret
See Also:   DesignerCaret.paint



deinstall
public void deinstall(DesignerPaneBase c)(Code)
Called when the UI is being removed from the interface of a JTextComponent. This is used to unregister any listeners that were attached.
Parameters:
  c - the component



detachDom
public void detachDom()(Code)
Notify caret that the range it is attached to is no longer valid



equals
public boolean equals(Object obj)(Code)
Compares this object to the specified object. The superclass behavior of comparing rectangles is not desired, so this is changed to the Object behavior.
Parameters:
  obj - the object to compare this font with true if the objects are equal; false otherwise



focusGained
public void focusGained(FocusEvent e)(Code)
Called when the component containing the caret gains focus. This is implemented to set the caret to visible if the component is editable.
Parameters:
  e - the focus event
See Also:   FocusListener.focusGained



focusLost
public void focusLost(FocusEvent e)(Code)
Called when the component containing the caret loses focus. This is implemented to set the caret to visibility to false.
Parameters:
  e - the focus event
See Also:   FocusListener.focusLost



getAsynchronousMovement
boolean getAsynchronousMovement()(Code)
Get the flag that determines whether or not asynchronous updates will move the caret. Normally the caret is moved by events from the event thread such as mouse or keyboard events. Changes from another thread might be used to load a file, or show changes from another user. This flag determines whether those changes will move the caret.



getBlinkRate
public int getBlinkRate()(Code)
Gets the caret blink rate. the delay in milliseconds. If this is zero the caret will not blink.



getComponent
final protected DesignerPaneBase getComponent()(Code)
Gets the text editor component that this caret is is bound to. the component



getDot
public DomPosition getDot()(Code)
Fetches the current position of the caret. The caret dot position is always a source position. the position >= 0



getFirstPosition
public DomPosition getFirstPosition()(Code)
Return the first endpoint of the range in the document. This is always a source position.



getLastPosition
public DomPosition getLastPosition()(Code)
Return the second/last endpoint of the range in the document. This is always a source position.



getMagicCaretPosition
public Point getMagicCaretPosition()(Code)
Gets the saved caret position. the position see #setMagicCaretPosition



getMark
public DomPosition getMark()(Code)
Fetches the current position of the mark. If there is a selection, the dot and mark will not be the same. The caret mark position is always a source position. the position >= 0



getRange
public DomRange getRange()(Code)



getSelectedText
String getSelectedText()(Code)



handleMoveDot
void handleMoveDot(DomPosition dot)(Code)



handleSetDot
void handleSetDot(DomPosition dot)(Code)



hasSelection
public boolean hasSelection()(Code)
Return true iff we have a selection - or put differently, if the dot is at a different location than the mark.



install
public void install(DesignerPaneBase c)(Code)
Called when the UI is being installed into the interface of a JTextComponent. This can be used to gain access to the model that is being navigated by the implementation of this interface. Sets the dot and mark to 0, and establishes document, property change, focus, mouse, and mouse motion listeners.
Parameters:
  c - the component



isReadOnlyRegion
public boolean isReadOnlyRegion()(Code)
Return true iff the caret is within a read only region



isSelectionVisible
public boolean isSelectionVisible()(Code)
Checks whether the current selection is visible. true if the selection is visible



isVisible
public boolean isVisible()(Code)
Determines if the caret is currently visible. true if visible else false



mouseClicked
public void mouseClicked(MouseEvent e)(Code)
Called when the mouse is clicked. If the click was generated from button1, a double click selects a word, and a triple click the current line.
Parameters:
  e - the mouse event
See Also:   MouseListener.mouseClicked



mouseDragged
public void mouseDragged(MouseEvent e)(Code)
Moves the caret position according to the mouse pointer's current location. This effectively extends the selection. By default, this is only done for mouse button 1.
Parameters:
  e - the mouse event
See Also:   MouseMotionListener.mouseDragged



mouseEntered
public void mouseEntered(MouseEvent e)(Code)
Called when the mouse enters a region.
Parameters:
  e - the mouse event
See Also:   MouseListener.mouseEntered



mouseExited
public void mouseExited(MouseEvent e)(Code)
Called when the mouse exits a region.
Parameters:
  e - the mouse event
See Also:   MouseListener.mouseExited



mouseMoved
public void mouseMoved(MouseEvent e)(Code)
Called when the mouse is moved.
Parameters:
  e - the mouse event
See Also:   MouseMotionListener.mouseMoved



mousePressed
public void mousePressed(MouseEvent e)(Code)
If button 1 is pressed, this is implemented to request focus on the associated text component, and to set the caret position. If the shift key is held down, the caret will be moved, potentially resulting in a selection, otherwise the caret position will be set to the new location. If the component is not enabled, there will be no request for focus.
Parameters:
  e - the mouse event
See Also:   MouseListener.mousePressed



mouseReleased
public void mouseReleased(MouseEvent e)(Code)
Called when the mouse is released.
Parameters:
  e - the mouse event
See Also:   MouseListener.mouseReleased



moveDot
public void moveDot(DomPosition dot)(Code)
Moves the caret position to some other position.
Parameters:
  dot - the position >= 0



paint
public void paint(Graphics g)(Code)
Renders the caret as a vertical line. If this is reimplemented the damage method should also be reimplemented as it assumes the shape of the caret is a vertical line. Sets the caret color to the value returned by getCaretColor().


Parameters:
  g - the graphics context
See Also:   DesignerCaret.damage




removeNextChar
public boolean removeNextChar()(Code)



removePreviousChar
public boolean removePreviousChar()(Code)



removeSelection
void removeSelection()(Code)



repaint
final protected synchronized void repaint()(Code)
Cause the caret to be painted. The repaint area is the bounding box of the caret (i.e. the caret rectangle or this).

This method is thread safe, although most Swing methods are not. Please see Threads and Swing for more information.




repaintNewCaret
void repaintNewCaret()(Code)
Repaints the new caret position, with the assumption that this is happening on the event thread so that calling modelToView is safe.



repaintSelection
final protected synchronized void repaintSelection()(Code)
Cause the selection region to be painted.



replaceSelection
boolean replaceSelection(String content)(Code)



setAsynchronousMovement
void setAsynchronousMovement(boolean m)(Code)
Set the flag that determines whether or not asynchronous updates will move the caret. Normally the caret is moved by events from the event thread such as mouse or keyboard events. Changes from another thread might be used to load a file, or show changes from another user. This flag determines whether those changes will move the caret.
Parameters:
  m - move the caret on asynchronous updates if true.



setBlinkRate
public void setBlinkRate(int rate)(Code)
Sets the caret blink rate.
Parameters:
  rate - the rate in milliseconds, 0 to stop blinking



setDot
public void setDot(DomPosition dot)(Code)
Sets the caret position and mark to some position. This implicitly sets the selection range to zero.
Parameters:
  dot - the position >= 0



setMagicCaretPosition
public void setMagicCaretPosition(Point p)(Code)
Saves the current caret position. This is used when caret up/down actions occur, moving between lines that have uneven end positions.
Parameters:
  p - the position
See Also:   DesignerCaret.getMagicCaretPosition



setSelectionVisible
public void setSelectionVisible(boolean vis)(Code)
Changes the selection visibility.
Parameters:
  vis - the new visibility



setVisible
public void setVisible(boolean e)(Code)
Sets the caret visibility, and repaints the caret.
Parameters:
  e - the visibility specifier



toString
public String toString()(Code)



Fields inherited from java.awt.Rectangle
public int height(Code)(Java Doc)
public int width(Code)(Java Doc)
public int x(Code)(Java Doc)
public int y(Code)(Java Doc)

Methods inherited from java.awt.Rectangle
public void add(int newx, int newy)(Code)(Java Doc)
public void add(Point pt)(Code)(Java Doc)
public void add(Rectangle r)(Code)(Java Doc)
public boolean contains(Point p)(Code)(Java Doc)
public boolean contains(int x, int y)(Code)(Java Doc)
public boolean contains(Rectangle r)(Code)(Java Doc)
public boolean contains(int X, int Y, int W, int H)(Code)(Java Doc)
public Rectangle2D createIntersection(Rectangle2D r)(Code)(Java Doc)
public Rectangle2D createUnion(Rectangle2D r)(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
public Rectangle getBounds()(Code)(Java Doc)
public Rectangle2D getBounds2D()(Code)(Java Doc)
public double getHeight()(Code)(Java Doc)
public Point getLocation()(Code)(Java Doc)
public Dimension getSize()(Code)(Java Doc)
public double getWidth()(Code)(Java Doc)
public double getX()(Code)(Java Doc)
public double getY()(Code)(Java Doc)
public void grow(int h, int v)(Code)(Java Doc)
public boolean inside(int X, int Y)(Code)(Java Doc)
public Rectangle intersection(Rectangle r)(Code)(Java Doc)
public boolean intersects(Rectangle r)(Code)(Java Doc)
public boolean isEmpty()(Code)(Java Doc)
public void move(int x, int y)(Code)(Java Doc)
public int outcode(double x, double y)(Code)(Java Doc)
public void reshape(int x, int y, int width, int height)(Code)(Java Doc)
public void resize(int width, int height)(Code)(Java Doc)
public void setBounds(Rectangle r)(Code)(Java Doc)
public void setBounds(int x, int y, int width, int height)(Code)(Java Doc)
public void setLocation(Point p)(Code)(Java Doc)
public void setLocation(int x, int y)(Code)(Java Doc)
public void setRect(double x, double y, double width, double height)(Code)(Java Doc)
public void setSize(Dimension d)(Code)(Java Doc)
public void setSize(int width, int height)(Code)(Java Doc)
public String toString()(Code)(Java Doc)
public void translate(int dx, int dy)(Code)(Java Doc)
public Rectangle union(Rectangle r)(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.