Copyright © 2005 Scientific Applications. All Rights Reserved.

com.sciapp.table.search
Class SearchTablePanel

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 com.sciapp.table.search.AbstractSearchPanel
                      extended by com.sciapp.table.search.SearchTablePanel
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

public class SearchTablePanel
extends AbstractSearchPanel

SearchTablePanel is a panel through which search model events are constructed and propagated to SearchModelListeners.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
protected  JComboBox fieldBox
          a combobox that contains the columns that we are able to search.
 
Fields inherited from class com.sciapp.table.search.AbstractSearchPanel
closeButton, findLabel, foundBackgroundColor, foundForegroundColor, highLight, nextButton, notFound, notFoundBackgroundColor, notFoundForegroundColor, prevButton, searchModel
 
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
SearchTablePanel(String[] fields)
          Constructs a SearchTablePanel with fields as the fields that we are able to search.
SearchTablePanel(String[] fields, Class[] classes)
          Constructs a SearchTablePanel with fields as the fields that we are able to search and classes as the corresponding classes of each field.
SearchTablePanel(TableModel tableModel)
          Constructs a SearchTablePanel by quering tableModel for the fields and their corresponding classes.
 
Method Summary
protected  void createDefaultSeekers()
          Creates default VisualSeeker for objects, strings, numbers and boolean values.
 VisualSeeker getDefaultSeeker(Class columnClass)
          Returns the visual seeker to use for the class defined by columnClass.
 VisualSeeker getDefaultSeeker(int field)
          Returns the visual seeker to use for the value at field.
 JComboBox getFieldBox()
          Returns a combobox that contains the fields that we are able to search.
protected  TableSearch getTableSearchForSeeker(VisualSeeker seeker)
          Returns a TableSearch for the seeker passed as argument.
 void highLight()
          Searches the whole table in an arbitrary direction.
protected  void initComponents()
          Initializes the components that will be added to the panel.
protected  void makePanel()
          Initializes the panel.
 void next()
          Searches in the forward direction.
 void previous()
          Searches in the backward direction.
 void setCurrentSeeker(VisualSeeker seeker)
          Assignes a visual seeker to the panel.
 void setDefaultSeeker(Class columnClass, VisualSeeker seeker)
          Sets the default visual seeker for columnClass.
 void setTable(JTable table)
          Assigns a table to the SearchTablePanel.
 void update(TableModel model)
          Updates the SearchTablePanel by querying model and recreating the fields that we are able to search.
 void updateUI()
          Resets the UI property with a value from the current look and feel.
 
Methods inherited from class com.sciapp.table.search.AbstractSearchPanel
getCloseButton, getFindLabel, getFoundBackgroundColor, getFoundForegroundColor, getHighLightButton, getNextButton, getNotFoundBackgroundColor, getNotFoundForegroundColor, getNotFoundLabel, getPrevButton, getSearchModel, register, registerListeners, setFoundBackgroundColor, setFoundForegroundColor, setNotFoundBackgroundColor, setNotFoundForegroundColor, unregister
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, 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, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, 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, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, 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, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, 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
 

Field Detail

fieldBox

protected JComboBox fieldBox
a combobox that contains the columns that we are able to search.

Constructor Detail

SearchTablePanel

public SearchTablePanel(String[] fields)
Constructs a SearchTablePanel with fields as the fields that we are able to search. The corresponing filter for each field is initialized to a StringFilter.

Parameters:
fields - the fields, which usually are the columns of a table.

SearchTablePanel

public SearchTablePanel(String[] fields,
                        Class[] classes)
Constructs a SearchTablePanel with fields as the fields that we are able to search and classes as the corresponding classes of each field. An IllegalArgumentException is thrown if fields and classes are not of the same length.

Parameters:
fields - the fields, which ususally are the columns of a table.
classes - the associated classes to fields.

SearchTablePanel

public SearchTablePanel(TableModel tableModel)
Constructs a SearchTablePanel by quering tableModel for the fields and their corresponding classes. The search columns and classes are constructed by calling the getColumnName and getColumnClass methods of TableModel respectively. Therefore, these methods should not return null.

Parameters:
tableModel - the tablemodel to query
Method Detail

createDefaultSeekers

protected void createDefaultSeekers()
Creates default VisualSeeker for objects, strings, numbers and boolean values.


getDefaultSeeker

public VisualSeeker getDefaultSeeker(int field)
Returns the visual seeker to use for the value at field.

This method returns null by default. Override it in order to return your own visual seeker object.

Parameters:
field - the field index to which a visual seeker is associated.
Returns:
the visual seeker that corresponds to field

getDefaultSeeker

public VisualSeeker getDefaultSeeker(Class columnClass)
Returns the visual seeker to use for the class defined by columnClass.

Parameters:
columnClass - the class to which a visual seeker is associated.
Returns:
the visual seeker that corresponds to columnClass.

getFieldBox

public JComboBox getFieldBox()
Returns a combobox that contains the fields that we are able to search.

Returns:
the combobox containing the available search columns

getTableSearchForSeeker

protected TableSearch getTableSearchForSeeker(VisualSeeker seeker)
Returns a TableSearch for the seeker passed as argument.

Parameters:
seeker - the visual seeker for which we want a TableSearch returned
Returns:
the TableSearch that corresponds to the seeker passed as argument

highLight

public void highLight()
Searches the whole table in an arbitrary direction.

Specified by:
highLight in class AbstractSearchPanel

initComponents

protected void initComponents()
Initializes the components that will be added to the panel.

Overrides:
initComponents in class AbstractSearchPanel

makePanel

protected void makePanel()
Initializes the panel.

Specified by:
makePanel in class AbstractSearchPanel

next

public void next()
Searches in the forward direction.

Specified by:
next in class AbstractSearchPanel

previous

public void previous()
Searches in the backward direction.

Specified by:
previous in class AbstractSearchPanel

setCurrentSeeker

public void setCurrentSeeker(VisualSeeker seeker)
Assignes a visual seeker to the panel.

Parameters:
seeker - the visual seeker to assign

setDefaultSeeker

public void setDefaultSeeker(Class columnClass,
                             VisualSeeker seeker)
Sets the default visual seeker for columnClass.

Parameters:
columnClass - the Class with which a visual seeker we want to associate
seeker - the visual seeker to assign

setTable

public void setTable(JTable table)
Assigns a table to the SearchTablePanel. The table will be used for correctly converting the model index of the column to the view index of the table. If a table is not assigned, the panel's fields should directly correspond to the table's columns.

Parameters:
table - the table to assign

update

public void update(TableModel model)
Updates the SearchTablePanel by querying model and recreating the fields that we are able to search.

Parameters:
model - the TableModel to query

updateUI

public void updateUI()
Resets the UI property with a value from the current look and feel.

Overrides:
updateUI in class JPanel
See Also:
JComponent.updateUI()

Copyright © 2005 Scientific Applications. All Rights Reserved.