com.github.gwtbootstrap.client.ui.base
Class DropdownBase

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.Panel
              extended by com.google.gwt.user.client.ui.ComplexPanel
                  extended by com.github.gwtbootstrap.client.ui.base.ComplexWidget
                      extended by com.github.gwtbootstrap.client.ui.base.DropdownBase
All Implemented Interfaces:
HasStyle, IsResponsive, HasChangeHandlers, HasClickHandlers, HasAttachHandlers, HasHandlers, EventListener, HasText, HasVisibility, HasWidgets, HasWidgets.ForIsWidget, IndexedPanel, IndexedPanel.ForIsWidget, IsWidget, Iterable<Widget>
Direct Known Subclasses:
Dropdown, DropdownButton, SplitDropdownButton

public abstract class DropdownBase
extends ComplexWidget
implements HasChangeHandlers, HasClickHandlers, HasWidgets, HasText

Base class for dropdown widgets.

Since:
2.0.4.0
Author:
Carlos A Becker, Dominik Mayer

Nested Class Summary
 
Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.UIObject
UIObject.DebugIdImpl, UIObject.DebugIdImplEnabled
 
Nested classes/interfaces inherited from interface com.google.gwt.user.client.ui.HasWidgets
HasWidgets.ForIsWidget
 
Nested classes/interfaces inherited from interface com.google.gwt.user.client.ui.IndexedPanel
IndexedPanel.ForIsWidget
 
Field Summary
 
Fields inherited from class com.google.gwt.user.client.ui.UIObject
DEBUG_ID_PREFIX
 
Constructor Summary
DropdownBase(String type)
          Creates a new widget of the given type.
 
Method Summary
 void add(Widget widget)
          Adds a widget to the dropdown menu.
 HandlerRegistration addChangeHandler(ChangeHandler handler)
           
 HandlerRegistration addClickHandler(ClickHandler handler)
           
protected  void addWidget(Widget widget)
          Adds a widget to the the dropdown widget, not to the dropdown menu.
 void clear()
           
protected abstract  IconAnchor createTrigger()
          Implement this method to create the trigger appropriate for your widget.
 NavLink getLastSelectedNavLink()
          Method to get the NavLink that has been clicked most recently.
 String getText()
           
protected  void onLoad()
          
 void setDropup(boolean dropup)
          Set dropup style.
 void setRightDropdown(boolean rightDropdown)
          Pull the dropdown menu to right
 void setText(String text)
          Sets the text of the dropdown trigger.
 
Methods inherited from class com.github.gwtbootstrap.client.ui.base.ComplexWidget
addStyle, insert, removeStyle, setHideOn, setShowOn, setStyle
 
Methods inherited from class com.google.gwt.user.client.ui.ComplexPanel
add, adjustIndex, checkIndexBoundsForAccess, checkIndexBoundsForInsertion, getChildren, getWidget, getWidgetCount, getWidgetIndex, getWidgetIndex, insert, insert, iterator, remove, remove
 
Methods inherited from class com.google.gwt.user.client.ui.Panel
add, adopt, adopt, disown, doAttachChildren, doDetachChildren, orphan, remove
 
Methods inherited from class com.google.gwt.user.client.ui.Widget
addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, fireEvent, getHandlerCount, getLayoutData, getParent, isAttached, isOrWasAttached, onAttach, onBrowserEvent, onDetach, 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, resolvePotentialElement, setElement, setElement, setHeight, setPixelSize, setSize, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, sinkBitlessEvent, 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
 
Methods inherited from interface com.google.gwt.user.client.ui.HasWidgets
iterator, remove
 

Constructor Detail

DropdownBase

public DropdownBase(String type)
Creates a new widget of the given type.

Parameters:
type - the HTML tag to be used for the widget
Method Detail

setText

public void setText(String text)
Sets the text of the dropdown trigger.

Specified by:
setText in interface HasText
Parameters:
text -

getText

public String getText()
Specified by:
getText in interface HasText
Returns:
the text of the dropdown trigger.

createTrigger

protected abstract IconAnchor createTrigger()
Implement this method to create the trigger appropriate for your widget. It has to be an IconAnchor or a subtype.

Returns:
the created trigger

setDropup

public void setDropup(boolean dropup)
Set dropup style.

Parameters:
dropup - true:Set Dropup false:Un-set Dropup

onLoad

protected void onLoad()

Overrides:
onLoad in class Widget

add

public void add(Widget widget)
Adds a widget to the dropdown menu.

Specified by:
add in interface HasWidgets
Overrides:
add in class ComplexWidget
Parameters:
widget - the widget that will be added to the menu
See Also:
addWidget(Widget)

addChangeHandler

public HandlerRegistration addChangeHandler(ChangeHandler handler)
Specified by:
addChangeHandler in interface HasChangeHandlers

addWidget

protected void addWidget(Widget widget)
Adds a widget to the the dropdown widget, not to the dropdown menu.

Use add(Widget) if you want to add a widget to the dropdown menu.

Parameters:
widget - the widget to be added.

setRightDropdown

public void setRightDropdown(boolean rightDropdown)
Pull the dropdown menu to right

Parameters:
rightDropdown - true pull to right, otherwise to left. Default is false

getLastSelectedNavLink

public NavLink getLastSelectedNavLink()
Method to get the NavLink that has been clicked most recently.

Returns:
Last clicked NavLink or null if none have been clicked.

clear

public void clear()
Specified by:
clear in interface HasWidgets
Overrides:
clear in class Panel

addClickHandler

public HandlerRegistration addClickHandler(ClickHandler handler)
Specified by:
addClickHandler in interface HasClickHandlers


Copyright © 2012 gwtbootstrap. All Rights Reserved.