You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@labs.apache.org by si...@apache.org on 2009/10/28 23:08:57 UTC
svn commit: r830777 - in /labs/magma/trunk/website-beansview/src:
main/java/org/apache/magma/website/beansview/
main/resources/org/apache/magma/website/beansview/
test/java/org/apache/magma/website/beansview/
Author: simoneg
Date: Wed Oct 28 22:08:56 2009
New Revision: 830777
URL: http://svn.apache.org/viewvc?rev=830777&view=rev
Log:
LABS-207: List with alternative table/ul output
Added:
labs/magma/trunk/website-beansview/src/main/java/org/apache/magma/website/beansview/ListHtmlEmitter.java
labs/magma/trunk/website-beansview/src/main/java/org/apache/magma/website/beansview/TableListHtmlEmitter.java
labs/magma/trunk/website-beansview/src/main/java/org/apache/magma/website/beansview/UlListHtmlEmitter.java
Modified:
labs/magma/trunk/website-beansview/src/main/java/org/apache/magma/website/beansview/ShowList.java
labs/magma/trunk/website-beansview/src/main/java/org/apache/magma/website/beansview/SmartList.java
labs/magma/trunk/website-beansview/src/main/java/org/apache/magma/website/beansview/SmartListProducer.java
labs/magma/trunk/website-beansview/src/main/resources/org/apache/magma/website/beansview/magmaBeansview.css
labs/magma/trunk/website-beansview/src/test/java/org/apache/magma/website/beansview/ShowListTest.java
Added: labs/magma/trunk/website-beansview/src/main/java/org/apache/magma/website/beansview/ListHtmlEmitter.java
URL: http://svn.apache.org/viewvc/labs/magma/trunk/website-beansview/src/main/java/org/apache/magma/website/beansview/ListHtmlEmitter.java?rev=830777&view=auto
==============================================================================
--- labs/magma/trunk/website-beansview/src/main/java/org/apache/magma/website/beansview/ListHtmlEmitter.java (added)
+++ labs/magma/trunk/website-beansview/src/main/java/org/apache/magma/website/beansview/ListHtmlEmitter.java Wed Oct 28 22:08:56 2009
@@ -0,0 +1,44 @@
+package org.apache.magma.website.beansview;
+
+import java.io.IOException;
+import java.io.Writer;
+
+import org.apache.magma.beans.MagmaBeanSupport;
+import org.apache.magma.view.tree.FieldNode;
+import org.apache.magma.view.tree.Node;
+
+public interface ListHtmlEmitter {
+
+ void openTable(Class<? extends MagmaBeanSupport> beanclass, Node root, String summary, String caption, Writer tables) throws IOException;
+
+ boolean supportsHeader();
+
+ void openHeader(Class<? extends MagmaBeanSupport> beanclass, Node root, Writer tables) throws IOException;
+
+ void openHeaderCell(FieldNode fldn, Writer tables) throws IOException;
+
+ void closeHeaderCell(FieldNode fldn, Writer tables) throws IOException;
+
+ void closeHeader(Class<? extends MagmaBeanSupport> beanclass, Node root, Writer tables) throws IOException;
+
+ boolean supportsBody();
+
+ void openBody(Class<? extends MagmaBeanSupport> beanclass, Node root, Writer tables) throws IOException;
+
+ void openRow(MagmaBeanSupport bean, Writer tables) throws IOException;
+
+ void openCell(FieldNode fldn, MagmaBeanSupport bean, Writer tables) throws IOException;
+
+ void openLink(String URL, String title, Writer tables) throws IOException;
+
+ void closeLink(Writer tables) throws IOException;
+
+ void closeCell(FieldNode fldn, MagmaBeanSupport bean, Writer tables) throws IOException;
+
+ void closeRow(MagmaBeanSupport bean, Writer tables) throws IOException;
+
+ void closeBody(Class<? extends MagmaBeanSupport> beanclass,Node root, Writer tables) throws IOException;
+
+ void closeTable(Class<? extends MagmaBeanSupport> beanclass, Node root, Writer tables) throws IOException;
+
+}
Modified: labs/magma/trunk/website-beansview/src/main/java/org/apache/magma/website/beansview/ShowList.java
URL: http://svn.apache.org/viewvc/labs/magma/trunk/website-beansview/src/main/java/org/apache/magma/website/beansview/ShowList.java?rev=830777&r1=830776&r2=830777&view=diff
==============================================================================
--- labs/magma/trunk/website-beansview/src/main/java/org/apache/magma/website/beansview/ShowList.java (original)
+++ labs/magma/trunk/website-beansview/src/main/java/org/apache/magma/website/beansview/ShowList.java Wed Oct 28 22:08:56 2009
@@ -51,27 +51,28 @@
protected Collection<?> list;
protected String link = null;
protected String linkUrl = null;
- protected Class<?> myclass;
+ protected Class<? extends MagmaBeanSupport> myclass;
protected Converter converter;
protected String caption;
protected String summary;
protected String gototitle;
protected String[] layers = LIST;
+ protected ListHtmlEmitter emitter = new TableListHtmlEmitter();
- public <T> ShowList(Class<T> myclass, Collection<? extends T> list, String link, String... layers) {
+ public <T extends MagmaBeanSupport> ShowList(Class<T> myclass, Collection<? extends T> list, String link, String... layers) {
this.list = list;
this.layers = layers;
this.link = link;
this.myclass = myclass;
}
- public <T> ShowList(Class<T> myclass,Collection<? extends T> list, String link) {
+ public <T extends MagmaBeanSupport> ShowList(Class<T> myclass,Collection<? extends T> list, String link) {
this.list = list;
this.link = link;
this.myclass = myclass;
}
- public <T> ShowList(Class<T> myclass,Collection<? extends T> list) {
+ public <T extends MagmaBeanSupport> ShowList(Class<T> myclass,Collection<? extends T> list) {
this.list = list;
this.myclass = myclass;
}
@@ -121,7 +122,8 @@
}
protected void createBody(Node root, Writer tables) throws IOException {
- tables.write("<tbody>");
+ if (!emitter.supportsBody()) return;
+ emitter.openBody(this.myclass, root, tables);
if (this.list != null) {
for (Object o : this.list) {
if (!(o instanceof MagmaBeanSupport)) continue;
@@ -134,20 +136,26 @@
createFieldNodeCell(fldn,mb, tables);
}
}
- closeRow(o, tables);
+ closeRow(mb, tables);
}
}
- tables.write("</tbody>");
+ emitter.closeBody(this.myclass, root, tables);
}
protected void createFieldNodeCell(FieldNode fldn, MagmaBeanSupport bean, Writer tables) throws IOException {
- tables.write("<td class=\"MagmaList-Cell " + fldn.getId() + "\">");
+ emitter.openCell(fldn, bean, tables);
if (this.linkUrl != null) {
- tables.write("<a href=\"");
- tables.write(createUrlFor(fldn, bean));
- tables.write("\" title=\"" + gototitle + "\">");
+ emitter.openLink(createUrlFor(fldn, bean), gototitle, tables);
}
Object value = ViewUtils.getNodeValue(fldn, bean);
+ createFieldNodeCellContent(fldn, bean, value, tables);
+ if (this.linkUrl != null) {
+ emitter.closeLink(tables);
+ }
+ emitter.closeCell(fldn, bean, tables);
+ }
+
+ protected void createFieldNodeCellContent(FieldNode fldn, MagmaBeanSupport bean, Object value, Writer tables) throws IOException {
PropertyInfo prop = fldn.getProperty();
String string = prop.toUser(value);
if (string != null) {
@@ -155,36 +163,31 @@
string = StringEscapeUtils.escapeHtml(string);
}
tables.write(string);
- }
- if (this.linkUrl != null) {
- tables.write("</a>");
- }
- tables.write("</td>");
+ }
}
protected String createUrlFor(FieldNode fldn, MagmaBeanSupport bean) {
return this.linkUrl + WebHandler.paramSeparator + this.converter.to(bean);
}
- protected void openRow(Object o, Writer tables) throws IOException {
- tables.write("<tr>");
+ protected void openRow(MagmaBeanSupport bean, Writer tables) throws IOException {
+ emitter.openRow(bean, tables);
}
- protected void closeRow(Object o, Writer tables) throws IOException {
- tables.write("</tr>");
+ protected void closeRow(MagmaBeanSupport bean, Writer tables) throws IOException {
+ emitter.closeRow(bean, tables);
}
- protected void openHeaderRow(Writer tables) throws IOException {
- tables.write("<thead>");
- tables.write("<tr>");
+ protected void openHeaderRow(Node root, Writer tables) throws IOException {
+ emitter.openHeader(this.myclass, root, tables);
}
- protected void closeHeaderRow(Writer tables) throws IOException {
- tables.write("</tr>");
- tables.write("</thead>");
+ protected void closeHeaderRow(Node root, Writer tables) throws IOException {
+ emitter.closeHeader(this.myclass, root, tables);
}
protected void createHeader(Node root, Writer tables) throws IOException {
- openHeaderRow(tables);
+ if (!emitter.supportsHeader()) return;
+ openHeaderRow(root, tables);
List<Node> nodes = root.getUniqueZone().getNodes();
for (Node node : nodes) {
if (node instanceof FieldNode) {
@@ -192,7 +195,7 @@
createFieldNodeHeader(fldn, tables);
}
}
- closeHeaderRow(tables);
+ closeHeaderRow(root, tables);
}
protected void createFooter(Node root, Writer tables) throws IOException {
@@ -200,28 +203,17 @@
}
protected void createFieldNodeHeader(FieldNode fldn, Writer tables) throws IOException {
- tables.write("<th class=\"MagmaList-HeaderCell " + fldn.getId() + "\">");
+ emitter.openHeaderCell(fldn, tables);
tables.write(new LocalizableString(fldn.getProperty().getViewSettings().getLabel()).toString());
- tables.write("</th>");
+ emitter.closeHeaderCell(fldn, tables);
}
protected void closeOuterTable(Node root, Writer tables) throws IOException {
- tables.write("</table>");
+ emitter.closeTable(this.myclass, root, tables);
}
protected void openOuterTable(Node root, Writer tables) throws IOException {
- tables.write("<table class=\"MagmaList ShowList\"");
- if (summary != null) {
- tables.write(" summary=\"");
- tables.write(summary);
- tables.write("\"");
- }
- tables.write(">");
- if (caption != null) {
- tables.write("<caption>");
- tables.write(caption);
- tables.write("</caption>");
- }
+ emitter.openTable(this.myclass, root, summary, caption, tables);
}
@@ -255,6 +247,25 @@
public void setLayers(String... layers) {
this.layers = layers;
}
+
+ public ShowList useList() {
+ emitter = new UlListHtmlEmitter();
+ return this;
+ }
+
+ public ShowList useTable() {
+ emitter = new TableListHtmlEmitter();
+ return this;
+ }
+
+ public ListHtmlEmitter getEmitter() {
+ return emitter;
+ }
+
+ public ShowList setEmitter(ListHtmlEmitter emitter) {
+ if (emitter != null) this.emitter = emitter;
+ return this;
+ }
}
Modified: labs/magma/trunk/website-beansview/src/main/java/org/apache/magma/website/beansview/SmartList.java
URL: http://svn.apache.org/viewvc/labs/magma/trunk/website-beansview/src/main/java/org/apache/magma/website/beansview/SmartList.java?rev=830777&r1=830776&r2=830777&view=diff
==============================================================================
--- labs/magma/trunk/website-beansview/src/main/java/org/apache/magma/website/beansview/SmartList.java (original)
+++ labs/magma/trunk/website-beansview/src/main/java/org/apache/magma/website/beansview/SmartList.java Wed Oct 28 22:08:56 2009
@@ -69,6 +69,8 @@
private String caption;
private String summary;
+
+ private ListHtmlEmitter emitter;
public SmartList(Class<?> beanClass, String query, Object... queryParams) {
@@ -159,6 +161,7 @@
producer.setLink("../" + this.linkUrl);
producer.setLayers(layers);
producer.setCaption(caption).setSummary(summary);
+ producer.setEmitter(emitter);
producer.compoundWith(prodHeader, CompoundType.BEFORE);
producer.compoundWith(prodFooter, CompoundType.AFTER);
return producer;
@@ -264,4 +267,24 @@
return this;
}
+ public SmartList useList() {
+ emitter = new UlListHtmlEmitter();
+ return this;
+ }
+
+ public SmartList useTable() {
+ emitter = new TableListHtmlEmitter();
+ return this;
+ }
+
+ public ListHtmlEmitter getEmitter() {
+ return emitter;
+ }
+
+ public SmartList setEmitter(ListHtmlEmitter emitter) {
+ if (emitter != null) this.emitter = emitter;
+ return this;
+ }
+
+
}
Modified: labs/magma/trunk/website-beansview/src/main/java/org/apache/magma/website/beansview/SmartListProducer.java
URL: http://svn.apache.org/viewvc/labs/magma/trunk/website-beansview/src/main/java/org/apache/magma/website/beansview/SmartListProducer.java?rev=830777&r1=830776&r2=830777&view=diff
==============================================================================
--- labs/magma/trunk/website-beansview/src/main/java/org/apache/magma/website/beansview/SmartListProducer.java (original)
+++ labs/magma/trunk/website-beansview/src/main/java/org/apache/magma/website/beansview/SmartListProducer.java Wed Oct 28 22:08:56 2009
@@ -23,9 +23,11 @@
import java.nio.charset.Charset;
import java.util.Collection;
import java.util.HashSet;
+import java.util.List;
import java.util.Set;
import org.apache.magma.basics.LocalizableString;
+import org.apache.magma.beans.MagmaBeanSupport;
import org.apache.magma.view.tree.FieldNode;
import org.apache.magma.view.tree.Node;
import org.apache.magma.website.WebHandler;
@@ -39,7 +41,7 @@
protected Set<String> sortables = null;
protected int count = -1;
- public <T> SmartListProducer(Class<T> myclass, Collection<? extends T> list) {
+ public <T extends MagmaBeanSupport> SmartListProducer(Class<T> myclass, Collection<? extends T> list) {
super(myclass, list);
}
@@ -160,13 +162,28 @@
return ret.toString();
}
+ @Override
+ protected void createHeader(Node root, Writer tables) throws IOException {
+ if (emitter.supportsHeader()) {
+ super.createHeader(root, tables);
+ } else {
+ tables.write("<div class=\"MagmaSortControl\">");
+ for (String sortid : this.sortables) {
+ Node subnode = root.findById(sortid);
+ if (subnode instanceof FieldNode) {
+ createFieldNodeHeader((FieldNode) subnode, tables);
+ }
+ }
+ tables.write("</div>");
+ }
+ }
@Override
protected void createFieldNodeHeader(FieldNode fldn, Writer tables)
throws IOException {
if (sortables != null && (sortables != null && sortables.contains(fldn.getId()))) {
- boolean sorted = this.sorting != null && this.sorting.equals(fldn.getId());
- tables.write("<th class=\"MagmaList-HeaderCell " + fldn.getId() + " Sortable" + (sorted ? "Sorted" : "") + "\">");
+ boolean sorted = this.sorting != null && this.sorting.equals(fldn.getId());
+ if (emitter.supportsHeader()) emitter.openHeaderCell(fldn, tables);
String link = "sort" + WebHandler.paramSeparator;
if (sorted) {
if (desc) {
@@ -178,7 +195,7 @@
link += "false" + WebHandler.paramSeparator;
}
link += fldn.getId();
- tables.write("<a href=\"" + link + "\">");
+ tables.write("<a href=\"" + link + "\" class=\"MagmaSortable" + (sorted ? "Sorted" : "") + "\">");
tables.write(new LocalizableString(fldn.getProperty().getViewSettings().getLabel()).toString());
if (sorted) {
tables.write("<img src=\"");
@@ -192,9 +209,9 @@
tables.write("\"/>");
}
tables.write("</a>");
- tables.write("</th>");
+ if (emitter.supportsHeader()) emitter.closeHeaderCell(fldn, tables);
} else {
- super.createFieldNodeHeader(fldn, tables);
+ if (emitter.supportsHeader()) super.createFieldNodeHeader(fldn, tables);
}
}
Added: labs/magma/trunk/website-beansview/src/main/java/org/apache/magma/website/beansview/TableListHtmlEmitter.java
URL: http://svn.apache.org/viewvc/labs/magma/trunk/website-beansview/src/main/java/org/apache/magma/website/beansview/TableListHtmlEmitter.java?rev=830777&view=auto
==============================================================================
--- labs/magma/trunk/website-beansview/src/main/java/org/apache/magma/website/beansview/TableListHtmlEmitter.java (added)
+++ labs/magma/trunk/website-beansview/src/main/java/org/apache/magma/website/beansview/TableListHtmlEmitter.java Wed Oct 28 22:08:56 2009
@@ -0,0 +1,95 @@
+package org.apache.magma.website.beansview;
+
+import java.io.IOException;
+import java.io.Writer;
+
+import org.apache.magma.beans.MagmaBeanSupport;
+import org.apache.magma.view.tree.FieldNode;
+import org.apache.magma.view.tree.Node;
+
+public class TableListHtmlEmitter implements ListHtmlEmitter {
+
+ public void openBody(Class<? extends MagmaBeanSupport> beanclass, Node root, Writer tables) throws IOException {
+ tables.write("<tbody>");
+ }
+
+ public void closeBody(Class<? extends MagmaBeanSupport> beanclass, Node root, Writer tables) throws IOException {
+ tables.write("</tbody>");
+ }
+
+ public void openCell(FieldNode fldn, MagmaBeanSupport bean, Writer tables) throws IOException {
+ tables.write("<td class=\"MagmaList-Cell " + fldn.getId() + "\">");
+ }
+
+ public void openLink(String URL, String title, Writer tables) throws IOException {
+ tables.write("<a href=\"");
+ tables.write(URL);
+ tables.write("\" title=\"");
+ tables.write(title);
+ tables.write("\">");
+ }
+
+ public void closeCell(FieldNode fldn, MagmaBeanSupport bean, Writer tables) throws IOException {
+ tables.write("</td>");
+ }
+
+ public void closeLink(Writer tables) throws IOException {
+ tables.write("</a>");
+ }
+
+ public void closeRow(MagmaBeanSupport bean, Writer tables) throws IOException {
+ tables.write("</tr>");
+ }
+
+ public void openRow(MagmaBeanSupport bean, Writer tables) throws IOException {
+ tables.write("<tr>");
+ }
+
+ public void openHeader(Class<? extends MagmaBeanSupport> beanclass, Node root, Writer tables) throws IOException {
+ tables.write("<thead>");
+ tables.write("<tr>");
+ }
+
+ public void closeHeader(Class<? extends MagmaBeanSupport> beanclass, Node root, Writer tables) throws IOException {
+ tables.write("</tr>");
+ tables.write("</thead>");
+ }
+
+ public void openHeaderCell(FieldNode fldn, Writer tables) throws IOException {
+ tables.write("<th class=\"MagmaList-HeaderCell " + fldn.getId() + "\">");
+ }
+
+ public void closeHeaderCell(FieldNode fldn, Writer tables) throws IOException {
+ tables.write("</th>");
+ }
+
+ public void closeTable(Class<? extends MagmaBeanSupport> beanclass, Node root, Writer tables) throws IOException {
+ tables.write("</table>");
+ }
+
+ public void openTable(Class<? extends MagmaBeanSupport> beanclass, Node root, String summary, String caption, Writer tables) throws IOException {
+ tables.write("<table class=\"MagmaList ShowList ");
+ tables.write(beanclass.getSimpleName());
+ tables.write("\"");
+ if (summary != null) {
+ tables.write(" summary=\"");
+ tables.write(summary);
+ tables.write("\"");
+ }
+ tables.write(">");
+ if (caption != null) {
+ tables.write("<caption>");
+ tables.write(caption);
+ tables.write("</caption>");
+ }
+ }
+
+ public boolean supportsBody() {
+ return true;
+ }
+
+ public boolean supportsHeader() {
+ return true;
+ }
+
+}
Added: labs/magma/trunk/website-beansview/src/main/java/org/apache/magma/website/beansview/UlListHtmlEmitter.java
URL: http://svn.apache.org/viewvc/labs/magma/trunk/website-beansview/src/main/java/org/apache/magma/website/beansview/UlListHtmlEmitter.java?rev=830777&view=auto
==============================================================================
--- labs/magma/trunk/website-beansview/src/main/java/org/apache/magma/website/beansview/UlListHtmlEmitter.java (added)
+++ labs/magma/trunk/website-beansview/src/main/java/org/apache/magma/website/beansview/UlListHtmlEmitter.java Wed Oct 28 22:08:56 2009
@@ -0,0 +1,85 @@
+package org.apache.magma.website.beansview;
+
+import java.io.IOException;
+import java.io.Writer;
+
+import org.apache.magma.beans.MagmaBeanSupport;
+import org.apache.magma.view.tree.FieldNode;
+import org.apache.magma.view.tree.Node;
+
+public class UlListHtmlEmitter implements ListHtmlEmitter {
+
+
+ public void openBody(Class<? extends MagmaBeanSupport> beanclass, Node root, Writer tables) throws IOException {
+ tables.write("<ul class=\"MagmaList ShowList " + beanclass.getSimpleName() + "\">");
+ }
+
+ public void closeBody(Class<? extends MagmaBeanSupport> beanclass, Node root, Writer tables) throws IOException {
+ tables.write("</ul>");
+ }
+
+ public void openCell(FieldNode fldn, MagmaBeanSupport bean, Writer tables) throws IOException {
+ tables.write("<span class=\"MagmaList-Span " + fldn.getId() + "\">");
+ }
+
+ public void openLink(String URL, String title, Writer tables) throws IOException {
+ tables.write("<a href=\"");
+ tables.write(URL);
+ tables.write("\" title=\"");
+ tables.write(title);
+ tables.write("\">");
+ }
+
+ public void closeCell(FieldNode fldn, MagmaBeanSupport bean, Writer tables) throws IOException {
+ tables.write("</span>");
+ }
+
+ public void closeLink(Writer tables) throws IOException {
+ tables.write("</a>");
+ }
+
+ public void closeRow(MagmaBeanSupport bean, Writer tables) throws IOException {
+ tables.write("</li>");
+ }
+
+ public void openRow(MagmaBeanSupport bean, Writer tables) throws IOException {
+ tables.write("<li>");
+ }
+
+ public void openHeader(Class<? extends MagmaBeanSupport> beanclass, Node root, Writer tables) throws IOException {
+ }
+
+ public void closeHeader(Class<? extends MagmaBeanSupport> beanclass, Node root, Writer tables) throws IOException {
+ }
+
+ public void openHeaderCell(FieldNode fldn, Writer tables) throws IOException {
+ }
+
+ public void closeHeaderCell(FieldNode fldn, Writer tables) throws IOException {
+ }
+
+ public void closeTable(Class<? extends MagmaBeanSupport> beanclass,Node root, Writer tables) throws IOException {
+ }
+
+ public void openTable(Class<? extends MagmaBeanSupport> beanclass, Node root, String summary, String caption, Writer tables) throws IOException {
+ if (summary != null) {
+ tables.write("<div class=\"MagmaList ListSummary\">");
+ tables.write(summary);
+ tables.write("</div>");
+ }
+ if (caption != null) {
+ tables.write("<div class=\"MagmaList ListCaption\">");
+ tables.write(caption);
+ tables.write("</div>");
+ }
+ }
+
+ public boolean supportsBody() {
+ return true;
+ }
+
+ public boolean supportsHeader() {
+ return false;
+ }
+
+}
Modified: labs/magma/trunk/website-beansview/src/main/resources/org/apache/magma/website/beansview/magmaBeansview.css
URL: http://svn.apache.org/viewvc/labs/magma/trunk/website-beansview/src/main/resources/org/apache/magma/website/beansview/magmaBeansview.css?rev=830777&r1=830776&r2=830777&view=diff
==============================================================================
--- labs/magma/trunk/website-beansview/src/main/resources/org/apache/magma/website/beansview/magmaBeansview.css (original)
+++ labs/magma/trunk/website-beansview/src/main/resources/org/apache/magma/website/beansview/magmaBeansview.css Wed Oct 28 22:08:56 2009
@@ -163,7 +163,7 @@
}
-.MagmaList{
+table.MagmaList{
width: 100%;
border-collapse: collapse;
}
@@ -172,22 +172,22 @@
text-decoration: none;
}
-.MagmaList a img {
+table.MagmaList a img {
border: none;
}
-.MagmaList-HeaderCell {
+table.MagmaList-HeaderCell {
background-color: #C5E8FA;
border: 2px solid #D1D0D0;
text-align: center;
}
-.MagmaList-Cell{
+table.MagmaList-Cell{
border: 1px solid #D1D0D0;
text-align: center;
}
-.MagmaList tr:hover td{
+table.MagmaList tr:hover td{
background-color: #E8F6FD;
}
Modified: labs/magma/trunk/website-beansview/src/test/java/org/apache/magma/website/beansview/ShowListTest.java
URL: http://svn.apache.org/viewvc/labs/magma/trunk/website-beansview/src/test/java/org/apache/magma/website/beansview/ShowListTest.java?rev=830777&r1=830776&r2=830777&view=diff
==============================================================================
--- labs/magma/trunk/website-beansview/src/test/java/org/apache/magma/website/beansview/ShowListTest.java (original)
+++ labs/magma/trunk/website-beansview/src/test/java/org/apache/magma/website/beansview/ShowListTest.java Wed Oct 28 22:08:56 2009
@@ -51,4 +51,28 @@
}
+ @Test
+ public void UlTest() throws Exception {
+ Person p = new Person();
+ p.setName("Simone");
+ p.setSurname("Gianni");
+ p.setEmail("simoneg@apache.org");
+
+ List<Person> lst = new ArrayList<Person>();
+ lst.add(p);
+ lst.add(p);
+
+ ShowList sbp = new ShowList(Person.class, lst);
+ sbp.useList();
+
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ sbp.produce(baos);
+
+ String result = new String(baos.toByteArray());
+
+ assertStructure(result, "<ul","<li","<span", "Simone", "</span", "<span", "Gianni", "</ul");
+ System.out.println(result);
+ }
+
+
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@labs.apache.org
For additional commands, e-mail: commits-help@labs.apache.org