/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
public class AquaTextFieldSearch {
private static final SearchFieldPropertyListener SEARCH_FIELD_PROPERTY_LISTENER = new SearchFieldPropertyListener();
}
}
if (!(source instanceof JTextComponent)) return;
return;
}
if (wantsToBeASearchField(c)) {
} else {
}
}
}
}
}
protected static final RecyclableSingleton<SearchFieldBorder> instance = new RecyclableSingletonFromDefaultConstructor<SearchFieldBorder>(SearchFieldBorder.class);
}
if (ui instanceof AquaTextFieldUI) {
}
}
c.removeAll();
if (ui instanceof AquaTextFieldUI) {
}
}
// The "magnifying glass" icon that sometimes has a downward pointing triangle next to it
// if a popup has been assigned to it. It does not appear to have a pressed state.
new DynamicallySizingJRSUIIcon(new SizeDescriptor(new SizeVariant(25, 22).alterMargins(0, 4, 0, -5))) {
public void initJRSUIState() {
}
}
:
new DynamicallySizingJRSUIIcon(new SizeDescriptor(new SizeVariant(25, 22).alterMargins(0, 4, 0, 2))) {
public void initJRSUIState() {
}
}
;
}
// The "X in a circle" that only shows up when there is text in the search field.
return new DynamicallySizingJRSUIIcon(new SizeDescriptor(new SizeVariant(22, 22).alterMargins(0, 0, 0, 4))) {
public void initJRSUIState() {
}
};
}
}
protected static JButton createButton(final JTextComponent c, final DynamicallySizingJRSUIIcon icon) {
// {
// public void paint(Graphics g) {
// super.paint(g);
//
// g.setColor(Color.green);
// g.drawRect(0, 0, getWidth() - 1, getHeight() - 1);
// }
// }
;
b.setBorderPainted(false);
b.setFocusable(false);
b.addChangeListener(new ChangeListener() {
public void stateChanged(final ChangeEvent e) {
}
});
b.addMouseListener(new MouseAdapter() {
public void mousePressed(final MouseEvent e) {
c.requestFocusInWindow();
}
});
return b;
}
b.setName("find");
if (findPopup instanceof JPopupMenu) {
// if we have a popup, indicate that in the icon
b.addMouseListener(new MouseAdapter() {
public void mousePressed(final MouseEvent e) {
c.requestFocusInWindow();
c.repaint();
}
});
}
if (findAction instanceof ActionListener) {
}
return b;
}
});
c.addFocusListener(new FocusAdapter() {
});
updatePromptLabel(label, c);
return label;
}
if (SwingUtilities.isEventDispatchThread()) {
} else {
});
}
}
}
}
b.setName("cancel");
if (cancelAction instanceof ActionListener) {
}
public void actionPerformed(final ActionEvent e) {
c.setText("");
}
});
});
updateCancelIcon(b, c);
return b;
}
// <rdar://problem/6444328> JTextField.variant=search: not thread-safe
if (SwingUtilities.isEventDispatchThread()) {
} else {
});
}
}
}
// subclass of normal text border, because we still want all the normal text field behaviors
protected boolean reallyPaintBorder;
public SearchFieldBorder() {
}
super(other);
}
public void paint(final JComponent c, final Graphics g, final int x, final int y, final int w, final int h) {
reallyPaintBorder = true;
paintBorder(c, g, x, y, w, h);
reallyPaintBorder = false;
}
// apparently without adjusting for odd height pixels, the search field "wobbles" relative to it's contents
public void paintBorder(final Component c, final Graphics g, final int x, final int y, final int width, final int height) {
if (!reallyPaintBorder) return;
}
if (!hasPopupMenu((JTextComponent)c)) {
return new Insets(sizeVariant.margins.top, sizeVariant.margins.left - 7, sizeVariant.margins.bottom, sizeVariant.margins.right);
}
return sizeVariant.margins;
}
protected boolean doingLayout;
// unfortunately, the default behavior of BorderLayout, which accommodates for margins
// is not what we want, so we "turn off margins" for layout for layout out our buttons
doingLayout = true;
super.layoutContainer(target);
doingLayout = false;
}
};
}
}
}