Custom component extension.

I am working on a CustomComponent consisting of a TextField and a PopupViewer. Under certain conditions, such as clearing the field, I want the PopupViewer to display. Is there an example of a CustomComponent extension or example along these lines that I can look at?

I suppose you mean
https://vaadin.com/api/7.1.15/com/vaadin/ui/PopupView.html
when speaking about the PopupViewer. If that is the case, I think the simplest solution would be add a ValueChangeListener to your TextField and check there whether or not the value of the field is empty. If it is empty, just call yourPopupView.setPopupVisible(true);

tf.addValueChangeListener(new ValueChangeListener() {
            
            @Override
            public void valueChange(ValueChangeEvent event) {
                if (tf.getValue().isEmpty()) {
                    pv.setPopupVisible(true);
                } else {
                    pv.setPopupVisible(false);
                }
            }
        });

The problem with the ValueChange event is that it is not triggered on the server until the user leaves the field and I wanted to show the popup the minute the user cleared the field. I managed to solve my problem through the use of a ServerRpc interface. When the keyup event on the client is triggered, I check to see if the results is an empty value, if so I call a method defined in the ServerRpc. On the server side when that method is called, I clear the text field, which causes the ValueChanged event to be triggered.

You could use
TextChangeListener
instead of
ValueChangeListener.