Revision: 1643
          http://svn.sourceforge.net/spring-rich-c/?rev=1643&view=rev
Author:   kevinstembridge
Date:     2007-01-10 08:31:51 -0800 (Wed, 10 Jan 2007)

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

Modified Paths:
--------------
    
trunk/spring-richclient/support/src/main/java/org/springframework/richclient/factory/AbstractControlFactory.java

Modified: 
trunk/spring-richclient/support/src/main/java/org/springframework/richclient/factory/AbstractControlFactory.java
===================================================================
--- 
trunk/spring-richclient/support/src/main/java/org/springframework/richclient/factory/AbstractControlFactory.java
    2007-01-10 16:10:28 UTC (rev 1642)
+++ 
trunk/spring-richclient/support/src/main/java/org/springframework/richclient/factory/AbstractControlFactory.java
    2007-01-10 16:31:51 UTC (rev 1643)
@@ -22,26 +22,63 @@
 import 
org.springframework.richclient.application.support.ApplicationServicesAccessor;
 
 /**
- * A control factory that only creates it's control when requested.
+ * A skeleton implementation of the [EMAIL PROTECTED] ControlFactory} 
interface that only creates it's control 
+ * when requested.
  * 
+ * <p>
+ * The factory may operate in singleton mode, which is the default. In this 
case, the control
+ * will be created the first time it is requested and the same instance will 
be returned for each
+ * subsequent request. When operating in non-singleton mode, a new control 
instance is created each 
+ * time it is requested.
+ * </p>
+ * 
  * @author Keith Donald
  */
 public abstract class AbstractControlFactory extends 
ApplicationServicesAccessor implements ControlFactory {
 
+    /** Class logger, available to subclasses. */
     protected Log logger = LogFactory.getLog(getClass());
 
     private boolean singleton = true;
 
     private JComponent control;
+    
+    /**
+     * Creates a new uninitialized [EMAIL PROTECTED] AbstractControlFactory}.
+     */
+    protected AbstractControlFactory() {
+        //do nothing
+    }
 
+    /**
+     * Returns true (the default) if this factory is to create a single 
instance of its control. 
+     *
+     * @return true if this factory returns a singleton instance of its 
control.
+     */
     protected final boolean isSingleton() {
         return singleton;
     }
 
+    /**
+     * Sets the flag that determines if this factory is to create a single 
instance of its control.
+     * By default, this flag is true.
+     *
+     * @param singleton The singleton flag.
+     */
     protected final void setSingleton(boolean singleton) {
         this.singleton = singleton;
     }
 
+    /**
+     * Returns an instance of the control that this factory produces. 
+     * 
+     * <p>
+     * This implementation is a template method, calling the abstract [EMAIL 
PROTECTED] #createControl()} 
+     * method if operating in non-singleton mode or if the control has not yet 
been created when 
+     * operating in singleton mode.
+     * </p>
+     * 
+     */
     public final JComponent getControl() {
         if (isSingleton()) {
             if (control == null) {
@@ -53,6 +90,14 @@
         return createControl();
     }
 
+    /**
+     * Returns true if the control for this factory has been created. If this 
factory is set 
+     * to non-singleton mode, this method will always return false even if an 
instance of the 
+     * control has previously been created.
+     *
+     * @return true if operating in singleton mode and an instance of the 
control has already 
+     * been created, false otherwise.
+     */
     public final boolean isControlCreated() {
         if (isSingleton()) {
             return control != null;
@@ -61,11 +106,22 @@
         return false;
     }
 
+    /**
+     * Creates an instance of the control produced by this factory if 
operating in singleton mode
+     * and the control instance has not already been created.
+     */
     protected void createControlIfNecessary() {
         if (isSingleton() && control == null) {
             getControl();
         }
     }
 
+    /**
+     * Subclasses must override this method to create a new instance of the 
control that this 
+     * factory produces.
+     *
+     * @return The newly created control, never null.
+     */
     protected abstract JComponent createControl();
-}
\ 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