Class RegexFilterWrapper
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
org.htmlparser.parserapplications.filterbuilder.Filter
org.htmlparser.parserapplications.filterbuilder.wrappers.RegexFilterWrapper
- All Implemented Interfaces:
ActionListener,ImageObserver,MenuContainer,Serializable,Cloneable,EventListener,DocumentListener,NodeFilter
Wrapper for RegexFilters.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponentNested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainerNested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected RegexFilterThe underlying filter.static Object[][]Mapping for RegexFilter constants to strings.protected JTextAreaText to check forprotected JComboBoxCombo box for strategy.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_WINDOWFields inherited from class java.awt.Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTFields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanPredicate to determine whether or not to keep the given node.voidactionPerformed(ActionEvent event) Invoked when an action occurs on the combo box.voidHandle a change update event.Get the name of the filter.Get the resource name for the icon.Get the underlying node filter object.Get the underlying node filter's subordinate filters.intindexToStrategy(int index) Convert an index into a regex strategy.voidHandle an insert update event.voidHandle a remove update event.voidsetNodeFilter(NodeFilter filter, Parser context) Assign the underlying node filter for this wrapper.voidsetSubNodeFilters(NodeFilter[] filters) Assign the underlying node filter's subordinate filters.intstrategyToIndex(int strategy) Convert the regex strategy to an index into the map.strategyToString(int strategy) Convert the regex strategy to a string.intstringToStrategy(String strategy) Convert a string to a regex strategy.toJavaCode(StringBuffer out, int[] context) Convert this filter into Java code.Methods inherited from class org.htmlparser.parserapplications.filterbuilder.Filter
deconstitute, deserialize, getEnclosed, getIcon, instantiate, newline, pickle, reconstitute, serialize, setExpanded, setSelected, spaces, toString, unpickle, wrapMethods 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, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUI, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, 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, updateUIMethods 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, validateTreeMethods inherited from class java.awt.Component
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, getAccessibleContext, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, 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, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, transferFocus, transferFocusBackward, transferFocusUpCycle
-
Field Details
-
mMap
Mapping for RegexFilter constants to strings. -
mFilter
The underlying filter. -
mPattern
Text to check for -
mStrategy
Combo box for strategy.
-
-
Constructor Details
-
RegexFilterWrapper
public RegexFilterWrapper()Create a wrapper over a new RegexFilter.
-
-
Method Details
-
getDescription
Get the name of the filter.- Specified by:
getDescriptionin classFilter- Returns:
- A descriptive name for the filter.
-
getIconSpec
Get the resource name for the icon.- Specified by:
getIconSpecin classFilter- Returns:
- The icon resource specification.
-
getNodeFilter
Get the underlying node filter object.- Specified by:
getNodeFilterin classFilter- Returns:
- The node filter object suitable for serialization.
-
setNodeFilter
Assign the underlying node filter for this wrapper.- Specified by:
setNodeFilterin classFilter- Parameters:
filter- The filter to wrap.context- The parser to use for conditioning this filter. Some filters need contextual information to provide to the user, i.e. for tag names or attribute names or values, so the Parser context is provided.
-
getSubNodeFilters
Get the underlying node filter's subordinate filters.- Specified by:
getSubNodeFiltersin classFilter- Returns:
- The node filter object's contained filters.
-
setSubNodeFilters
Assign the underlying node filter's subordinate filters.- Specified by:
setSubNodeFiltersin classFilter- Parameters:
filters- The filters to insert into the underlying node filter.
-
toJavaCode
Convert this filter into Java code. Output whatever text necessary and return the variable name.- Specified by:
toJavaCodein classFilter- Parameters:
out- The output buffer.context- Three integers as follows:- indent level - the number of spaces to insert at the beginning of each line
- filter number - the next available filter number
- filter array number - the next available array of filters number
- Returns:
- The variable name to use when referencing this filter (usually "filter" + context[1]++)
-
strategyToString
Convert the regex strategy to a string.- Parameters:
strategy- The regex strategy.- Returns:
- A string for display in the GUI or in the Java program.
-
stringToStrategy
Convert a string to a regex strategy.- Parameters:
strategy- The string equivalent of a regex strategy.- Returns:
- The regex strategy to use in executing the regular expression.
-
strategyToIndex
public int strategyToIndex(int strategy) Convert the regex strategy to an index into the map.- Parameters:
strategy- The regex strategy.- Returns:
- The index of the regex strategy in the map.
-
indexToStrategy
public int indexToStrategy(int index) Convert an index into a regex strategy.- Parameters:
index- The index of the regex strategy in the map.- Returns:
- The regex strategy at that inxdex.
-
accept
Predicate to determine whether or not to keep the given node. The behaviour based on this outcome is determined by the context in which it is called. It may lead to the node being added to a list or printed out. See the calling routine for details.- Specified by:
acceptin interfaceNodeFilter- Parameters:
node- The node to test.- Returns:
trueif the node is to be kept,falseif it is to be discarded.
-
actionPerformed
Invoked when an action occurs on the combo box.- Specified by:
actionPerformedin interfaceActionListener- Parameters:
event- Details about the action event.
-
insertUpdate
Handle an insert update event.- Specified by:
insertUpdatein interfaceDocumentListener- Parameters:
e- Details about the insert event.
-
removeUpdate
Handle a remove update event.- Specified by:
removeUpdatein interfaceDocumentListener- Parameters:
e- Details about the remove event.
-
changedUpdate
Handle a change update event.- Specified by:
changedUpdatein interfaceDocumentListener- Parameters:
e- Details about the change event.
-