Package org.zaproxy.zap.utils
Class ZapTextArea
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- javax.swing.JComponent
-
- javax.swing.text.JTextComponent
-
- javax.swing.JTextArea
-
- org.zaproxy.zap.utils.ZapTextArea
-
- All Implemented Interfaces:
java.awt.image.ImageObserver
,java.awt.MenuContainer
,java.io.Serializable
,javax.accessibility.Accessible
,javax.swing.Scrollable
- Direct Known Subclasses:
HttpPanelTextArea
public class ZapTextArea extends javax.swing.JTextArea
ZapTextArea
is aJTextArea
withUndoableEdit
s.The default is to maintain a window of 100 undoable edits. When the limit is reached older undoable edits start to be discarded when new ones are saved. The limit can be changed with the method
setEditsLimit(int)
.It is responsibility of the owner of the
ZapTextArea
to discard all undoable edits when they are not needed.If you do not need undoable edits consider using a
JTextArea
instead.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class javax.swing.JTextArea
javax.swing.JTextArea.AccessibleJTextArea
-
Nested classes/interfaces inherited from class javax.swing.text.JTextComponent
javax.swing.text.JTextComponent.AccessibleJTextComponent, javax.swing.text.JTextComponent.DropLocation, 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.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
-
-
Constructor Summary
Constructors Constructor Description ZapTextArea()
Constructs aZapTextArea
, with a defaultDocument
,null
text and zero rows/columns.ZapTextArea(int rows, int columns)
Constructs aZapTextArea
, with a defaultDocument
,null
text
and the given number of rows and columns.ZapTextArea(java.lang.String text)
Constructs aZapTextArea
, with a defaultDocument
, the giventext
and zero rows/columns.ZapTextArea(java.lang.String text, int rows, int columns)
Constructs aZapTextArea
, with a defaultDocument
, the giventext
and the given number of rows and columns.ZapTextArea(javax.swing.text.Document doc)
Constructs aZapTextArea
, with the givenDocument
,null
text and zero rows/columns.ZapTextArea(javax.swing.text.Document doc, java.lang.String text, int rows, int columns)
Constructs aZapTextArea
, with the givenDocument
,text
and number of rows and columns.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
discardAllEdits()
Discards all undoable edits.void
setEditsLimit(int limit)
Sets the maximum number of undoable edits thisZapTextArea
can hold.void
setUndoManagerPolicy(ZapTextComponentUndoManager.UndoManagerPolicy policy)
Sets the policy of the undoable edits of thisZapTextArea
.-
Methods inherited from class javax.swing.JTextArea
append, createDefaultModel, getAccessibleContext, getColumns, getColumnWidth, getLineCount, getLineEndOffset, getLineOfOffset, getLineStartOffset, getLineWrap, getPreferredScrollableViewportSize, getPreferredSize, getRowHeight, getRows, getScrollableTracksViewportWidth, getScrollableUnitIncrement, getTabSize, getUIClassID, getWrapStyleWord, insert, paramString, replaceRange, setColumns, setFont, setLineWrap, setRows, setTabSize, setWrapStyleWord
-
Methods inherited from class javax.swing.text.JTextComponent
addCaretListener, addInputMethodListener, addKeymap, copy, cut, fireCaretUpdate, getActions, getCaret, getCaretColor, getCaretListeners, getCaretPosition, getDisabledTextColor, getDocument, getDragEnabled, getDropLocation, getDropMode, getFocusAccelerator, getHighlighter, getInputMethodRequests, getKeymap, getKeymap, getMargin, getNavigationFilter, getPrintable, getScrollableBlockIncrement, getScrollableTracksViewportHeight, getSelectedText, getSelectedTextColor, getSelectionColor, getSelectionEnd, getSelectionStart, getText, getText, getToolTipText, getUI, isEditable, loadKeymap, modelToView, modelToView2D, moveCaretPosition, paste, print, print, print, processInputMethodEvent, read, removeCaretListener, removeKeymap, removeNotify, replaceSelection, restoreComposedText, saveComposedText, select, selectAll, setCaret, setCaretColor, setCaretPosition, setComponentOrientation, setDisabledTextColor, setDocument, setDragEnabled, setDropMode, setEditable, setFocusAccelerator, setHighlighter, setKeymap, setMargin, setNavigationFilter, setSelectedTextColor, setSelectionColor, setSelectionEnd, setSelectionStart, setText, setUI, updateUI, viewToModel, viewToModel2D, write
-
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, 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, getMinimumSize, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, 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, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
-
Methods inherited from class java.awt.Container
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
-
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, 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, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, 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, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
-
-
-
Constructor Detail
-
ZapTextArea
public ZapTextArea()
Constructs aZapTextArea
, with a defaultDocument
,null
text and zero rows/columns.
-
ZapTextArea
public ZapTextArea(javax.swing.text.Document doc)
Constructs aZapTextArea
, with the givenDocument
,null
text and zero rows/columns.- Parameters:
doc
- the document of the text area
-
ZapTextArea
public ZapTextArea(java.lang.String text)
Constructs aZapTextArea
, with a defaultDocument
, the giventext
and zero rows/columns.- Parameters:
text
- the initial text of the text area
-
ZapTextArea
public ZapTextArea(int rows, int columns)
Constructs aZapTextArea
, with a defaultDocument
,null
text
and the given number of rows and columns.- Parameters:
rows
- the number of rows of the text areacolumns
- the number of columns of the text area
-
ZapTextArea
public ZapTextArea(java.lang.String text, int rows, int columns)
Constructs aZapTextArea
, with a defaultDocument
, the giventext
and the given number of rows and columns.- Parameters:
text
- the initial text of the text arearows
- the number of rows of the text areacolumns
- the number of columns of the text area
-
ZapTextArea
public ZapTextArea(javax.swing.text.Document doc, java.lang.String text, int rows, int columns)
Constructs aZapTextArea
, with the givenDocument
,text
and number of rows and columns.- Parameters:
doc
- the document of the text areatext
- the initial text of the text arearows
- the number of rows of the text areacolumns
- the number of columns of the text area
-
-
Method Detail
-
discardAllEdits
public void discardAllEdits()
Discards all undoable edits.- See Also:
UndoManager.discardAllEdits()
-
setEditsLimit
public void setEditsLimit(int limit)
Sets the maximum number of undoable edits thisZapTextArea
can hold.- Parameters:
limit
- the new limit- See Also:
UndoManager.setLimit(int)
-
setUndoManagerPolicy
public void setUndoManagerPolicy(ZapTextComponentUndoManager.UndoManagerPolicy policy) throws java.lang.NullPointerException
Sets the policy of the undoable edits of thisZapTextArea
.- Parameters:
policy
- the new policy- Throws:
java.lang.NullPointerException
- if policy isnull
- See Also:
ZapTextComponentUndoManager.setUndoManagerPolicy(UndoManagerPolicy)
-
-