com.atlassian.gwt
Class QuickSearchInputField

java.lang.Object
  extended by com.google.gwt.user.client.ui.UIObject
      extended by com.google.gwt.user.client.ui.Widget
          extended by com.google.gwt.user.client.ui.Composite
              extended by com.atlassian.gwt.InputField
                  extended by com.atlassian.gwt.QuickSearchInputField
All Implemented Interfaces:
QuickSearchSupport, com.google.gwt.event.dom.client.HasBlurHandlers, com.google.gwt.event.dom.client.HasFocusHandlers, com.google.gwt.event.dom.client.HasKeyDownHandlers, com.google.gwt.event.dom.client.HasKeyUpHandlers, com.google.gwt.event.shared.HasHandlers, com.google.gwt.user.client.EventListener

public class QuickSearchInputField
extends InputField
implements QuickSearchSupport

The is a widget that extends InputField to include a quick search drop down. This relies on the existing quick search js that lives inside of Confluence. After creating the widget, it's necessary to call bindDropDown to add the default query parameters and a drop down handler that handles js events called from the user interacting with the quick search results.

Author:
Ryan Ackley, Agnes Ro

Nested Class Summary
 
Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.UIObject
com.google.gwt.user.client.ui.UIObject.DebugIdImpl, com.google.gwt.user.client.ui.UIObject.DebugIdImplEnabled
 
Field Summary
protected  com.google.gwt.user.client.ui.FlowPanel dropDownPanel
          Hidden div that the quick search results drop down attaches to.
 
Fields inherited from class com.atlassian.gwt.InputField
label, panel, textBox
 
Fields inherited from class com.google.gwt.user.client.ui.UIObject
DEBUG_ID_PREFIX
 
Constructor Summary
QuickSearchInputField(String fieldName, int size)
           
 
Method Summary
 void bindDropDown(DropDownHandler handler)
          Sets the default query parameters for the quick search and adds a listener for js events called by the quick search.
 void cancelDropDown()
          Prevents the down down from showing, if any.
 void clearSearchCache()
          Clears the search cache used by the quick search dropdown.
 boolean dropDownHasFocus()
           
 String getSearchForText()
           
 void hideDropDown()
          Hides the current drop down, if any.
 boolean isDropDownOpen()
           
 void setLabelClassName(String className)
           
 void setSearchForText(String searchForText)
           
 
Methods inherited from class com.atlassian.gwt.InputField
addBlurHandler, addFocusHandler, addKeyDownHandler, addKeyUpHandler, focus, getText, getTextBox, selectAll, setLabel, setText
 
Methods inherited from class com.google.gwt.user.client.ui.Composite
getWidget, initWidget, isAttached, onAttach, onBrowserEvent, onDetach, setWidget
 
Methods inherited from class com.google.gwt.user.client.ui.Widget
addDomHandler, addHandler, delegateEvent, doAttachChildren, doDetachChildren, fireEvent, getHandlerCount, getLayoutData, getParent, isOrWasAttached, onLoad, onUnload, removeFromParent, setLayoutData, sinkEvents
 
Methods inherited from class com.google.gwt.user.client.ui.UIObject
addStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, getTitle, isVisible, isVisible, onEnsureDebugId, removeStyleDependentName, removeStyleName, setElement, setElement, setHeight, setPixelSize, setSize, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, toString, unsinkEvents
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.google.gwt.event.shared.HasHandlers
fireEvent
 

Field Detail

dropDownPanel

protected final com.google.gwt.user.client.ui.FlowPanel dropDownPanel
Hidden div that the quick search results drop down attaches to.

Constructor Detail

QuickSearchInputField

@UiConstructor
public QuickSearchInputField(String fieldName,
                                           int size)
Parameters:
fieldName - The name attribute for the text input field.
size - The visible size of the text input field.
Method Detail

getSearchForText

public String getSearchForText()

bindDropDown

public void bindDropDown(DropDownHandler handler)
Description copied from interface: QuickSearchSupport
Sets the default query parameters for the quick search and adds a listener for js events called by the quick search.

Specified by:
bindDropDown in interface QuickSearchSupport
Parameters:
handler - This is the event handler that does something when a user makes a selection from the quick search results.

hideDropDown

public void hideDropDown()
Description copied from interface: QuickSearchSupport
Hides the current drop down, if any.

Specified by:
hideDropDown in interface QuickSearchSupport

isDropDownOpen

public boolean isDropDownOpen()
Specified by:
isDropDownOpen in interface QuickSearchSupport
Returns:
true if the quick search drop down is visible

clearSearchCache

public void clearSearchCache()
Description copied from interface: QuickSearchSupport
Clears the search cache used by the quick search dropdown. The cache is only based on the search query text so this needs to be cleared when any other search parameter changes (like the space key)

Specified by:
clearSearchCache in interface QuickSearchSupport

cancelDropDown

public void cancelDropDown()
Description copied from interface: QuickSearchSupport
Prevents the down down from showing, if any.

Specified by:
cancelDropDown in interface QuickSearchSupport

dropDownHasFocus

public boolean dropDownHasFocus()
Specified by:
dropDownHasFocus in interface QuickSearchSupport
Returns:
true if there is a selection active in the drop down

setLabelClassName

public void setLabelClassName(String className)

setSearchForText

public void setSearchForText(String searchForText)


Copyright © 2003-2010 Atlassian. All Rights Reserved.