public class JextTextArea extends JEditTextArea implements javax.swing.event.UndoableEditListener, javax.swing.event.DocumentListener
Jext
,
Serialized Formjavax.swing.JComponent.AccessibleJComponent
Modifier and Type | Field and Description |
---|---|
static int |
BUFFER_SIZE
This constant defines the size of the buffer used to read files
|
static int |
DOS_LINE_END |
static int |
MACOS_LINE_END |
static int |
UNIX_LINE_END |
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
accessibleContext, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
Constructor and Description |
---|
JextTextArea(JextFrame parent)
The constructor add the necessary listeners, set some stuffs
(caret color, borers, fonts...).
|
Modifier and Type | Method and Description |
---|---|
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.
|
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.
|
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. |
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.
|
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.
|
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.
|
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.
|
void |
setDocument(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.
|
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) |
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.
|
addCaretListener, addNotify, appendCopy, appendCut, blinkCaret, copy, cut, documentChanged, fireCaretEvent, getBracketLine, getBracketPosition, getCaretLine, getCaretPosition, getDocument, getDocumentLength, getElectricScroll, getFirstLine, getFocusTraversalKeysEnabled, getGutter, getHorizontalOffset, getInputHandler, getLineCount, getLineEndOffset, getLineLength, getLineOfOffset, getLineStartOffset, getLineText, getLineText, getMagicCaretPosition, getMarkLine, getMarkPosition, getMinimumSize, getPainter, getRightClickPopup, getSelectedText, getSelectionEnd, getSelectionEnd, getSelectionEndLine, getSelectionStart, getSelectionStart, getSelectionStartLine, getShadowCaretLine, getShadowCaretPosition, getStatus, getText, getText, getText, getTokenMarker, getVisibleLines, isCaretBlinkEnabled, isCaretVisible, isEditable, isManagingFocus, isOverwriteEnabled, isSelectionRectangular, lineToY, offsetToX, overwriteSetSelectedText, paste, processKeyEvent, recalculateVisibleLines, removeCaretListener, removeNotify, scrollTo, scrollToCaret, select, selectAll, selectNone, setCaretBlinkEnabled, setCaretPosition, setCaretVisible, setEditable, setElectricScroll, setFirstLine, setHorizontalOffset, setMagicCaretPosition, setOneClick, setOneClick, setOrigin, setOverwriteEnabled, setRightClickPopup, setSelectedText, setSelectionEnd, setSelectionRectangular, setSelectionStart, setShadowCaretPosition, setText, setTokenMarker, updateBracketHighlight, updateScrollBars, xToOffset, xyToOffset, yToLine
addAncestorListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, transferFocus, transferFocusBackward, transferFocusUpCycle
public static final int BUFFER_SIZE
public static final int DOS_LINE_END
public static final int MACOS_LINE_END
public static final int UNIX_LINE_END
public JextTextArea(JextFrame parent)
parent
- JextTextArea
needs a Jext
parent
because it provides a lot of 'vital' methodspublic boolean isLineTermChanged()
public void initSearchHighlight()
public SearchHighlight getSearchHighlight()
public static javax.swing.JPopupMenu getPopupMenu()
public java.lang.String getProperty(java.lang.String key)
public void setDocument(SyntaxDocument document)
setDocument
in class JEditTextArea
document
- The documentpublic java.lang.String getFontName()
public int getFontSize()
public int getFontStyle()
public void setFontName(java.lang.String name)
name
- The name of the fontpublic void setFontSize(int size)
size
- The new font's sizepublic void setFontStyle(int style)
style
- The new style to applypublic void waitingCursor(boolean on)
public static boolean getTabIndent()
public static boolean getEnterIndent()
public static boolean getSoftTab()
public void beginOperation()
public void endOperation()
public JextFrame getJextParent()
public boolean getOperation()
public java.io.File getFile()
File
object.public java.lang.String getCurrentFile()
public void setCurrentFile(java.lang.String path)
public void filteredPaste()
public void newFile()
public void autoSave()
public void insert(java.lang.String insert, int pos)
insert
- The string to insertpos
- The offset of the text where to insert the stringpublic void userInput(char c)
public int getTabSize()
public void setTabSize(int size)
size
- The new tab size (in amount of spaces)public void setParentTitle()
public java.lang.String getName()
getName
in class java.awt.Component
public void setColorizing(java.lang.String mode)
mode
- Colorization modepublic void setColorizing(Mode mode)
public void setColorizingMode(java.lang.String mode)
mode
- The colorizing mode namepublic java.lang.String getColorizingMode()
public void checkLastModificationTime()
public void zipContent()
public void zip(java.lang.String zipFile)
zipFile
- The file name where to zip the textpublic void saveContent()
public void save(java.lang.String file)
file
- The file in which we'll write the textpublic void open(java.lang.String path)
path
- The path of the file to be loadedpublic void open(java.lang.String path, boolean addToRecentList)
path
- The path of the file to be loadedaddToRecentList
- If false, the file name is not added to recent listpublic void open(java.lang.String path, java.io.InputStreamReader _in, int bufferSize)
path
- The path of the file to be loaded_in
- You can specify an InputStreamReader (see ZipExplorer)bufferSize
- Size of the StringBuffer, useful if _in != nullpublic void open(java.lang.String path, java.io.InputStreamReader _in, int bufferSize, boolean web, boolean addToRecentList)
path
- The path of the file to be loaded_in
- You can specify an InputStreamReader (see ZipExplorer);
if you do this the TextArea is marked as 'dirty'bufferSize
- Size of the StringBuffer, useful if _in != nullweb
- True if open an urladdToRecentList
- If false, the file name is not added to recent listpublic void setNewFlag(boolean newFlag)
public boolean isNew()
public boolean isEmpty()
public boolean isDirty()
public void clean()
public void discard()
public void setAnchor()
public void gotoAnchor()
public int getAnchorOffset()
public javax.swing.undo.UndoManager getUndo()
public void beginCompoundEdit()
public void beginCompoundEdit(boolean cursorHandle)
public void beginProtectedCompoundEdit()
public void endCompoundEdit()
public void endCompoundEdit(boolean cursorHandle)
public void endProtectedCompoundEdit()
public int getLength()
public void undoableEditHappened(javax.swing.event.UndoableEditEvent e)
undoableEditHappened
in interface javax.swing.event.UndoableEditListener
public void endCurrentEdit()
public void setUndoing(boolean action)
public void changedUpdate(javax.swing.event.DocumentEvent e)
changedUpdate
in interface javax.swing.event.DocumentListener
public void insertUpdate(javax.swing.event.DocumentEvent e)
insertUpdate
in interface javax.swing.event.DocumentListener
public void removeUpdate(javax.swing.event.DocumentEvent e)
removeUpdate
in interface javax.swing.event.DocumentListener
public java.lang.String toString()
toString
in class java.awt.Component
protected void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
java.lang.Throwable
Copyright ? 2002 Romain Guy.