Author: nickarls
Date: 2008-09-22 07:14:43 -0400 (Mon, 22 Sep 2008)
New Revision: 9097
Modified:
trunk/doc/Seam_Reference_Guide/en-US/Rss.xml
trunk/examples/rss/src/org/jboss/seam/rss/RSSTest.java
trunk/src/rss/org/jboss/seam/rss/ui/UIEntry.java
trunk/src/rss/org/jboss/seam/rss/ui/UIFeed.java
Log:
Refactored summaryFormat to textFormat, fixed feed format, updated docs
Modified: trunk/doc/Seam_Reference_Guide/en-US/Rss.xml
===================================================================
--- trunk/doc/Seam_Reference_Guide/en-US/Rss.xml 2008-09-22 11:13:12 UTC (rev 9096)
+++ trunk/doc/Seam_Reference_Guide/en-US/Rss.xml 2008-09-22 11:14:43 UTC (rev 9097)
@@ -115,6 +115,13 @@
The value is a string.
</para>
</listitem>
+ <listitem>
+ <para>
+ <literal>feedFormat</literal>
+ —The feed format. The value is a string and
defaults
+ to ATOM1. Valid values are RSS10, RSS20, ATOM03 and
ATOM10.
+ </para>
+ </listitem>
</itemizedlist>
<para>
<emphasis>Child elemenents</emphasis>
@@ -196,9 +203,10 @@
</listitem>
<listitem>
<para>
- <literal>summaryFormat</literal>
- —The format of the body of the story. The value
is a string
- and valid values are "text" and "html".
Defaults to "html".
+ <literal>textFormat</literal>
+ —The format of the body and title of the story.
+ The value is a string and valid values are "text"
and
+ "html". Defaults to "html".
</para>
</listitem>
<listitem>
Modified: trunk/examples/rss/src/org/jboss/seam/rss/RSSTest.java
===================================================================
--- trunk/examples/rss/src/org/jboss/seam/rss/RSSTest.java 2008-09-22 11:13:12 UTC (rev
9096)
+++ trunk/examples/rss/src/org/jboss/seam/rss/RSSTest.java 2008-09-22 11:14:43 UTC (rev
9097)
@@ -28,7 +28,7 @@
entry.setLink("Link " + i);
entry.setPublished(new Date(0));
entry.setSummary("Summary <b>" + i + "</b>");
- entry.setTitle("Title " + i);
+ entry.setTitle("Title <i>" + i + "</i>");
entry.setUid(UUID.randomUUID().toString());
entry.setUpdated(new Date());
entries.add(entry);
Modified: trunk/src/rss/org/jboss/seam/rss/ui/UIEntry.java
===================================================================
--- trunk/src/rss/org/jboss/seam/rss/ui/UIEntry.java 2008-09-22 11:13:12 UTC (rev 9096)
+++ trunk/src/rss/org/jboss/seam/rss/ui/UIEntry.java 2008-09-22 11:14:43 UTC (rev 9097)
@@ -30,7 +30,7 @@
private String link;
private String author;
private String summary;
- private TextType summaryFormat = TextType.html;
+ private TextType textFormat = TextType.html;
private Date published;
private Date updated;
@@ -40,6 +40,12 @@
return COMPONENT_TYPE;
}
+ private Text makeText(String textString) {
+ Text text = new Text(textFormat);
+ text.setText(textString);
+ return text;
+ }
+
@SuppressWarnings("unchecked")
@Override
public void encodeBegin(FacesContext facesContext) throws IOException
@@ -48,7 +54,7 @@
ItemEntry itemEntry = new ItemEntry();
itemEntry.setUid(getUid());
- itemEntry.setTitle(getTitle());
+ itemEntry.setTitle(makeText(getTitle()));
itemEntry.addLink(getLink());
String author = getAuthor();
if (author != null)
@@ -57,9 +63,7 @@
authorPerson.setName(author);
itemEntry.addAuthorOrCreator(authorPerson);
}
- Text summary = new Text(summaryFormat);
- summary.setText(getSummary());
- itemEntry.setDescriptionOrSummary(summary);
+ itemEntry.setDescriptionOrSummary(makeText(getSummary()));
if (getUpdated() != null) {
itemEntry.setUpdatedDate(getUpdated(), new SimpleDateFormat(ATOM_DATE_FORMAT));
}
@@ -140,14 +144,14 @@
this.uid = uid;
}
- public TextType getSummaryFormat()
+ public TextType getTextFormat()
{
- return summaryFormat;
+ return textFormat;
}
- public void setSummaryFormat(TextType summaryFormat)
+ public void setTextFormat(TextType textFormat)
{
- this.summaryFormat = summaryFormat;
+ this.textFormat = textFormat;
}
}
Modified: trunk/src/rss/org/jboss/seam/rss/ui/UIFeed.java
===================================================================
--- trunk/src/rss/org/jboss/seam/rss/ui/UIFeed.java 2008-09-22 11:13:12 UTC (rev 9096)
+++ trunk/src/rss/org/jboss/seam/rss/ui/UIFeed.java 2008-09-22 11:14:43 UTC (rev 9097)
@@ -42,16 +42,15 @@
private static final String COMPONENT_TYPE =
"org.jboss.seam.rss.ui.UIFeed";
private static final String EXTENSION = "xml";
private static final String MIMETYPE = "text/xml";
- private static final FeedFormat DEFAULT_FEED_FORMAT = FeedFormat.ATOM10;
private boolean sendRedirect = true;
- private FeedFormat feedFormat = DEFAULT_FEED_FORMAT;
private String uid;
private String title;
private String subtitle;
private Date updated;
private String link;
+ private FeedFormat feedFormat = FeedFormat.ATOM10;
@SuppressWarnings("unchecked")
@@ -75,7 +74,7 @@
ChannelFeed channelFeed = (ChannelFeed)
Contexts.getEventContext().get(FEED_IMPL_KEY);
ByteArrayOutputStream byteStream = new ByteArrayOutputStream();
try {
- FeedWriter.writeChannel(DEFAULT_FEED_FORMAT, channelFeed, byteStream);
+ FeedWriter.writeChannel(feedFormat, channelFeed, byteStream);
} catch (YarfrawException e) {
/**
* Was IOException, but 1.5 does not have this constructor
@@ -165,9 +164,9 @@
this.link = link;
}
- public String getFeedFormat()
+ public FeedFormat getFeedFormat()
{
- return (String) valueOf("feedFormat", feedFormat);
+ return (FeedFormat) valueOf("feedFormat", feedFormat);
}
public void setFeedFormat(FeedFormat feedFormat)
Show replies by date