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.google.gwt.user.client.ui.HasText; 019 020//@formatter:off 021/** 022 * Link, used in a navigation context. 023 * 024 * <p> 025 * <h3>UiBinder Usage:</h3> 026 * 027 * <pre> 028 * {@code 029 * <b:NavList> 030 * <b:NavHeader>I'm the Header</b:NavHeader> 031 * <b:NavLink icon="PLANE">I'm a link to nowhere.</b:NavLink> 032 * </b:NavList> 033 * } 034 * </pre> 035 * All arguments are optional 036 * </p> 037 * 038 * @since 2.0.4.0 039 * 040 * @author Dominik Mayer 041 * @author ohashi keisuke 042 * 043 * @see <a href="http://getbootstrap.com/2.3.2/components.html#navbar">Bootstrap documentation (Navbar)</a> 044 * @see <a href="http://getbootstrap.com/2.3.2/components.html#navs">Bootstrap documentation (Navs)</a> 045 * @see NavList 046 * @see WellNavList 047 * @see Dropdown 048 * @see Navbar 049 * @see ResponsiveNavbar 050 */ 051//@formatter:on 052public class NavLink extends NavWidget implements HasText { 053 054 /** 055 * Creates an empty widget. 056 */ 057 public NavLink() { 058 super(); 059 } 060 061 /** 062 * Creates an empty widget of given text. 063 * 064 * @param text 065 * text of the widget 066 */ 067 public NavLink(String text) { 068 super(); 069 setText(text); 070 } 071 072 /** 073 * Creates an empty widget of given text and href. 074 * 075 * @param text 076 * text of the widget 077 * @param href 078 * URL the link should point to 079 */ 080 public NavLink(String text, String href) { 081 super(); 082 setText(text); 083 setHref(href); 084 } 085 086 /** 087 * Creates an empty widget of given text and href. 088 * 089 * @param text 090 * text of the widget 091 * @param href 092 * URL the link should point to 093 * @param 094 * target the target attribute 095 */ 096 public NavLink(String text, String href, String target) { 097 super(); 098 setText(text); 099 setHref(href); 100 setTarget(target); 101 } 102}