Package org.jdesktop.swingx.plaf
Class SearchFieldUI
java.lang.Object
javax.swing.plaf.ComponentUI
javax.swing.plaf.TextUI
org.jdesktop.swingx.plaf.PromptTextUI
org.jdesktop.swingx.plaf.PromptTextFieldUI
org.jdesktop.swingx.plaf.BuddyTextFieldUI
org.jdesktop.swingx.plaf.SearchFieldUI
The default
JXSearchField
UI delegate.- Author:
- Peter Weishapl petw@gmx.net
-
Nested Class Summary
Nested classes/interfaces inherited from class org.jdesktop.swingx.plaf.PromptTextUI
PromptTextUI.PainterHighlighter
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Insets
protected JXSearchField
The search field that we're a UI delegate for.Fields inherited from class org.jdesktop.swingx.plaf.BuddyTextFieldUI
layoutAndBorder
Fields inherited from class org.jdesktop.swingx.plaf.PromptTextUI
delegate, promptComponent
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected final JButton
Convienence method.protected BuddyLayoutAndBorder
TODO docprotected Icon
getNewIcon
(Icon icon, String resKey) Convience method for only replacing icons if they have not been customized by the user.protected int
Returns the number of pixels between the popup button and the clear (or search) button as specified in the default table by 'SearchField.popupOffset'.protected void
Initialize the search fields various properties based on the corresponding "SearchField.*" properties from defaults table.void
CallsinstallDefaults()
, adds the search, clear and popup button to the search field and registers aPropertyChangeListener
adDocumentListener
and anActionListener
on the popup button.protected final JButton
Convienence method.protected final JButton
Convienence method.protected boolean
void
Removes all installed listeners, the layout and resets the search field original border and removes all children.protected void
Sets the visibility of the search, clear and popup buttons depending on the search mode, layout stye, search text, search popup menu and the use of a seperate popup button.boolean
Returnstrue
ifJXSearchField.isUseSeperatePopupButton()
istrue
and a search popup menu has been set.Methods inherited from class org.jdesktop.swingx.plaf.BuddyTextFieldUI
getPreferredSize, paint
Methods inherited from class org.jdesktop.swingx.plaf.PromptTextFieldUI
createPromptComponent, getPromptComponent, modelToView, modelToView, viewToModel, viewToModel
Methods inherited from class org.jdesktop.swingx.plaf.PromptTextUI
contains, damageRange, damageRange, equals, getAccessibleChild, getAccessibleChildrenCount, getBaseline, getEditorKit, getMaximumSize, getMinimumSize, getNextVisualPositionFrom, getRootView, getToolTipText2D, hashCode, modelToView2D, modelToView2D, paintPromptComponent, shouldPaintPrompt, toString, update, viewToModel2D
Methods inherited from class javax.swing.plaf.TextUI
getToolTipText
Methods inherited from class javax.swing.plaf.ComponentUI
createUI, getBaselineResizeBehavior
-
Field Details
-
searchField
The search field that we're a UI delegate for. Initialized by theinstallUI
method, and reset to null byuninstallUI
. -
NO_INSETS
-
-
Constructor Details
-
SearchFieldUI
-
-
Method Details
-
installUI
CallsinstallDefaults()
, adds the search, clear and popup button to the search field and registers aPropertyChangeListener
adDocumentListener
and anActionListener
on the popup button.- Overrides:
installUI
in classBuddyTextFieldUI
-
createBuddyLayoutAndBorder
Description copied from class:BuddyTextFieldUI
TODO doc- Overrides:
createBuddyLayoutAndBorder
in classBuddyTextFieldUI
- Returns:
- BuddyLayoutAndBorder
-
installDefaults
protected void installDefaults()Initialize the search fields various properties based on the corresponding "SearchField.*" properties from defaults table. TheJXSearchField
s layout is set to the value returned bycreateLayout
. -
uninstallUI
Removes all installed listeners, the layout and resets the search field original border and removes all children.- Overrides:
uninstallUI
in classBuddyTextFieldUI
-
shouldReplaceResource
- Parameters:
o
- an object- Returns:
- true if
o
isnull
or of instanceUIResource
-
getNewIcon
Convience method for only replacing icons if they have not been customized by the user. Returns the icon from the defaults table belonging toresKey
, ifshouldReplaceResource(Object)
with theicon
as a parameter returnstrue
. Otherwise returnsicon
.- Parameters:
icon
- the current iconresKey
- the resource key identifying the default icon- Returns:
- the new icon
-
clearButton
Convienence method.- Returns:
- the clear button
- See Also:
-
searchButton
Convienence method.- Returns:
- the search button
- See Also:
-
popupButton
Convienence method.- Returns:
- the popup button
- See Also:
-
usingSeperatePopupButton
public boolean usingSeperatePopupButton()Returnstrue
ifJXSearchField.isUseSeperatePopupButton()
istrue
and a search popup menu has been set.- Returns:
- the popup button is used in addition to the search button
-
getPopupOffset
protected int getPopupOffset()Returns the number of pixels between the popup button and the clear (or search) button as specified in the default table by 'SearchField.popupOffset'. Returns 0 ifusingSeperatePopupButton()
returnsfalse
- Returns:
- number of pixels between the popup button and the clear (or search) button
-
updateButtons
protected void updateButtons()Sets the visibility of the search, clear and popup buttons depending on the search mode, layout stye, search text, search popup menu and the use of a seperate popup button. Also resets the search buttons pressed and rollover icons if the search field is in regular search mode or clears the icons when the search field is in instant search mode.
-