fr.umlv.unitex.editor
Class EditionTextArea

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.text.JTextComponent
                  extended by javax.swing.JTextArea
                      extended by fr.umlv.unitex.editor.EditionTextArea
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.Scrollable

public class EditionTextArea
extends javax.swing.JTextArea

This class describes a JTextArea that can correctly load unicode text an seach on it

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.text.JTextComponent
javax.swing.text.JTextComponent.AccessibleJTextComponent, javax.swing.text.JTextComponent.KeyBinding
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Field Summary
 
Fields inherited from class javax.swing.text.JTextComponent
DEFAULT_KEYMAP, FOCUS_ACCELERATOR_KEY
 
Fields inherited from class javax.swing.JComponent
TOOL_TIP_TEXT_KEY, 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
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
EditionTextArea()
          Default Constructor
EditionTextArea(javax.swing.text.Document doc)
           
 
Method Summary
 int countAll(java.lang.String key, boolean searchUp, boolean modelWord, boolean modelCase)
          count all the String occurrence in the text after or before the caret
 void dictionaryFindNext(boolean searchUp, boolean modelCase, boolean modelword, boolean flexionnalForm, boolean canonicalForm, java.lang.String key)
          finds a word ( key ) with dictionary mode
 void findNext(boolean searchUp, boolean modelCase, boolean modelWord, boolean modelPrefixe, boolean modelSuffixe, boolean modelRadical, java.lang.String key)
          finds a word ( key ) in a text
 void findSentence(int number)
          find the sentence numbered X
 void replaceAll(java.lang.String key, java.lang.String rKey, boolean modelUp, boolean modelCase, boolean modelWord)
          Replaces all occurences of a word in a text
 void setSelection(int xStart, int xFinish, boolean moveUp)
          select a part of the text
 
Methods inherited from class javax.swing.JTextArea
append, getAccessibleContext, getColumns, getLineCount, getLineEndOffset, getLineOfOffset, getLineStartOffset, getLineWrap, getPreferredScrollableViewportSize, getPreferredSize, getRows, getScrollableTracksViewportWidth, getScrollableUnitIncrement, getTabSize, getUIClassID, getWrapStyleWord, insert, replaceRange, setColumns, setFont, setLineWrap, setRows, setTabSize, setWrapStyleWord
 
Methods inherited from class javax.swing.text.JTextComponent
addCaretListener, addInputMethodListener, addKeymap, copy, cut, getActions, getCaret, getCaretColor, getCaretListeners, getCaretPosition, getDisabledTextColor, getDocument, getDragEnabled, getFocusAccelerator, getHighlighter, getInputMethodRequests, getKeymap, getKeymap, getMargin, getNavigationFilter, getScrollableBlockIncrement, getScrollableTracksViewportHeight, getSelectedText, getSelectedTextColor, getSelectionColor, getSelectionEnd, getSelectionStart, getText, getText, getToolTipText, getUI, isEditable, loadKeymap, modelToView, moveCaretPosition, paste, read, removeCaretListener, removeKeymap, removeNotify, replaceSelection, select, selectAll, setCaret, setCaretColor, setCaretPosition, setComponentOrientation, setDisabledTextColor, setDocument, setDragEnabled, setEditable, setFocusAccelerator, setHighlighter, setKeymap, setMargin, setNavigationFilter, setSelectedTextColor, setSelectionColor, setSelectionEnd, setSelectionStart, setText, setUI, updateUI, viewToModel, write
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, 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, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, 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, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

EditionTextArea

public EditionTextArea()
Default Constructor


EditionTextArea

public EditionTextArea(javax.swing.text.Document doc)
Method Detail

findNext

public void findNext(boolean searchUp,
                     boolean modelCase,
                     boolean modelWord,
                     boolean modelPrefixe,
                     boolean modelSuffixe,
                     boolean modelRadical,
                     java.lang.String key)
              throws javax.swing.text.BadLocationException,
                     KeyErrorException
finds a word ( key ) in a text

Parameters:
searchUp - true if Search up mode is enabled
modelCase - true if mode case is enabled
modelWord - true if wall word only mode is selected
modelPrefixe - true if prefixe search mode is selected
modelSuffixe - true if suffixe search mode is selected
modelRadical - true if radical search mode is selected
key - the word to find
Throws:
javax.swing.text.BadLocationException
KeyErrorException - if the key if null or with 0 size

dictionaryFindNext

public void dictionaryFindNext(boolean searchUp,
                               boolean modelCase,
                               boolean modelword,
                               boolean flexionnalForm,
                               boolean canonicalForm,
                               java.lang.String key)
                        throws javax.swing.text.BadLocationException,
                               KeyErrorException
finds a word ( key ) with dictionary mode

Parameters:
searchUp - true if Search up mode is enabled
modelCase - true if case mode is selected
modelword - true if wall word only mode is selected
flexionnalForm - true if flexional search mode is selected
canonicalForm - true if canonical search mode is selected
key - the word to find
Throws:
javax.swing.text.BadLocationException
KeyErrorException - if the key if null or with 0 size

setSelection

public void setSelection(int xStart,
                         int xFinish,
                         boolean moveUp)
select a part of the text

Parameters:
xStart - the beginning of the selection
xFinish - the end of the selection
moveUp - the search direction mode ( up or down )

findSentence

public void findSentence(int number)
                  throws javax.swing.text.BadLocationException,
                         KeyErrorException,
                         TextAreaSeparatorException
find the sentence numbered X

Parameters:
number - the sentence's number
Throws:
javax.swing.text.BadLocationException
KeyErrorException - if an error occure while sentences counting
TextAreaSeparatorException - if there isn't any sentence separator {S} or if number > sentences number in the text

countAll

public int countAll(java.lang.String key,
                    boolean searchUp,
                    boolean modelWord,
                    boolean modelCase)
             throws javax.swing.text.BadLocationException,
                    KeyErrorException
count all the String occurrence in the text after or before the caret

Parameters:
key - the word to find
searchUp - true if Search up mode is enabled
modelCase - true if case mode is selected
modelWord - true if wall word only mode is selected
Returns:
the count number of a String in the text,
-1 if there is a location error
Throws:
javax.swing.text.BadLocationException
KeyErrorException - if the key if null or with 0 size

replaceAll

public void replaceAll(java.lang.String key,
                       java.lang.String rKey,
                       boolean modelUp,
                       boolean modelCase,
                       boolean modelWord)
                throws TargetException,
                       ReplacementTargetException
Replaces all occurences of a word in a text

Parameters:
key - the word to find
rKey - the new word
modelUp - true if Search up mode is enabled
modelCase - true if case mode is selected
modelWord - true if wall word only mode is selected
Throws:
TargetException - is key is empty
ReplacementTargetException - is the new word is empty