Author: artdaw
Date: 2009-04-25 11:56:51 -0400 (Sat, 25 Apr 2009)
New Revision: 13873
Modified:
trunk/docs/realworld_app_guide/en/src/main/docbook/includes/hiw.xml
trunk/docs/realworld_app_guide/en/src/main/docbook/master.xml
Log:
https://jira.jboss.org/jira/browse/RF-5768 - Photo Album review
Modified: trunk/docs/realworld_app_guide/en/src/main/docbook/includes/hiw.xml
===================================================================
--- trunk/docs/realworld_app_guide/en/src/main/docbook/includes/hiw.xml 2009-04-25
15:08:12 UTC (rev 13872)
+++ trunk/docs/realworld_app_guide/en/src/main/docbook/includes/hiw.xml 2009-04-25
15:56:51 UTC (rev 13873)
@@ -1,90 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<section>
- <title>Upload images</title>
- <para>The implementation of <emphasis
role="bold"><property><rich:fileUpload></property></emphasis>
in the Photo Album Demo uses the embedded Flash module that adds extra functionality to
the component.
- Here are the additional features that the Flash module provides:
- </para>
- <itemizedlist>
- <listitem><para>Multiple files
choosing;</para></listitem>
- <listitem><para>Specification of permitted file types in
the "Open File" dialog window;</para></listitem>
- <listitem><para>A number of additional entry object
properties.</para></listitem>
- </itemizedlist>
-
- <para>
- The photos uploading functionality is based on the
<code>/includes/fileUpload/fileUploader.xhtml page</code>. Let's have a
look at this page to find out how the uploader is implemented:
- </para>
-
- <programlisting role="XML"><![CDATA[<rich:fileUpload
style="margin : 0px 0px 20px 0px; width : 504px; height : 200px; background :
#f1f1f1; border : 1px solid #A1A1A1"
- id="fileUpload"
- allowFlash="true"
- immediateUpload="false"
- acceptedTypes="jpg,jpeg"
- maxFilesQuantity="100"
- autoclear="true"
- fileUploadListener="#{fileUploadManager.listener}" >
- <a4j:support event="onuploadcomplete" reRender="filesPanel, tree"
/>
- <a4j:support event="onfileuploadcomplete" />
- </rich:fileUpload>]]></programlisting>
-
- <para>
- The
"<emphasis><property>FileUploadListener</property></emphasis>"
attribute is binded with <code>fileUploadManager.listener</code> method which
makes the main job on the upload.
- Below is the <code>fileUploadManager.listener</code>
method:
- </para>
- <programlisting role="JAVA"><![CDATA[public void
listener(UploadEvent event) throws Exception {
- UploadItem item = event.getUploadItem();
- Image image = constructImage(item);
- try {
- extractMetadata(item, image);
- } catch (Exception e1) {
- addError(item, image, Constants.FILE_PROCESSING_ERROR);
- return;
- }
- image.setAlbum(model.getSelectedAlbum());
- if(image.getAlbum() == null){
- addError(item, image, Constants.NO_ALBUM_TO_DOWNLOAD_ERROR);
- return;
- }
- try{
- if(imageAction.isImageWithThisPathExist(image)){
- image.setPath(generateNewPath(image.getPath()));
- }
- imageAction.addImage(image);
- }catch(Exception e){
- addError(item, image, Constants.IMAGE_SAVING_ERROR);
- return;
- }
- if(!fileManager.addImage(image.getFullPath(), item.getFile().getPath())){
- addError(item, image, Constants.FILE_SAVE_ERROR);
- return;
- }
- fileWrapper.getFiles().add(image);
- Events.instance().raiseEvent(Constants.IMAGE_ADDED_EVENT, image);
- item.getFile().delete();
-}]]></programlisting>
-
-<para>
- When a photo is added into the uploader, the first thing it does is saving this
photo in the file system.
- The uploaded files are stored in the temporary folder in the computer file system.
- For this purpose the value of the <code>createTempFile</code>
parameter in <code>Ajax4jsf Filter</code> section should be set to
<code>true</code>.
- Below in the <code>Web.xml</code> file Ajax filter section:
-</para>
- <programlisting role="XML"><![CDATA[...
-<init-param>
- <param-name>createTempFiles</param-name>
- <param-value>true</param-value>
-</init-param>
-...]]></programlisting>
-
- <para>
- Then the uploader creates an <code>Image</code> object and
extracts all image metadata such as Camera name, Image size etc.
- Then it sets an album and generates a new path to it.
- The system should save six different sizes of the photo.
- After the photo was added into the database the system removes a temporary
file created for storage.
- </para>
-
-
- </section>
<section>
<title>Slide show</title>
Modified: trunk/docs/realworld_app_guide/en/src/main/docbook/master.xml
===================================================================
--- trunk/docs/realworld_app_guide/en/src/main/docbook/master.xml 2009-04-25 15:08:12 UTC
(rev 13872)
+++ trunk/docs/realworld_app_guide/en/src/main/docbook/master.xml 2009-04-25 15:56:51 UTC
(rev 13873)
@@ -9,6 +9,7 @@
<!ENTITY usedComponents SYSTEM "includes/usedComponents.xml">
<!ENTITY navigationPanel SYSTEM "includes/navigationPanel.xml">
+ <!ENTITY uploadImages SYSTEM "includes/uploadImages.xml">
<!ENTITY hiw SYSTEM "includes/hiw.xml">
]>
@@ -63,6 +64,7 @@
<?forseChanks?>
&usedComponents;
&navigationPanel;
+ &uploadImages;
&hiw;
</chapter>