001    /* JAPI - (Yet another (hopefully) useful) Java API
002     *
003     * Copyright (C) 2004-2006 Christian Hujer
004     *
005     * This program is free software; you can redistribute it and/or
006     * modify it under the terms of the GNU General Public License as
007     * published by the Free Software Foundation; either version 2 of the
008     * License, or (at your option) any later version.
009     *
010     * This program is distributed in the hope that it will be useful, but
011     * WITHOUT ANY WARRANTY; without even the implied warranty of
012     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
013     * General Public License for more details.
014     *
015     * You should have received a copy of the GNU General Public License
016     * along with this program; if not, write to the Free Software
017     * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
018     * 02111-1307, USA.
019     */
020    
021    package net.sf.japi.swing.bookmarks;
022    
023    import java.awt.Component;
024    import net.sf.japi.swing.io.CanLoad;
025    
026    /** Interface for classes that want to interact with the BookmarkManager.
027     * Implement this interface if your class provides information for creating bookmarks.
028     * See the class {@link BookmarkManager} for more information on Bookmarks.
029     * @see BookmarkManager
030     * @author <a href="mailto:chris@riedquat.de">Christian Hujer</a>
031     */
032    public interface Bookmarkable extends CanLoad {
033    
034        /** Get wether it currently is possible to create a bookmark.
035         * @return <code>true</code> if it is possible to create a bookmark, e.g. {@link #getBookmarkTitle()} and {@link #getBookmarkURL()} will return
036         * meaningful values, otherwise <code>false</code>
037         */
038        boolean isBookmarkPossible();
039    
040        /** Get the title for the Bookmark.
041         * @return title for Bookmark
042         */
043        String getBookmarkTitle();
044    
045        /** Get the URL for the Bookmark.
046         * @return url for Bookmark
047         */
048        String getBookmarkURL();
049    
050        /** {@inheritDoc}
051         * Invoked when the user requests to load a Bookmark.
052         * The implementor of this method is itself responsible of handling errors and displaying eventual error messages to the user
053         * @param url URL from bookmark
054         */
055        boolean load(final String url);
056    
057        /** Get the component which to block for modal dialogs.
058         * It is safe to return <code>null</code>.
059         * @return component
060         */
061        Component getBookmarkBlocker();
062    
063    } // interface Bookmarkable