|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.awt.Component | +--java.awt.Container | +--javax.swing.JComponent | +--javax.swing.text.JTextComponent | +--javax.swing.JTextArea | +--com.chez.powerteam.java.tools.JextTextAreaLite
This component extends a JTextArea. This component provides its own methods to read and save files (even to zip them).
Inner classes inherited from class javax.swing.JTextArea |
javax.swing.JTextArea.AccessibleJTextArea |
Inner classes inherited from class javax.swing.text.JTextComponent |
javax.swing.text.JTextComponent.AccessibleJTextComponent,
javax.swing.text.JTextComponent.KeyBinding |
Inner classes inherited from class javax.swing.JComponent |
javax.swing.JComponent.AccessibleJComponent |
Field Summary | |
static int |
OPEN
This constant defines an open dialog box. |
static int |
SAVE
This constant defines a save dialog box. |
Fields inherited from class javax.swing.text.JTextComponent |
DEFAULT_KEYMAP,
FOCUS_ACCELERATOR_KEY |
Fields inherited from class javax.swing.JComponent |
accessibleContext,
listenerList,
TOOL_TIP_TEXT_KEY,
ui,
UNDEFINED_CONDITION,
WHEN_ANCESTOR_OF_FOCUSED_COMPONENT,
WHEN_FOCUSED,
WHEN_IN_FOCUSED_WINDOW |
Fields inherited from class java.awt.Component |
BOTTOM_ALIGNMENT,
CENTER_ALIGNMENT,
LEFT_ALIGNMENT,
RIGHT_ALIGNMENT,
TOP_ALIGNMENT |
Constructor Summary | |
JextTextAreaLite()
The constructor add the necessary listeners, set some stuffs (caret color, borers, fonts...). |
Method Summary | |
void |
beginCompoundEdit()
Used for ReplaceAll. |
void |
beginOperation()
When an operation has began, setChanged() cannot be called. |
void |
changedUpdate(javax.swing.event.DocumentEvent e)
When a modification is made in the text, we turn the 'to_be_saved' flag to true. |
static java.lang.String |
chooseFile(java.awt.Component owner,
int mode)
Display a file chooser dialog box. |
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 |
endOperation()
Calling this will allow the DocumentListener to use setChanged(). |
boolean |
find(java.lang.String searchStr,
int start,
boolean ignoreCase)
Return the result of a string search. |
int |
getAnchor()
Return the anchor position. |
java.lang.String |
getCurrentFile()
Return the full path of the opened 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...) |
int |
getLength()
Return the lentgh of the text in the area. |
int |
getLineStartOffset(int off)
This is just to reduce code size of other classes. |
boolean |
getOperation()
Return true if we can use the setChanged() method, false otherwise. |
javax.swing.undo.UndoManager |
getUndo()
Useful for the GUI. |
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 |
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 |
removeUpdate(javax.swing.event.DocumentEvent e)
When a modification is made in the text, we turn the 'to_be_saved' flag to true. |
boolean |
replaceAll(java.lang.String searchStr,
java.lang.String replaceStr,
int start,
int end,
boolean ignoreCase)
Return the result of a string replace. |
void |
save(java.lang.String file)
Store the text in a specified file. |
void |
saveContent()
Called to save this component's content. |
void |
setAnchor(int offset)
Set the anchor postion. |
void |
setDirty()
Called when the content of the area has changed. |
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. |
static void |
showError(java.lang.String message)
Display an error message in a dialog box. |
static void |
showMessage(java.lang.String message)
Display a sample message in a dialog box. |
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 |
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 javax.swing.JTextArea |
append,
createDefaultModel,
getAccessibleContext,
getColumns,
getColumnWidth,
getLineCount,
getLineEndOffset,
getLineOfOffset,
getLineWrap,
getPreferredScrollableViewportSize,
getPreferredSize,
getRowHeight,
getRows,
getScrollableTracksViewportWidth,
getScrollableUnitIncrement,
getTabSize,
getUIClassID,
getWrapStyleWord,
insert,
isManagingFocus,
paramString,
processComponentKeyEvent,
replaceRange,
setColumns,
setFont,
setLineWrap,
setRows,
setTabSize,
setWrapStyleWord |
Methods inherited from class javax.swing.text.JTextComponent |
addCaretListener,
addKeymap,
copy,
cut,
fireCaretUpdate,
getActions,
getCaret,
getCaretColor,
getCaretPosition,
getDisabledTextColor,
getDocument,
getFocusAccelerator,
getHighlighter,
getInputMethodRequests,
getKeymap,
getKeymap,
getMargin,
getScrollableBlockIncrement,
getScrollableTracksViewportHeight,
getSelectedText,
getSelectedTextColor,
getSelectionColor,
getSelectionEnd,
getSelectionStart,
getText,
getText,
getUI,
isEditable,
isFocusTraversable,
isOpaque,
loadKeymap,
modelToView,
moveCaretPosition,
paste,
processInputMethodEvent,
read,
removeCaretListener,
removeKeymap,
removeNotify,
replaceSelection,
select,
selectAll,
setCaret,
setCaretColor,
setCaretPosition,
setDisabledTextColor,
setDocument,
setEditable,
setEnabled,
setFocusAccelerator,
setHighlighter,
setKeymap,
setMargin,
setOpaque,
setSelectedTextColor,
setSelectionColor,
setSelectionEnd,
setSelectionStart,
setText,
setUI,
updateUI,
viewToModel,
write |
Methods inherited from class javax.swing.JComponent |
addAncestorListener,
addNotify,
addPropertyChangeListener,
addVetoableChangeListener,
computeVisibleRect,
contains,
createToolTip,
firePropertyChange,
firePropertyChange,
firePropertyChange,
firePropertyChange,
firePropertyChange,
firePropertyChange,
firePropertyChange,
firePropertyChange,
firePropertyChange,
fireVetoableChange,
getActionForKeyStroke,
getAlignmentX,
getAlignmentY,
getAutoscrolls,
getBorder,
getBounds,
getClientProperty,
getComponentGraphics,
getConditionForKeyStroke,
getDebugGraphicsOptions,
getGraphics,
getHeight,
getInsets,
getInsets,
getLocation,
getMaximumSize,
getMinimumSize,
getNextFocusableComponent,
getRegisteredKeyStrokes,
getRootPane,
getSize,
getToolTipLocation,
getToolTipText,
getToolTipText,
getTopLevelAncestor,
getVisibleRect,
getWidth,
getX,
getY,
grabFocus,
hasFocus,
isDoubleBuffered,
isFocusCycleRoot,
isLightweightComponent,
isOptimizedDrawingEnabled,
isPaintingTile,
isRequestFocusEnabled,
isValidateRoot,
paint,
paintBorder,
paintChildren,
paintComponent,
paintImmediately,
paintImmediately,
processFocusEvent,
processKeyEvent,
processMouseMotionEvent,
putClientProperty,
registerKeyboardAction,
registerKeyboardAction,
removeAncestorListener,
removePropertyChangeListener,
removeVetoableChangeListener,
repaint,
repaint,
requestDefaultFocus,
requestFocus,
resetKeyboardActions,
reshape,
revalidate,
scrollRectToVisible,
setAlignmentX,
setAlignmentY,
setAutoscrolls,
setBackground,
setBorder,
setDebugGraphicsOptions,
setDoubleBuffered,
setForeground,
setMaximumSize,
setMinimumSize,
setNextFocusableComponent,
setPreferredSize,
setRequestFocusEnabled,
setToolTipText,
setUI,
setVisible,
unregisterKeyboardAction,
update |
Methods inherited from class java.awt.Container |
add,
add,
add,
add,
add,
addContainerListener,
addImpl,
countComponents,
deliverEvent,
doLayout,
findComponentAt,
findComponentAt,
getComponent,
getComponentAt,
getComponentAt,
getComponentCount,
getComponents,
getLayout,
insets,
invalidate,
isAncestorOf,
layout,
list,
list,
locate,
minimumSize,
paintComponents,
preferredSize,
print,
printComponents,
processContainerEvent,
processEvent,
remove,
remove,
removeAll,
removeContainerListener,
setLayout,
validate,
validateTree |
Methods inherited from class java.awt.Component |
action,
add,
addComponentListener,
addFocusListener,
addInputMethodListener,
addKeyListener,
addMouseListener,
addMouseMotionListener,
addPropertyChangeListener,
bounds,
checkImage,
checkImage,
coalesceEvents,
contains,
createImage,
createImage,
disable,
disableEvents,
dispatchEvent,
enable,
enable,
enableEvents,
enableInputMethods,
getBackground,
getBounds,
getColorModel,
getComponentOrientation,
getCursor,
getDropTarget,
getFont,
getFontMetrics,
getForeground,
getInputContext,
getLocale,
getLocation,
getLocationOnScreen,
getName,
getParent,
getPeer,
getSize,
getToolkit,
getTreeLock,
gotFocus,
handleEvent,
hide,
imageUpdate,
inside,
isDisplayable,
isEnabled,
isLightweight,
isShowing,
isValid,
isVisible,
keyDown,
keyUp,
list,
list,
list,
location,
lostFocus,
mouseDown,
mouseDrag,
mouseEnter,
mouseExit,
mouseMove,
mouseUp,
move,
nextFocus,
paintAll,
postEvent,
prepareImage,
prepareImage,
printAll,
processComponentEvent,
processMouseEvent,
remove,
removeComponentListener,
removeFocusListener,
removeInputMethodListener,
removeKeyListener,
removeMouseListener,
removeMouseMotionListener,
removePropertyChangeListener,
repaint,
repaint,
repaint,
resize,
resize,
setBounds,
setBounds,
setComponentOrientation,
setCursor,
setDropTarget,
setLocale,
setLocation,
setLocation,
setName,
setSize,
setSize,
show,
show,
size,
transferFocus |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
Field Detail |
public static final int OPEN
public static final int SAVE
Constructor Detail |
public JextTextAreaLite()
Method Detail |
public static java.lang.String chooseFile(java.awt.Component owner, int mode)
owner
- Component
which 'owns' the dialogmode
- Can be either LOAD
or SAVE
public static void showMessage(java.lang.String message)
message
- The message to displaypublic static void showError(java.lang.String message)
message
- The message to displaypublic 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 java.lang.String getCurrentFile()
public void beginOperation()
public void endOperation()
public boolean getOperation()
public void newFile()
public int getLineStartOffset(int off)
off
- The line indexpublic 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 wich we'll write the textpublic void open(java.lang.String path)
path
- The path of the file to be loadedpublic boolean isNew()
public boolean isEmpty()
public boolean isDirty()
public void setDirty()
public void clean()
public void discard()
public javax.swing.undo.UndoManager getUndo()
public int getAnchor()
public void setAnchor(int offset)
offset
- The new anchor's positionpublic int getLength()
public void beginCompoundEdit()
public void endCompoundEdit()
public boolean find(java.lang.String searchStr, int start, boolean ignoreCase)
searchStr
- The string to be foundstart
- The search's start offsetignoreCase
- Set to true, we'll ignore the text casesearchStr
has been found, false otherwisepublic boolean replaceAll(java.lang.String searchStr, java.lang.String replaceStr, int start, int end, boolean ignoreCase) throws gnu.regexp.REException
searchStr
- The string to be foundreplaceStr
- The string which will replace searchStr
start
- The search's start offsetend
- The search's end offsetignoreCase
- Set to true, we'll ignore the text casepublic void undoableEditHappened(javax.swing.event.UndoableEditEvent e)
public void changedUpdate(javax.swing.event.DocumentEvent e)
public void insertUpdate(javax.swing.event.DocumentEvent e)
public void removeUpdate(javax.swing.event.DocumentEvent e)
public java.lang.String toString()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |