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.DropdownBase;
019 import com.github.gwtbootstrap.client.ui.base.IconAnchor;
020
021 //@formatter:off
022 /**
023 * Dropdown menus that are usually used in a navigation context.
024 *
025 * <p>
026 * <h3>UiBinder Usage:</h3>
027 *
028 * <pre>
029 * {@code
030 * <b:Dropdown text="I am the Caption">
031 * <b:NavHeader>Header</b:NavHeader>
032 * <b:NavLink>Link 1</b:NavLink>
033 * <b:NavLink>Link 2</b:NavLink>
034 * </b:Dropdown>
035 * }
036 * </pre>
037 * </p>
038 *
039 * @since 2.0.4.0
040 *
041 * @author Carlos Alexandro Becker
042 * @author Dominik Mayer
043 *
044 * @see <a href="http://twitter.github.com/bootstrap/javascript.html#dropdowns">Bootstrap documentation</a>
045 * @see DropdownButton
046 * @see SplitDropdownButton
047 */
048 //@formatter:on
049 public class Dropdown extends DropdownBase {
050
051 /**
052 * Creates an empty Dropdown without a caption.
053 */
054 public Dropdown() {
055 super("li");
056 addStyleName("dropdown");
057 }
058
059 /**
060 * Creates an empty Dropdown with the given caption.
061 *
062 * @param caption
063 * the dropdown's caption
064 */
065 public Dropdown(final String caption) {
066 this();
067 setText(caption);
068 }
069
070 /**
071 * {@inheritDoc}
072 */
073 @Override
074 protected IconAnchor createTrigger() {
075 final IconAnchor trigger = new IconAnchor();
076 trigger.setCaret(true);
077 return trigger;
078 }
079 }