You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by ar...@apache.org on 2009/07/10 20:26:12 UTC
svn commit: r793066 - in /myfaces/trinidad-maven/trunk:
maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/parse/
maven-faces-plugin/src/main/resources/org/apache/myfaces/trinidadbuild/plugin/faces/resources/
maven-tagdoc-pl...
Author: arobinson74
Date: Fri Jul 10 18:26:12 2009
New Revision: 793066
URL: http://svn.apache.org/viewvc?rev=793066&view=rev
Log:
TRINIDAD-1529
applied patch
Modified:
myfaces/trinidad-maven/trunk/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/parse/AbstractTagBean.java
myfaces/trinidad-maven/trunk/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/parse/FacesConfigParser.java
myfaces/trinidad-maven/trunk/maven-faces-plugin/src/main/resources/org/apache/myfaces/trinidadbuild/plugin/faces/resources/transform12.xsl
myfaces/trinidad-maven/trunk/maven-tagdoc-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/tagdoc/TagdocReport.java
Modified: myfaces/trinidad-maven/trunk/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/parse/AbstractTagBean.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad-maven/trunk/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/parse/AbstractTagBean.java?rev=793066&r1=793065&r2=793066&view=diff
==============================================================================
--- myfaces/trinidad-maven/trunk/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/parse/AbstractTagBean.java (original)
+++ myfaces/trinidad-maven/trunk/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/parse/AbstractTagBean.java Fri Jul 10 18:26:12 2009
@@ -33,7 +33,9 @@
private int _tagClassModifiers;
private Map _examples;
private int _exampleIdx = 0;
-
+ private Map _screenshots;
+ private int _screenshotIdx = 0;
+
public AbstractTagBean()
{
this(false);
@@ -50,6 +52,7 @@
_properties = new LinkedHashMap();
}
_examples = new LinkedHashMap();
+ _screenshots = new LinkedHashMap();
}
/**
@@ -225,6 +228,51 @@
return _examples.values().iterator();
}
+ /**
+ * Adds a Screenshot to this component.
+ *
+ * @param screenshot the screenshot to add
+ */
+ public void addScreenshot(
+ ScreenshotBean screenshot)
+ {
+ String key = _generateScreenshotKey();
+ screenshot.setKey(key);
+ _screenshots.put(key, screenshot);
+ }
+
+ /**
+ * Returns true if this component has any screenshots.
+ *
+ * @return true if this component has any screenshots,
+ * false otherwise
+ */
+ public boolean hasScreenshots()
+ {
+ return !_screenshots.isEmpty();
+ }
+
+ /**
+ * Returns the screenshot for this screenshot key.
+ *
+ * @param key the hashmap screenshot key
+ */
+ public ScreenshotBean findScreenshot(
+ String key)
+ {
+ return (ScreenshotBean)_screenshots.get(key);
+ }
+
+ /**
+ * Returns an iterator for all screenshots on this component only.
+ *
+ * @return the screenshot iterator
+ */
+ public Iterator screenshots()
+ {
+ return _screenshots.values().iterator();
+ }
+
public void parseTagClassModifier(
String modifier)
{
@@ -297,4 +345,14 @@
_exampleIdx++;
return key;
}
+
+ /* Get a generated key to use in storing
+ * this screen shot bean in its hashmap.
+ */
+ private String _generateScreenshotKey()
+ {
+ String key = "Screenshot" + Integer.toString(_screenshotIdx);
+ _screenshotIdx++;
+ return key;
+ }
}
Modified: myfaces/trinidad-maven/trunk/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/parse/FacesConfigParser.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad-maven/trunk/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/parse/FacesConfigParser.java?rev=793066&r1=793065&r2=793066&view=diff
==============================================================================
--- myfaces/trinidad-maven/trunk/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/parse/FacesConfigParser.java (original)
+++ myfaces/trinidad-maven/trunk/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/parse/FacesConfigParser.java Fri Jul 10 18:26:12 2009
@@ -188,6 +188,16 @@
digester.addSetNext("faces-config/component/component-extension/example",
"addExample", ExampleBean.class.getName());
+ // faces-config/component/component-extension/screenshot
+ digester.addObjectCreate("faces-config/component/component-extension/screenshot",
+ ScreenshotBean.class);
+ digester.addBeanPropertySetter("faces-config/component/component-extension/screenshot/description",
+ "description");
+ digester.addBeanPropertySetter("faces-config/component/component-extension/screenshot/image",
+ "image");
+ digester.addSetNext("faces-config/component/component-extension/screenshot",
+ "addScreenshot", ScreenshotBean.class.getName());
+
// faces-config/component/component-extension/event
digester.addObjectCreate("faces-config/component/component-extension/event", EventRefBean.class);
digester.addBeanPropertySetter("faces-config/component/component-extension/event/event-type",
Modified: myfaces/trinidad-maven/trunk/maven-faces-plugin/src/main/resources/org/apache/myfaces/trinidadbuild/plugin/faces/resources/transform12.xsl
URL: http://svn.apache.org/viewvc/myfaces/trinidad-maven/trunk/maven-faces-plugin/src/main/resources/org/apache/myfaces/trinidadbuild/plugin/faces/resources/transform12.xsl?rev=793066&r1=793065&r2=793066&view=diff
==============================================================================
--- myfaces/trinidad-maven/trunk/maven-faces-plugin/src/main/resources/org/apache/myfaces/trinidadbuild/plugin/faces/resources/transform12.xsl (original)
+++ myfaces/trinidad-maven/trunk/maven-faces-plugin/src/main/resources/org/apache/myfaces/trinidadbuild/plugin/faces/resources/transform12.xsl Fri Jul 10 18:26:12 2009
@@ -1055,6 +1055,7 @@
<xsl:template match="//mfp:jsp-property-name" />
<xsl:template match="//mfp:long-description" />
<xsl:template match="//mfp:method-binding-signature" />
+ <xsl:template match="//mfp:screenshot" />
<xsl:template match="//mfp:short-description" />
<xsl:template match="//mfp:state-holder" />
<xsl:template match="//mfp:tag-attribute-excluded" />
Modified: myfaces/trinidad-maven/trunk/maven-tagdoc-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/tagdoc/TagdocReport.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad-maven/trunk/maven-tagdoc-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/tagdoc/TagdocReport.java?rev=793066&r1=793065&r2=793066&view=diff
==============================================================================
--- myfaces/trinidad-maven/trunk/maven-tagdoc-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/tagdoc/TagdocReport.java (original)
+++ myfaces/trinidad-maven/trunk/maven-tagdoc-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/tagdoc/TagdocReport.java Fri Jul 10 18:26:12 2009
@@ -62,6 +62,7 @@
import org.apache.myfaces.trinidadbuild.plugin.faces.parse.FacesConfigParser;
import org.apache.myfaces.trinidadbuild.plugin.faces.parse.FacetBean;
import org.apache.myfaces.trinidadbuild.plugin.faces.parse.PropertyBean;
+import org.apache.myfaces.trinidadbuild.plugin.faces.parse.ScreenshotBean;
import org.apache.myfaces.trinidadbuild.plugin.faces.parse.ValidatorBean;
import org.apache.myfaces.trinidadbuild.plugin.faces.util.ComponentFilter;
import org.apache.myfaces.trinidadbuild.plugin.faces.util.ConverterFilter;
@@ -401,11 +402,12 @@
out.write(" <p>\n");
_writeComponentSummary(out, component);
out.write(" </p>\n");
- out.write(" <p>\n");
- _writeExamples(out, component);
- out.write(" </p>\n");
out.write(" </section>\n");
-
+
+ _writeScreenshots(out, component);
+
+ _writeExamples(out, component);
+
if (component.hasEvents(true))
{
out.write(" <section name=\"Events\">\n");
@@ -469,11 +471,12 @@
out.write(" <p>\n");
_writeConverterSummary(out, converter);
out.write(" </p>\n");
- out.write(" <p>\n");
- _writeExamples(out, converter);
- out.write(" </p>\n");
out.write(" </section>\n");
-
+
+ _writeScreenshots(out, converter);
+
+ _writeExamples(out, converter);
+
out.write(" <section name=\"Attributes\">\n");
_writeConverterAttributes(out, converter);
out.write(" </section>\n");
@@ -519,11 +522,12 @@
out.write(" <p>\n");
_writeValidatorSummary(out, validator);
out.write(" </p>\n");
- out.write(" <p>\n");
- _writeExamples(out, validator);
- out.write(" </p>\n");
out.write(" </section>\n");
-
+
+ _writeScreenshots(out, validator);
+
+ _writeExamples(out, validator);
+
out.write(" <section name=\"Attributes\">\n");
_writeValidatorAttributes(out, validator);
out.write(" </section>\n");
@@ -1062,8 +1066,8 @@
ExampleBean exBean = null;
// Write header
- out.write(" <b>Example(s):</b> ");
- out.write(" <br/>\n");
+ out.write(" <section name=\"Code Example(s)\">\n");
+ out.write(" <p>\n");
out.write(" <html>\n");
// Go through each example, write its description
@@ -1097,6 +1101,64 @@
}
}
out.write(" </html>\n");
+ out.write(" </p>\n");
+ out.write(" </section>\n");
+ }
+
+ private void _writeScreenshots(Writer out, AbstractTagBean bean) throws IOException
+ {
+ if (!bean.hasScreenshots())
+ return;
+
+ ScreenshotBean ssBean = null;
+
+ // Write header
+ out.write(" <section name=\"Screenshot(s)\">\n");
+ out.write(" <p>\n");
+ out.write(" <html>\n");
+
+ // Go through each screenshot, write its image
+ // followed by the image's caption.
+ Iterator iter = bean.screenshots();
+ while (iter.hasNext())
+ {
+ ssBean = (ScreenshotBean) iter.next();
+ String desc = ssBean.getDescription();
+ String img = ssBean.getImage();
+
+ out.write(" <div class=\'screenshot\'>\n");
+
+ if (img != null)
+ {
+ if (!"".equals(img))
+ {
+ out.write(img);
+ }
+ }
+
+ if (desc != null)
+ {
+ desc = desc.replaceAll("<", "<");
+ desc = desc.replaceAll(">", ">");
+
+ if (!"".equals(desc))
+ {
+ out.write("<br/>");
+ out.write(desc + "\n");
+ }
+ }
+ out.write(" </div>\n");
+
+ // create extra space between each screenshot to ensure it is clear which description
+ // text belongs to which image
+ if (iter.hasNext())
+ {
+ out.write("<br/>");
+ }
+ }
+ out.write(" </html>\n");
+ out.write(" </p>\n");
+ out.write(" </section>\n");
}
protected MavenProject getProject()