public class SearchPanel
extends com.googlecode.jfilechooserbookmarks.gui.BasePanel
Modifier and Type | Class and Description |
---|---|
static class |
SearchPanel.LayoutType
The layout of the panel.
|
JPanel.AccessibleJPanel
JComponent.AccessibleJComponent
Container.AccessibleAWTContainer
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
Modifier and Type | Field and Description |
---|---|
protected String |
m_ButtonCaption
the caption (+ optional mnemonic indicator) for the search button.
|
protected JButton |
m_ButtonSearch
the button for searching the table.
|
protected JCheckBox |
m_CheckboxRegExp
whether to use regular expressions for searching or plain string
comparison.
|
protected boolean |
m_Incremental
whether incremental search is enabled.
|
protected JLabel |
m_LabelPrefix
the label for the text field.
|
protected String |
m_LastSearch
the last search term.
|
protected SearchPanel.LayoutType |
m_LayoutType
the layout.
|
protected GridLayout |
m_LayoutWidgets
the layout for the Widgets.
|
protected int |
m_MinimumChars
the minimum number of characters before triggering search events.
|
protected JPanel |
m_PanelWidgets
the panel with the buttons and search box.
|
protected String |
m_Prefix
the prefix (caption + optional mnemonic indicator).
|
protected boolean |
m_RegExpEnabled
whether regular expressions are enabled.
|
protected HashSet<SearchListener> |
m_SearchListeners
the listeners for a search being initiated.
|
protected JTextField |
m_TextSearch
the text field for entering the search text.
|
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
Constructor and Description |
---|
SearchPanel(SearchPanel.LayoutType layout,
boolean regExp)
Initializes the panel.
|
SearchPanel(SearchPanel.LayoutType layout,
boolean regExp,
String prefix,
boolean incremental,
String button)
Initializes the panel with optional incremental search (and no search
button if incremental search turned on).
|
SearchPanel(SearchPanel.LayoutType layout,
boolean regExp,
String prefix,
String button)
Initializes the panel.
|
Modifier and Type | Method and Description |
---|---|
void |
addSearchListener(SearchListener l)
Adds the specified listener to the internal list of listeners.
|
void |
addToWidgetsPanel(Component comp)
Adds the component to the panel with the Widgets.
|
void |
addToWidgetsPanel(Component comp,
int index)
Adds the component to the panel with the Widgets.
|
protected void |
clearSearch()
Clears a previous search if the last search term had a non-zero length.
|
void |
clearWidgetsPanel()
Removes all components from the panel holding the Widgets.
|
String |
getButtonCaption()
Returns the current caption of the search button (incl.
|
SearchPanel.LayoutType |
getLayoutType()
Returns the type of layout.
|
int |
getMinimumChars()
Returns the minimum number of characters that the user needs to enter
before triggering a search event.
|
String |
getSearchText()
Returns the text in the search box.
|
int |
getTextColumns()
Returns the number of columns of the text field.
|
void |
grabFocus()
The text field for the search tries to grab the focus.
|
protected boolean |
hasPrefix()
Checks whether a prefix string was provided.
|
protected void |
initGUI()
Initializes the widgets.
|
protected void |
initialize()
Initializes the members.
|
boolean |
isEnabled()
Returns whether the panel is enabled or not.
|
boolean |
isIncremental()
Returns whether incremental search is enabled.
|
boolean |
isRegularExpression()
Returns whether the search text is a regular expression one or not.
|
boolean |
isRegularExpressionEnabled()
Returns whether regular expressions are turned on.
|
protected boolean |
isValidSearch()
Checks whether the search is valid.
|
protected void |
notifySearchListeners(SearchEvent e)
Sends out the event to all listeners.
|
protected void |
performSearch()
Initiates a search.
|
void |
removeFromWidgetsPanel(Component comp)
Removes the component from the panel with the Widgets.
|
void |
removeSearchListener(SearchListener l)
Removes the specified listener from the internal list of listeners.
|
void |
search()
Imitates a click on the search button to initiate a search.
|
void |
setButtonCaption(String value)
The caption for the search button (incl.
|
void |
setEnabled(boolean value)
Sets the enabled state of the components.
|
void |
setMinimumChars(int value)
Sets the minimum number of characters that the user needs to enter
before triggering a search event.
|
void |
setRegularExpression(boolean value)
Sets whether the search text is a regular expression one or not.
|
void |
setSearchText(String value)
Sets the search text.
|
void |
setTextColumns(int value)
Sets the number of columns for the text field.
|
void |
updateWidth(int width)
In case of vertical display, the size of the panel can be adjusted to
the specified width.
|
afterHide, afterShow, beforeHide, beforeShow, closeParent, finishInit, getParentDialog, getParentFrame, getParentInternalFrame, getParentTitle, main, printErrorMessage, printException, setParentTitle, setVisible
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
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, 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, 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, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, unregisterKeyboardAction, update
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
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, 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, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
protected SearchPanel.LayoutType m_LayoutType
protected boolean m_RegExpEnabled
protected boolean m_Incremental
protected String m_Prefix
protected String m_ButtonCaption
protected JLabel m_LabelPrefix
protected JTextField m_TextSearch
protected JCheckBox m_CheckboxRegExp
protected JButton m_ButtonSearch
protected JPanel m_PanelWidgets
protected GridLayout m_LayoutWidgets
protected HashSet<SearchListener> m_SearchListeners
protected int m_MinimumChars
protected String m_LastSearch
public SearchPanel(SearchPanel.LayoutType layout, boolean regExp)
layout
- the layout of the panelregExp
- whether to display regular expressionspublic SearchPanel(SearchPanel.LayoutType layout, boolean regExp, String prefix, String button)
layout
- the layout of the panelregExp
- whether to display regular expressionsprefix
- the prefix label to use, use null to ignore.
Mnemonics can be indicated by a preceding underscore "_".button
- the caption for the button.
Mnemonics can be indicated by a preceding underscore "_".public SearchPanel(SearchPanel.LayoutType layout, boolean regExp, String prefix, boolean incremental, String button)
layout
- the layout of the panelregExp
- whether to display regular expressionsprefix
- the prefix label to use, use null to ignore.
Mnemonics can be indicated by a preceding underscore "_".incremental
- if true then no search button will be displayedbutton
- the caption for the button.
Mnemonics can be indicated by a preceding underscore "_".protected void initialize()
initialize
in class com.googlecode.jfilechooserbookmarks.gui.BasePanel
protected void initGUI()
initGUI
in class com.googlecode.jfilechooserbookmarks.gui.BasePanel
public void setEnabled(boolean value)
setEnabled
in class JComponent
value
- if true then the components are enabled otherwise notpublic boolean isEnabled()
public SearchPanel.LayoutType getLayoutType()
protected boolean hasPrefix()
public boolean isRegularExpressionEnabled()
public void setSearchText(String value)
value
- the new search textpublic String getSearchText()
public void setRegularExpression(boolean value)
value
- if true then regular expression search will be enabledpublic boolean isRegularExpression()
public boolean isIncremental()
public void setMinimumChars(int value)
value
- the minimum number of characters (>= 1)public int getMinimumChars()
public void setTextColumns(int value)
value
- the number of columns (>0)public int getTextColumns()
public void setButtonCaption(String value)
value
- the captionpublic String getButtonCaption()
public void clearWidgetsPanel()
public void addToWidgetsPanel(Component comp, int index)
comp
- the component to addindex
- the index where to add the component, -1 adds the
component at the endpublic void addToWidgetsPanel(Component comp)
comp
- the component to addpublic void removeFromWidgetsPanel(Component comp)
comp
- the component to removepublic void addSearchListener(SearchListener l)
l
- the listener to addpublic void removeSearchListener(SearchListener l)
l
- the listener to removeprotected void notifySearchListeners(SearchEvent e)
e
- the event to sendprotected void performSearch()
protected void clearSearch()
protected boolean isValidSearch()
public void search()
public void grabFocus()
grabFocus
in class JComponent
public void updateWidth(int width)
width
- the new widthCopyright © 2017. All Rights Reserved.