public class Navbar extends DivWidget
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
.
<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.ResponsiveNavbar
UIObject.DebugIdImpl, UIObject.DebugIdImplEnabled
InsertPanel.ForIsWidget
HasWidgets.ForIsWidget
DEBUG_ID_PREFIX
Constructor and Description |
---|
Navbar()
Creates an empty Navbar.
|
Modifier and Type | Method and Description |
---|---|
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()
Get ID
|
Scrollspy |
getSpy() |
protected void |
onAttach() |
void |
setId(String id)
Set ID
|
void |
setInverse(boolean inverse)
Set inverse style.
|
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.
|
addStyle, pullRight, removeStyle, setHideOn, setPullRight, setShowOn, setStyle
add, adjustIndex, checkIndexBoundsForAccess, checkIndexBoundsForInsertion, getChildren, getWidget, getWidgetCount, getWidgetIndex, getWidgetIndex, insert, insert, iterator, remove, remove
add, adopt, adopt, disown, doAttachChildren, doDetachChildren, orphan, remove
addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, fireEvent, getHandlerCount, getLayoutData, getParent, isAttached, isOrWasAttached, onBrowserEvent, onDetach, onLoad, onUnload, removeFromParent, setLayoutData, sinkEvents
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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
add
getWidgetIndex
getWidget, getWidgetCount, getWidgetIndex, remove
public Navbar()
protected Container getContainer()
FluidContainer
.public void setScrollspy(boolean scrollspy)
Scrollspy
.scrollspy
- true
to include a Scrollspy. Default:
false
public void setSpyElement(Element spyElement)
spyElement
- target elementpublic void setPosition(NavbarPosition position)
For this to work properly, the Navbar must not be a child of a
Container
.
position
- the position of the Navbarpublic void add(Widget child)
add
in interface HasWidgets
add
in interface InsertPanel
add
in class FlowPanel
protected void addWidget(Widget widget)
widget
- widget to addpublic void setInverse(boolean inverse)
inverse
- true:set false:unsetCopyright © 2012-2014 gwtbootstrap. All Rights Reserved.