|
Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference 11g Release 1 (11.1.1.9.0) E52944-01 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object
java.awt.geom.RectangularShape
java.awt.geom.Rectangle2D
java.awt.Rectangle
javax.swing.text.DefaultCaret
oracle.javatools.editor.BasicCaret
public class BasicCaret
A BasicCaret
extends the DefaultCaret to modify the default behavior about the visibility of the selection, and other extra features.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.awt.geom.Rectangle2D |
---|
java.awt.geom.Rectangle2D.Double, java.awt.geom.Rectangle2D.Float |
Field Summary | |
---|---|
static java.lang.String |
CARET_BLINK_RATE The property name for the blink rate of the caret. |
static java.lang.String |
CARET_COLOR The property name for the color of the caret. |
static int |
CARET_DOUBLE_UNDER_BAR The constant for the double-thickness under bar caret shape. |
static int |
CARET_DOUBLE_VERTICAL_BAR The constant for the double-thickness vertical bar caret shape. |
static int |
CARET_EDITOR_SELECTION_COLUMNS The type of editor selection which includes character obeying the following rules: 1 - The character between the line containing the first selection mark and the line containing the last selection mark (inclusive). |
static java.lang.String |
CARET_EDITOR_SELECTION_TYPE The property name for the type of selection the editor (e.g. |
static int |
CARET_EDITOR_SELECTION_WRAP The type of editor selection which runs from the very first character in the selection start to the very end containing all characters in between (inclusive). |
static java.lang.String |
CARET_ENABLE_BLINK The property name for whether the caret should blink. |
static int |
CARET_OUTLINE_BOX The constant for the outline box caret shape. |
static int |
CARET_QUAD_UNDER_BAR The constant for the quad-thickness under bar caret shape. |
static int |
CARET_QUAD_VERTICAL_BAR The constant for the quad-thickness vertical bar caret shape. |
static java.lang.String |
CARET_RIGHT_CLICK_SELECTION The property name for whether right-click will position the caret when clicking outside of a selection. |
static java.lang.String |
CARET_SHAPE_INSERT The property name for the caret shape in insert mode. |
static java.lang.String |
CARET_SHAPE_OVERWRITE The property name for the caret shape in ovewrite mode. |
static int |
CARET_SOLID_BOX The constant for the solid box caret shape. |
static int |
CARET_TRIPLE_UNDER_BAR The constant for the triple-thickness under bar caret shape. |
static int |
CARET_TRIPLE_VERTICAL_BAR The constant for the triple-thickness vertical bar caret shape. |
static int |
CARET_UNDER_BAR The constant for the single-thickness under bar caret shape. |
static int |
CARET_VERTICAL_BAR The constant for the single-thickness vertical bar caret shape. |
static java.lang.String |
CARET_XOR_PAINTING The property name for whether the caret should use xor painting or regular painting. |
static java.lang.String |
HIGHLIGHT_SELECTION_NAME The name of the selection highlight style. |
protected int |
lastClickCount Stores the click count from the last mousePressed event. |
protected int |
lastClickOffset Stores the offset from the first mousePressed event. |
Fields inherited from class javax.swing.text.DefaultCaret |
---|
ALWAYS_UPDATE, changeEvent, listenerList, NEVER_UPDATE, UPDATE_WHEN_ON_EDT |
Fields inherited from class java.awt.Rectangle |
---|
height, width, x, y |
Fields inherited from class java.awt.geom.Rectangle2D |
---|
OUT_BOTTOM, OUT_LEFT, OUT_RIGHT, OUT_TOP |
Fields inherited from interface oracle.javatools.buffer.TextBufferListener |
---|
EOL_TYPE_ATTRIBUTE, MODIFIED_ATTRIBUTE, READ_ONLY_ATTRIBUTE, RELOAD_END_ATTRIBUTE, RELOAD_START_ATTRIBUTE |
Constructor Summary | |
---|---|
BasicCaret() Creates a new instance of the BasicCaret. |
Method Summary | |
---|---|
protected void |
adjustCaretPosition(java.awt.event.MouseEvent event) Utility routine to adjust the caret position based on the given mouse event. |
protected void |
adjustVisibility(java.awt.Rectangle newRect) Scrolls the associated view (if necessary) to make the caret visible. |
void |
attributeUpdate(TextBuffer buffer, int attribute) Provides notification regarding a change to one of the buffer attributes. |
protected void |
damage(java.awt.Rectangle r) This damages the area surrounding the caret to cause it to be repainted in the a new location. |
void |
deinstall(javax.swing.text.JTextComponent component) Called when the UI is being removed from the interface of a JTextComponent. |
protected void |
fireStateChanged() Notifies all listeners that have registered interest for notification on this event type. |
void |
focusGained(java.awt.event.FocusEvent event) Called when the component containing the caret gains focus. |
ActionInvoker |
getActionInvoker() Fetches the action invoker to use to execute some particular action. |
protected java.awt.Rectangle |
getCaretInsets(java.awt.Rectangle caretRect) Using the specified caretRectangle, fetch a new rectangle that includes the caret visible insets around it. |
EditorSelection |
getEditorSelection() The caret can work with different types of selection models. |
boolean |
getInsertMode() Fetches whether the caret is currently in insert mode or overwrite mode. |
protected int |
getOffsetForMouseEvent(java.awt.event.MouseEvent event) Utility routine to fetch the editor offset most closely associated with an X-Y point in the given mouse event. |
void |
insertUpdate(TextBuffer buffer, int offset, int count, char[] insertedData) Provides notification about an insertion into the text buffer. |
void |
install(javax.swing.text.JTextComponent component) Called when the UI is being installed into the interface of a JTextComponent. |
protected boolean |
isPressInSelection(java.awt.event.MouseEvent event) Utility routine to check if the given mouse event is within the current selection. |
void |
mouseClicked(java.awt.event.MouseEvent event) Called when the mouse is clicked. |
void |
mouseDragged(java.awt.event.MouseEvent event) Invoked when the mouse button has been pressed and dragged. |
void |
mousePressed(java.awt.event.MouseEvent event) Invoked when a mouse button has been pressed on a component. |
void |
mouseReleased(java.awt.event.MouseEvent event) Invoked when a mouse button has been released on a component. |
protected void |
moveCaret(java.awt.event.MouseEvent event) Tries to move the position of the caret from the coordinates of a mouse event, using viewToModel(). |
void |
moveDot(int dot) Moves the caret position to some other position. |
void |
paint(java.awt.Graphics g) Paints the caret. |
protected void |
positionCaret(java.awt.event.MouseEvent event) Tries to set the position of the caret from the coordinates of a mouse event, using viewToModel(). |
void |
propertyChange(java.beans.PropertyChangeEvent event) This method gets called when a bound property is changed. |
void |
removeUpdate(TextBuffer buffer, int offset, int count, char[] removedData) Provides notification about a removal from the text buffer. |
void |
setDot(int dot) Sets the caret position and mark to some position. |
void |
setEditorSelection(EditorSelection newEditorSelection) Change the selection model used by this caret. |
void |
setInsertMode(boolean insertMode) Changes the caret mode between insert and overwrite mode. |
void |
toggleInsertMode() Toggles the current insert mode. |
void |
updateHighlight() Get the selection highlight to reapply it's highlighs |
Methods inherited from class javax.swing.text.DefaultCaret |
---|
addChangeListener, equals, focusLost, getBlinkRate, getChangeListeners, getComponent, getDot, getDotBias, getListeners, getMagicCaretPosition, getMark, getMarkBias, getSelectionPainter, getUpdatePolicy, isActive, isSelectionVisible, isVisible, mouseEntered, mouseExited, mouseMoved, moveDot, removeChangeListener, repaint, setBlinkRate, setDot, setMagicCaretPosition, setSelectionVisible, setUpdatePolicy, setVisible, toString |
Methods inherited from class java.awt.Rectangle |
---|
add, add, add, contains, contains, contains, contains, createIntersection, createUnion, getBounds, getBounds2D, getHeight, getLocation, getSize, getWidth, getX, getY, grow, inside, intersection, intersects, isEmpty, move, outcode, reshape, resize, setBounds, setBounds, setLocation, setLocation, setRect, setSize, setSize, translate, union |
Methods inherited from class java.awt.geom.Rectangle2D |
---|
add, add, add, contains, contains, getPathIterator, getPathIterator, hashCode, intersect, intersects, intersectsLine, intersectsLine, outcode, setFrame, setRect, union |
Methods inherited from class java.awt.geom.RectangularShape |
---|
clone, contains, contains, getCenterX, getCenterY, getFrame, getMaxX, getMaxY, getMinX, getMinY, intersects, setFrame, setFrame, setFrameFromCenter, setFrameFromCenter, setFrameFromDiagonal, setFrameFromDiagonal |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.awt.Shape |
---|
contains, contains, contains, contains, getPathIterator, getPathIterator, intersects, intersects |
Field Detail |
---|
public static final int CARET_VERTICAL_BAR
public static final int CARET_DOUBLE_VERTICAL_BAR
public static final int CARET_TRIPLE_VERTICAL_BAR
public static final int CARET_QUAD_VERTICAL_BAR
public static final int CARET_UNDER_BAR
public static final int CARET_DOUBLE_UNDER_BAR
public static final int CARET_TRIPLE_UNDER_BAR
public static final int CARET_QUAD_UNDER_BAR
public static final int CARET_OUTLINE_BOX
public static final int CARET_SOLID_BOX
public static final java.lang.String CARET_SHAPE_INSERT
public static final java.lang.String CARET_SHAPE_OVERWRITE
public static final java.lang.String CARET_ENABLE_BLINK
public static final java.lang.String CARET_BLINK_RATE
public static final java.lang.String CARET_COLOR
public static final java.lang.String CARET_XOR_PAINTING
public static final java.lang.String CARET_RIGHT_CLICK_SELECTION
public static final java.lang.String CARET_EDITOR_SELECTION_TYPE
public static final int CARET_EDITOR_SELECTION_WRAP
public static final int CARET_EDITOR_SELECTION_COLUMNS
protected int lastClickCount
protected int lastClickOffset
public static final java.lang.String HIGHLIGHT_SELECTION_NAME
Constructor Detail |
---|
public BasicCaret()
Method Detail |
---|
public void install(javax.swing.text.JTextComponent component)
install
in interface javax.swing.text.Caret
install
in class javax.swing.text.DefaultCaret
component
- the componentpublic void deinstall(javax.swing.text.JTextComponent component)
deinstall
in interface javax.swing.text.Caret
deinstall
in class javax.swing.text.DefaultCaret
component
- the componentprotected void adjustVisibility(java.awt.Rectangle newRect)
adjustVisibility
in class javax.swing.text.DefaultCaret
newRect
- the new position to make visiblepublic void setDot(int dot)
setDot
in interface javax.swing.text.Caret
setDot
in class javax.swing.text.DefaultCaret
dot
- the position >= 0public void moveDot(int dot)
moveDot
in interface javax.swing.text.Caret
moveDot
in class javax.swing.text.DefaultCaret
dot
- the position >= 0protected void fireStateChanged()
fireStateChanged
in class javax.swing.text.DefaultCaret
public void updateHighlight()
public ActionInvoker getActionInvoker()
protected void moveCaret(java.awt.event.MouseEvent event)
We override the default behavior here to take into account whether we are in insert or overwrite mode. If in insert mode, if the user clicks in the right side of a letter, the cursor will go to the right of the letter.
moveCaret
in class javax.swing.text.DefaultCaret
event
- the mouse eventprotected void positionCaret(java.awt.event.MouseEvent event)
We override the default behavior here to take into account whether we are in insert or overwrite mode. If in insert mode, if the user clicks in the right side of a letter, the cursor will go to the right of the letter.
positionCaret
in class javax.swing.text.DefaultCaret
event
- the mouse eventprotected void adjustCaretPosition(java.awt.event.MouseEvent event)
event
- the mouse eventprotected int getOffsetForMouseEvent(java.awt.event.MouseEvent event)
event
- the mouse event that occurredprotected boolean isPressInSelection(java.awt.event.MouseEvent event)
event
- the mouse eventpublic void focusGained(java.awt.event.FocusEvent event)
Overriding default behavior so that the caret is visible even if the buffer is read only.
focusGained
in interface java.awt.event.FocusListener
focusGained
in class javax.swing.text.DefaultCaret
event
- the focus eventFocusListener.focusGained(java.awt.event.FocusEvent)
protected void damage(java.awt.Rectangle r)
damage
in class javax.swing.text.DefaultCaret
r
- the current location of the caretpublic void paint(java.awt.Graphics g)
paint
in interface javax.swing.text.Caret
paint
in class javax.swing.text.DefaultCaret
g
- the graphics contextpublic boolean getInsertMode()
public void setInsertMode(boolean insertMode)
insertMode
- true if setting in insert modepublic void toggleInsertMode()
public EditorSelection getEditorSelection()
public void setEditorSelection(EditorSelection newEditorSelection)
newEditorSelection
-public void mouseClicked(java.awt.event.MouseEvent event)
mouseClicked
in interface java.awt.event.MouseListener
mouseClicked
in class javax.swing.text.DefaultCaret
event
- the mouse eventMouseListener.mouseClicked(java.awt.event.MouseEvent)
public void mouseDragged(java.awt.event.MouseEvent event)
mouseDragged
in interface java.awt.event.MouseMotionListener
mouseDragged
in class javax.swing.text.DefaultCaret
event
- the mouse drag eventpublic void mousePressed(java.awt.event.MouseEvent event)
mousePressed
in interface java.awt.event.MouseListener
mousePressed
in class javax.swing.text.DefaultCaret
event
- the mouse event that occurredpublic void mouseReleased(java.awt.event.MouseEvent event)
mouseReleased
in interface java.awt.event.MouseListener
mouseReleased
in class javax.swing.text.DefaultCaret
event
- the mouse event that occurredpublic void propertyChange(java.beans.PropertyChangeEvent event)
propertyChange
in interface java.beans.PropertyChangeListener
event
- A PropertyChangeEvent object describing the event source and the property that has changed.public void insertUpdate(TextBuffer buffer, int offset, int count, char[] insertedData)
insertUpdate
in interface TextBufferListener
buffer
-offset
- the offset where the insert took placecount
- the number of characters inserted (insertedData.length)insertedData
- the contents of the insertionpublic void removeUpdate(TextBuffer buffer, int offset, int count, char[] removedData)
removeUpdate
in interface TextBufferListener
buffer
-offset
- the offset where the removal took placecount
- the number of characters removed (removedData.length)removedData
- the contents of the removalpublic void attributeUpdate(TextBuffer buffer, int attribute)
attributeUpdate
in interface TextBufferListener
buffer
-attribute
- the attribute that changedprotected java.awt.Rectangle getCaretInsets(java.awt.Rectangle caretRect)
caretRect
- the caret rectangle
|
Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference 11g Release 1 (11.1.1.9.0) E52944-01 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |