|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.raelity.jvi.swing.TextView
public class TextView
Presents a swing editor interface for use with vi. There is one of these for each JEditorPane;
Notice the listeners for caret changes. If the caret changes to a location that is unexpected, i.e. it came from some external source, then an externalChange message is sent to vi.
The getEditorComponent method should not be used by the primary vi software. The primary vi software should only access, or make changes to, the underlying JEditorPane through other methods in this class.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface com.raelity.jvi.ViTextView |
|---|
ViTextView.FOLDOP, ViTextView.JLOP, ViTextView.MARKOP, ViTextView.NLOP, ViTextView.TABOP, ViTextView.TAGOP, ViTextView.WMOP |
| Field Summary | |
|---|---|
protected DefaultBuffer |
buf
|
protected TextViewCache |
cache
|
protected JEditorPane |
editorPane
|
protected int |
expectedCaretPosition
|
protected int |
mygen
|
protected TextOps |
ops
|
protected ViStatusDisplay |
statusDisplay
|
boolean |
w_p_nu
jVi doesn't support this flag. |
protected Window |
window
|
| Constructor Summary | |
|---|---|
TextView(JEditorPane editorPane)
|
|
| Method Summary | |
|---|---|
void |
activateOptions(ViTextView tv)
This is invoked when switchto bag's associated editor. |
void |
anonymousMark(ViTextView.MARKOP op,
int count)
Anonymous mark handling. |
protected void |
applyBackground(int[] blocks,
MutableAttributeSet mas)
|
void |
attach()
establish all the listeners |
void |
clearSelect()
clear the select, if any, on the screen, don't move the caret |
int |
coladvanceCoord(int lineOffset,
int colIdx)
|
void |
computeCursorPosition(int offset,
MutableInt line,
MutableInt column)
|
void |
computeCursorPosition(MutableInt offset,
MutableInt line,
MutableInt column)
Determine cursor position, all args get set (call by reference). |
protected void |
createOps(JEditorPane editorPane)
Create methods to invoke and interact with editor pane actions. |
protected ViStatusDisplay |
createStatusDisplay()
Override this class to provide a different implementations of status display. |
protected TextViewCache |
createTextViewCache()
Override this method to provide different cache implementation |
void |
deleteChar(int start,
int end)
Delete a bunch of characters |
void |
deletePreviousChar()
Delete previous character (backspace). |
void |
detach()
tear down all the listeners |
void |
findMatch()
find matching character for character under the cursor. |
void |
foldOperation(ViTextView.FOLDOP op)
Perform the fold operation. |
void |
foldOperation(ViTextView.FOLDOP op,
int offset)
Perform the fold operation. |
DefaultBuffer |
getBuffer()
|
int |
getBufferLineOffset(int coordLine)
Reverse of getCoordLine, convert coord line to document line |
int |
getCaretPosition()
|
int |
getCoordLine(int line)
|
int |
getCoordLineCount()
|
JEditorPane |
getEditorComponent()
|
ViMark |
getMark(int i)
|
int |
getMarkPosition()
|
TextOps |
getOps()
|
ViMark |
getPCMark()
|
ViMark |
getPrevPCMark()
|
ViStatusDisplay |
getStatusDisplay()
Handle displayable editor state changes |
String |
getText(int offset,
int length)
|
int |
getViewBlankLines()
|
int |
getViewBottomLine()
|
int |
getViewCoordBlankLines()
|
int |
getViewCoordBottomLine()
|
int |
getViewCoordTopLine()
|
int |
getViewLines()
|
int |
getViewTopLine()
|
ViFPOS |
getWCursor()
|
int |
getWCurswant()
|
Window |
getWindow()
|
boolean |
getWPList()
|
int |
getWPScroll()
|
boolean |
getWSetCurswant()
|
void |
insertChar(char c)
insert character at cursor position. |
void |
insertNewLine()
Insert new line at current position |
void |
insertTab()
Insert tab at current position |
void |
insertText(int offset,
String s)
insert text at specified location |
void |
insertTypedChar(char c)
Add a character verbatim to the window. |
boolean |
isEditable()
Can the editor text be changed |
boolean |
isShutdown()
|
void |
jumpDefinition(String ident)
Jump to the definition of the identifier under the cursor. |
void |
jumpList(ViTextView.JLOP op,
int count)
Jump list handling |
boolean |
openNewLine(ViTextView.NLOP op)
Create an empty line, autoindented, either before or after current line. |
void |
pushPCMark()
|
void |
redo()
redo a change |
void |
replaceChar(char c,
boolean advanceCursor)
Replace character at current cursor location with argument character |
void |
replaceString(int start,
int end,
String s)
Replace indicated region with string |
void |
scroll(int n_lines)
Scroll down (n_lines positive) or up (n_lines negative) the specified number of lines. |
void |
setCaretPosition(int offset)
set the caret to the indicated position. |
void |
setCaretPosition(int lnum,
int col)
set the caret to the indicated position. |
void |
setCursorCoordLine(int coordLine,
int col)
|
void |
setSelect(int dot,
int mark)
select a region of the screen |
void |
setViewCoordTopLine(int coordLine)
cause the idndicated line to be displayed as top line in view. |
void |
setViewTopLine(int line)
cause the idndicated line to be displayed as top line in view. |
void |
setWCurswant(int c)
|
void |
setWindow(Window window)
|
void |
setWPList(boolean f)
|
void |
setWPScroll(int n)
|
void |
setWSetCurswant(boolean f)
|
void |
shutdown()
going away, do any remaining cleanup |
void |
startup(Buffer buf)
called after TV and Buffer are constructed |
void |
tabOperation(ViTextView.TABOP op,
int count)
move to other file tab. For NEXT,PREV if count == 0 then neighboring tab; if count != 0 then countTh tab, where first is one |
void |
undo()
undo a change |
void |
updateCursor(ViCursor cursor)
Change the cursor shape |
void |
updateHighlightSearchState()
Update the hightlight search state |
void |
updateVisualState()
Update the selection highlight. |
void |
viOptionSet(ViTextView tv,
String name)
The set command used to change an option |
void |
win_close_others(boolean forceit)
Close other windows |
void |
win_close(boolean freeBuf)
Close this window |
void |
win_cycle(int n)
Cycle to the indicated buffer. |
void |
win_goto(int n)
Goto the indicated buffer. |
void |
win_quit()
Quit editing window. |
void |
win_split(int n)
Split this window. |
void |
wordMatchOperation(ViTextView.WMOP op)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected int mygen
protected JEditorPane editorPane
protected DefaultBuffer buf
protected TextOps ops
protected TextViewCache cache
protected Window window
protected ViStatusDisplay statusDisplay
protected int expectedCaretPosition
public boolean w_p_nu
| Constructor Detail |
|---|
public TextView(JEditorPane editorPane)
| Method Detail |
|---|
public void startup(Buffer buf)
ViTextView
startup in interface ViTextViewpublic void shutdown()
ViTextView
shutdown in interface ViTextViewpublic boolean isShutdown()
isShutdown in interface ViTextView
public void viOptionSet(ViTextView tv,
String name)
ViOptionBag
viOptionSet in interface ViOptionBagpublic void activateOptions(ViTextView tv)
ViOptionBag
activateOptions in interface ViOptionBagpublic void setWindow(Window window)
setWindow in interface ViTextViewpublic Window getWindow()
getWindow in interface ViTextViewpublic ViFPOS getWCursor()
getWCursor in interface ViTextViewpublic int getWCurswant()
getWCurswant in interface ViTextViewpublic void setWCurswant(int c)
setWCurswant in interface ViTextViewpublic boolean getWSetCurswant()
getWSetCurswant in interface ViTextViewpublic void setWSetCurswant(boolean f)
setWSetCurswant in interface ViTextViewpublic ViMark getPCMark()
getPCMark in interface ViTextViewpublic ViMark getPrevPCMark()
getPrevPCMark in interface ViTextViewpublic void pushPCMark()
pushPCMark in interface ViTextViewpublic ViMark getMark(int i)
getMark in interface ViTextViewpublic int getWPScroll()
getWPScroll in interface ViTextViewpublic void setWPScroll(int n)
setWPScroll in interface ViTextViewpublic boolean getWPList()
getWPList in interface ViTextViewpublic void setWPList(boolean f)
setWPList in interface ViTextViewpublic final DefaultBuffer getBuffer()
getBuffer in interface ViTextViewprotected ViStatusDisplay createStatusDisplay()
protected TextViewCache createTextViewCache()
public void attach()
ViTextView
attach in interface ViTextViewpublic void detach()
ViTextView
detach in interface ViTextViewprotected void createOps(JEditorPane editorPane)
public JEditorPane getEditorComponent()
getEditorComponent in interface ViTextViewpublic boolean isEditable()
ViTextView
isEditable in interface ViTextViewpublic void insertNewLine()
ViTextView
insertNewLine in interface ViTextViewpublic void insertTab()
ViTextView
insertTab in interface ViTextView
public void replaceChar(char c,
boolean advanceCursor)
ViTextView
replaceChar in interface ViTextViewpublic void deletePreviousChar()
ViTextView
deletePreviousChar in interface ViTextViewpublic void insertChar(char c)
insertChar in interface ViTextViewpublic void insertTypedChar(char c)
insertTypedChar in interface ViTextView
public void replaceString(int start,
int end,
String s)
ViTextView
replaceString in interface ViTextView
public void deleteChar(int start,
int end)
ViTextView
deleteChar in interface ViTextView
public void insertText(int offset,
String s)
ViTextView
insertText in interface ViTextViewpublic boolean openNewLine(ViTextView.NLOP op)
Create an empty line, autoindented, either before or after current line. This is simple algorithm; but it ignores guarded text issues and code folding subtlties.
In this example, either the cursor was on line1 and do a NL_FORWARD, or cursor on line2 and NL_BACKWARD. The cursor is shown as '|' positioned where the newLine action will open up a clean line with proper autoindent.
line1|\n
line2\n
This has problems if line1 is guarded text (write protected), since
it modifies that line. And issues with folding in that it will open
the fold since a folded line is modified.
openNewLine in interface ViTextViewpublic void undo()
ViTextView
undo in interface ViTextViewpublic void redo()
ViTextView
redo in interface ViTextView
public String getText(int offset,
int length)
throws BadLocationException
BadLocationExceptionpublic int getCaretPosition()
getCaretPosition in interface ViTextViewpublic int getMarkPosition()
getMarkPosition in interface ViTextViewpublic void setCaretPosition(int offset)
ViTextView
setCaretPosition in interface ViTextView
public void setCaretPosition(int lnum,
int col)
ViTextView
setCaretPosition in interface ViTextView
public void setSelect(int dot,
int mark)
ViTextView
setSelect in interface ViTextViewpublic void clearSelect()
ViTextView
clearSelect in interface ViTextViewpublic void findMatch()
ViTextView
findMatch in interface ViTextViewpublic void jumpDefinition(String ident)
ViTextView
jumpDefinition in interface ViTextView
public void anonymousMark(ViTextView.MARKOP op,
int count)
ViTextView
anonymousMark in interface ViTextView
public void jumpList(ViTextView.JLOP op,
int count)
ViTextView
jumpList in interface ViTextViewpublic void foldOperation(ViTextView.FOLDOP op)
ViTextView
foldOperation in interface ViTextView
public void foldOperation(ViTextView.FOLDOP op,
int offset)
ViTextView
foldOperation in interface ViTextViewpublic void wordMatchOperation(ViTextView.WMOP op)
wordMatchOperation in interface ViTextView
public void tabOperation(ViTextView.TABOP op,
int count)
ViTextView
tabOperation in interface ViTextView
public void computeCursorPosition(MutableInt offset,
MutableInt line,
MutableInt column)
ViTextView
computeCursorPosition in interface ViTextView
public void computeCursorPosition(int offset,
MutableInt line,
MutableInt column)
public int getViewTopLine()
getViewTopLine in interface ViTextViewpublic int getViewBottomLine()
getViewBottomLine in interface ViTextViewpublic void setViewTopLine(int line)
ViTextView
setViewTopLine in interface ViTextViewpublic int getViewBlankLines()
getViewBlankLines in interface ViTextViewpublic int getViewLines()
getViewLines in interface ViTextViewpublic void scroll(int n_lines)
scroll in interface ViTextViewpublic int getViewCoordTopLine()
getViewCoordTopLine in interface ViTextViewpublic void setViewCoordTopLine(int coordLine)
ViTextView
setViewCoordTopLine in interface ViTextViewpublic int getViewCoordBlankLines()
getViewCoordBlankLines in interface ViTextViewpublic int getViewCoordBottomLine()
getViewCoordBottomLine in interface ViTextViewpublic int getCoordLineCount()
getCoordLineCount in interface ViTextViewpublic int getCoordLine(int line)
getCoordLine in interface ViTextViewpublic int getBufferLineOffset(int coordLine)
ViTextView
getBufferLineOffset in interface ViTextView
public void setCursorCoordLine(int coordLine,
int col)
setCursorCoordLine in interface ViTextView
public int coladvanceCoord(int lineOffset,
int colIdx)
coladvanceCoord in interface ViTextViewpublic void updateCursor(ViCursor cursor)
ViTextView
updateCursor in interface ViTextViewpublic void win_quit()
win_quit in interface ViTextViewpublic void win_split(int n)
win_split in interface ViTextViewn - the size of the new window.public void win_close(boolean freeBuf)
win_close in interface ViTextViewfreeBuf - true if the related buffer may be freedpublic void win_close_others(boolean forceit)
win_close_others in interface ViTextViewforceit - true if always hide all other windowspublic void win_goto(int n)
win_goto in interface ViTextViewn - the index of the window to make currentpublic void win_cycle(int n)
win_cycle in interface ViTextViewn - the positive/negative number of windows to cycle.public ViStatusDisplay getStatusDisplay()
ViTextView
getStatusDisplay in interface ViTextViewpublic TextOps getOps()
public void updateVisualState()
updateVisualState in interface ViTextViewpublic void updateHighlightSearchState()
ViTextView
updateHighlightSearchState in interface ViTextView
protected void applyBackground(int[] blocks,
MutableAttributeSet mas)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||