Revision: 1668
          http://svn.sourceforge.net/spring-rich-c/?rev=1668&view=rev
Author:   kevinstembridge
Date:     2007-01-15 13:36:45 -0800 (Mon, 15 Jan 2007)

Log Message:
-----------
Added javadoc

Modified Paths:
--------------
    
trunk/spring-richclient/support/src/main/java/org/springframework/richclient/command/config/CommandButtonIconInfo.java

Modified: 
trunk/spring-richclient/support/src/main/java/org/springframework/richclient/command/config/CommandButtonIconInfo.java
===================================================================
--- 
trunk/spring-richclient/support/src/main/java/org/springframework/richclient/command/config/CommandButtonIconInfo.java
      2007-01-15 21:22:44 UTC (rev 1667)
+++ 
trunk/spring-richclient/support/src/main/java/org/springframework/richclient/command/config/CommandButtonIconInfo.java
      2007-01-15 21:36:45 UTC (rev 1668)
@@ -30,10 +30,33 @@
 import org.springframework.util.ObjectUtils;
 
 /**
+ * A parameter object consisting of the various icons that may be displayed on 
a single
+ * command button depending on its state. 
+ * 
+ * <p>
+ * The set of states for which this object maintains icons are as follows:
+ * 
+ * <ul>
+ * <li>default</li>
+ * <li>selected</li>
+ * <li>disabled</li>
+ * <li>pressed</li>
+ * <li>rollover</li>
+ * </ul>
+ *  
+ * </p> 
+
  * @author Keith Donald
+ * 
  */
 public class CommandButtonIconInfo implements ButtonConfigurer, 
VisualizedElement {
 
+    /**
+     * A [EMAIL PROTECTED] CommandButtonIconInfo} instance that can be used 
for command buttons that have no
+     * icon information associated with them.
+     */
+    //FIXME this is a mutable object so we probably shouldn't be reusing the 
same instance for 
+    //a blank IconInfo. What happens if multiple blanks have been dished out 
and one of them is modified?
     public static final CommandButtonIconInfo BLANK_ICON_INFO = new 
CommandButtonIconInfo(null);
 
     private Icon icon;
@@ -46,22 +69,59 @@
 
     private Icon rolloverIcon;
 
+    /**
+     * Creates a new [EMAIL PROTECTED] CommandButtonIconInfo} with the given 
icon. No optional icons will
+     * be associated with this instance.
+     *
+     * @param icon The main displayable icon.
+     */
     public CommandButtonIconInfo(Icon icon) {
         this.icon = icon;
     }
 
+    /**
+     * Creates a new [EMAIL PROTECTED] CommandButtonIconInfo} with the given 
icons.
+     *
+     * @param icon The main default icon. May be null.
+     * @param selectedIcon The icon to be displayed when the command button is 
in a selected state.
+     * May be null.
+     */
     public CommandButtonIconInfo(Icon icon, Icon selectedIcon) {
         this.icon = icon;
         this.selectedIcon = selectedIcon;
     }
 
+    /**
+     * Creates a new [EMAIL PROTECTED] CommandButtonIconInfo} with the given 
icons.
+     *
+     * @param icon The main default icon. May be null.
+     * @param selectedIcon The icon to be displayed when the command button is 
in a selected state.
+     * @param rolloverIcon The icon to be displayed when the mouse pointer 
rolls over the command
+     * button. May be null.
+     */
     public CommandButtonIconInfo(Icon icon, Icon selectedIcon, Icon 
rolloverIcon) {
         this.icon = icon;
         this.selectedIcon = selectedIcon;
         this.rolloverIcon = rolloverIcon;
     }
 
-    public CommandButtonIconInfo(Icon icon, Icon selectedIcon, Icon 
rolloverIcon, Icon disabledIcon, Icon pressedIcon) {
+    /**
+     * Creates a new [EMAIL PROTECTED] CommandButtonIconInfo} with the given 
icons.
+     *
+     * @param icon The main default icon. May be null.
+     * @param selectedIcon The icon to be displayed when the command button is 
in a selected state.
+     * @param rolloverIcon The icon to be displayed when the mouse pointer 
rolls over the command
+     * button. May be null.
+     * @param disabledIcon The icon to be displayed when the command button is 
in a disabled state.
+     * May be null.
+     * @param pressedIcon The icon to be displayed when the command button is 
in a pressed state.
+     * May be null.
+     */
+    public CommandButtonIconInfo(Icon icon, 
+                                 Icon selectedIcon, 
+                                 Icon rolloverIcon, 
+                                 Icon disabledIcon, 
+                                 Icon pressedIcon) {
         this.icon = icon;
         this.selectedIcon = selectedIcon;
         this.rolloverIcon = rolloverIcon;
@@ -69,8 +129,16 @@
         this.pressedIcon = pressedIcon;
     }
 
+    /**
+     * Configures the given command button with the icon values from this 
instance.
+     * 
+     * @param button The button to be configured with icons. Must not be null.
+     * 
+     * @throws IllegalArgumentException if [EMAIL PROTECTED] button} is null.
+     */
     public AbstractButton configure(AbstractButton button) {
         Assert.notNull(button, "The button to configure is required");
+        
         if (button instanceof JMenu) {
             button.setIcon(null);
             button.setSelectedIcon(null);
@@ -90,9 +158,18 @@
             button.setPressedIcon(pressedIcon);
             button.setRolloverIcon(rolloverIcon);
         }
+        
         return button;
+        
     }
 
+    /**
+     * Returns the image from the main default icon of this instance if it is 
actually an instance 
+     * of an [EMAIL PROTECTED] ImageIcon}.
+     * 
+     * @return The image from the main default icon, or null if there is no 
default icon or it
+     * is not an [EMAIL PROTECTED] ImageIcon}.
+     */
     public Image getImage() {
         if (getIcon() instanceof ImageIcon)
             return ((ImageIcon)getIcon()).getImage();
@@ -100,50 +177,104 @@
         return null;
     }
 
+    /**
+     * [EMAIL PROTECTED]
+     */
     public Icon getIcon() {
         return icon;
     }
 
+    /**
+     * Returns the icon to be displayed when the command button is in a 
disabled state.
+     *
+     * @return The icon for the command button in disabled state, or null.
+     */
     public Icon getDisabledIcon() {
         return disabledIcon;
     }
 
+    /**
+     * Returns the icon to be displayed when the command button is in a 
pressed state.
+     *
+     * @return The icon for the command button in pressed state, or null.
+     */
     public Icon getPressedIcon() {
         return pressedIcon;
     }
 
+    /**
+     * Returns the icon to be displayed when the mouse pointer rolls over the 
command button.
+     *
+     * @return The icon for the command button when rolled over by the mouse 
pointer, or null.
+     */
     public Icon getRolloverIcon() {
         return rolloverIcon;
     }
 
+    /**
+     * Returns the icon to be displayed when the command button is in a 
selected state.
+     *
+     * @return The icon for the command button in selected state, or null.
+     */
     public Icon getSelectedIcon() {
         return selectedIcon;
     }
 
+    /**
+     * Sets the main default icon for the command button.
+     *
+     * @param icon The main default icon for the command button. May be null.
+     */
     public void setIcon(Icon icon) {
         this.icon = icon;
     }
 
+    /**
+     * Sets the icon to be displayed when the command button is in a disabled 
state.
+     *
+     * @param disabledIcon The icon for the button in a disabled state. May be 
null.
+     */
     public void setDisabledIcon(Icon disabledIcon) {
         this.disabledIcon = disabledIcon;
     }
 
+    /**
+     * Sets the icon to be displayed when the command button is in a pressed 
state.
+     *
+     * @param pressedIcon The icon for the button in a pressed state. May be 
null.
+     */
     public void setPressedIcon(Icon pressedIcon) {
         this.pressedIcon = pressedIcon;
     }
 
+    /**
+     * Sets the icon to be displayed when the mouse pointer rolls over the 
command button.
+     *
+     * @param rolloverIcon The icon for the button in a rolled over. May be 
null.
+     */
     public void setRolloverIcon(Icon rolloverIcon) {
         this.rolloverIcon = rolloverIcon;
     }
 
+    /**
+     * Sets the icon to be displayed when the command button is in a pressed 
state.
+     *
+     * @param selectedIcon The icon for the button in a pressed state. May be 
null.
+     */
     public void setSelectedIcon(Icon selectedIcon) {
         this.selectedIcon = selectedIcon;
     }
 
+    /**
+     * [EMAIL PROTECTED]
+     */
     public String toString() {
         return new ToStringCreator(this).toString();
     }
 
+    /**
+     * [EMAIL PROTECTED]
+     */
     public boolean equals(Object o) {
         if (!(o instanceof CommandButtonIconInfo)) {
             return false;
@@ -155,11 +286,9 @@
                 && ObjectUtils.nullSafeEquals(rolloverIcon, other.rolloverIcon)
                 && ObjectUtils.nullSafeEquals(selectedIcon, 
other.selectedIcon);
     }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see java.lang.Object#hashCode()
+    
+    /**
+     * [EMAIL PROTECTED]
      */
     public int hashCode() {
         int hash = 1;
@@ -171,4 +300,4 @@
         return hash;
     }
 
-}
\ No newline at end of file
+}


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
spring-rich-c-cvs mailing list
spring-rich-c-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spring-rich-c-cvs

Reply via email to