com.ca.directory.jxplorer.search
Class JoinFilterPanel

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--javax.swing.JPanel
                          |
                          +--com.ca.commons.cbutil.CBPanel
                                |
                                +--com.ca.directory.jxplorer.search.JoinFilterPanel
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public class JoinFilterPanel
extends CBPanel

Creates a scrollable panel that can add and remove rows that are used to join raw filters or filters that are a combination of filter. Each row consists of a filter combo box that contains the names of all possible filters that can be joined (obtained from search_filter.txt) and an edit button which is used to display the filter of a particular row. If there are more than one row, an And/Or combo is added to the second row and and And/Or labels to all rows there after. The And/Or labels always show the value of the And/Or combo box.

This idea behind this class is that a user can join existing filters. The filters can be raw filters or filters consisting of already joined filters. This enables the user to construct complex LDAP filters.

This panel is controlled by the SearchGUI class. I.e. the SearchGUI class tells this class to add or remove a row or to edit or load a certain filter. It also feeds back to the SearchGUI the values of it's components when required.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Nested classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
 
Fields inherited from class com.ca.commons.cbutil.CBPanel
c, xpos, ypos
 
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
JoinFilterPanel(javax.swing.JButton btnEdit)
          Constructor that sets up the Join tab with a not check box, and the first row e.g a filter combo and an edit button.
 
Method Summary
protected  void addFilterRow(javax.swing.JButton btnEdit)
          Adds a row or line to the Join tab.
protected  boolean displayFilter(java.util.ArrayList list, java.lang.String value)
          Attempts to display a filter usually after someone has selected to load a filter via the load dialog or via the edit button in the search dialog.
protected  java.lang.String getFilter()
          Returns the current filter that is displayed in the Join tab by getting the values of each component.
protected  java.lang.String getFilterComboValue(int row)
          Returns the value of the filter combo box at a specified row.
protected  boolean isFilterValid()
          Checks if the filter is valid.
protected  void removeFilterRow(javax.swing.JButton btnEdit)
          Removes the last line from the join filter tab e.g the filter combo, edit button and andOr combo/label.
protected  void setItems(boolean not, int index)
          Selects or de-selects the not check box depending on the value supplied and sets the and/or combo to the index supplied.
protected  void setItems(java.lang.String filter, int row)
          Sets the filter combo with the supplied string (or filter) at the supplied row.
protected  void updateFilterCombo(java.lang.String item)
          Updates the all filter combo's and their renders with any new filters that have usually been added in the Build tab.
 
Methods inherited from class com.ca.commons.cbutil.CBPanel
add, add, add, addGreedyWide, addGreedyWide, addLine, addLines, addln, addWide, makeHeavy, makeHigh, makeLight, makeWide, newLine, toString
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
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, 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, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JoinFilterPanel

public JoinFilterPanel(javax.swing.JButton btnEdit)
Constructor that sets up the Join tab with a not check box, and the first row e.g a filter combo and an edit button.

Parameters:
btnEdit - the edit button that is added to each row.
Method Detail

addFilterRow

protected void addFilterRow(javax.swing.JButton btnEdit)

Adds a row or line to the Join tab. A line consists of a filter combo and an edit button. If the second row is added, an And/Or combo is added, if there are any more rows that are added after the second an And/Or label is added with the value of the And/Or combo. If the And/Or combo is changed by the user the And/Or labels are updated to reflect the change via a listener on the And/Or combo.

The components in a row are added according to row number for example if the second row is being added, a filter combo is created and stored in the filter combo array at that row position.

Parameters:
btnEdit - the edit button to be added to the row.

updateFilterCombo

protected void updateFilterCombo(java.lang.String item)
Updates the all filter combo's and their renders with any new filters that have usually been added in the Build tab.

Parameters:
item - the name of the filter to add to the combo boxes.

removeFilterRow

protected void removeFilterRow(javax.swing.JButton btnEdit)
Removes the last line from the join filter tab e.g the filter combo, edit button and andOr combo/label.

Parameters:
btnEdit - the edit button for the line or row that is being removed.

isFilterValid

protected boolean isFilterValid()
Checks if the filter is valid. A filter is not valid if any attribute or function combo contains an empty string or a null. returns true if all combo contain a value, false otherwise.


getFilter

protected java.lang.String getFilter()
Returns the current filter that is displayed in the Join tab by getting the values of each component.

Returns:
the filter value (not an LDAP filter, something more like: '&JXFilter.myFilter1JXFilter.myFilter2').

getFilterComboValue

protected java.lang.String getFilterComboValue(int row)
Returns the value of the filter combo box at a specified row.

Parameters:
row - the row number of the combo box that the value is to be returned from.
Returns:
the value that is selected in the combo box.

displayFilter

protected boolean displayFilter(java.util.ArrayList list,
                                java.lang.String value)
Attempts to display a filter usually after someone has selected to load a filter via the load dialog or via the edit button in the search dialog. This method needs to set values for the andOr combo and labels, the not check box, and the filter combos.

Parameters:
list - a list of the names of the filters e.g.[myFilter1, myFilter2].
value - the value of the filter being displayed e.g. '&JXFilter.myFilter1JXFilter.myFilter2'. return true if the display was successful, false otherwise.

setItems

protected void setItems(java.lang.String filter,
                        int row)
Sets the filter combo with the supplied string (or filter) at the supplied row.

Parameters:
filter - the value to displayed in the filter combo.
row - the row number of the combo box that the value is to be set.

setItems

protected void setItems(boolean not,
                        int index)
Selects or de-selects the not check box depending on the value supplied and sets the and/or combo to the index supplied.

Parameters:
not - the state of the not check box.
index - the index that the and/or combo is to be set to.