org.ceryle.ui.graph
Class FindTopicPanel
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
org.ceryle.ui.graph.FindTopicPanel
- All Implemented Interfaces:
- ImageObserver, MenuContainer, Serializable, Accessible
public class FindTopicPanel
- extends JPanel
A JPanel extension used for searching for a topic in the graph.
This uses the gnu.regexp regular expression (RE)
package, which allows for sixteen different (!) RE syntax variations,
which should pretty much satisfy anyone's preferences.
While this is a JPanel, its functionality is also useful when not
displayed. The search functionality should be extracted to its own
utility class, but for now the panel itself is used.
- Since:
- JDK1.3
- Version:
- $Id: FindTopicPanel.java,v 3.13 2007-06-20 01:28:21 altheim Exp $
- Author:
- Murray Altheim
- See Also:
- Serialized Form
|
Field Summary |
static int |
BIT_caseSens
Bitwise settings for searching and replacing (see code for docs). |
static int |
BIT_modal
Bitwise settings for searching and replacing (see code for docs). |
static int |
BIT_regexp
Bitwise settings for searching and replacing (see code for docs). |
static int |
BIT_simple
Bitwise settings for searching and replacing (see code for docs). |
static int |
BIT_vizonly
Bitwise settings for searching and replacing (see code for docs). |
protected JButton |
btn_find
|
static int |
defaultLength
Default length (in rows) for the Search Results list. |
static int |
defaultWidth
Default width (in characters) for the Find field. |
protected JComboBox |
findBox
|
protected JTextField |
findEditor
|
static int |
maxHistory
Default number of Find history items to store (must be greater than zero). |
|
Constructor Summary |
FindTopicPanel(MessageWriter msgWriter,
String defaultString,
BitSet settings)
Constructor for a FindTopicPanel, including a reference to the
MessageWriter, an optional default search String defaultString
(which can be null), and a BitSet settings to provide various
search settings. |
|
Method Summary |
protected void |
addCloseButton(AbstractAction action)
Adds a close button to the button panel whose AbstractAction is action. |
void |
doFind(boolean next)
Performs the Find function, Find Next if next is true. |
boolean |
find(String searchString,
boolean next)
Performs the find function using the search string searchString,
starting at the beginning of the iterated results if next is false,
or at the end of the last search if true. |
int |
getResultCount()
Returns the number of matching Topics in the last-performed search. |
Set |
getResults()
Returns a Set containing the results of the last-performed search,
or null if empty. |
boolean |
isSearchVisibleOnly()
Returns true if the current setting is to search visible nodes only. |
void |
keyPressed(KeyEvent ke)
Responds to KeyEvents sent to the FindTopicDialog's KeyListener. |
void |
loadTopics(TMLayoutPanel tmlpanel)
Builds the HashMap containing references to all TNodes in the
graph found in the provided TMLayoutPanel tmlpanel,
crossreferenced with their corresponding Topics, or null
when the latter is unavailable. |
void |
setParent(Window window)
Sets the parent Window (usually a JDialog) to window,
used to allow this panel to pack() it when resizing. |
protected void |
setSearchMode()
Sets the enabled and visible state of the regexp buttons. |
| 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, 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, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, 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 |
| 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, transferFocusBackward, transferFocusDownCycle, validate, validateTree |
| Methods 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, 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, 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, toString, transferFocus, transferFocusUpCycle |
defaultWidth
public static int defaultWidth
- Default width (in characters) for the Find field.
defaultLength
public static int defaultLength
- Default length (in rows) for the Search Results list.
maxHistory
public static int maxHistory
- Default number of Find history items to store (must be greater than zero).
BIT_caseSens
public static final int BIT_caseSens
- Bitwise settings for searching and replacing (see code for docs).
- See Also:
- Constant Field Values
BIT_regexp
public static final int BIT_regexp
- Bitwise settings for searching and replacing (see code for docs).
- See Also:
- Constant Field Values
BIT_modal
public static final int BIT_modal
- Bitwise settings for searching and replacing (see code for docs).
- See Also:
- Constant Field Values
BIT_simple
public static final int BIT_simple
- Bitwise settings for searching and replacing (see code for docs).
- See Also:
- Constant Field Values
BIT_vizonly
public static final int BIT_vizonly
- Bitwise settings for searching and replacing (see code for docs).
- See Also:
- Constant Field Values
findBox
protected JComboBox findBox
findEditor
protected JTextField findEditor
btn_find
protected JButton btn_find
FindTopicPanel
public FindTopicPanel(MessageWriter msgWriter,
String defaultString,
BitSet settings)
- Constructor for a FindTopicPanel, including a reference to the
MessageWriter, an optional default search String defaultString
(which can be null), and a BitSet settings to provide various
search settings.
Note that among the bitwise settings (see code) is BIT_simple,
which rather than the full-featured dialog, creates a minimal,
single row version.
- Parameters:
msgWriter - MessageWriter to receive status messagesdefaultString - the default search stringsettings - bitwise settings
loadTopics
public void loadTopics(TMLayoutPanel tmlpanel)
- Builds the HashMap containing references to all TNodes in the
graph found in the provided TMLayoutPanel tmlpanel,
crossreferenced with their corresponding Topics, or null
when the latter is unavailable.
If called with a null parameter after the TMLayoutPanel has
been set, re-processes the graph (perhaps with a different
set of visible nodes).
- Parameters:
tmlpanel - the TMLayoutPanel source of the graph
isSearchVisibleOnly
public boolean isSearchVisibleOnly()
- Returns true if the current setting is to search visible nodes only.
setParent
public void setParent(Window window)
- Sets the parent Window (usually a JDialog) to window,
used to allow this panel to pack() it when resizing.
addCloseButton
protected void addCloseButton(AbstractAction action)
- Adds a close button to the button panel whose AbstractAction is action.
getResultCount
public int getResultCount()
- Returns the number of matching Topics in the last-performed search.
getResults
public Set getResults()
- Returns a Set containing the results of the last-performed search,
or null if empty.
doFind
public void doFind(boolean next)
- Performs the Find function, Find Next if next is true.
If the search string is null (i.e., a search has not yet
occurred), a Find is performed.
find
public boolean find(String searchString,
boolean next)
- Performs the find function using the search string searchString,
starting at the beginning of the iterated results if next is false,
or at the end of the last search if true. Returns true if the search was
successful, and in the case of "next" searches, true if there are still
more results available.
keyPressed
public void keyPressed(KeyEvent ke)
- Responds to KeyEvents sent to the FindTopicDialog's KeyListener. This only
functions if the popup list is visible, and hilights a list item if so.
setSearchMode
protected void setSearchMode()
- Sets the enabled and visible state of the regexp buttons.
The Ceryle Project. Copyright ©2001-2007 Murray Altheim, All Rights Reserved. See LICENSE included with distribution.