Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.greenstone.gatherer.gui
Class Filter  view Filter download Filter.java

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byjavax.swing.JPanel
                  extended byorg.greenstone.gatherer.gui.Filter
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public class Filter
extends javax.swing.JPanel

This object allows the user to set a filter on one of the workspace trees, specifying a preset type, or a regular expression that a files must match to be in the tree. Note that all directories are included. This class includes the controls for editing the filter. The trick is that several instances of the Filter class can share the same internal data (termed a 'run' of filters), so that the filter set on the CollectionPane and the MetaEditPane are virtually the same.

The regular expression typed uses '*' as a wildcard character (equivalent to '.*'), and does not use '.' to match any single character (use '?' instead).

Version:
2.3

Nested Class Summary
private  class Filter.ComboBoxListener
          Listens for changes in the combobox as when one is detected attempts to compile a regular expression from whatever text was entered.
private  class Filter.Entry
          An object that holds a filter entry.
 
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
private  javax.swing.JCheckBox checkbox
          The check box to enable/disable filter.
private  GComboBox combobox
          The editable combobox where you either choose a predefined filter, or type a new pseudo-regular expression.
private static java.lang.String[] DEFAULTS
          Preprogrammed default filters.
private  boolean first
          Is this the first filter of this run of filters created (later filters will share the same information).
private  boolean ignore
          Prevent any changes we make in the class from causing events which we then process causing events...
private  javax.swing.JLabel label
          The label shown on the filter controls.
private  java.util.ArrayList others
          The other filters in this run of filters, used to ensure they all show the same thing.
private static java.awt.Dimension SIZE
          The default size for the label.
private  Filter this_filter
          A reference to ourselves so inner classes can refer to us.
private  org.greenstone.gatherer.gui.tree.DragTree tree
          A reference to the tree this filter is being applied to.
 
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.Container
 
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
Filter(org.greenstone.gatherer.gui.tree.DragTree tree)
          Constructor.
Filter(org.greenstone.gatherer.gui.tree.DragTree tree, java.util.ArrayList others)
          Constructor.
 
Method Summary
private  java.lang.String encode(java.lang.String raw)
          Encode an expression in pseudo-regular expression into regular expression.
 GComboBox getComboBox()
          Retrieve the combobox associated with this filter.
 void setComboBoxModel(javax.swing.ComboBoxModel model)
          Set the combobox model for this filter.
 void setComboBoxSelection(Filter.Entry selection)
          Ensure that a certain entry is selected from the combobox.
 void setEnabled(boolean state)
          Used to restore the filter state to enabled, the normal state during collection editing.
private  void setFilter(java.util.regex.Pattern pattern)
          This method applies the given pattern to the tree registered as belonging to this filter.
 void setFirst(boolean first)
          Set to signify that this filter is the first in a new run of filters.
 Filter spawn(org.greenstone.gatherer.gui.tree.DragTree tree_spawn)
          Spawn produces a copy of this filter, which has new controls, but shares listeners with this filter, and vice versa.
 
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, 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, swapComponents, 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, transferFocusBackward, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

others

private java.util.ArrayList others
The other filters in this run of filters, used to ensure they all show the same thing.


first

private boolean first
Is this the first filter of this run of filters created (later filters will share the same information).


ignore

private boolean ignore
Prevent any changes we make in the class from causing events which we then process causing events...


this_filter

private Filter this_filter
A reference to ourselves so inner classes can refer to us.


checkbox

private javax.swing.JCheckBox checkbox
The check box to enable/disable filter.


combobox

private GComboBox combobox
The editable combobox where you either choose a predefined filter, or type a new pseudo-regular expression.


label

private javax.swing.JLabel label
The label shown on the filter controls.


tree

private org.greenstone.gatherer.gui.tree.DragTree tree
A reference to the tree this filter is being applied to.


SIZE

private static final java.awt.Dimension SIZE
The default size for the label.


DEFAULTS

private static final java.lang.String[] DEFAULTS
Preprogrammed default filters.

Constructor Detail

Filter

public Filter(org.greenstone.gatherer.gui.tree.DragTree tree)
Constructor.


Filter

public Filter(org.greenstone.gatherer.gui.tree.DragTree tree,
              java.util.ArrayList others)
Constructor.

Method Detail

getComboBox

public GComboBox getComboBox()
Retrieve the combobox associated with this filter.


setEnabled

public void setEnabled(boolean state)
Used to restore the filter state to enabled, the normal state during collection editing.


setComboBoxModel

public void setComboBoxModel(javax.swing.ComboBoxModel model)
Set the combobox model for this filter.


setComboBoxSelection

public void setComboBoxSelection(Filter.Entry selection)
Ensure that a certain entry is selected from the combobox.


setFirst

public void setFirst(boolean first)
Set to signify that this filter is the first in a new run of filters.


spawn

public Filter spawn(org.greenstone.gatherer.gui.tree.DragTree tree_spawn)
Spawn produces a copy of this filter, which has new controls, but shares listeners with this filter, and vice versa. Thus we can have two synchronized, but differing sets of controls.


encode

private java.lang.String encode(java.lang.String raw)
Encode an expression in pseudo-regular expression into regular expression.


setFilter

private void setFilter(java.util.regex.Pattern pattern)
This method applies the given pattern to the tree registered as belonging to this filter.