/*
 * Copyright (c) 2009 Kathryn Huxtable and Kenneth Orr.
 *
 * This file is part of the SeaGlass Pluggable Look and Feel.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * 
 * $Id$
 */
package com.seaglasslookandfeel.state;

import javax.swing.JComponent;
import javax.swing.JPopupMenu;
import javax.swing.text.JTextComponent;

/**
 * Is the text field a search field variant with a popup menu?
 */
public class SearchFieldHasPopupState extends State {
    public SearchFieldHasPopupState() {
        super("HasPopup");
    }

    public boolean isInState(JComponent c) {
        if (!(c instanceof JTextComponent) || !"search".equals(c.getClientProperty("JTextField.variant"))) {
            return false;
        }

        Object o = c.getClientProperty("JTextField.Search.FindPopup");
        return (o != null && o instanceof JPopupMenu);
    }
}

@@ -731,16 +731,72 @@
 state;%0A%0A
+import java.awt.Container;%0A%0Aimport javax.swing.JButton;%0A
 import j
@@ -818,16 +818,16 @@
 ponent;%0A
-
 import j
@@ -1166,26 +1166,239 @@
 of J
-TextComponent) %7C%7C 
+Button)) %7B%0A            return false;%0A        %7D%0A%0A        Container p = c.getParent();%0A        if (p == null %7C%7C !(p instanceof JTextComponent)) %7B return false;%7D%0A        %0A        JTextComponent field = (JTextComponent) p;%0A        if (
 !%22se
@@ -1410,17 +1410,21 @@
 .equals(
-c
+field
 .getClie
@@ -1516,17 +1516,21 @@
 ect o = 
-c
+field
 .getClie

Make hasPopup state use the parent's client property.