prefuse.util.ui
Class JSearchPanel

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by prefuse.util.ui.JSearchPanel
All Implemented Interfaces:
java.awt.event.ActionListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.event.DocumentListener

public class JSearchPanel
extends javax.swing.JPanel
implements javax.swing.event.DocumentListener, java.awt.event.ActionListener

Swing component that enables keyword search over prefuse data tuples.

Author:
jeffrey heer
See Also:
SearchQueryBinding, Serialized Form

Nested Class Summary
 class JSearchPanel.CancelButton
          A button depicted as an "X" that allows users to cancel the current query and clear the query field.
 
Nested classes/interfaces inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
 
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
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
JSearchPanel(SearchTupleSet search, java.lang.String field)
          Create a new JSearchPanel.
JSearchPanel(SearchTupleSet search, java.lang.String field, boolean monitorKeystrokes)
          Create a new JSearchPanel.
JSearchPanel(TupleSet source, SearchTupleSet search, java.lang.String[] fields, boolean autoIndex, boolean monitorKeystrokes)
          Create a new JSearchPanel.
JSearchPanel(Visualization vis, java.lang.String field)
          Create a new JSearchPanel.
JSearchPanel(Visualization vis, java.lang.String group, java.lang.String field)
          Create a new JSearchPanel.
JSearchPanel(Visualization vis, java.lang.String group, java.lang.String field, boolean autoIndex)
          Create a new JSearchPanel.
JSearchPanel(Visualization vis, java.lang.String group, java.lang.String field, boolean autoIndex, boolean monitorKeystrokes)
          Create a new JSearchPanel.
JSearchPanel(Visualization vis, java.lang.String group, java.lang.String searchGroup, java.lang.String[] fields, boolean autoIndex, boolean monitorKeystrokes)
          Create a new JSearchPanel.
JSearchPanel(Visualization vis, java.lang.String group, java.lang.String searchGroup, java.lang.String field, boolean autoIndex, boolean monitorKeystrokes)
          Create a new JSearchPanel.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
           
 void changedUpdate(javax.swing.event.DocumentEvent e)
           
 java.lang.String getQuery()
          Get the query string in the text field.
 void insertUpdate(javax.swing.event.DocumentEvent e)
           
 void removeUpdate(javax.swing.event.DocumentEvent e)
           
 void requestFocus()
          Request the keyboard focus for this component.
protected  void searchUpdate()
          Update the search results based on the current query.
 void setBackground(java.awt.Color bg)
           
 void setCancelColor(java.awt.Color c)
          Set the fill color of the cancel 'x' button that appears when the button has the mouse pointer over it.
 void setFont(java.awt.Font f)
           
 void setForeground(java.awt.Color fg)
           
 void setLabelText(java.lang.String text)
          Set the label text used on this component.
 void setLock(java.lang.Object lock)
          Set the lock, an object to synchronize on while issuing queries.
 void setOpaque(boolean opaque)
           
 void setQuery(java.lang.String query)
          Set the query string in the text field.
 void setShowBorder(boolean b)
          Indicates if the component should show a border around the text field.
 void setShowCancel(boolean b)
          Indicates if the component should show the cancel query button.
 void setShowResultCount(boolean b)
          Indicates if the component should show the number of search results.
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
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, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, 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, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, 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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JSearchPanel

public JSearchPanel(SearchTupleSet search,
                    java.lang.String field)
Create a new JSearchPanel.

Parameters:
search - the search tuple set conducting the searches
field - the data field being searched

JSearchPanel

public JSearchPanel(SearchTupleSet search,
                    java.lang.String field,
                    boolean monitorKeystrokes)
Create a new JSearchPanel.

Parameters:
search - the search tuple set conducting the searches
field - the data field being searched
monitorKeystrokes - indicates if each keystroke event should result in a new search being issued (true) or if searches should only be initiated by hitting the enter key (false)

JSearchPanel

public JSearchPanel(TupleSet source,
                    SearchTupleSet search,
                    java.lang.String[] fields,
                    boolean autoIndex,
                    boolean monitorKeystrokes)
Create a new JSearchPanel.

Parameters:
source - the source set of tuples that should be searched over
search - the search tuple set conducting the searches
fields - the data fields being searched
monitorKeystrokes - indicates if each keystroke event should result in a new search being issued (true) or if searches should only be initiated by hitting the enter key (false)

JSearchPanel

public JSearchPanel(Visualization vis,
                    java.lang.String field)
Create a new JSearchPanel. The default search tuple set for the visualization will be used.

Parameters:
vis - the Visualization to search over
field - the data field being searched

JSearchPanel

public JSearchPanel(Visualization vis,
                    java.lang.String group,
                    java.lang.String field)
Create a new JSearchPanel. The default search tuple set for the visualization will be used.

Parameters:
vis - the Visualization to search over
group - the particular data group to search over
field - the data field being searched

JSearchPanel

public JSearchPanel(Visualization vis,
                    java.lang.String group,
                    java.lang.String field,
                    boolean autoIndex)
Create a new JSearchPanel. The default search tuple set for the visualization will be used.

Parameters:
vis - the Visualization to search over
group - the particular data group to search over
field - the data field being searched
autoIndex - indicates if items should be automatically indexed and unindexed as their membership in the source group changes.

JSearchPanel

public JSearchPanel(Visualization vis,
                    java.lang.String group,
                    java.lang.String field,
                    boolean autoIndex,
                    boolean monitorKeystrokes)
Create a new JSearchPanel. The default search tuple set for the visualization will be used.

Parameters:
vis - the Visualization to search over
group - the particular data group to search over
field - the data field being searched
autoIndex - indicates if items should be automatically indexed and unindexed as their membership in the source group changes.
monitorKeystrokes - indicates if each keystroke event should result in a new search being issued (true) or if searches should only be initiated by hitting the enter key (false)

JSearchPanel

public JSearchPanel(Visualization vis,
                    java.lang.String group,
                    java.lang.String searchGroup,
                    java.lang.String field,
                    boolean autoIndex,
                    boolean monitorKeystrokes)
Create a new JSearchPanel.

Parameters:
vis - the Visualization to search over
group - the particular data group to search over
searchGroup - the group name that resolves to the SearchTupleSet to use
field - the data field being searched
autoIndex - indicates if items should be automatically indexed and unindexed as their membership in the source group changes.
monitorKeystrokes - indicates if each keystroke event should result in a new search being issued (true) or if searches should only be initiated by hitting the enter key (false)

JSearchPanel

public JSearchPanel(Visualization vis,
                    java.lang.String group,
                    java.lang.String searchGroup,
                    java.lang.String[] fields,
                    boolean autoIndex,
                    boolean monitorKeystrokes)
Create a new JSearchPanel.

Parameters:
vis - the Visualization to search over
group - the particular data group to search over
searchGroup - the group name that resolves to the SearchTupleSet to use
fields - the data fields being searched
autoIndex - indicates if items should be automatically indexed and unindexed as their membership in the source group changes.
monitorKeystrokes - indicates if each keystroke event should result in a new search being issued (true) or if searches should only be initiated by hitting the enter key (false)
Method Detail

requestFocus

public void requestFocus()
Request the keyboard focus for this component.

Overrides:
requestFocus in class javax.swing.JComponent

setLock

public void setLock(java.lang.Object lock)
Set the lock, an object to synchronize on while issuing queries.

Parameters:
lock - the synchronization lock

setShowResultCount

public void setShowResultCount(boolean b)
Indicates if the component should show the number of search results.

Parameters:
b - true to show the result count, false to hide it

setShowBorder

public void setShowBorder(boolean b)
Indicates if the component should show a border around the text field.

Parameters:
b - true to show the text field border, false to hide it

setShowCancel

public void setShowCancel(boolean b)
Indicates if the component should show the cancel query button.

Parameters:
b - true to show the cancel query button, false to hide it

searchUpdate

protected void searchUpdate()
Update the search results based on the current query.


setQuery

public void setQuery(java.lang.String query)
Set the query string in the text field.

Parameters:
query - the query string to use

getQuery

public java.lang.String getQuery()
Get the query string in the text field.

Returns:
the current query string

setCancelColor

public void setCancelColor(java.awt.Color c)
Set the fill color of the cancel 'x' button that appears when the button has the mouse pointer over it.

Parameters:
c - the cancel color

setBackground

public void setBackground(java.awt.Color bg)
Overrides:
setBackground in class javax.swing.JComponent
See Also:
Component.setBackground(java.awt.Color)

setForeground

public void setForeground(java.awt.Color fg)
Overrides:
setForeground in class javax.swing.JComponent
See Also:
Component.setForeground(java.awt.Color)

setOpaque

public void setOpaque(boolean opaque)
Overrides:
setOpaque in class javax.swing.JComponent
See Also:
JComponent.setOpaque(boolean)

setFont

public void setFont(java.awt.Font f)
Overrides:
setFont in class javax.swing.JComponent
See Also:
Component.setFont(java.awt.Font)

setLabelText

public void setLabelText(java.lang.String text)
Set the label text used on this component.

Parameters:
text - the label text, use null to show no label

changedUpdate

public void changedUpdate(javax.swing.event.DocumentEvent e)
Specified by:
changedUpdate in interface javax.swing.event.DocumentListener
See Also:
DocumentListener.changedUpdate(javax.swing.event.DocumentEvent)

insertUpdate

public void insertUpdate(javax.swing.event.DocumentEvent e)
Specified by:
insertUpdate in interface javax.swing.event.DocumentListener
See Also:
DocumentListener.insertUpdate(javax.swing.event.DocumentEvent)

removeUpdate

public void removeUpdate(javax.swing.event.DocumentEvent e)
Specified by:
removeUpdate in interface javax.swing.event.DocumentListener
See Also:
DocumentListener.removeUpdate(javax.swing.event.DocumentEvent)

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
Specified by:
actionPerformed in interface java.awt.event.ActionListener
See Also:
ActionListener.actionPerformed(java.awt.event.ActionEvent)


Copyright © 2007 Regents of the University of California