Package adams.gui.core
Class FilterPanel
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- javax.swing.JComponent
-
- javax.swing.JPanel
-
- adams.gui.core.BasePanel
-
- adams.gui.core.FilterPanel
-
- All Implemented Interfaces:
ImageObserver
,MenuContainer
,Serializable
,Accessible
public class FilterPanel extends BasePanel
Compact filter component that allows user to enter text. Any change in the text triggers a notification.- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- 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.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
-
-
Field Summary
Fields Modifier and Type Field Description static int
HORIZONTAL
for horizontal layout (label textfield button).protected Set<ChangeListener>
m_ChangeListeners
the filter listeners.protected JLabel
m_LabelFilter
the label for the filter.protected JLabel
m_LabelFilterClear
the icon for clearing the text field.protected int
m_Layout
the type of layout to use.protected int
m_TextColumns
the text width in columnsprotected BaseTextField
m_TextFilter
the edit field for the filter.static int
UNDEFINED
for undefined layout.static int
VERTICAL
for vertical layout (label \n textfield button).-
Fields inherited from class adams.gui.core.BasePanel
m_FileChooser
-
Fields inherited from class javax.swing.JComponent
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
accessibleContext, 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
Constructors Constructor Description FilterPanel(int layout)
Initializes the component.FilterPanel(int layout, int textColumns)
Initializes the component.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addChangeListener(ChangeListener l)
Adds the listener to the internal set.void
clearChangeListeners()
Removes all change listeners.protected void
finishInit()
Finishes the initialization.String
getFilter()
Returns the filter string.String
getFilterLabel()
Returns the text of the filter label (no mnemonic).int
getTextColumns()
Returns the width of the text field.String
getToolTipText()
Returns the tool tip for the text field.protected void
initGUI()
Initializes the widgets.protected void
initialize()
Initializes the members.boolean
isEnabled()
Returns the enabled state.protected void
notifyChangeListeners()
Notifies all change listeners.void
removeChangeListener(ChangeListener l)
Removes the listener from the internal set.void
requestFocus()
For the text field to request the focus.void
setEnabled(boolean value)
Sets the enabled state.void
setFilter(String value)
Sets the filter string.void
setFilterLabel(String value)
Sets the text for the filter label.void
setTextColumns(int value)
Sets the width of the text field.void
setToolTipText(String value)
Sets the tool tip for the text field and label.-
Methods inherited from class adams.gui.core.BasePanel
afterHide, afterShow, beforeHide, beforeShow, closeParent, getParentChild, getParentDialog, getParentFrame, getParentInternalFrame, getParentTitle, initFileChooser, main, printErrorMessage, printException, saveComponent, setEnabledCascade, setEnabledCascade, setParentTitle, setVisible
-
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, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, 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, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, 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, 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, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, 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, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
-
-
-
Field Detail
-
UNDEFINED
public static final int UNDEFINED
for undefined layout.- See Also:
- Constant Field Values
-
HORIZONTAL
public static final int HORIZONTAL
for horizontal layout (label textfield button).- See Also:
- Constant Field Values
-
VERTICAL
public static final int VERTICAL
for vertical layout (label \n textfield button).- See Also:
- Constant Field Values
-
m_Layout
protected int m_Layout
the type of layout to use.
-
m_TextColumns
protected int m_TextColumns
the text width in columns
-
m_LabelFilter
protected JLabel m_LabelFilter
the label for the filter.
-
m_TextFilter
protected BaseTextField m_TextFilter
the edit field for the filter.
-
m_LabelFilterClear
protected JLabel m_LabelFilterClear
the icon for clearing the text field.
-
m_ChangeListeners
protected Set<ChangeListener> m_ChangeListeners
the filter listeners.
-
-
Constructor Detail
-
FilterPanel
public FilterPanel(int layout)
Initializes the component.- Parameters:
layout
- the type of layout- See Also:
HORIZONTAL
,VERTICAL
-
FilterPanel
public FilterPanel(int layout, int textColumns)
Initializes the component.- Parameters:
layout
- the type of layouttextColumns
- the width of the text field, ignored if <=0- See Also:
HORIZONTAL
,VERTICAL
-
-
Method Detail
-
initialize
protected void initialize()
Initializes the members.- Overrides:
initialize
in classBasePanel
-
finishInit
protected void finishInit()
Finishes the initialization.- Overrides:
finishInit
in classBasePanel
-
setFilterLabel
public void setFilterLabel(String value)
Sets the text for the filter label. Use "_" before the character that you want to use as mnemonic.- Parameters:
value
- the text
-
getFilterLabel
public String getFilterLabel()
Returns the text of the filter label (no mnemonic).- Returns:
- the text
-
setFilter
public void setFilter(String value)
Sets the filter string.- Parameters:
value
- the string
-
getFilter
public String getFilter()
Returns the filter string.- Returns:
- the string
-
setToolTipText
public void setToolTipText(String value)
Sets the tool tip for the text field and label.- Overrides:
setToolTipText
in classJComponent
- Parameters:
value
- the tip text
-
getToolTipText
public String getToolTipText()
Returns the tool tip for the text field.- Overrides:
getToolTipText
in classJComponent
- Returns:
- the tip text
-
addChangeListener
public void addChangeListener(ChangeListener l)
Adds the listener to the internal set.- Parameters:
l
- the listener to add
-
removeChangeListener
public void removeChangeListener(ChangeListener l)
Removes the listener from the internal set.- Parameters:
l
- the listener to remove
-
clearChangeListeners
public void clearChangeListeners()
Removes all change listeners.
-
notifyChangeListeners
protected void notifyChangeListeners()
Notifies all change listeners.
-
setEnabled
public void setEnabled(boolean value)
Sets the enabled state.- Overrides:
setEnabled
in classJComponent
- Parameters:
value
- true if enabled
-
isEnabled
public boolean isEnabled()
Returns the enabled state.
-
requestFocus
public void requestFocus()
For the text field to request the focus.- Overrides:
requestFocus
in classJComponent
-
setTextColumns
public void setTextColumns(int value)
Sets the width of the text field.- Parameters:
value
- the width in columns
-
getTextColumns
public int getTextColumns()
Returns the width of the text field.- Returns:
- the width in columns
-
-