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.base;
017
018/**
019 * Interface for widgets that can work as a link.
020 * 
021 * @since 2.0.4.0
022 * 
023 * @author Dominik Mayer
024 */
025public interface HasHref {
026
027        /**
028         * Sets the <code>href</code> property of the anchor tag.
029         * <p>
030         * Use it only to set links to another page. Links on the same page or GWT
031         * tokens should be set with {@code #setTargetHistoryToken(String)}
032         * 
033         * @param href
034         *            the website URL
035         */
036        void setHref(String href);
037
038        /**
039         * Gets the URL of the website, the link is pointing to.
040         * 
041         * @return the URL
042         */
043        String getHref();
044
045        /**
046         * Sets the <code>href</code> property of the anchor tag to
047         * <code>"#" + targetHistoryToken</code>.
048         * 
049         * @param targetHistoryToken
050         *            the history token
051         */
052        void setTargetHistoryToken(String targetHistoryToken);
053
054        /**
055         * Gets the history token this link points to
056         * 
057         * @return the history token
058         */
059        String getTargetHistoryToken();
060
061}