[seam-commits] Seam SVN: r7166 - in trunk/examples/wiki: src/main/org/jboss/seam/wiki/core/feeds and 3 other directories.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Mon Jan 21 07:25:46 EST 2008


Author: christian.bauer at jboss.com
Date: 2008-01-21 07:25:45 -0500 (Mon, 21 Jan 2008)
New Revision: 7166

Added:
   trunk/examples/wiki/view/includes/preferences/
   trunk/examples/wiki/view/includes/preferences/editor.xhtml
   trunk/examples/wiki/view/includes/preferences/editorAdaptiveTextInput.xhtml
   trunk/examples/wiki/view/includes/preferences/editorNumberRange.xhtml
   trunk/examples/wiki/view/includes/preferences/editorSelectOne.xhtml
Modified:
   trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/dao/TagDAO.java
   trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/feeds/FeedDAO.java
   trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/ui/WikiFormattedTextHandler.java
Log:
Various bugfixes

Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/dao/TagDAO.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/dao/TagDAO.java	2008-01-21 12:04:34 UTC (rev 7165)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/dao/TagDAO.java	2008-01-21 12:25:45 UTC (rev 7166)
@@ -58,7 +58,7 @@
     public List<WikiFile> findWikFiles(WikiDirectory startDir, WikiFile ignoreFile, final String tag,
                                        WikiNode.SortableProperty orderBy, boolean orderAscending) {
 
-        if (tag == null || tag.length() == 0) return Collections.emptyList();
+        if (tag == null || tag.length() == 0) return Collections.EMPTY_LIST;
 
         StringBuilder queryString = new StringBuilder();
 

Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/feeds/FeedDAO.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/feeds/FeedDAO.java	2008-01-21 12:04:34 UTC (rev 7165)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/feeds/FeedDAO.java	2008-01-21 12:25:45 UTC (rev 7166)
@@ -21,6 +21,7 @@
 import javax.persistence.Query;
 import java.util.Date;
 import java.util.List;
+import java.util.Iterator;
 
 /**
  * DAO for feeds.
@@ -224,11 +225,25 @@
     public void purgeOldFeedEntries(Date olderThan) {
         log.debug("cleaning up feed entries older than: " + olderThan);
         // Clean up _all_ feed entries that are older than N days
-        int result = restrictedEntityManager.createQuery("delete from FeedEntry fe where fe.publishedDate < :oldestDate")
-                .setParameter("oldestDate", olderThan).executeUpdate();
-        log.debug("cleaned up " + result + " outdated feed entries");
+        List<Feed> feedsWithOutdatedEntries =
+                restrictedEntityManager
+                    .createQuery("select distinct f from FeedEntry fe, WikiFeed f join f.feedEntries allFe " +
+                                 " where fe = allFe and fe.publishedDate < :oldestDate")
+                    .setParameter("oldestDate", olderThan)
+                    .getResultList();
+        for (Feed feed : feedsWithOutdatedEntries) {
+            log.debug("feed has outdated entries: " + feed);
+            Iterator<FeedEntry> it = feed.getFeedEntries().iterator();
+            while (it.hasNext()) {
+                FeedEntry feedEntry = it.next();
+                if (feedEntry.getPublishedDate().compareTo(olderThan) < 0) {
+                    log.debug("removing outdated feed entry: " + feedEntry);
+                    it.remove(); // Unlink from feed
+                    restrictedEntityManager.remove(feedEntry);
+                }
+            }
+        }
     }
 
 
-
 }

Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/ui/WikiFormattedTextHandler.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/ui/WikiFormattedTextHandler.java	2008-01-21 12:04:34 UTC (rev 7165)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/ui/WikiFormattedTextHandler.java	2008-01-21 12:25:45 UTC (rev 7166)
@@ -156,7 +156,10 @@
                     log.debug("found macro: " + macro);
 
                     URL faceletURL = getPluginURL(macro.getName(), ctx);
-                    if (faceletURL == null) return null;
+                    if (faceletURL == null) {
+                        log.debug("macro has no plugin facelets file: " + macro.getName());
+                        return null;
+                    }
 
                     log.debug("setting current macro in EVENT context before including facelets file");
                     Contexts.getEventContext().set(UIWikiFormattedText.CURRENT_MACRO_EVENT_VARIABLE, macro);

Added: trunk/examples/wiki/view/includes/preferences/editor.xhtml
===================================================================
--- trunk/examples/wiki/view/includes/preferences/editor.xhtml	                        (rev 0)
+++ trunk/examples/wiki/view/includes/preferences/editor.xhtml	2008-01-21 12:25:45 UTC (rev 7166)
@@ -0,0 +1,50 @@
+<s:fragment
+    xmlns="http://www.w3.org/1999/xhtml"
+    xmlns:ui="http://java.sun.com/jsf/facelets"
+    xmlns:h="http://java.sun.com/jsf/html"
+    xmlns:f="http://java.sun.com/jsf/core"
+    xmlns:a="https://ajax4jsf.dev.java.net/ajax"
+    xmlns:s="http://jboss.com/products/seam/taglib">
+
+    <s:div rendered="#{v.preferenceProperty.fieldType.simpleName == 'Boolean'}">
+        <h:selectBooleanCheckbox value="#{v.value}"/>
+    </s:div>
+
+    <s:div rendered="#{v.preferenceProperty.fieldType.simpleName == 'String'}">
+        <h:inputText styleClass="ajaxSupport" value="#{v.value}" size="25">
+            <a:support status="#{statusId}" event="onchange" action="#{preferenceEditor.validate}" oncomplete="onAjaxRequestComplete()"
+                       reRender="preferenceValidationErrors"/>
+        </h:inputText>
+    </s:div>
+
+    <s:div rendered="#{v.preferenceProperty.fieldType.simpleName == 'Long'}">
+        <h:inputText styleClass="ajaxSupport" value="#{v.value}" size="5">
+            <f:converter converterId="javax.faces.Long"/>
+            <a:support status="#{statusId}" event="onchange" action="#{preferenceEditor.validate}" oncomplete="onAjaxRequestComplete()"
+                       reRender="preferenceValidationErrors"/>
+        </h:inputText>
+    </s:div>
+
+    <s:div rendered="#{v.preferenceProperty.fieldType.simpleName == 'Double'}">
+        <h:inputText styleClass="ajaxSupport" value="#{v.value}" size="10">
+            <f:converter converterId="javax.faces.Double"/>
+            <a:support status="#{statusId}" event="onchange" action="#{preferenceEditor.validate}" oncomplete="onAjaxRequestComplete()"
+                       reRender="preferenceValidationErrors"/>
+        </h:inputText>
+    </s:div>
+<!-- TODO: Duplicate identifiers...
+    <s:div rendered="#{v.preferenceProperty.fieldType.simpleName == 'Date'}">
+         <h:inputText styleClass="ajaxSupport" id="dt" value="#{v.value}">
+            <f:convertDateTime pattern="dd. MMM yyyy, HH:mm" timeZone="#{preferences.get('Wiki').timeZone}"/>
+             <a:support status="#{statusId}" event="onchange" action="#{preferenceEditor.validate}" oncomplete="onAjaxRequestComplete()"
+                        reRender="preferenceValidationErrors"/>
+        </h:inputText>
+        <s:selectDate for="dt" dateFormat="dd. MMM yyyy, HH:mm">
+            <h:graphicImage style="vertical-align:bottom;margin-bottom:2px;"
+                            value="/themes/#{preferences.get('Wiki').themeName}/img/icon.calendar.gif"
+                            width="16" height="16"/>
+        </s:selectDate>
+    </s:div>
+-->
+
+</s:fragment>

Added: trunk/examples/wiki/view/includes/preferences/editorAdaptiveTextInput.xhtml
===================================================================
--- trunk/examples/wiki/view/includes/preferences/editorAdaptiveTextInput.xhtml	                        (rev 0)
+++ trunk/examples/wiki/view/includes/preferences/editorAdaptiveTextInput.xhtml	2008-01-21 12:25:45 UTC (rev 7166)
@@ -0,0 +1,29 @@
+<s:fragment
+        xmlns="http://www.w3.org/1999/xhtml"
+        xmlns:ui="http://java.sun.com/jsf/facelets"
+        xmlns:h="http://java.sun.com/jsf/html"
+        xmlns:f="http://java.sun.com/jsf/core"
+        xmlns:a="https://ajax4jsf.dev.java.net/ajax"
+        xmlns:rich="http://richfaces.org/rich"
+        xmlns:s="http://jboss.com/products/seam/taglib">
+
+    <s:fragment rendered="#{not editorAdaptiveTextInput.isRenderTextArea(v.preferenceProperty)}">
+        <h:inputText styleClass="ajaxSupport"
+                     value="#{v.value}"
+                     size="#{editorAdaptiveTextInput.getSize(v.preferenceProperty)}"
+                     maxlength="#{editorAdaptiveTextInput.getMaxLength(v.preferenceProperty)}">
+            <a:support status="#{statusId}" event="onchange" action="#{preferenceEditor.validate}" oncomplete="onAjaxRequestComplete()"
+                       reRender="preferenceValidationErrors"/>
+        </h:inputText>
+    </s:fragment>
+    <s:fragment rendered="#{editorAdaptiveTextInput.isRenderTextArea(v.preferenceProperty)}">
+        <h:inputTextarea value="#{v.value}"
+                         cols="#{editorAdaptiveTextInput.getTextAreaCols(v.preferenceProperty)}"
+                         rows="#{editorAdaptiveTextInput.getTextAreaRows(v.preferenceProperty)}"
+                         style="margin:5px;">
+            <a:support status="#{statusId}" event="onchange" action="#{preferenceEditor.validate}"
+                       reRender="preferenceValidationErrors"/>
+        </h:inputTextarea>
+    </s:fragment>
+
+</s:fragment>
\ No newline at end of file

Added: trunk/examples/wiki/view/includes/preferences/editorNumberRange.xhtml
===================================================================
--- trunk/examples/wiki/view/includes/preferences/editorNumberRange.xhtml	                        (rev 0)
+++ trunk/examples/wiki/view/includes/preferences/editorNumberRange.xhtml	2008-01-21 12:25:45 UTC (rev 7166)
@@ -0,0 +1,17 @@
+<s:fragment
+        xmlns="http://www.w3.org/1999/xhtml"
+        xmlns:ui="http://java.sun.com/jsf/facelets"
+        xmlns:h="http://java.sun.com/jsf/html"
+        xmlns:f="http://java.sun.com/jsf/core"
+        xmlns:a="https://ajax4jsf.dev.java.net/ajax"
+        xmlns:rich="http://richfaces.org/rich"
+        xmlns:s="http://jboss.com/products/seam/taglib">
+
+    <rich:inputNumberSlider
+            value="#{v.value}" converter="javax.faces.Long"
+            enableManualInput="false"
+            minValue="#{editorNumberRange.getRangeMin(v.preferenceProperty)}"
+            maxValue="#{editorNumberRange.getRangeMax(v.preferenceProperty)}">
+    </rich:inputNumberSlider>
+
+</s:fragment>
\ No newline at end of file

Added: trunk/examples/wiki/view/includes/preferences/editorSelectOne.xhtml
===================================================================
--- trunk/examples/wiki/view/includes/preferences/editorSelectOne.xhtml	                        (rev 0)
+++ trunk/examples/wiki/view/includes/preferences/editorSelectOne.xhtml	2008-01-21 12:25:45 UTC (rev 7166)
@@ -0,0 +1,18 @@
+<s:fragment
+        xmlns="http://www.w3.org/1999/xhtml"
+        xmlns:ui="http://java.sun.com/jsf/facelets"
+        xmlns:h="http://java.sun.com/jsf/html"
+        xmlns:f="http://java.sun.com/jsf/core"
+        xmlns:a="https://ajax4jsf.dev.java.net/ajax"
+        xmlns:s="http://jboss.com/products/seam/taglib">
+
+    <h:selectOneMenu value="#{v.value}" tabindex="1">
+        <s:selectItems value="#{editorSelectOne.getAllValues(v.preferenceProperty)}"
+                       var="templateValue"
+                       label="#{templateValue}"
+                       noSelectionLabel="#{editorSelectOne.isNullable(v.preferenceProperty)
+                                           ? messages['lacewiki.preferences.editor.SelectNone']
+                                           : null}"/>
+    </h:selectOneMenu>
+
+</s:fragment>
\ No newline at end of file




More information about the seam-commits mailing list