com.github.gwtbootstrap.client.ui
Class Navbar

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.google.gwt.user.client.ui.FlowPanel
                      extended by com.github.gwtbootstrap.client.ui.base.DivWidget
                          extended by com.github.gwtbootstrap.client.ui.Navbar
All Implemented Interfaces:
HasStyle, IsResponsive, HasAttachHandlers, HasHandlers, EventListener, HasVisibility, HasWidgets, HasWidgets.ForIsWidget, IndexedPanel, IndexedPanel.ForIsWidget, InsertPanel, InsertPanel.ForIsWidget, IsWidget, Iterable<Widget>
Direct Known Subclasses:
ResponsiveNavbar

public class Navbar
extends DivWidget

Navbar with optional text, links and forms.

The Navbar can be fixed on the top or bottom of the site where it will stay when the user scrolls the page. For proper rendering, a fixed Navbar cannot be part of any container! It has to be attached directly to the RootPanel.

UiBinder Usage:

 <g:FlowPanel>
     <b:Navbar>
         <b:Brand>Bootstrap</b:Brand>
         <b:Nav>
             <b:NavLink>Link 1</b:NavLink>
             <b:NavLink>Link 2</b:NavLink>
         </b:Nav>
         <b:NavForm size="1" />
         <b:Nav alignment="RIGHT">
             <b:NavLink>Link 3</b:NavLink>
         </b:Nav>
     </b:Navbar>
     <b:Container>
         [...]
     </b:Container>
 </g:FlowPanel>

 
 

NOTE: We assume that most people will use the ResponsiveNavbar, so, we automatically add a padding-top: 50px in body.If you don't want this, you have to put a padding-top: 0px; manually in your document body tag.

Since:
2.0.4.0
Author:
Dominik Mayer, Carlos Alexandro Becker
See Also:
Bootstrap documentation, ResponsiveNavbar

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.InsertPanel
InsertPanel.ForIsWidget
 
Nested classes/interfaces inherited from interface com.google.gwt.user.client.ui.HasWidgets
HasWidgets.ForIsWidget
 
Field Summary
 
Fields inherited from class com.google.gwt.user.client.ui.UIObject
DEBUG_ID_PREFIX
 
Constructor Summary
Navbar()
          Creates an empty Navbar.
 
Method Summary
 void add(Widget child)
          
protected  void addWidget(Widget widget)
          Adds a widget to the Navbar element, not the container.
protected  Container getContainer()
          Defines the default container implementation.
 String getId()
           
 Scrollspy getSpy()
           
protected  void onAttach()
           
 void setId(String id)
           
 void setPosition(NavbarPosition position)
          Fix the Navbar at the top or bottom of the screen.
 void setScrollspy(boolean scrollspy)
          Defines whether the Navbar should contain a Scrollspy.
 void setSpyElement(Element spyElement)
          Defines scrollspy target element.
 
Methods inherited from class com.github.gwtbootstrap.client.ui.base.DivWidget
addStyle, pullRight, removeStyle, setHideOn, setShowOn, setStyle
 
Methods inherited from class com.google.gwt.user.client.ui.FlowPanel
clear, insert, insert
 
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, onBrowserEvent, onDetach, 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, 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.user.client.ui.InsertPanel.ForIsWidget
add
 
Methods inherited from interface com.google.gwt.user.client.ui.IndexedPanel.ForIsWidget
getWidgetIndex
 
Methods inherited from interface com.google.gwt.user.client.ui.IndexedPanel
getWidget, getWidgetCount, getWidgetIndex, remove
 

Constructor Detail

Navbar

public Navbar()
Creates an empty Navbar.

Method Detail

setId

public void setId(String id)

getId

public String getId()

getContainer

protected Container getContainer()
Defines the default container implementation. You can override this in a extended class if you want another implementation, like a FluidContainer.


setScrollspy

public void setScrollspy(boolean scrollspy)
Defines whether the Navbar should contain a Scrollspy.

Parameters:
scrollspy - true to include a Scrollspy. Default: false

setSpyElement

public void setSpyElement(Element spyElement)
Defines scrollspy target element.

Parameters:
spyElement - target element

onAttach

protected void onAttach()
Overrides:
onAttach in class Widget

setPosition

public void setPosition(NavbarPosition position)
Fix the Navbar at the top or bottom of the screen.

For this to work properly, the Navbar must not be a child of a Container.

Parameters:
position - the position of the Navbar

add

public void add(Widget child)

Specified by:
add in interface HasWidgets
Specified by:
add in interface InsertPanel
Overrides:
add in class FlowPanel

addWidget

protected void addWidget(Widget widget)
Adds a widget to the Navbar element, not the container.

Parameters:
widget - widget to add

getSpy

public Scrollspy getSpy()


Copyright © 2012 gwtbootstrap. All Rights Reserved.