Author: jalkanen
Date: Sat May 31 12:58:13 2008
New Revision: 662069

URL: http://svn.apache.org/viewvc?rev=662069&view=rev
Log:
Javadoc fixes.

Modified:
    
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/htmltowiki/ForgetNullValuesLinkedHashMap.java
    
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/htmltowiki/HtmlStringToWikiTranslator.java
    
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/htmltowiki/PersistentMapDecorator.java
    
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/htmltowiki/PropertiesUtils.java
    
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/htmltowiki/WhitespaceTrimWriter.java
    
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/htmltowiki/XHtmlElementToWikiTranslator.java
    
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/htmltowiki/XHtmlToWikiConfig.java

Modified: 
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/htmltowiki/ForgetNullValuesLinkedHashMap.java
URL: 
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/htmltowiki/ForgetNullValuesLinkedHashMap.java?rev=662069&r1=662068&r2=662069&view=diff
==============================================================================
--- 
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/htmltowiki/ForgetNullValuesLinkedHashMap.java
 (original)
+++ 
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/htmltowiki/ForgetNullValuesLinkedHashMap.java
 Sat May 31 12:58:13 2008
@@ -25,13 +25,19 @@
 /**
  * A LinkedHashMap that does not put null values into the map.
  * 
+ * @param <K> [EMAIL PROTECTED]
+ * @param <V> [EMAIL PROTECTED]
+ * 
  * @author Sebastian Baltes ([EMAIL PROTECTED])
  */
-public class ForgetNullValuesLinkedHashMap extends LinkedHashMap
+public class ForgetNullValuesLinkedHashMap<K,V> extends LinkedHashMap<K,V>
 {
     private static final long serialVersionUID = 0L;
     
-    public Object put( Object key, Object value )
+    /**
+     *  [EMAIL PROTECTED]
+     */
+    public V put( K key, V value )
     {
         if( value != null )
         {

Modified: 
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/htmltowiki/HtmlStringToWikiTranslator.java
URL: 
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/htmltowiki/HtmlStringToWikiTranslator.java?rev=662069&r1=662068&r2=662069&view=diff
==============================================================================
--- 
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/htmltowiki/HtmlStringToWikiTranslator.java
 (original)
+++ 
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/htmltowiki/HtmlStringToWikiTranslator.java
 Sat May 31 12:58:13 2008
@@ -42,19 +42,54 @@
 
     private static final String CYBERNEKO_PARSER = 
"org.cyberneko.html.parsers.SAXParser";
 
+    /**
+     *  Create a new translator.
+     */
     public HtmlStringToWikiTranslator()
     {}
 
+    /**
+     *  Translates text from HTML into WikiMarkup without a WikiContext 
(meaning
+     *  some things perhaps cannot be translated).  Uses the default 
configuration.
+     *  
+     *  @param html HTML text to translate
+     *  @return WikiMarkup
+     *  
+     *  @throws JDOMException If parsing fails
+     *  @throws IOException For other kinds of errors.
+     */
     public String translate( String html ) throws JDOMException, IOException
     {
         return translate( html, new XHtmlToWikiConfig() );
     }
 
+    /**
+     *  Translates text from HTML into WikiMarkup with a WikiContext.  The 
translation
+     *  accuracy is better.  Uses the default configuration.
+     *  
+     *  @param html HTML text to translate
+     *  @param wikiContext The WikiContext to use.
+     *  @return WikiMarkup
+     *  
+     *  @throws JDOMException If parsing fails
+     *  @throws IOException For other kinds of errors.
+     */
     public String translate( String html, WikiContext wikiContext ) throws 
JDOMException, IOException
     {
         return translate( html, new XHtmlToWikiConfig( wikiContext ) );
     }
 
+    /**
+     *  Translates text from HTML into WikiMarkup using a specified 
configuration.
+     *  
+     *  @param html HTML text to translate
+     *  @param config The configuration to use.
+     *  @return WikiMarkup
+     *  
+     *  @throws JDOMException If parsing fails
+     *  @throws IOException For other kinds of errors.
+     */
+
     public String translate( String html, XHtmlToWikiConfig config ) throws 
JDOMException, IOException
     {
         Element element = htmlStringToElement( html );
@@ -64,7 +99,7 @@
     }
 
     /**
-     * use NekoHtml to parse HTML like well formed XHTML
+     * Use NekoHtml to parse HTML like well formed XHTML
      * 
      * @param html
      * @return xhtml jdom root element (node "HTML")
@@ -79,6 +114,12 @@
         return element;
     }
 
+    /**
+     *  A static helper method to create HTML from an Element.
+     *  
+     *  @param element The element to get HTML from.
+     *  @return HTML
+     */
     public static String element2String( Element element )
     {
         Document document = new Document( element );

Modified: 
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/htmltowiki/PersistentMapDecorator.java
URL: 
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/htmltowiki/PersistentMapDecorator.java?rev=662069&r1=662068&r2=662069&view=diff
==============================================================================
--- 
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/htmltowiki/PersistentMapDecorator.java
 (original)
+++ 
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/htmltowiki/PersistentMapDecorator.java
 Sat May 31 12:58:13 2008
@@ -37,81 +37,146 @@
     
     private Map m_delegate;
 
+    /**
+     *  Creates a new decorator for a given map.
+     *  
+     *  @param delegate The map to create a decorator for.
+     */
     public PersistentMapDecorator( Map delegate )
     {
-        this.m_delegate = delegate;
+        m_delegate = delegate;
     }
 
+    /**
+     *  [EMAIL PROTECTED]
+     */
+    @Override
     public void clear()
     {
         m_delegate.clear();
     }
 
+    /**
+     *  [EMAIL PROTECTED]
+     */
+    @Override
     public boolean containsKey( Object key )
     {
         return m_delegate.containsKey( key );
     }
 
+    /**
+     *  [EMAIL PROTECTED]
+     */
+    @Override
     public boolean containsValue( Object value )
     {
         return m_delegate.containsValue( value );
     }
 
+    /**
+     *  [EMAIL PROTECTED]
+     */
+    @Override
     public Set entrySet()
     {
         return m_delegate.entrySet();
     }
 
+    /**
+     *  [EMAIL PROTECTED]
+     */
+    @Override
     public boolean equals( Object obj )
     {
         return m_delegate.equals( obj );
     }
 
+    /**
+     *  [EMAIL PROTECTED]
+     */
+    @Override
     public Object get( Object key )
     {
         return m_delegate.get( key );
     }
 
+    /**
+     *  [EMAIL PROTECTED]
+     */
+    @Override
     public int hashCode()
     {
         return m_delegate.hashCode();
     }
 
+    /**
+     *  [EMAIL PROTECTED]
+     */
+    @Override
     public boolean isEmpty()
     {
         return m_delegate.isEmpty();
     }
 
+    /**
+     *  [EMAIL PROTECTED]
+     */
+    @Override
     public Set keySet()
     {
         return m_delegate.keySet();
     }
 
+    /**
+     *  [EMAIL PROTECTED]
+     */
+    @Override
     public Object put( Object arg0, Object arg1 )
     {
         return m_delegate.put( arg0, arg1 );
     }
 
+    /**
+     *  [EMAIL PROTECTED]
+     */
+    @Override
     public void putAll( Map arg0 )
     {
         m_delegate.putAll( arg0 );
     }
 
+    /**
+     *  [EMAIL PROTECTED]
+     */
+    @Override
     public Object remove( Object key )
     {
         return m_delegate.remove( key );
     }
 
+    /**
+     *  [EMAIL PROTECTED]
+     */
+    @Override
     public int size()
     {
         return m_delegate.size();
     }
 
+    /**
+     *  [EMAIL PROTECTED]
+     */
+    @Override
     public String toString()
     {
         return m_delegate.toString();
     }
 
+    /**
+     *  [EMAIL PROTECTED]
+     */
+    @Override
     public Collection values()
     {
         return m_delegate.values();

Modified: 
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/htmltowiki/PropertiesUtils.java
URL: 
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/htmltowiki/PropertiesUtils.java?rev=662069&r1=662068&r2=662069&view=diff
==============================================================================
--- 
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/htmltowiki/PropertiesUtils.java 
(original)
+++ 
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/htmltowiki/PropertiesUtils.java 
Sat May 31 12:58:13 2008
@@ -31,6 +31,7 @@
  * @author Sebastian Baltes ([EMAIL PROTECTED])
  * @version 1.0
  */
+// FIXME3.0 move to utils package
 public final class PropertiesUtils
 {
     private static final String OTHER_WHITESPACE = "\t\r\n\014";

Modified: 
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/htmltowiki/WhitespaceTrimWriter.java
URL: 
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/htmltowiki/WhitespaceTrimWriter.java?rev=662069&r1=662068&r2=662069&view=diff
==============================================================================
--- 
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/htmltowiki/WhitespaceTrimWriter.java
 (original)
+++ 
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/htmltowiki/WhitespaceTrimWriter.java
 Sat May 31 12:58:13 2008
@@ -26,10 +26,11 @@
 import java.util.regex.Pattern;
 
 /**
- * Part of the XHtmlToWikiTranslator
+ * Part of the XHtmlToWikiTranslator.
  * 
  * @author Sebastian Baltes ([EMAIL PROTECTED])
  */
+// FIXME: Needs a better description as to how it works.
 public class WhitespaceTrimWriter extends Writer
 {
 
@@ -43,6 +44,10 @@
 
     private boolean m_currentlyOnLineBegin = true;
 
+    /**
+     *  [EMAIL PROTECTED]
+     */
+    @Override
     public void flush()
     {
         if( m_buffer.length() > 0 )
@@ -85,11 +90,21 @@
         return s;
     }
 
+    /**
+     *  Returns true, if this Writer is currently trimming any whitespaces.
+     *  
+     *  @return True, if trimming.
+     */
     public boolean isWhitespaceTrimMode()
     {
         return m_trimMode;
     }
 
+    /**
+     *  Set the trimming mode on/off.
+     *  
+     *  @param trimMode True, if you want trimming to be turned on.  False 
otherwise.
+     */
     public void setWhitespaceTrimMode( boolean trimMode )
     {
         if( m_trimMode != trimMode )
@@ -99,21 +114,38 @@
         }
     }
 
+    /**
+     *  [EMAIL PROTECTED]
+     */
+    @Override
     public void write( char[] arg0, int arg1, int arg2 ) throws IOException
     {
         m_buffer.append( arg0, arg1, arg2 );
         m_currentlyOnLineBegin = ONLINE_PATTERN.matcher( m_buffer ).matches();
     }
 
+    /**
+     *  [EMAIL PROTECTED]
+     */
+    @Override
     public void close() throws IOException
     {}
 
+    /**
+     *  [EMAIL PROTECTED]
+     */
+    @Override
     public String toString()
     {
         flush();
         return m_result.toString();
     }
 
+    /**
+     *  Returns true, if the writer is currently writing a line start.
+     *  
+     *  @return True or false.
+     */
     public boolean isCurrentlyOnLineBegin()
     {
         return m_currentlyOnLineBegin;

Modified: 
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/htmltowiki/XHtmlElementToWikiTranslator.java
URL: 
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/htmltowiki/XHtmlElementToWikiTranslator.java?rev=662069&r1=662068&r2=662069&view=diff
==============================================================================
--- 
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/htmltowiki/XHtmlElementToWikiTranslator.java
 (original)
+++ 
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/htmltowiki/XHtmlElementToWikiTranslator.java
 Sat May 31 12:58:13 2008
@@ -38,7 +38,7 @@
 import org.jdom.xpath.XPath;
 
 /**
- * Converting XHtml to Wiki Markup
+ * Converting XHtml to Wiki Markup.  This is the class which does all of the 
heavy loading.
  *
  * @author Sebastian Baltes ([EMAIL PROTECTED])
  */
@@ -56,11 +56,26 @@
 
     private PreStack m_preStack = new PreStack();
 
+    /**
+     *  Create a new translator using the default config.
+     *  
+     *  @param base The base element from which to start translating.
+     *  @throws IOException If reading of the DOM tree fails.
+     *  @throws JDOMException If the DOM tree is faulty.
+     */
     public XHtmlElementToWikiTranslator( Element base ) throws IOException, 
JDOMException
     {
         this( base, new XHtmlToWikiConfig() );
     }
 
+    /**
+     *  Create a new translator using the specified config.
+     *  
+     *  @param base The base element from which to start translating.
+     *  @param config The config to use.
+     *  @throws IOException If reading of the DOM tree fails.
+     *  @throws JDOMException If the DOM tree is faulty.
+     */
     public XHtmlElementToWikiTranslator( Element base, XHtmlToWikiConfig 
config ) throws IOException, JDOMException
     {
         this.m_config = config;
@@ -69,6 +84,11 @@
         print( base );
     }
 
+    /**
+     *  FIXME: I have no idea what this does...
+     * 
+     *  @return Something.
+     */
     public String getWikiString()
     {
         return m_outTimmer.toString();
@@ -669,6 +689,7 @@
         }
     }
 
+    @SuppressWarnings("unchecked")
     private void printImage( Element base ) throws JDOMException
     {
         Element child = (Element)XPath.selectSingleNode( base, "TBODY/TR/TD/*" 
);
@@ -678,7 +699,7 @@
         }
         Element img;
         String href;
-        Map map = new ForgetNullValuesLinkedHashMap();
+        Map<Object,Object> map = new ForgetNullValuesLinkedHashMap();
         if( child.getName().equals( "A" ) )
         {
             img = child.getChild( "IMG" );
@@ -764,7 +785,7 @@
      */
     private Map getAugmentedWikiLinkAttributes( Element a )
     {
-        Map attributesMap = new HashMap();
+        Map<String,String> attributesMap = new HashMap<String,String>();
 
         String id = a.getAttributeValue( "id" );
         if( id != null && !id.equals( "" ) )
@@ -1000,7 +1021,7 @@
 
     // FIXME: These should probably be better used with java.util.Stack
 
-    static class LiStack
+    private static class LiStack
     {
 
         private StringBuffer m_li = new StringBuffer();
@@ -1023,7 +1044,7 @@
 
     }
 
-    class PreStack
+    private class PreStack
     {
 
         private int m_pre = 0;

Modified: 
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/htmltowiki/XHtmlToWikiConfig.java
URL: 
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/htmltowiki/XHtmlToWikiConfig.java?rev=662069&r1=662068&r2=662069&view=diff
==============================================================================
--- 
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/htmltowiki/XHtmlToWikiConfig.java 
(original)
+++ 
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/htmltowiki/XHtmlToWikiConfig.java 
Sat May 31 12:58:13 2008
@@ -42,6 +42,9 @@
 
     private String m_pageName;
 
+    /**
+     *  Creates a new, empty config object.
+     */
     public XHtmlToWikiConfig()
     {}
 
@@ -49,7 +52,7 @@
      *  The constructor initializes the different internal fields
      *  according to the current URLConstructor.
      *
-     * @param wikiContext
+     * @param wikiContext A WikiContext
      */
     public XHtmlToWikiConfig( WikiContext wikiContext )
     {
@@ -71,20 +74,6 @@
         m_pageInfoJsp = wikiContext.getURL( WikiContext.INFO, "" );
     }
 
-    /*
-    // FIXME: Unused.
-    private String removeLast(String str, String remove )
-    {
-        int idx = str.lastIndexOf( remove );
-
-        if( idx != -1 )
-        {
-            str = StringUtils.left( str, idx ) + StringUtils.substring( str, 
idx+remove.length() );
-        }
-
-        return str;
-    }
-    */
     private void setWikiContext( WikiContext wikiContext )
     {
         if( wikiContext.getPage() != null )
@@ -93,61 +82,122 @@
         }
     }
 
+    /**
+     *  Return the URL for the attachments.
+     *  
+     *  @return URL for attachments.
+     */
     public String getAttachPage()
     {
         return m_attachPage;
     }
 
+    /**
+     *  Set the URL for attachments.
+     *  
+     *  @param attachPage The attachment URL.
+     */
     public void setAttachPage( String attachPage )
     {
         m_attachPage = attachPage;
     }
 
+    /**
+     *  Gets the URL of the outlink image.
+     *  
+     *  @return The URL of the outlink image.
+     */
     public String getOutlink()
     {
         return m_outlink;
     }
 
+    /**
+     *  Set the outlink URL.
+     *  
+     *  @param outlink The outlink URL.
+     */
     public void setOutlink( String outlink )
     {
         m_outlink = outlink;
     }
 
+    /**
+     *  Get the PageInfo.jsp URI.
+     *  
+     *  @return The URI for the page info display.
+     */
     public String getPageInfoJsp()
     {
         return m_pageInfoJsp;
     }
 
+    /**
+     *  Set the URI for the page info display.
+     *  
+     *  @param pageInfoJsp URI for the page info.
+     */
     public void setPageInfoJsp( String pageInfoJsp )
     {
         m_pageInfoJsp = pageInfoJsp;
     }
 
+    /**
+     *  Get the page name.
+     *  
+     *  @return The Page Name.
+     */
     public String getPageName()
     {
         return m_pageName;
     }
 
+    
+    /**
+     *  Set the page name.
+     *  
+     *  @param pageName The name of the page.
+     */
     public void setPageName( String pageName )
     {
         m_pageName = pageName;
     }
 
+    /**
+     *  Get the URI to the Wiki.jsp view.
+     *  
+     *  @return The URI to the Wiki.jsp.
+     */
     public String getWikiJspPage()
     {
         return m_wikiJspPage;
     }
 
+    /**
+     *  Set the URI to the Wiki.jsp.
+     *  
+     *  @param wikiJspPage The URI to the Wiki.jsp.
+     */
     public void setWikiJspPage( String wikiJspPage )
     {
         m_wikiJspPage = wikiJspPage;
     }
 
+    /**
+     *  Return the URI to the Edit.jsp page.
+     *  
+     *  @return The URI to the Edit.jsp page.
+     */
     public String getEditJspPage()
     {
         return m_editJspPage;
     }
 
+    /**
+     *  Set the URI to the Edit.jsp page.
+     *  
+     *  @param editJspPage The Edit.jsp URI.
+     */
     public void setEditJspPage( String editJspPage )
     {
         m_editJspPage = editJspPage;


Reply via email to