Author: jalkanen
Date: Mon May 26 12:06:04 2008
New Revision: 660272

URL: http://svn.apache.org/viewvc?rev=660272&view=rev
Log:
Javadoc, Java5, checkstyle, and comment fixes.

Modified:
    incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/WikiContext.java
    incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/parser/LinkParser.java
    incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/parser/ParseException.java
    incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/parser/PluginContent.java
    incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/parser/WikiDocument.java

Modified: incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/WikiContext.java
URL: 
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/WikiContext.java?rev=660272&r1=660271&r2=660272&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/WikiContext.java (original)
+++ incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/WikiContext.java Mon May 26 
12:06:04 2008
@@ -956,7 +956,7 @@
      */
     public static Locale getLocale( WikiContext context )
     {
-        return( Preferences.getLocale( context ) );
+        return Preferences.getLocale( context );
 /*
         HttpServletRequest request = context.getHttpRequest();
         return ( request != null )

Modified: incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/parser/LinkParser.java
URL: 
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/parser/LinkParser.java?rev=660272&r1=660271&r2=660272&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/parser/LinkParser.java 
(original)
+++ incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/parser/LinkParser.java Mon 
May 26 12:06:04 2008
@@ -344,10 +344,10 @@
      */
     public static class Link
     {
-        private String m_text;
-        private String m_ref = null;
-        private int    m_interwikiPoint = -1;
-        private List   m_attribs = null;
+        private String            m_text;
+        private String            m_ref = null;
+        private int               m_interwikiPoint = -1;
+        private List<Attribute>   m_attribs = null;
 
         /**
          *  Create a new Link with text but no reference.
@@ -508,7 +508,7 @@
         {
             if( m_attribs == null )
             {
-                m_attribs = new ArrayList();
+                m_attribs = new ArrayList<Attribute>();
             }
             m_attribs.add(attr);
         }

Modified: 
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/parser/ParseException.java
URL: 
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/parser/ParseException.java?rev=660272&r1=660271&r2=660272&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/parser/ParseException.java 
(original)
+++ incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/parser/ParseException.java 
Mon May 26 12:06:04 2008
@@ -31,6 +31,11 @@
 {
     private static final long serialVersionUID = 1L;
 
+    /**
+     *  Constructs a new ParseException.
+     *  
+     *  @param msg [EMAIL PROTECTED]
+     */
     public ParseException(String msg)
     {
         super(msg);

Modified: 
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/parser/PluginContent.java
URL: 
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/parser/PluginContent.java?rev=660272&r1=660271&r2=660272&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/parser/PluginContent.java 
(original)
+++ incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/parser/PluginContent.java Mon 
May 26 12:06:04 2008
@@ -22,7 +22,6 @@
 
 import java.text.MessageFormat;
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.Map;
 import java.util.ResourceBundle;
 
@@ -36,6 +35,14 @@
 
 /**
  *  Stores the contents of a plugin in a WikiDocument DOM tree.
+ *  <p>
+ *  If the RenderingManager.WYSIWYG_EDITOR_MODE is set to Boolean.TRUE in the 
context, 
+ *  then the plugin
+ *  is rendered as WikiMarkup.  This allows an HTML editor to work without
+ *  rendering the plugin each time as well. 
+ *  <p>
+ *  If RenderingManager.VAR_EXECUTE_PLUGINS is set to Boolean.FALSE, then
+ *  the plugin is not executed.
  *  
  *  @since  2.4
  */
@@ -52,37 +59,70 @@
 
     private static final long serialVersionUID = 1L;
 
-    private String m_pluginName;
-    private Map    m_params;
+    private String                m_pluginName;
+    private Map<String,Object>    m_params;
     
+    /**
+     *  Creates a new DOM element with the given plugin name and a map of 
parameters.
+     *  
+     *  @param pluginName The FQN of a plugin.
+     *  @param parameters A Map of parameters.
+     */
+    @SuppressWarnings("unchecked")
     public PluginContent( String pluginName, Map parameters )
     {
         m_pluginName = pluginName;
         m_params     = parameters;
     }
     /**
-     * @since 2.5.7
+     *  Returns the name of the plugin invoked by the DOM element.
+     *  
+     *  @return Name of the plugin
+     *  @since 2.5.7
      */
     public String getPluginName()
     {
         return m_pluginName;
     }
     
+    /**
+     *  Returns a parameter value from the parameter map.
+     *  
+     *  @param name the name of the parameter.
+     *  @return The value from the map, or null, if no such parameter exists.
+     */
     public Object getParameter( String name )
     {
         return m_params.get(name);
     }
     
+    /**
+     *  Returns the parameter map given in the constructor.
+     *  
+     *  @return The parameter map.
+     */
     public Map getParameters()
     {
         return m_params;
     }
     
+    /**
+     *  Returns the rendered plugin.  Only calls getText().
+     *  
+     *  @return HTML
+     */
     public String getValue()
     {
         return getText();
     }
     
+    /**
+     *  The main invocation for the plugin.  When the getText() is called, it
+     *  invokes the plugin and returns its contents.  If there is no Document
+     *  yet, only returns the plugin name itself.
+     *  
+     *  @return The plugin rendered according to the options set in the 
WikiContext.
+     */
     public String getText()
     {
         String result;
@@ -136,15 +176,13 @@
 
                 WikiEngine engine = context.getEngine();
             
-                HashMap parsedParams = new HashMap();
+                HashMap<String,Object> parsedParams = new 
HashMap<String,Object>();
             
                 //
                 //  Parse any variable instances from the string
                 //
-                for( Iterator i = m_params.entrySet().iterator(); i.hasNext(); 
)
+                for( Map.Entry e : m_params.entrySet() )
                 {
-                    Map.Entry e = (Map.Entry) i.next();
-                
                     Object val = e.getValue();
                 
                     if( val instanceof String )
@@ -152,7 +190,7 @@
                         val = engine.getVariableManager().expandVariables( 
context, (String)val );
                     }
                 
-                    parsedParams.put( e.getKey(), val );
+                    parsedParams.put( (String)e.getKey(), val );
                 }
             
                 result = engine.getPluginManager().execute( context,
@@ -183,12 +221,13 @@
     /**
      *  Executes the executeParse() method.
      *  
-     *  @param m_context
+     *  @param context The WikiContext
+     *  @throws PluginException If something goes wrong.
      */
-    public void executeParse(WikiContext m_context)
+    public void executeParse(WikiContext context)
         throws PluginException
     {
-        m_context.getEngine().getPluginManager().executeParse( this, m_context 
);
+        context.getEngine().getPluginManager().executeParse( this, context );
     }
 
 }

Modified: incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/parser/WikiDocument.java
URL: 
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/parser/WikiDocument.java?rev=660272&r1=660271&r2=660272&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/parser/WikiDocument.java 
(original)
+++ incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/parser/WikiDocument.java Mon 
May 26 12:06:04 2008
@@ -39,12 +39,12 @@
  */
 public class WikiDocument extends Document
 {
-    private static final long serialVersionUID = 0L;
+    private static final long serialVersionUID = 1L;
     
-    private WikiPage m_page;
-    private String   m_wikiText;
+    private WikiPage                   m_page;
+    private String                     m_wikiText;
 
-    private WeakReference m_context;
+    private WeakReference<WikiContext> m_context;
     
     /**
      *  Creates a new WikiDocument for a specific page.
@@ -56,24 +56,48 @@
         m_page     = page;
     }
     
+    /**
+     *  Set the WikiMarkup for this document.
+     *  
+     *  @param data The WikiMarkup
+     */
     public void setPageData( String data )
     {
         m_wikiText = data;
     }
     
+    /**
+     *  Returns the wikimarkup used to render this document.
+     *  
+     *  @return The WikiMarkup
+     */
     public String getPageData()
     {
         return m_wikiText;
     }
     
+    /**
+     *  Return the WikiPage for whom this WikiDocument exists.
+     *  
+     *  @return The WikiPage
+     */
     public WikiPage getPage()
     {
         return m_page;
     }
 
+    /**
+     *  Set the WikiContext in which the WikiDocument is rendered. The
+     *  WikiContext is stored in a WeakReference, which means that it 
+     *  can be garbagecollected away.  This is to allow for caching of
+     *  the WikiDocument without having to carry the WikiContext around
+     *  for a long time.
+     *  
+     *  @param ctx A WikiContext.
+     */
     public void setContext( WikiContext ctx )
     {
-        m_context = new WeakReference( ctx );
+        m_context = new WeakReference<WikiContext>( ctx );
     }
     
     /**
@@ -84,6 +108,6 @@
      */
     public WikiContext getContext()
     {
-        return (WikiContext) m_context.get();
+        return m_context.get();
     }
 }


Reply via email to