[seam-commits] Seam SVN: r11017 - in branches/community/Seam_2_1/examples/wiki: src/main/org/jboss/seam/wiki/core/wikitext/renderer and 9 other directories.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Thu May 28 04:54:09 EDT 2009


Author: christian.bauer at jboss.com
Date: 2009-05-28 04:54:09 -0400 (Thu, 28 May 2009)
New Revision: 11017

Modified:
   branches/community/Seam_2_1/examples/wiki/src/main/org/jboss/seam/wiki/core/wikitext/engine/WikiLink.java
   branches/community/Seam_2_1/examples/wiki/src/main/org/jboss/seam/wiki/core/wikitext/engine/WikiTextParser.java
   branches/community/Seam_2_1/examples/wiki/src/main/org/jboss/seam/wiki/core/wikitext/renderer/DefaultWikiTextRenderer.java
   branches/community/Seam_2_1/examples/wiki/src/main/org/jboss/seam/wiki/core/wikitext/renderer/jsf/UIWikiFormattedText.java
   branches/community/Seam_2_1/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/blog/templates/blogDirectory.xhtml
   branches/community/Seam_2_1/examples/wiki/view/docDisplay_m.xhtml
   branches/community/Seam_2_1/examples/wiki/view/includes/admin/sessionManager.xhtml
   branches/community/Seam_2_1/examples/wiki/view/includes/attachmentDisplay.xhtml
   branches/community/Seam_2_1/examples/wiki/view/themes/default/js/lacewiki.js
   branches/community/Seam_2_1/examples/wiki/view/themes/inrelationto/js/lacewiki.js
   branches/community/Seam_2_1/examples/wiki/view/themes/sfwkorg/css/sfwk.css
   branches/community/Seam_2_1/examples/wiki/view/themes/sfwkorg/js/lacewiki.js
Log:
JBSEAM-4199, minor wiki bugfixes

Modified: branches/community/Seam_2_1/examples/wiki/src/main/org/jboss/seam/wiki/core/wikitext/engine/WikiLink.java
===================================================================
--- branches/community/Seam_2_1/examples/wiki/src/main/org/jboss/seam/wiki/core/wikitext/engine/WikiLink.java	2009-05-27 20:44:49 UTC (rev 11016)
+++ branches/community/Seam_2_1/examples/wiki/src/main/org/jboss/seam/wiki/core/wikitext/engine/WikiLink.java	2009-05-28 08:54:09 UTC (rev 11017)
@@ -25,9 +25,6 @@
         this.external = external;
     }
 
-    public int getIdentifier() { return identifier; }
-    public void setIdentifier(int identifier) { this.identifier = identifier; }
-
     public WikiFile getFile() { return file; }
     public void setFile(WikiFile file) { this.file = file; }
 

Modified: branches/community/Seam_2_1/examples/wiki/src/main/org/jboss/seam/wiki/core/wikitext/engine/WikiTextParser.java
===================================================================
--- branches/community/Seam_2_1/examples/wiki/src/main/org/jboss/seam/wiki/core/wikitext/engine/WikiTextParser.java	2009-05-27 20:44:49 UTC (rev 11016)
+++ branches/community/Seam_2_1/examples/wiki/src/main/org/jboss/seam/wiki/core/wikitext/engine/WikiTextParser.java	2009-05-28 08:54:09 UTC (rev 11017)
@@ -38,7 +38,6 @@
 public class WikiTextParser extends SeamTextParser {
 
     private int macroPosition = 0;
-    private int linkCounter = 0;
 
     private WikiTextRenderer renderer;
 
@@ -130,9 +129,6 @@
         WikiLink link = resolvedLinks.get((linkText));
         if (link == null) return "";
 
-        // Set an internal identifier, used for attachments and external links we later push into a hashmap into the contexts
-        link.setIdentifier(linkCounter++);
-
         // Override the description of the WikiLink with description found in tag
         String finalDescriptionText =
                 (descriptionText!=null && descriptionText.length() > 0 ? descriptionText : link.getDescription());

Modified: branches/community/Seam_2_1/examples/wiki/src/main/org/jboss/seam/wiki/core/wikitext/renderer/DefaultWikiTextRenderer.java
===================================================================
--- branches/community/Seam_2_1/examples/wiki/src/main/org/jboss/seam/wiki/core/wikitext/renderer/DefaultWikiTextRenderer.java	2009-05-27 20:44:49 UTC (rev 11016)
+++ branches/community/Seam_2_1/examples/wiki/src/main/org/jboss/seam/wiki/core/wikitext/renderer/DefaultWikiTextRenderer.java	2009-05-28 08:54:09 UTC (rev 11017)
@@ -1,6 +1,5 @@
 package org.jboss.seam.wiki.core.wikitext.renderer;
 
-import org.jboss.seam.wiki.core.wikitext.renderer.WikiTextRenderer;
 import org.jboss.seam.wiki.core.wikitext.engine.WikiLink;
 import org.jboss.seam.wiki.core.model.WikiTextMacro;
 import org.jboss.seam.wiki.core.ui.WikiURLRenderer;
@@ -89,7 +88,6 @@
                + "</h4>";
     }
 
-
     public String renderOrderedListOpenTag() {
         return "<ol class=\"wikiOrderedList\">\n";
     }

Modified: branches/community/Seam_2_1/examples/wiki/src/main/org/jboss/seam/wiki/core/wikitext/renderer/jsf/UIWikiFormattedText.java
===================================================================
--- branches/community/Seam_2_1/examples/wiki/src/main/org/jboss/seam/wiki/core/wikitext/renderer/jsf/UIWikiFormattedText.java	2009-05-27 20:44:49 UTC (rev 11016)
+++ branches/community/Seam_2_1/examples/wiki/src/main/org/jboss/seam/wiki/core/wikitext/renderer/jsf/UIWikiFormattedText.java	2009-05-28 08:54:09 UTC (rev 11017)
@@ -226,32 +226,39 @@
             @Override
             public void setAttachmentLinks(List<WikiLink> attachmentLinks) {
                 // Put attachments (wiki links...) into the event context for later rendering
-                setLinks("wikiTextAttachments", attachmentLinks);
+                String contextVariable = "attachmentLinksByWikiFile";
+
+                // We need to key them by WikiFile identifier, so we put a map in the context
+                Map<Long, List<WikiLink>> linksByFile;
+                if ((linksByFile = (Map)Contexts.getEventContext().get(contextVariable)) == null) {
+                    linksByFile = new HashMap();
+                }
+
+                // This method may be called multiple times when we render a "base file", e.g. header, content, footer, comments
+                List<WikiLink> linksForBaseFile;
+                if ((linksForBaseFile = linksByFile.get(baseFile.getId())) != null) {
+                    // Aggregate all links for a base file, don't reset them on each render pass for the same base file
+                    linksForBaseFile.addAll(attachmentLinks);
+                } else {
+                    linksForBaseFile = attachmentLinks;
+                }
+
+                linksByFile.put(baseFile.getId(), linksForBaseFile);
+
+                Contexts.getEventContext().set(contextVariable, linksByFile);
             }
 
             @Override
             public void setExternalLinks(List<WikiLink> externalLinks) {
                 // Put external links (to targets not on this wiki) into the event context for later rendering
-                setLinks("wikiTextExternalLinks", externalLinks);
-            }
-
-            private void setLinks(String contextVariable, List<WikiLink> links) {
-                // TODO: Need some tricks here with link identifiers and attachment numbers, right now we just skip this if it's already set
-                /// ... hoping that the first caller was the document renderer and not the comment renderer - that means comment attachments are broken
+                // TODO: This is actually never used anywhere... nobody is rendering a list of "external links"
+                // We COULD use this to render a list of links in a print view (like coWiki)
+                /*
+                String contextVariable = "wikiTextExternalLinks";
                 List<WikiLink> contextLinks = (List<WikiLink>)Contexts.getEventContext().get(contextVariable);
                 if (contextLinks == null || contextLinks.size()==0) {
-                    Contexts.getEventContext().set(contextVariable, links);
+                    Contexts.getEventContext().set(contextVariable, externalLinks);
                 }
-                        /*
-                Map<Integer, WikiLink> contextLinks =
-                    (Map<Integer,WikiLink>)Contexts.getEventContext().get(contextVariable);
-                if (contextLinks == null) {
-                    contextLinks = new HashMap<Integer, WikiLink>();
-                }
-                for (WikiLink link : links) {
-                    contextLinks.put(link.getIdentifier(), link);
-                }
-                Contexts.getEventContext().set(contextVariable, contextLinks);
                 */
             }
 

Modified: branches/community/Seam_2_1/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/blog/templates/blogDirectory.xhtml
===================================================================
--- branches/community/Seam_2_1/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/blog/templates/blogDirectory.xhtml	2009-05-27 20:44:49 UTC (rev 11016)
+++ branches/community/Seam_2_1/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/blog/templates/blogDirectory.xhtml	2009-05-28 08:54:09 UTC (rev 11017)
@@ -91,11 +91,11 @@
                                 </h:outputLink>
                             </s:div>
                             <s:div styleClass="blogEntryAttachmentsLink undecoratedLink"
-                                    rendered="#{wiki:sizeOf(wikiTextAttachments) > 0}">
+                                    rendered="#{wiki:sizeOf(attachmentLinksByWikiFile[blogEntry.entryDocument.id]) > 0}">
                                 <h:outputLink value="#{wikiURLRenderer.renderPermURL(blogEntry.entryDocument)}#attachments" target="_top">
                                     <span class="blogEntryAttachmentsLinkText">
-                                        <h:outputText value="#{wiki:sizeOf(wikiTextAttachments)}&#160;"/>
-                                        <h:outputText value="#{wiki:sizeOf(wikiTextAttachments)>1
+                                        <h:outputText value="#{wiki:sizeOf(attachmentLinksByWikiFile[blogEntry.entryDocument.id])}&#160;"/>
+                                        <h:outputText value="#{wiki:sizeOf(attachmentLinksByWikiFile[blogEntry.entryDocument.id])>1
                                                              ? messages['blog.directory.label.Attachments']
                                                              : messages['blog.directory.label.Attachment']}"/>
                                     </span>

Modified: branches/community/Seam_2_1/examples/wiki/view/docDisplay_m.xhtml
===================================================================
--- branches/community/Seam_2_1/examples/wiki/view/docDisplay_m.xhtml	2009-05-27 20:44:49 UTC (rev 11016)
+++ branches/community/Seam_2_1/examples/wiki/view/docDisplay_m.xhtml	2009-05-28 08:54:09 UTC (rev 11017)
@@ -151,13 +151,13 @@
 
     </s:div>
 
-    <s:div styleClass="box" rendered="#{wikiTextAttachments.size() > 0}">
+    <s:div styleClass="box" rendered="#{wiki:sizeOf(attachmentLinksByWikiFile[documentHome.instance.id]) > 0}">
 
         <h3>
             <h:outputText value="#{messages['lacewiki.label.attachmentDisplay.Attachments']}:"/>
         </h3>
 
-        <h:dataTable value="#{wikiTextAttachments}" var="link"
+        <h:dataTable value="#{attachmentLinksByWikiFile[documentHome.instance.id]}" var="link"
              id="attachmentTable"
              rowClasses="rowOdd,rowEven">
             <h:column>

Modified: branches/community/Seam_2_1/examples/wiki/view/includes/admin/sessionManager.xhtml
===================================================================
--- branches/community/Seam_2_1/examples/wiki/view/includes/admin/sessionManager.xhtml	2009-05-27 20:44:49 UTC (rev 11016)
+++ branches/community/Seam_2_1/examples/wiki/view/includes/admin/sessionManager.xhtml	2009-05-28 08:54:09 UTC (rev 11017)
@@ -122,6 +122,8 @@
                 <h:outputText value="User"/>
             </f:facet>
             <h:outputText value="#{wikiHttpSessionManager.getUsername(s.id)}"/>
+            <br/>
+            <h:outputText value="[ID: #{s.id}]"/>
         </h:column>
 
         <h:column>

Modified: branches/community/Seam_2_1/examples/wiki/view/includes/attachmentDisplay.xhtml
===================================================================
--- branches/community/Seam_2_1/examples/wiki/view/includes/attachmentDisplay.xhtml	2009-05-27 20:44:49 UTC (rev 11016)
+++ branches/community/Seam_2_1/examples/wiki/view/includes/attachmentDisplay.xhtml	2009-05-28 08:54:09 UTC (rev 11017)
@@ -1,5 +1,5 @@
 <s:div styleClass="attachmentDisplay box"
-     rendered="#{wikiTextAttachments.size() > 0}"
+     rendered="#{wiki:sizeOf(attachmentLinksByWikiFile[documentHome.instance.id]) > 0}"
      xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
@@ -7,7 +7,7 @@
      xmlns:a="https://ajax4jsf.dev.java.net/ajax"
      xmlns:s="http://jboss.com/products/seam/taglib">
 
-    <h:dataTable value="#{wikiTextAttachments}" var="link"
+    <h:dataTable value="#{attachmentLinksByWikiFile[documentHome.instance.id]}" var="link"
          id="attachmentTable"
          styleClass="datatable rightBorder leftBorder topBorder bottomBorder"
          headerClass="regularHeader alignLeft"

Modified: branches/community/Seam_2_1/examples/wiki/view/themes/default/js/lacewiki.js
===================================================================
--- branches/community/Seam_2_1/examples/wiki/view/themes/default/js/lacewiki.js	2009-05-27 20:44:49 UTC (rev 11016)
+++ branches/community/Seam_2_1/examples/wiki/view/themes/default/js/lacewiki.js	2009-05-28 08:54:09 UTC (rev 11017)
@@ -99,8 +99,8 @@
     var prefix = formatString.substring(0, formatString.indexOf(inline ? inlinePlaceholder : blockPlaceholder));
     var suffix = formatString.substring(formatString.indexOf(inline ? inlinePlaceholder : blockPlaceholder)+3, formatString.length);
     if (block) {
-        prefix = "\n" + prefix;
-        suffix = suffix + "\n";
+        prefix = "\n\n" + prefix;
+        suffix = suffix + "\n\n";
     }
 
     if (typeof(textArea.caretPos) != "undefined" && textArea.createTextRange) {

Modified: branches/community/Seam_2_1/examples/wiki/view/themes/inrelationto/js/lacewiki.js
===================================================================
--- branches/community/Seam_2_1/examples/wiki/view/themes/inrelationto/js/lacewiki.js	2009-05-27 20:44:49 UTC (rev 11016)
+++ branches/community/Seam_2_1/examples/wiki/view/themes/inrelationto/js/lacewiki.js	2009-05-28 08:54:09 UTC (rev 11017)
@@ -99,8 +99,8 @@
     var prefix = formatString.substring(0, formatString.indexOf(inline ? inlinePlaceholder : blockPlaceholder));
     var suffix = formatString.substring(formatString.indexOf(inline ? inlinePlaceholder : blockPlaceholder)+3, formatString.length);
     if (block) {
-        prefix = "\n" + prefix;
-        suffix = suffix + "\n";
+        prefix = "\n\n" + prefix;
+        suffix = suffix + "\n\n";
     }
 
     if (typeof(textArea.caretPos) != "undefined" && textArea.createTextRange) {

Modified: branches/community/Seam_2_1/examples/wiki/view/themes/sfwkorg/css/sfwk.css
===================================================================
--- branches/community/Seam_2_1/examples/wiki/view/themes/sfwkorg/css/sfwk.css	2009-05-27 20:44:49 UTC (rev 11016)
+++ branches/community/Seam_2_1/examples/wiki/view/themes/sfwkorg/css/sfwk.css	2009-05-28 08:54:09 UTC (rev 11017)
@@ -122,6 +122,7 @@
     font-family: Andale Mono, Courier New, monospace;
     font-size: 90%;
     overflow-x: auto;
+    max-width: 950px;
 }
 
 /* ---- Fonts ----- */

Modified: branches/community/Seam_2_1/examples/wiki/view/themes/sfwkorg/js/lacewiki.js
===================================================================
--- branches/community/Seam_2_1/examples/wiki/view/themes/sfwkorg/js/lacewiki.js	2009-05-27 20:44:49 UTC (rev 11016)
+++ branches/community/Seam_2_1/examples/wiki/view/themes/sfwkorg/js/lacewiki.js	2009-05-28 08:54:09 UTC (rev 11017)
@@ -99,8 +99,8 @@
     var prefix = formatString.substring(0, formatString.indexOf(inline ? inlinePlaceholder : blockPlaceholder));
     var suffix = formatString.substring(formatString.indexOf(inline ? inlinePlaceholder : blockPlaceholder)+3, formatString.length);
     if (block) {
-        prefix = "\n" + prefix;
-        suffix = suffix + "\n";
+        prefix = "\n\n" + prefix;
+        suffix = suffix + "\n\n";
     }
 
     if (typeof(textArea.caretPos) != "undefined" && textArea.createTextRange) {




More information about the seam-commits mailing list