001/* 002 * Copyright 2012 GWT-Bootstrap 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016package com.github.gwtbootstrap.client.ui; 017 018import com.github.gwtbootstrap.client.ui.base.ListItem; 019import com.github.gwtbootstrap.client.ui.resources.Bootstrap; 020import com.google.gwt.user.client.ui.HasText; 021 022//@formatter:off 023/** 024 * Header for menus in a navigation context. 025 * 026 * <p> 027 * <h3>UiBinder Usage:</h3> 028 * 029 * <pre> 030 * {@code 031 * <b:NavList> 032 * <b:NavHeader>I'm the Header</b:NavHeader> 033 * <b:NavLink>I'm a link to nowhere.</b:NavLink> 034 * </b:NavList> 035 * } 036 * </pre> 037 * </p> 038 * 039 * @since 2.0.4.0 040 * 041 * @author Dominik Mayer 042 * 043 * @see <a href="http://getbootstrap.com/2.3.2/components.html#navs">Bootstrap documentation</a> 044 * @see NavList 045 * @see WellNavList 046 * @see Dropdown 047 */ 048//@formatter:on 049public class NavHeader extends ListItem implements HasText { 050 051 /** 052 * Creates an empty widget. 053 */ 054 public NavHeader() { 055 setStyleName(Bootstrap.nav_header); 056 } 057 058 /** 059 * Creates a widget and sets the given text. 060 * 061 * @param text 062 * the text of the widget 063 */ 064 public NavHeader(String text) { 065 this(); 066 setText(text); 067 } 068 069 /** 070 * {@inheritDoc} 071 */ 072 public String getText() { 073 return getElement().getInnerText(); 074 } 075 076 /** 077 * {@inheritDoc} 078 */ 079 public void setText(String text) { 080 getElement().setInnerText(text); 081 } 082 083}