[Japi-cvs] SF.net SVN: japi: [461]
Status: Beta
Brought to you by:
christianhujer
From: <chr...@us...> - 2007-06-30 08:53:35
|
Revision: 461 http://svn.sourceforge.net/japi/?rev=461&view=rev Author: christianhujer Date: 2007-06-30 01:53:24 -0700 (Sat, 30 Jun 2007) Log Message: ----------- Added missing @NotNull / @Nullable annotations. Improved documentation. Modified Paths: -------------- libs/swing-app/trunk/src/net/sf/japi/swing/app/CanLoad.java libs/swing-bookmarks/trunk/src/net/sf/japi/swing/bookmarks/BookmarkDropTargetAdapter.java libs/swing-bookmarks/trunk/src/net/sf/japi/swing/bookmarks/BookmarkManager.java libs/swing-bookmarks/trunk/src/net/sf/japi/swing/bookmarks/Bookmarkable.java progs/jeduca/trunk/src/net/sf/japi/progs/jeduca/jtest/gui/ProgramFrame.java Modified: libs/swing-app/trunk/src/net/sf/japi/swing/app/CanLoad.java =================================================================== --- libs/swing-app/trunk/src/net/sf/japi/swing/app/CanLoad.java 2007-06-30 07:41:21 UTC (rev 460) +++ libs/swing-app/trunk/src/net/sf/japi/swing/app/CanLoad.java 2007-06-30 08:53:24 UTC (rev 461) @@ -19,6 +19,8 @@ package net.sf.japi.swing.app; +import org.jetbrains.annotations.NotNull; + /** Interface to be implemented by classes that are able to load a URL. * @author <a href="mailto:ch...@ri...">Christian Hujer</a> */ @@ -30,6 +32,6 @@ * @param url URL to load * @return <code>true</code> if and only if loading the file was successful */ - boolean load(String url); + boolean load(@NotNull String url); } // interface CanLoad Modified: libs/swing-bookmarks/trunk/src/net/sf/japi/swing/bookmarks/BookmarkDropTargetAdapter.java =================================================================== --- libs/swing-bookmarks/trunk/src/net/sf/japi/swing/bookmarks/BookmarkDropTargetAdapter.java 2007-06-30 07:41:21 UTC (rev 460) +++ libs/swing-bookmarks/trunk/src/net/sf/japi/swing/bookmarks/BookmarkDropTargetAdapter.java 2007-06-30 08:53:24 UTC (rev 461) @@ -28,6 +28,7 @@ import javax.swing.JTree; import javax.swing.tree.TreePath; import org.jetbrains.annotations.Nullable; +import org.jetbrains.annotations.NotNull; import static net.sf.japi.swing.bookmarks.BookmarkTransferable.getBookmarkDataFlavor; /** Class for dropping a bookmark over a JTree managing bookmarks. @@ -36,7 +37,7 @@ public class BookmarkDropTargetAdapter extends DropTargetAdapter { /** {@inheritDoc} */ - public void drop(final DropTargetDropEvent dtde) { + public void drop(@NotNull final DropTargetDropEvent dtde) { System.err.println("drop"); final JTree tree = (JTree) dtde.getDropTargetContext().getComponent(); BookmarkManager.Bookmark dest = getDestBookmark(dtde, tree); @@ -56,7 +57,7 @@ * @param tree JTree to find bookmark in * @return destination bookmark */ - private static BookmarkManager.Bookmark getDestBookmark(final DropTargetDropEvent dtde, final JTree tree) { + @NotNull private static BookmarkManager.Bookmark getDestBookmark(@NotNull final DropTargetDropEvent dtde, @NotNull final JTree tree) { final Point p = dtde.getLocation(); final TreePath tp = tree.getClosestPathForLocation(p.x, p.y); return (BookmarkManager.Bookmark) tp.getLastPathComponent(); @@ -66,7 +67,7 @@ * @param dtde drop event * @return source bookmark */ - @Nullable private static BookmarkManager.Bookmark getSourceBookmark(final DropTargetDropEvent dtde) { + @Nullable private static BookmarkManager.Bookmark getSourceBookmark(@NotNull final DropTargetDropEvent dtde) { final Transferable source = dtde.getTransferable(); try { return (BookmarkManager.Bookmark) source.getTransferData(getBookmarkDataFlavor()); Modified: libs/swing-bookmarks/trunk/src/net/sf/japi/swing/bookmarks/BookmarkManager.java =================================================================== --- libs/swing-bookmarks/trunk/src/net/sf/japi/swing/bookmarks/BookmarkManager.java 2007-06-30 07:41:21 UTC (rev 460) +++ libs/swing-bookmarks/trunk/src/net/sf/japi/swing/bookmarks/BookmarkManager.java 2007-06-30 08:53:24 UTC (rev 461) @@ -55,6 +55,7 @@ import org.w3c.dom.NodeList; import org.w3c.dom.ls.DOMImplementationLS; import org.xml.sax.SAXException; +import org.jetbrains.annotations.NotNull; import net.sf.japi.swing.ActionFactory; import net.sf.japi.swing.IconManager; import net.sf.japi.util.EmptyEnumeration; @@ -82,7 +83,9 @@ /** The ProgramFrame this BookmarkManager manages bookmarks for. */ private Bookmarkable bookmarkable; - /** Create a new BookmarkManager. */ + /** Create a new BookmarkManager. + * @param bookmarkable The bookmarkable to use for this BookmarkManager. + */ public BookmarkManager(final Bookmarkable bookmarkable) { this.bookmarkable = bookmarkable; try { @@ -98,7 +101,7 @@ /** Create a Bookmark ToolBar. * @return toolBar for Bookmarks */ - public JToolBar createBookmarkToolBar() { + @NotNull public JToolBar createBookmarkToolBar() { // Variant 1: JToolBar with JMenuBar with one entry "Lesezeichen" final JToolBar toolBar = new JToolBar(ACTION_FACTORY.getString("bookmarkToolBar.name")); final JMenuBar mb = new JMenuBar(); @@ -142,7 +145,7 @@ /** Create a Bookmark Menu. * @return JMenu for Bookmarks */ - public JMenu createBookmarkMenu() { + @NotNull public JMenu createBookmarkMenu() { final JMenu menu = bookmarks.createMenu(); menu.add(new JMenuItem(manageBookmarks)); return menu; @@ -151,7 +154,7 @@ /** Create a Bookmark ControlPanel. * @return ControlPanel for Bookmarks */ - public JComponent createBookmarkControlPanel() { + @NotNull public JComponent createBookmarkControlPanel() { return new ControlPanel(); } @@ -159,7 +162,7 @@ * @param menu JMenu to attach bookmarks to * @param bookmarks Bookmarks to attach */ - private static void attach(final JMenu menu, final BookmarkFolder bookmarks) { + private static void attach(@NotNull final JMenu menu, @NotNull final BookmarkFolder bookmarks) { for (final Bookmark bookmark : bookmarks) { if (bookmark instanceof BookmarkFolder) { final JMenu newMenu = new JMenu(bookmark); @@ -214,7 +217,7 @@ * @throws IOException in case of I/O problems * @throws ParserConfigurationException in case of XML configuration problems */ - public void save(final String uri) throws IOException, ParserConfigurationException { + public void save(@NotNull final String uri) throws IOException, ParserConfigurationException { final DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); final DocumentBuilder db = dbf.newDocumentBuilder(); final Document doc = db.newDocument(); @@ -232,7 +235,7 @@ * @throws ParserConfigurationException in case of XML configuration problems * @throws SAXException in case of XML document problems */ - public void load(final String uri) throws IOException, ParserConfigurationException, SAXException { + public void load(@NotNull final String uri) throws IOException, ParserConfigurationException, SAXException { final DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); final DocumentBuilder db = dbf.newDocumentBuilder(); final Document doc = db.parse(uri); @@ -277,7 +280,7 @@ /** Title for Bookmark. * @serial include */ - private String title; + @NotNull private String title; /** The folder (parent) of this bookmark. * @serial include @@ -294,7 +297,7 @@ * You must not forget to invoke {@link #setFolder(BookmarkFolder)} in order to make {@link #getParent()} for JTrees working. * @param title title for Bookmark */ - protected Bookmark(final String title) { + protected Bookmark(@NotNull final String title) { setTitle(title); putValue(SMALL_ICON, IconManager.getDefaultIconManager().getIcon(ACTION_FACTORY.getString("bookmark.icon"))); } @@ -302,7 +305,7 @@ /** {@inheritDoc} * @return title of this Bookmark */ - public String toString() { + @NotNull public String toString() { return title; } @@ -326,7 +329,7 @@ /** Set this Bookmark's title. * @param title new title for this Bookmark */ - public void setTitle(final String title) { + public void setTitle(@NotNull final String title) { this.title = title; putValue(NAME, title); } @@ -339,7 +342,7 @@ /** Get this Bookmark's title. * @return Bookmark title */ - public String getTitle() { + @NotNull public String getTitle() { return title; } Modified: libs/swing-bookmarks/trunk/src/net/sf/japi/swing/bookmarks/Bookmarkable.java =================================================================== --- libs/swing-bookmarks/trunk/src/net/sf/japi/swing/bookmarks/Bookmarkable.java 2007-06-30 07:41:21 UTC (rev 460) +++ libs/swing-bookmarks/trunk/src/net/sf/japi/swing/bookmarks/Bookmarkable.java 2007-06-30 08:53:24 UTC (rev 461) @@ -21,6 +21,8 @@ import java.awt.Component; import net.sf.japi.swing.app.CanLoad; +import org.jetbrains.annotations.Nullable; +import org.jetbrains.annotations.NotNull; /** Interface for classes that want to interact with the BookmarkManager. * Implement this interface if your class provides information for creating bookmarks. @@ -38,25 +40,27 @@ /** Get the title for the Bookmark. * @return title for Bookmark + * @todo Eventually change to @NotNull */ - String getBookmarkTitle(); + @Nullable String getBookmarkTitle(); /** Get the URL for the Bookmark. * @return url for Bookmark + * @todo Eventually change to @NotNull */ - String getBookmarkURL(); + @Nullable String getBookmarkURL(); /** {@inheritDoc} * Invoked when the user requests to load a Bookmark. * The implementor of this method is itself responsible of handling errors and displaying eventual error messages to the user * @param url URL from bookmark */ - boolean load(final String url); + boolean load(@NotNull String url); /** Get the component which to block for modal dialogs. * It is safe to return <code>null</code>. * @return component */ - Component getBookmarkBlocker(); + @Nullable Component getBookmarkBlocker(); } // interface Bookmarkable Modified: progs/jeduca/trunk/src/net/sf/japi/progs/jeduca/jtest/gui/ProgramFrame.java =================================================================== --- progs/jeduca/trunk/src/net/sf/japi/progs/jeduca/jtest/gui/ProgramFrame.java 2007-06-30 07:41:21 UTC (rev 460) +++ progs/jeduca/trunk/src/net/sf/japi/progs/jeduca/jtest/gui/ProgramFrame.java 2007-06-30 08:53:24 UTC (rev 461) @@ -59,6 +59,7 @@ import net.sf.japi.swing.LookAndFeelManager; import net.sf.japi.swing.bookmarks.BookmarkManager; import net.sf.japi.swing.bookmarks.Bookmarkable; +import org.jetbrains.annotations.NotNull; /** Programmfenster. * @author $Author: chris $ @@ -219,7 +220,7 @@ } /** {@inheritDoc} */ - public boolean load(final String newUrl) { + public boolean load(@NotNull final String newUrl) { boolean okay; try { // TODO: IOManager This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |