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 */
016 package com.github.gwtbootstrap.client.ui;
017
018 import com.github.gwtbootstrap.client.ui.base.HasAlignment;
019 import com.github.gwtbootstrap.client.ui.base.UnorderedList;
020 import com.github.gwtbootstrap.client.ui.constants.Alignment;
021 import com.github.gwtbootstrap.client.ui.resources.Bootstrap;
022
023 //@formatter:off
024 /**
025 * Navigation menu of the {@link Navbar}.
026 *
027 * <p>
028 * <h3>UiBinder Usage:</h3>
029 *
030 * <pre>
031 * {@code
032 * <b:Navbar>
033 * <b:Brand>Bootstrap</b:Brand>
034 * <b:Nav>
035 * <b:NavLink>Link 1</b:NavLink>
036 * <b:NavLink>Link 2</b:NavLink>
037 * </b:Nav>
038 * <b:NavForm size="1" />
039 * <b:Nav alignment="RIGHT">
040 * <b:NavLink>Link 3</b:NavLink>
041 * </b:Nav>
042 * </b:Navbar>
043 * }
044 * </pre>
045 * </p>
046 * @since 2.0.4.0
047 *
048 * @author Dominik Mayer
049 *
050 * @see <a href="http://twitter.github.com/bootstrap/components.html#navbar">Bootstrap documentation</a>
051 */
052 //@formatter:on
053 public class Nav extends UnorderedList implements HasAlignment {
054
055 /**
056 * Creates an empty widget.
057 */
058 public Nav() {
059 addStyleName(Bootstrap.nav);
060 }
061
062 /**
063 * {@inheritDoc}
064 */
065 public void setAlignment(Alignment alignment) {
066 removeStyle(Alignment.RIGHT);
067 removeStyle(Alignment.LEFT);
068 addStyle(alignment);
069 }
070 }