[Japi-cvs] SF.net SVN: japi:[1408] libs/swing-action/trunk/src/prj/net/sf/japi/swing/ action
Status: Beta
Brought to you by:
christianhujer
From: <aki...@us...> - 2010-05-26 08:11:35
|
Revision: 1408 http://japi.svn.sourceforge.net/japi/?rev=1408&view=rev Author: akirschbaum Date: 2010-05-26 08:11:28 +0000 (Wed, 26 May 2010) Log Message: ----------- Add @NotNull annotations. Modified Paths: -------------- libs/swing-action/trunk/src/prj/net/sf/japi/swing/action/ActionProvider.java libs/swing-action/trunk/src/prj/net/sf/japi/swing/action/IconManager.java Modified: libs/swing-action/trunk/src/prj/net/sf/japi/swing/action/ActionProvider.java =================================================================== --- libs/swing-action/trunk/src/prj/net/sf/japi/swing/action/ActionProvider.java 2010-05-26 06:27:55 UTC (rev 1407) +++ libs/swing-action/trunk/src/prj/net/sf/japi/swing/action/ActionProvider.java 2010-05-26 08:11:28 UTC (rev 1408) @@ -19,6 +19,7 @@ package net.sf.japi.swing.action; import javax.swing.Action; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; /** Interface for classes that provide actions. @@ -31,6 +32,6 @@ * @param key Key to find * @return Action for <var>key</var> or <code>null</code> */ - @Nullable Action getAction(final String key); + @Nullable Action getAction(@NotNull final String key); } // interface ActionProvider Modified: libs/swing-action/trunk/src/prj/net/sf/japi/swing/action/IconManager.java =================================================================== --- libs/swing-action/trunk/src/prj/net/sf/japi/swing/action/IconManager.java 2010-05-26 06:27:55 UTC (rev 1407) +++ libs/swing-action/trunk/src/prj/net/sf/japi/swing/action/IconManager.java 2010-05-26 08:11:28 UTC (rev 1408) @@ -28,6 +28,7 @@ import java.util.WeakHashMap; import javax.swing.Icon; import javax.swing.ImageIcon; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; /** Class to handle icons. @@ -43,11 +44,13 @@ public final class IconManager { /** The default IconManager. */ + @NotNull private static final IconManager DEFAULT_ICON_MANAGER = createDefaultIconManager(); /** Create the default IconManager. * @return default IconManager */ + @NotNull private static IconManager createDefaultIconManager() { final IconManager defaultIconManager = new IconManager(); defaultIconManager.iconPaths.add("icons/"); @@ -56,24 +59,29 @@ } /** ClassLoader to get icons from, must not be null. */ + @NotNull private final ClassLoader classLoader; /** The available sizes provided by this IconManager. */ + @NotNull private final int[] availableSizes = { 16, 24 }; /** The icon cache. * Key: short name for icon, which is likely to be used as a relative file name. * Value: Icon */ + @NotNull private final Map<String, Icon> smallCache = new WeakHashMap<String, Icon>(); /** The paths to search icons in. */ + @NotNull private final List<String> iconPaths = new ArrayList<String>(); /** Get the default IconManager. * The ClassLoader in use is the classloader IconManager was loaded with, whatever classloader that was. * @return default IconManaager */ + @NotNull public static IconManager getDefaultIconManager() { return DEFAULT_ICON_MANAGER; } @@ -88,6 +96,7 @@ //this(IconManager.class.getClassLoader()); } + @NotNull private static ClassLoader getContextClassLoader() { return AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() { public ClassLoader run() { @@ -103,20 +112,21 @@ /** Create an IconManager. * @param clazz Class to get ClassLoader for IconManager */ - public IconManager(final Class<?> clazz) { + public IconManager(@NotNull final Class<?> clazz) { classLoader = clazz.getClassLoader(); } /** Create an IconManager. * @param cl ClassLoader to create IconManager for */ - public IconManager(final ClassLoader cl) { + public IconManager(@NotNull final ClassLoader cl) { classLoader = cl; } /** Return the available sizes for icons. * @return available icon sizes */ + @NotNull public int[] getAvailableSizes() { return availableSizes.clone(); } @@ -126,7 +136,7 @@ * @return Icon for <var>s</var> */ @Nullable - public Icon getIcon(final String s) { + public Icon getIcon(@NotNull final String s) { Icon icon = smallCache.get(s); if (icon == null) { URL url = null; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |