|
|||||||||
| Home >> All >> org >> [ jext overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.jext
Class JextTextArea

java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
org.gjt.sp.jedit.textarea.JEditTextArea
org.jext.JextTextArea
- All Implemented Interfaces:
- javax.swing.event.DocumentListener, java.util.EventListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.swing.event.UndoableEditListener
- public class JextTextArea
- extends org.gjt.sp.jedit.textarea.JEditTextArea
- implements javax.swing.event.UndoableEditListener, javax.swing.event.DocumentListener
- extends org.gjt.sp.jedit.textarea.JEditTextArea
Extending JEditTextArea allow us to support syntax colorization. We also implement some listeners: for the caret, for the undos and redos, for the keys (indent) and for the modifications which can occures in the text. This component provides its own methods to read and save files (even to zip them).
| Nested Class Summary | |
(package private) class |
JextTextArea.CaretHandler
|
(package private) class |
JextTextArea.FocusHandler
|
(package private) class |
JextTextArea.JextTextAreaPopupMenu
|
| Nested classes inherited from class org.gjt.sp.jedit.textarea.JEditTextArea |
|
| Nested classes inherited from class javax.swing.JComponent |
javax.swing.JComponent.AccessibleJComponent |
| Nested classes inherited from class java.awt.Container |
java.awt.Container.AccessibleAWTContainer |
| Nested classes inherited from class java.awt.Component |
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
| Field Summary | |
private javax.swing.text.Position |
anchor
|
static int |
BUFFER_SIZE
This constant defines the size of the buffer used to read files |
private javax.swing.undo.CompoundEdit |
compoundEdit
|
private javax.swing.undo.CompoundEdit |
currentEdit
|
private java.lang.String |
currentFile
|
private boolean |
dirty
|
static int |
DOS_LINE_END
|
private java.lang.String |
fontName
|
private int |
fontSize
|
private int |
fontStyle
|
(package private) javax.swing.JComboBox |
lineTermSelector
|
static int |
MACOS_LINE_END
|
private java.lang.String |
mode
|
private long |
modTime
|
private java.lang.String |
myLineTerm
|
private boolean |
newf
|
private boolean |
operation
|
private java.lang.String |
origLineTerm
|
private JextFrame |
parent
|
private static javax.swing.JPopupMenu |
popupMenu
|
private boolean |
protectedCompoundEdit
|
private org.jext.search.SearchHighlight |
searchHighlight
|
private javax.swing.undo.UndoManager |
undo
|
private boolean |
undoing
|
static int |
UNIX_LINE_END
|
| Fields inherited from class org.gjt.sp.jedit.textarea.JEditTextArea |
biasLeft, blink, BOTTOM, bracketLine, bracketPosition, caretBlinks, caretEvent, caretTimer, caretVisible, CENTER, document, documentHandler, documentHandlerInstalled, editable, electricScroll, firstLine, focusedComponent, gutter, horizontal, horizontalOffset, inputHandler, LEFT, LEFT_OF_SCROLLBAR, listenerList, magicCaret, maxHorizontalScrollWidth, oneClick, oneClickEvent, overwrite, painter, popup, rectSelect, RIGHT, scrollBarsInitialized, selectionEnd, selectionEndLine, selectionStart, selectionStartLine, vertical, visibleLines |
| Fields inherited from class javax.swing.JComponent |
accessibleContext, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
| Fields inherited from class java.awt.Container |
|
| Fields inherited from class java.awt.Component |
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
| Fields inherited from interface java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
| Constructor Summary | |
JextTextArea(JextFrame parent)
The constructor add the necessary listeners, set some stuffs (caret color, borers, fonts...). |
|
| Method Summary | |
void |
autoSave()
This is called by the AutoSave thread. |
void |
beginCompoundEdit()
Used for ReplaceAll. |
void |
beginCompoundEdit(boolean cursorHandle)
|
void |
beginOperation()
When an operation has began, setChanged() cannot be called. |
void |
beginProtectedCompoundEdit()
A protected compound edit is a compound edit which cannot be ended by a normal call to endCompoundEdit(). |
void |
changedUpdate(javax.swing.event.DocumentEvent e)
When a modification is made in the text, we turn the 'to_be_saved' flag to true. |
private void |
changeFont()
Set the new font. |
void |
checkLastModificationTime()
Checks if holded file has been changed by an external program. |
void |
clean()
Called after having saved or created a new document to ensure the content isn't 'dirty'. |
void |
discard()
Discard all edits contained in the UndoManager. |
private void |
enableColorizing(java.lang.String mode,
org.gjt.sp.jedit.syntax.TokenMarker token)
|
void |
endCompoundEdit()
See beginCompoundEdit(). |
void |
endCompoundEdit(boolean cursorHandle)
|
void |
endCurrentEdit()
|
void |
endOperation()
Calling this will allow the DocumentListener to use setChanged(). |
void |
endProtectedCompoundEdit()
This terminates a protected compound edit. |
void |
filteredPaste()
Performs a 'filtered' paste. |
protected void |
finalize()
Patch -> Memory management improvements : it may help the garbage collector. |
int |
getAnchorOffset()
|
java.lang.String |
getColorizingMode()
Returns current syntax colorizing mode. |
java.lang.String |
getCurrentFile()
Return the full path of the opened file. |
static boolean |
getEnterIndent()
This is necessary to determine if we have to indent on enter key press or not. |
java.io.File |
getFile()
Return current opened file as a File object. |
private java.lang.String |
getFileName(java.lang.String file)
|
java.lang.String |
getFontName()
Return current font's name |
int |
getFontSize()
Return current font's size |
int |
getFontStyle()
Return current font's style (bold, italic...) |
JextFrame |
getJextParent()
Return the parent of this component. |
int |
getLength()
Return the lentgh of the text in the area. |
private java.lang.String |
getLineTerm()
|
(package private) java.lang.String |
getLineTermName()
|
java.lang.String |
getName()
Get name of this text area. |
boolean |
getOperation()
Return true if we can use the setChanged() method, false otherwise. |
static javax.swing.JPopupMenu |
getPopupMenu()
Returns text area popup menu. |
java.lang.String |
getProperty(java.lang.String key)
Get property inherent to current syntax colorizing mode. |
org.jext.search.SearchHighlight |
getSearchHighlight()
Returns the associated search highlighter. |
static boolean |
getSoftTab()
Return the state of the softtab check menu item. |
static boolean |
getTabIndent()
This is necessary to determine if we have to indent on tab key press or not. |
int |
getTabSize()
Because JEditorPane doesn't have any getTabSize() method, we implement our own one. |
javax.swing.undo.UndoManager |
getUndo()
Used by Jext to update its menu items. |
void |
gotoAnchor()
Go to anchor position |
void |
initSearchHighlight()
Adds a search highlighter if none exists. |
void |
insert(java.lang.String insert,
int pos)
This overrides standard insert method. |
void |
insertUpdate(javax.swing.event.DocumentEvent e)
When a modification is made in the text, we turn the 'to_be_saved' flag to true. |
boolean |
isDirty()
Return true if area content has changed, false otherwise. |
boolean |
isEmpty()
Return true if area is empty, false otherwise. |
boolean |
isLineTermChanged()
|
boolean |
isNew()
Return true if current text is new, false otherwise. |
void |
newFile()
Set a new file. |
void |
open(java.lang.String path)
Called to load a new file in the text area. |
void |
open(java.lang.String path,
boolean addToRecentList)
Called to load a new file in the text area. |
void |
open(java.lang.String path,
java.io.InputStreamReader _in,
int bufferSize)
Called to load a new file in the text area. |
void |
open(java.lang.String path,
java.io.InputStreamReader _in,
int bufferSize,
boolean web,
boolean addToRecentList)
Called to load a new file in the text area. |
void |
removeUpdate(javax.swing.event.DocumentEvent e)
When a modification is made in the text, we turn the 'to_be_saved' flag to true. |
private void |
resetLineTerm()
|
(package private) void |
rotateLineTerm()
|
void |
save(java.lang.String file)
Store the text in a specified file. |
void |
saveContent()
Called to save this component's content. |
void |
setAnchor()
Set the anchor postion. |
void |
setColorizing(Mode mode)
|
void |
setColorizing(java.lang.String mode)
Turn syntax colorization on or off. |
void |
setColorizingMode(java.lang.String mode)
Sets current colorizing mode. |
void |
setCurrentFile(java.lang.String path)
Set path of current opened file. |
private void |
setDirty()
Called when the content of the area has changed. |
void |
setDocument(org.gjt.sp.jedit.syntax.SyntaxDocument document)
Set a new document |
void |
setFontName(java.lang.String name)
Set the font which has to be used. |
void |
setFontSize(int size)
Set the size of the font. |
void |
setFontStyle(int style)
Set the style of the font. |
(package private) void |
setLineTerm(int lineTermConst)
|
private void |
setLineTerm(java.lang.String newLineTerm)
|
private void |
setMouseWheel()
|
void |
setNewFlag(boolean newFlag)
Set the new flag and resets the default line end separator. |
void |
setParentTitle()
Set parent title according to the fullfilename flag in the user properties. |
void |
setTabSize(int size)
See getTabSize(). |
void |
setUndoing(boolean action)
|
private void |
storeOrigLineTerm()
|
java.lang.String |
toString()
Return a String representation of this object. |
void |
undoableEditHappened(javax.swing.event.UndoableEditEvent e)
When an undoable event is fired, we add it to the undo/redo list. |
void |
userInput(char c)
|
void |
waitingCursor(boolean on)
Show/hide waiting cursor |
void |
zip(java.lang.String zipFile)
Zip text area content into specified file. |
void |
zipContent()
Called to save current content in specified zip file. |
| Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
popupMenu
private static javax.swing.JPopupMenu popupMenu
parent
private JextFrame parent
mode
private java.lang.String mode
modTime
private long modTime
anchor
private javax.swing.text.Position anchor
fontSize
private int fontSize
fontStyle
private int fontStyle
fontName
private java.lang.String fontName
currentFile
private java.lang.String currentFile
lineTermSelector
javax.swing.JComboBox lineTermSelector
undoing
private boolean undoing
undo
private javax.swing.undo.UndoManager undo
compoundEdit
private javax.swing.undo.CompoundEdit compoundEdit
currentEdit
private javax.swing.undo.CompoundEdit currentEdit
dirty
private boolean dirty
newf
private boolean newf
operation
private boolean operation
protectedCompoundEdit
private boolean protectedCompoundEdit
searchHighlight
private org.jext.search.SearchHighlight searchHighlight
BUFFER_SIZE
public static final int BUFFER_SIZE
- This constant defines the size of the buffer used to read files
- See Also:
- Constant Field Values
DOS_LINE_END
public static final int DOS_LINE_END
- See Also:
- Constant Field Values
MACOS_LINE_END
public static final int MACOS_LINE_END
- See Also:
- Constant Field Values
UNIX_LINE_END
public static final int UNIX_LINE_END
- See Also:
- Constant Field Values
myLineTerm
private java.lang.String myLineTerm
origLineTerm
private java.lang.String origLineTerm
| Constructor Detail |
JextTextArea
public JextTextArea(JextFrame parent)
- The constructor add the necessary listeners, set some stuffs
(caret color, borers, fonts...).
| Method Detail |
setLineTerm
private void setLineTerm(java.lang.String newLineTerm)
getLineTerm
private java.lang.String getLineTerm()
resetLineTerm
private void resetLineTerm()
storeOrigLineTerm
private void storeOrigLineTerm()
isLineTermChanged
public boolean isLineTermChanged()
setLineTerm
void setLineTerm(int lineTermConst)
getLineTermName
java.lang.String getLineTermName()
rotateLineTerm
void rotateLineTerm()
setMouseWheel
private void setMouseWheel()
initSearchHighlight
public void initSearchHighlight()
- Adds a search highlighter if none exists.
getSearchHighlight
public org.jext.search.SearchHighlight getSearchHighlight()
- Returns the associated search highlighter.
getPopupMenu
public static javax.swing.JPopupMenu getPopupMenu()
- Returns text area popup menu.
getProperty
public java.lang.String getProperty(java.lang.String key)
- Get property inherent to current syntax colorizing mode.
setDocument
public void setDocument(org.gjt.sp.jedit.syntax.SyntaxDocument document)
- Set a new document
getFontName
public java.lang.String getFontName()
- Return current font's name
getFontSize
public int getFontSize()
- Return current font's size
getFontStyle
public int getFontStyle()
- Return current font's style (bold, italic...)
setFontName
public void setFontName(java.lang.String name)
- Set the font which has to be used.
setFontSize
public void setFontSize(int size)
- Set the size of the font.
setFontStyle
public void setFontStyle(int style)
- Set the style of the font.
changeFont
private void changeFont()
- Set the new font.
waitingCursor
public void waitingCursor(boolean on)
- Show/hide waiting cursor
getTabIndent
public static boolean getTabIndent()
- This is necessary to determine if we have to indent on tab key press or not.
getEnterIndent
public static boolean getEnterIndent()
- This is necessary to determine if we have to indent on enter key press or not.
getSoftTab
public static boolean getSoftTab()
- Return the state of the softtab check menu item.
This is necessary to know if tabs have to be replaced
by whitespaces.
beginOperation
public void beginOperation()
- When an operation has began, setChanged() cannot be called.
This is very important when we need to insert or remove some
parts of the text without turning on the 'to_be_saved' flag.
endOperation
public void endOperation()
- Calling this will allow the DocumentListener to use setChanged().
getJextParent
public JextFrame getJextParent()
- Return the parent of this component. Note that a LOT of
external functions need to call methods contained in the parent.
getOperation
public boolean getOperation()
- Return true if we can use the setChanged() method,
false otherwise.
getFile
public java.io.File getFile()
- Return current opened file as a
Fileobject.
getCurrentFile
public java.lang.String getCurrentFile()
- Return the full path of the opened file.
setCurrentFile
public void setCurrentFile(java.lang.String path)
- Set path of current opened file.
filteredPaste
public void filteredPaste()
- Performs a 'filtered' paste. A filtered paste is a paste action performed after having
made some search and replace operations over the clipboard text.
newFile
public void newFile()
- Set a new file. We first ask the user if he'd like to save its
changes (if some have been made).
autoSave
public void autoSave()
- This is called by the AutoSave thread.
insert
public void insert(java.lang.String insert, int pos)
- This overrides standard insert method. Indeed, we need
to update the label containing caret's position.
userInput
public void userInput(char c)
getTabSize
public int getTabSize()
- Because JEditorPane doesn't have any getTabSize() method,
we implement our own one.
setTabSize
public void setTabSize(int size)
- See getTabSize().
setParentTitle
public void setParentTitle()
- Set parent title according to the fullfilename flag
in the user properties.
getFileName
private java.lang.String getFileName(java.lang.String file)
getName
public java.lang.String getName()
- Get name of this text area. This name is made of the current opened
file name.
setColorizing
public void setColorizing(java.lang.String mode)
- Turn syntax colorization on or off.
setColorizing
public void setColorizing(Mode mode)
enableColorizing
private void enableColorizing(java.lang.String mode, org.gjt.sp.jedit.syntax.TokenMarker token)
setColorizingMode
public void setColorizingMode(java.lang.String mode)
- Sets current colorizing mode.
getColorizingMode
public java.lang.String getColorizingMode()
- Returns current syntax colorizing mode.
checkLastModificationTime
public void checkLastModificationTime()
- Checks if holded file has been changed by an external program.
zipContent
public void zipContent()
- Called to save current content in specified zip file.
Call zip(String file) but asks user for overwriting if
file already exists.
zip
public void zip(java.lang.String zipFile)
- Zip text area content into specified file.
saveContent
public void saveContent()
- Called to save this component's content.
Call save(String file) but let the user choosing a file name
if the isNew() flag is true (int the case the user choosed
an existing file, we ask him if he really wants to overwrite it).
save
public void save(java.lang.String file)
- Store the text in a specified file.
open
public void open(java.lang.String path)
- Called to load a new file in the text area.
Determines which line separator (\n, \r\n...) are used in the
file to open. Convert'em into Swing line separator (\n).
open
public void open(java.lang.String path, boolean addToRecentList)
- Called to load a new file in the text area.
Determines which line separator (\n, \r\n...) are used in the
file to open. Convert'em into Swing line separator (\n).
open
public void open(java.lang.String path, java.io.InputStreamReader _in, int bufferSize)
- Called to load a new file in the text area.
Determines which line separator (\n, \r\n...) are used in the
file to open. Convert'em into Swing line separator (\n).
open
public void open(java.lang.String path, java.io.InputStreamReader _in, int bufferSize, boolean web, boolean addToRecentList)
- Called to load a new file in the text area.
Determines which line separator (\n, \r\n...) are used in the
file to open. Convert'em into Swing line separator (\n).
setNewFlag
public void setNewFlag(boolean newFlag)
- Set the new flag and resets the default line end separator.
isNew
public boolean isNew()
- Return true if current text is new, false otherwise.
isEmpty
public boolean isEmpty()
- Return true if area is empty, false otherwise.
isDirty
public boolean isDirty()
- Return true if area content has changed, false otherwise.
setDirty
private void setDirty()
- Called when the content of the area has changed.
clean
public void clean()
- Called after having saved or created a new document to ensure
the content isn't 'dirty'.
discard
public void discard()
- Discard all edits contained in the UndoManager.
Update the corresponding menu items.
setAnchor
public void setAnchor()
- Set the anchor postion.
gotoAnchor
public void gotoAnchor()
- Go to anchor position
getAnchorOffset
public int getAnchorOffset()
getUndo
public javax.swing.undo.UndoManager getUndo()
- Used by Jext to update its menu items.
beginCompoundEdit
public void beginCompoundEdit()
- Used for ReplaceAll.
This merges all text changes made between the beginCompoundEdit()
and the endCompoundEdit() calls into only one undo event.
beginCompoundEdit
public void beginCompoundEdit(boolean cursorHandle)
beginProtectedCompoundEdit
public void beginProtectedCompoundEdit()
- A protected compound edit is a compound edit which cannot be ended by
a normal call to endCompoundEdit().
endCompoundEdit
public void endCompoundEdit()
- See beginCompoundEdit().
endCompoundEdit
public void endCompoundEdit(boolean cursorHandle)
endProtectedCompoundEdit
public void endProtectedCompoundEdit()
- This terminates a protected compound edit.
getLength
public int getLength()
- Return the lentgh of the text in the area.
undoableEditHappened
public void undoableEditHappened(javax.swing.event.UndoableEditEvent e)
- When an undoable event is fired, we add it to the undo/redo list.
- Specified by:
undoableEditHappenedin interfacejavax.swing.event.UndoableEditListener
endCurrentEdit
public void endCurrentEdit()
setUndoing
public void setUndoing(boolean action)
changedUpdate
public void changedUpdate(javax.swing.event.DocumentEvent e)
- When a modification is made in the text, we turn
the 'to_be_saved' flag to true.
- Specified by:
changedUpdatein interfacejavax.swing.event.DocumentListener
insertUpdate
public void insertUpdate(javax.swing.event.DocumentEvent e)
- When a modification is made in the text, we turn
the 'to_be_saved' flag to true.
- Specified by:
insertUpdatein interfacejavax.swing.event.DocumentListener
removeUpdate
public void removeUpdate(javax.swing.event.DocumentEvent e)
- When a modification is made in the text, we turn
the 'to_be_saved' flag to true.
- Specified by:
removeUpdatein interfacejavax.swing.event.DocumentListener
toString
public java.lang.String toString()
- Return a String representation of this object.
finalize
protected void finalize()
throws java.lang.Throwable
- Patch
-> Memory management improvements : it may help the garbage collector.
-> Author : Julien Ponge (julien@izforge.com)
-> Date : 23, May 2001
|
|||||||||
| Home >> All >> org >> [ jext overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC