Wednesday, 11 March
2009
Wed, 11 Mar
'09
5:54 a.m.
Author: amarkhel
Date: 2009-03-11 06:54:51 -0400 (Wed, 11 Mar 2009)
New Revision: 12915
Added:
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/util/Controller.java
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/util/Model.java
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/util/TreeManager.java
trunk/test-applications/realworld2/web/src/main/webapp/layout/panelBar.xhtml
Removed:
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/modalpanel/AlbumPopupHelper.java
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/modalpanel/ImagePopupHelper.java
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/modalpanel/LinkBuilder.java
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/navigation/NavigationHelper.java
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/servlet/PictureServlet.java
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/servlet/WebUtil.java
trunk/test-applications/realworld2/web/src/main/webapp/WEB-INF/tags/templates/image.xhtml
trunk/test-applications/realworld2/web/src/main/webapp/WEB-INF/tags/templates/linkPanel.xhtml
trunk/test-applications/realworld2/web/src/main/webapp/img/ajax/
trunk/test-applications/realworld2/web/src/main/webapp/img/dtpick.gif
trunk/test-applications/realworld2/web/src/main/webapp/img/error.gif
trunk/test-applications/realworld2/web/src/main/webapp/img/folder.jpg
trunk/test-applications/realworld2/web/src/main/webapp/img/gb.png
trunk/test-applications/realworld2/web/src/main/webapp/img/icons/
trunk/test-applications/realworld2/web/src/main/webapp/img/locked.jpg
trunk/test-applications/realworld2/web/src/main/webapp/img/logo.gif
trunk/test-applications/realworld2/web/src/main/webapp/img/ru.png
trunk/test-applications/realworld2/web/src/main/webapp/img/tree/disc.gif
trunk/test-applications/realworld2/web/src/main/webapp/img/tree/singer.gif
trunk/test-applications/realworld2/web/src/main/webapp/img/tree/song.gif
trunk/test-applications/realworld2/web/src/main/webapp/includes/image/breadCrumb.xhtml
trunk/test-applications/realworld2/web/src/main/webapp/includes/image/comments.xhtml
trunk/test-applications/realworld2/web/src/main/webapp/includes/image/imageScroller.xhtml
trunk/test-applications/realworld2/web/src/main/webapp/includes/imagePreview-backup.xhtml
trunk/test-applications/realworld2/web/src/main/webapp/includes/imagePreview.xhtml
trunk/test-applications/realworld2/web/src/main/webapp/includes/news/recent.xhtml
trunk/test-applications/realworld2/web/src/main/webapp/includes/panelBar/favoriteAlbums.xhtml
trunk/test-applications/realworld2/web/src/main/webapp/includes/userPrefs/loginPrefsTab.xhtml
trunk/test-applications/realworld2/web/src/main/webapp/layout/menu-backup.xhtml
trunk/test-applications/realworld2/web/src/main/webapp/layout/panelBar-backup.xhtml
trunk/test-applications/realworld2/web/src/main/webapp/layout/panelBar.xhtml
trunk/test-applications/realworld2/web/src/main/webapp/layout/template.xhtml
trunk/test-applications/realworld2/web/src/main/webapp/layout/template2.xhtml
trunk/test-applications/realworld2/web/src/main/webapp/stylesheet/realworld.css
Modified:
trunk/test-applications/realworld2/web/META-INF/MANIFEST.MF
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/fileupload/FileItem.java
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/fileupload/FileManager.java
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/fileupload/FileManagerTest.java
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/fileupload/FileUploadBean.java
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/fileupload/FileWrapper.java
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/fileupload/ImageLoader.java
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/AlbumManager.java
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/Authenticator.java
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/DnDManager.java
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/ImageManager.java
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/ShelfManager.java
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/UserManager.java
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/search/ISearchOption.java
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/search/ImageSearchHelper.java
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/search/SearchOptionByAlbum.java
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/search/SearchOptionByImage.java
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/search/SearchOptionByTag.java
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/user/UserPrefsBean.java
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/util/RenderLogic.java
trunk/test-applications/realworld2/web/src/main/resources/messages_en.properties
trunk/test-applications/realworld2/web/src/main/resources/messages_ru.properties
trunk/test-applications/realworld2/web/src/main/webapp/Thumbs.db
trunk/test-applications/realworld2/web/src/main/webapp/WEB-INF/tags/realWorld-taglib.xml
trunk/test-applications/realworld2/web/src/main/webapp/WEB-INF/web.xml
trunk/test-applications/realworld2/web/src/main/webapp/img/Thumbs.db
trunk/test-applications/realworld2/web/src/main/webapp/includes/album/userAlbumEditBlock.xhtml
trunk/test-applications/realworld2/web/src/main/webapp/includes/album/userAlbumsPreview.xhtml
trunk/test-applications/realworld2/web/src/main/webapp/includes/contextMenu/CMForAlbum.xhtml
trunk/test-applications/realworld2/web/src/main/webapp/includes/contextMenu/CMForImage.xhtml
trunk/test-applications/realworld2/web/src/main/webapp/includes/contextMenu/CMForShelf.xhtml
trunk/test-applications/realworld2/web/src/main/webapp/includes/contextMenu/CMForUser.xhtml
trunk/test-applications/realworld2/web/src/main/webapp/includes/fileUpload/fileUploader.xhtml
trunk/test-applications/realworld2/web/src/main/webapp/includes/fileUpload/multyMode.xhtml
trunk/test-applications/realworld2/web/src/main/webapp/includes/image/imagePreview.xhtml
trunk/test-applications/realworld2/web/src/main/webapp/includes/image/mainImage.xhtml
trunk/test-applications/realworld2/web/src/main/webapp/includes/image/shelf.xhtml
trunk/test-applications/realworld2/web/src/main/webapp/includes/image/shelfs.xhtml
trunk/test-applications/realworld2/web/src/main/webapp/includes/image/slideshow.xhtml
trunk/test-applications/realworld2/web/src/main/webapp/includes/image/userImageEditBlock.xhtml
trunk/test-applications/realworld2/web/src/main/webapp/includes/image/userImageMainBlock.xhtml
trunk/test-applications/realworld2/web/src/main/webapp/includes/image/userImagePreviewBlock.xhtml
trunk/test-applications/realworld2/web/src/main/webapp/includes/image/userImagesPreview.xhtml
trunk/test-applications/realworld2/web/src/main/webapp/includes/misc/modalPanels.xhtml
trunk/test-applications/realworld2/web/src/main/webapp/includes/misc/slideShowPooler.xhtml
trunk/test-applications/realworld2/web/src/main/webapp/includes/search/result/albumsResult.xhtml
trunk/test-applications/realworld2/web/src/main/webapp/includes/search/result/imageResult.xhtml
trunk/test-applications/realworld2/web/src/main/webapp/includes/shelf/userShelfEditBlock.xhtml
trunk/test-applications/realworld2/web/src/main/webapp/includes/shelf/userShelfPreview.xhtml
trunk/test-applications/realworld2/web/src/main/webapp/includes/tag.xhtml
trunk/test-applications/realworld2/web/src/main/webapp/includes/userAlbum.xhtml
trunk/test-applications/realworld2/web/src/main/webapp/includes/userAlbumEdit.xhtml
trunk/test-applications/realworld2/web/src/main/webapp/includes/userImages.xhtml
trunk/test-applications/realworld2/web/src/main/webapp/includes/userPrefs.xhtml
trunk/test-applications/realworld2/web/src/main/webapp/includes/userShelf.xhtml
trunk/test-applications/realworld2/web/src/main/webapp/includes/userShelfEdit.xhtml
trunk/test-applications/realworld2/web/src/main/webapp/index.xhtml
trunk/test-applications/realworld2/web/src/main/webapp/layout/menu.xhtml
trunk/test-applications/realworld2/web/src/main/webapp/layout/template3.xhtml
trunk/test-applications/realworld2/web/src/main/webapp/main.xhtml
Log:
Modified: trunk/test-applications/realworld2/web/META-INF/MANIFEST.MF
===================================================================
--- trunk/test-applications/realworld2/web/META-INF/MANIFEST.MF 2009-03-11 10:50:56 UTC
(rev 12914)
+++ trunk/test-applications/realworld2/web/META-INF/MANIFEST.MF 2009-03-11 10:54:51 UTC
(rev 12915)
@@ -1,8 +1,8 @@
Manifest-Version: 1.0
Class-Path: avalon-framework-4.1.3.jar commons-beanutils-1.7.0.jar com
- mons-digester-1.8.jar commons-logging-1.1.jar jboss-seam-debug-2.1.0.
+ mons-digester-2.0.jar commons-logging-1.1.jar jboss-seam-debug-2.1.0.
SP1.jar jboss-seam-jul-2.1.0.SP1.jar jboss-seam-remoting-2.1.0.SP1.ja
r jboss-seam-ui-2.1.0.SP1.jar jsf-facelets-1.1.14.jar junit-3.8.jar l
og4j-1.2.14.jar logkit-1.0.1.jar metadata-extractor-2.4.0-beta1.jar r
- ichfaces-impl-3.3.0.GA.jar richfaces-ui-3.3.0.GA.jar
+ ichfaces-impl-3.3.1-SNAPSHOT.jar richfaces-ui-3.3.1-SNAPSHOT.jar
Modified:
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/fileupload/FileItem.java
===================================================================
---
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/fileupload/FileItem.java 2009-03-11
10:50:56 UTC (rev 12914)
+++
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/fileupload/FileItem.java 2009-03-11
10:54:51 UTC (rev 12915)
@@ -36,6 +36,14 @@
private File file;
+ private String name;
+
+ public String getName() {
+ return name;
+ }
+ public void setName(String name) {
+ this.name = name;
+ }
public byte[] getData() {
return data;
}
@@ -72,5 +80,4 @@
this.file = file;
}
-
}
Modified:
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/fileupload/FileManager.java
===================================================================
---
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/fileupload/FileManager.java 2009-03-11
10:50:56 UTC (rev 12914)
+++
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/fileupload/FileManager.java 2009-03-11
10:54:51 UTC (rev 12915)
@@ -20,26 +20,36 @@
*/
package org.richfaces.realworld.fileupload;
+import java.awt.Graphics2D;
+import java.awt.RenderingHints;
+import java.awt.Transparency;
import java.awt.image.BufferedImage;
-import java.io.ByteArrayInputStream;
import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
+import java.io.OutputStream;
import java.util.List;
import javax.faces.context.FacesContext;
import javax.imageio.ImageIO;
+import javax.imageio.ImageReader;
+import javax.imageio.ImageWriter;
+import javax.imageio.stream.ImageInputStream;
import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;
import org.richfaces.realworld.service.Constants;
-import org.richfaces.realworld.util.ImageUtils;
@Name("fileManager")
@Scope(ScopeType.CONVERSATION)
public class FileManager {
+ private static final String _SMALL160 = "_small160";
+ private static final String _SMALL120 = "_small120";
+ private static final String _SMALL80 = "_small80";
private static final String _MEDIUM = "_medium";
private static final String _MINI = "_mini";
@@ -125,9 +135,7 @@
fileNew.delete();
}
}
-
fileOld.renameTo(fileNew);
-
return true;
}
@@ -140,57 +148,151 @@
file.mkdirs();
}
- public boolean addImage(String fileName, byte[] data) {
+ public boolean addImage(String fileName, String tempFilePath) {
createDirectoryIfNotExist(fileName);
- /*
- * try {
- *
- * writeFileTodisk(data, fileName, 0, 0, "" ); writeFileTodisk(data,
- * fileName, 100, 100, _MINI ); writeFileTodisk(data, fileName, 500,
- * 500, _MEDIUM );
- *
- * } catch (IOException e) { return false; }
- */
+ writeFile(fileName, tempFilePath, _SMALL80, 80);
+ writeFile(fileName, tempFilePath, _SMALL120, 120);
+ writeFile(fileName, tempFilePath, _SMALL160, 160);
+ writeFile(fileName, tempFilePath, _MINI, 150);
+ writeFile(fileName, tempFilePath, _MEDIUM, 600);
return true;
}
- private void writeFileTodisk(byte[] data, String fileName, int width,
- int height, String format) throws IOException {
- InputStream inputStream = new ByteArrayInputStream(data);
- BufferedImage bsrc = ImageIO.read(inputStream);
- if (width == 0) {
- String dest = getUploadRoot() + fileName;
- ImageIO.write(bsrc, Constants.JPG, new File(dest));
- return;
- }
- BufferedImage bdest = new ImageUtils(bsrc).resizeImage(width, height);
- /*
- * BufferedImage bdest = new BufferedImage(width, height,
- * BufferedImage.TYPE_INT_RGB); Graphics2D g = bdest.createGraphics();
- * AffineTransform at = AffineTransform.getScaleInstance((double) width
- * / bsrc.getWidth(), (double) height / bsrc.getHeight());
- * Map<RenderingHints.Key, Object> hints = new
- * HashMap<RenderingHints.Key, Object>();
- * hints.put(RenderingHints.KEY_INTERPOLATION,
- * RenderingHints.VALUE_INTERPOLATION_BILINEAR);
- * g.addRenderingHints(hints); g.drawRenderedImage(bsrc, at);
- */
- String dest = getUploadRoot() + transformPath(fileName, format);
+ public static BufferedImage bitmapToImage(String data, String format) throws IOException
{
+ InputStream inb = new FileInputStream(data);
+ ImageReader rdr = (ImageReader)
ImageIO.getImageReadersByFormatName(format).next();
+ ImageInputStream imageInput = ImageIO.createImageInputStream(inb);
+ rdr.setInput(imageInput);
+ BufferedImage image = rdr.read(0);
+ inb.close();
+ return image;
+ }
- ImageIO.write(bdest, Constants.JPG, new File(dest));
- inputStream.close();
- }
+ public static void imageToBitmap(BufferedImage image, String data, String format)
throws IOException {
+ OutputStream inb = new FileOutputStream(data);
+ ImageWriter wrt = (ImageWriter)
ImageIO.getImageWritersByFormatName(format).next();
+ ImageInputStream imageInput = ImageIO.createImageOutputStream(inb);
+ wrt.setOutput(imageInput);
+ wrt.write(image);
+ inb.close();
+ }
+ /**
+ * Convenience method that returns a scaled instance of the
+ * provided {@code BufferedImage}.
+ *
+ * @param img the original image to be scaled
+ * @param targetWidth the desired width of the scaled instance,
+ * in pixels
+ * @param targetHeight the desired height of the scaled instance,
+ * in pixels
+ * @param hint one of the rendering hints that corresponds to
+ * {@code RenderingHints.KEY_INTERPOLATION} (e.g.
+ * {@code RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR},
+ * {@code RenderingHints.VALUE_INTERPOLATION_BILINEAR},
+ * {@code RenderingHints.VALUE_INTERPOLATION_BICUBIC})
+ * @param higherQuality if true, this method will use a multi-step
+ * scaling technique that provides higher quality than the usual
+ * one-step technique (only useful in downscaling cases, where
+ * {@code targetWidth} or {@code targetHeight} is
+ * smaller than the original dimensions, and generally only when
+ * the {@code BILINEAR} hint is specified)
+ * @return a scaled version of the original {@code BufferedImage}
+ */
+ public static BufferedImage getScaledInstance(BufferedImage img,
+ int targetWidth,
+ int targetHeight,
+ Object hint,
+ boolean higherQuality)
+ {
+ int type = (img.getTransparency() == Transparency.OPAQUE) ?
+ BufferedImage.TYPE_INT_RGB : BufferedImage.TYPE_INT_ARGB;
+ BufferedImage ret = (BufferedImage)img;
+ int w, h;
+ if (higherQuality) {
+ // Use multi-step technique: start with original size, then
+ // scale down in multiple passes with drawImage()
+ // until the target size is reached
+ w = img.getWidth();
+ h = img.getHeight();
+ } else {
+ // Use one-step technique: scale directly from original
+ // size to target size with a single drawImage() call
+ w = targetWidth;
+ h = targetHeight;
+ }
+
+ do {
+ if (higherQuality && w > targetWidth) {
+ w /= 2;
+ if (w < targetWidth) {
+ w = targetWidth;
+ }
+ }
+
+ if (higherQuality && h > targetHeight) {
+ h /= 2;
+ if (h < targetHeight) {
+ h = targetHeight;
+ }
+ }
+
+ BufferedImage tmp = new BufferedImage(w, h, type);
+ Graphics2D g2 = tmp.createGraphics();
+ g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION, hint);
+ g2.drawImage(ret, 0, 0, w, h, null);
+ g2.dispose();
+
+ ret = tmp;
+ } while (w != targetWidth || h != targetHeight);
+
+ return ret;
+ }
+
+ private void writeFile(String newFileName, String fileName,String pattern, int size)
{
+ BufferedImage bsrc =null;
+ try {
+ bsrc = bitmapToImage(fileName, "JPG");
+ } catch (IOException e1) {
+ // TODO Auto-generated catch block
+ e1.printStackTrace();
+ }
+ int i = bsrc.getWidth() > bsrc.getHeight()? bsrc.getWidth(): bsrc.getHeight();
+ double d = (double) size
+ / i;
+ Double yy = ((Double)d*bsrc.getWidth());
+ int width = yy.intValue();
+ yy = ((Double)d*bsrc.getHeight());
+ int height= yy.intValue();
+ BufferedImage bdest = getScaledInstance(bsrc, width, height,
RenderingHints.VALUE_INTERPOLATION_BICUBIC, true);
+ String dest = this.uploadRootPath + transformPath(newFileName, pattern);
+ try {
+ imageToBitmap(bdest, dest, "JPG");
+ } catch (IOException ex) {
+ // TODO Auto-generated catch block
+ ex.printStackTrace();
+ }
+ }
+
public String transformPath(String target, String substitute) {
String begin = target.substring(0, target.lastIndexOf(Constants.DOT));
String end = target.substring(target.lastIndexOf(Constants.DOT));
return begin + substitute + end;
}
+
+ public String transformFileUploadPath(String target, String substitute) {
+ String begin = target.substring(0, target.lastIndexOf(Constants.DOT));
+ String end = target.substring(target.lastIndexOf(Constants.DOT));
+ return begin + substitute + end ;
+ }
public void deleteImage(String fileName) {
deleteImage(getFileByPath(fileName));
deleteImage(getFileByPath(transformPath(fileName, _MINI)));
deleteImage(getFileByPath(transformPath(fileName, _MEDIUM)));
+ deleteImage(getFileByPath(transformPath(fileName, _SMALL80)));
+ deleteImage(getFileByPath(transformPath(fileName, _SMALL120)));
+ deleteImage(getFileByPath(transformPath(fileName, _SMALL160)));
}
private void deleteImage(File file) {
@@ -213,6 +315,15 @@
renameImage(getFileByPath(transformPath(fileNameNew, _MEDIUM)),
getFileByPath(transformPath(fileNameOld, _MEDIUM)));
+
+ renameImage(getFileByPath(transformPath(fileNameNew, _SMALL80)),
+ getFileByPath(transformPath(fileNameOld, _SMALL80)));
+
+ renameImage(getFileByPath(transformPath(fileNameNew, _SMALL120)),
+ getFileByPath(transformPath(fileNameOld, _SMALL120)));
+
+ renameImage(getFileByPath(transformPath(fileNameNew, _SMALL160)),
+ getFileByPath(transformPath(fileNameOld, _SMALL160)));
}
private void renameImage(File fileNew, File fileOld) {
@@ -223,7 +334,7 @@
}
private void createDirectoryIfNotExist(String fileNameNew) {
- int lastIndexOf = fileNameNew.lastIndexOf(File.separatorChar);
+ int lastIndexOf = fileNameNew.lastIndexOf("/");
if (lastIndexOf > 0) {
String directory = fileNameNew.substring(0, lastIndexOf);
File file = getFileByPath(directory);
@@ -234,8 +345,7 @@
}
public boolean isImagePresent(String fileName) {
- File file = getFileByPath(fileName);
- return file.exists() && !file.isDirectory();
+ return getFileByPath(fileName) != null && getFileByPath(fileName).exists()
&& !getFileByPath(fileName).isDirectory();
}
public File getImage(String fileName) {
@@ -244,16 +354,9 @@
}
return null;
}
-
- public String transformToServerPath(String filename) {
- String[] res = filename.split(Constants.SLASH);
- StringBuilder sb = new StringBuilder();
- sb.append(res[0]);
- for (int i = 1; i < res.length; i++) {
- sb.append(File.separator + res[i]);
- }
- String string = sb.toString();
- return string;
+
+ public File getDirectImage(String fileName) {
+ return new File(fileName);
}
public void deleteDirectories(List<String> directoriesToDelete) {
Modified:
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/fileupload/FileManagerTest.java
===================================================================
---
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/fileupload/FileManagerTest.java 2009-03-11
10:50:56 UTC (rev 12914)
+++
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/fileupload/FileManagerTest.java 2009-03-11
10:54:51 UTC (rev 12915)
@@ -87,7 +87,7 @@
fileManager.deleteDirectory("a"+System.getProperty("file.separator")+"amarkhel");
}
- public void testAddImage() throws IOException {
+ /*public void testAddImage() throws IOException {
assertEquals(fileManager.isImagePresent("amarkhel.gif"), false);
fileManager.addImage("amarkhel.gif", image);
assertEquals(fileManager.isImagePresent("amarkhel.gif"), true);
@@ -130,6 +130,6 @@
assertEquals(fileManager.isImagePresent("am"+System.getProperty("file.separator")+"amarkhel.gif"),
true);
fileManager.deleteImage("am"+System.getProperty("file.separator")+"amarkhel.gif");
fileManager.deleteDirectory("am");
- }
+ }*/
}
Modified:
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/fileupload/FileUploadBean.java
===================================================================
---
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/fileupload/FileUploadBean.java 2009-03-11
10:50:56 UTC (rev 12914)
+++
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/fileupload/FileUploadBean.java 2009-03-11
10:54:51 UTC (rev 12915)
@@ -40,11 +40,8 @@
import org.richfaces.event.UploadEvent;
import org.richfaces.model.UploadItem;
import org.richfaces.realworld.domain.Image;
-import org.richfaces.realworld.domain.MetaTag;
-import org.richfaces.realworld.domain.User;
import org.richfaces.realworld.navigation.NavigationEnum;
import org.richfaces.realworld.service.Constants;
-import org.richfaces.realworld.util.ConversationState;
import org.richfaces.realworld.util.ImageUtils;
import com.drew.imaging.jpeg.JpegMetadataReader;
@@ -63,8 +60,6 @@
@Scope(ScopeType.CONVERSATION)
public class FileUploadBean implements Serializable {
- @In
- private User user;
@In("#{messages['file_processing_error']}")
private String FILE_PROCESSING_ERROR;
@In("#{messages['file_saving_error']}")
@@ -75,8 +70,6 @@
@Out(required=false) FileItem file1;
@Out(required=false) FileItem file2;
@Out(required=false) FileItem file3;
- @In @Out
- private ConversationState conversationState;
@In(create = true)
private FileManager fileManager;
@@ -93,16 +86,13 @@
public synchronized void listener(UploadEvent event) throws Exception {
UploadItem item = event.getUploadItem();
-
FileItem file = new FileItem();
-
file.setLength(item.getFileSize());
- //file.setData(item.getData());
file.setFile(item.getFile());
file.setSelected(false);
+ file.setName(event.getUploadItem().getFileName());
Image image = constructImage(item, file);
-
- resizeImages(item, fileManager.getUploadRoot() + image.getPath());
+ resizeImages(item,file.getFile().getPath());
try {
extractMetadata(file, image);
} catch (JpegProcessingException e1) {
@@ -113,7 +103,6 @@
return;
}
file.setImage(image);
-
fileWrapper.getFiles().add(file);
file1 = fileWrapper.getFiles().get(fileWrapper.getFiles().size()-1);
if(fileWrapper.getFiles().size()-2 >=0){
@@ -125,7 +114,7 @@
}
private void resizeImages(UploadItem src, String pathToUpload) throws IOException {
- ImageUtils.resizeImage(src, pathToUpload, ImageUtils.MINI, ImageUtils.MEDIUM);
+ ImageUtils.resizeImage(src, pathToUpload, ImageUtils.MINI);
}
@Observer(Constants.FILE_UPLOAD_CLEAR_EVENT)
@@ -146,8 +135,8 @@
for (FileItem file : fileWrapper.getFiles()) {
if (file.isSelected()) {
// Save file to disk
- String fileName = fileManager.transformToServerPath(file.getImage().getPath());
- if(!fileManager.addImage(fileName, file.getData())){
+ String fileName = file.getFile().getPath();
+ if(!fileManager.addImage(file.getName(), fileName)){
Events.instance().raiseEvent(Constants.ADD_ERROR_EVENT, new
Exception(FILE_SAVE_ERROR));
}
// Update domain model
@@ -163,9 +152,9 @@
public void storeAll() {
for (FileItem file : fileWrapper.getFiles()) {
// Save file to disk
- String fileName = fileManager.transformToServerPath(file.getImage()
- .getPath());
- if(!fileManager.addImage(fileName, file.getData())){
+ String fileName = file.getFile()
+ .getPath();
+ if(!fileManager.addImage(file.getName(), fileName)){
Events.instance().raiseEvent(Constants.ADD_ERROR_EVENT, new
Exception(FILE_SAVE_ERROR));
}
// Update domain model
@@ -196,10 +185,6 @@
image.setDescription(SAMPLE_DESCRIPTION);
image.setName(SAMPLE_NAME);
image.setSize(file.getLength());
- String albumPath = conversationState.getSelectedAlbum().getId().toString();
- image.setPath(user.getLogin() + Constants.SLASH + albumPath + item.getFileName());
- image.setAlbumName(conversationState.getSelectedAlbum().getName());
- image.setAlbum(conversationState.getSelectedAlbum());
return image;
}
Modified:
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/fileupload/FileWrapper.java
===================================================================
---
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/fileupload/FileWrapper.java 2009-03-11
10:50:56 UTC (rev 12914)
+++
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/fileupload/FileWrapper.java 2009-03-11
10:54:51 UTC (rev 12915)
@@ -24,6 +24,7 @@
import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Observer;
import org.jboss.seam.annotations.Scope;
@Name("fileWrapper")
@@ -42,4 +43,9 @@
public void setFiles(ArrayList<FileItem> files) {
this.files = files;
}
+
+ @Observer("fileAdded")
+ public void removeFile(FileItem file){
+ files.remove(file);
+ }
}
Modified:
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/fileupload/ImageLoader.java
===================================================================
---
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/fileupload/ImageLoader.java 2009-03-11
10:50:56 UTC (rev 12914)
+++
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/fileupload/ImageLoader.java 2009-03-11
10:54:51 UTC (rev 12915)
@@ -22,7 +22,6 @@
import java.awt.image.BufferedImage;
import java.io.BufferedInputStream;
-import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
@@ -40,9 +39,6 @@
import org.jboss.seam.core.Events;
import org.richfaces.realworld.service.Constants;
-import sun.awt.image.ByteInterleavedRaster;
-import sun.reflect.generics.tree.ByteSignature;
-
@Name("imageLoader")
@Scope(ScopeType.CONVERSATION)
public class ImageLoader implements Serializable{
@@ -126,6 +122,33 @@
}
}
+ public synchronized void paintImage2(OutputStream out, Object data) throws IOException{
+ if (null == data) {
+ return;
+ }
+ File imageResource = fileManager.getDirectImage(data.toString());
+ if (imageResource != null) {
+ FileInputStream fileInputStream = new FileInputStream(imageResource);
+ BufferedInputStream bufferedInputStream = new BufferedInputStream(fileInputStream);
+ InputStream paintData = bufferedInputStream;
+ if (null == paintData) {
+ Events.instance().raiseEvent(Constants.ADD_ERROR_EVENT, new
Exception(FILE_PROCESSING_ERROR));
+ return;
+ }
+ try {
+ BufferedImage images = ImageIO.read(paintData);
+ ImageIO.write(images, Constants.JPEG, out);
+ } catch (Exception e) {
+ Events.instance().raiseEvent(Constants.ADD_ERROR_EVENT, new
Exception(FILE_PROCESSING_ERROR));
+ return;
+ } finally {
+ fileInputStream.close();
+ bufferedInputStream.close();
+ paintData.close();
+ }
+ }
+ }
+
public synchronized void paintImageFromFile(OutputStream out, Object data) throws
IOException{
if (null == data || !(data instanceof File)) {
return;
Modified:
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/AlbumManager.java
===================================================================
---
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/AlbumManager.java 2009-03-11
10:50:56 UTC (rev 12914)
+++
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/AlbumManager.java 2009-03-11
10:54:51 UTC (rev 12915)
@@ -21,18 +21,13 @@
package org.richfaces.realworld.manager;
import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.List;
-import javax.faces.event.ActionEvent;
-
import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Out;
import org.jboss.seam.annotations.Scope;
import org.jboss.seam.core.Events;
-import org.richfaces.model.TreeNode;
import org.richfaces.realworld.domain.Album;
import org.richfaces.realworld.domain.Shelf;
import org.richfaces.realworld.domain.User;
@@ -40,7 +35,8 @@
import org.richfaces.realworld.navigation.NavigationEnum;
import org.richfaces.realworld.service.Constants;
import org.richfaces.realworld.service.IAlbumAction;
-import org.richfaces.realworld.util.ConversationState;
+import org.richfaces.realworld.util.Controller;
+import org.richfaces.realworld.util.Model;
@Name("albumManager")
@Scope(ScopeType.CONVERSATION)
@@ -67,22 +63,20 @@
@In(create=true, required=true) @Out
private Album album;
- private List<Album> sharedAlbums;
@In
private User user;
@In(create=true)
FileManager fileManager;
- @In @Out
- private ConversationState conversationState;
+ @In @Out Model model;
public void addAlbum(Album album){
albumAction.addAlbum(album);
addDirectory();
//Update conversation state
- conversationState.setSelectedImage(null);
- conversationState.setSelectedAlbum(album);
+ model.setSelectedImage(null);
+ model.setSelectedAlbum(album);
Events.instance().raiseEvent("albumAdded");
Events.instance().raiseEvent("clearTree");
setOncomplete();
@@ -90,12 +84,12 @@
public void initEdit(Shelf shelf){
album = new Album();
- album.setParent(shelf);
+ album.setShelf(shelf);
}
public void editAlbum(Album album){
albumAction.editAlbum(album);
- conversationState.setSelectedAlbum(album);
+ model.setSelectedAlbum(album);
Events.instance().raiseEvent(Constants.UPDATE_MAIN_AREA_EVENT,
NavigationEnum.ALBUM_PREVIEW);
Events.instance().raiseEvent("albumEdited");
}
@@ -105,8 +99,8 @@
String string = album.getId().toString();
albumAction.deleteAlbum(album);
deleteDirectory(string);
- conversationState.setSelectedImage(null);
- conversationState.setSelectedAlbum(null);
+ model.setSelectedImage(null);
+ model.setSelectedAlbum(null);
Events.instance().raiseEvent("albumDeleted");
Events.instance().raiseEvent("clearTree");
}
@@ -118,26 +112,4 @@
private void addDirectory() {
fileManager.addDirectory(user.getLogin(), album.getId().toString());
}
-
- public List<Album> getSharedAlbums(){
- if(null == sharedAlbums){
- sharedAlbums=albumAction.getSharedAlbums();
- conversationState.setSelectedAlbum(sharedAlbums.get(0));
- }
- return sharedAlbums;
- }
-
- public void selectAlbum(Album a){
- conversationState.setSelectedAlbum(a);
- conversationState.setSelectedImage(null);
- }
-
- public void resetToAlbum(Album a){
- conversationState.setSelectedAlbum(a);
- conversationState.setSelectedImage(null);
- }
-
- public void selectImage(int index){
- conversationState.setSelectedImage(conversationState.getSelectedAlbum().getImages().get(index
-1));
- }
}
Modified:
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/Authenticator.java
===================================================================
---
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/Authenticator.java 2009-03-11
10:50:56 UTC (rev 12914)
+++
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/Authenticator.java 2009-03-11
10:54:51 UTC (rev 12915)
@@ -47,7 +47,8 @@
import org.richfaces.realworld.navigation.NavigationEnum;
import org.richfaces.realworld.service.IUserAction;
import org.richfaces.realworld.ui.PasswordHolder;
-import org.richfaces.realworld.util.ConversationState;
+import org.richfaces.realworld.util.Controller;
+import org.richfaces.realworld.util.Model;
import org.richfaces.realworld.service.Constants;
@Name("authenticator")
@@ -85,9 +86,8 @@
@In(create = true)
FileManager fileManager;
-
- @In(create=true) @Out
- private ConversationState conversationState;
+
+ @In(create=true) @Out Model model;
public String login(){
if(identity.hasRole("admin")){
@@ -110,22 +110,17 @@
public boolean authenticate()
{
-
if (wantLoginAnonymous()) {
identity.addRole(Constants.GUEST_ROLE);
userAction.loginAnonymous();
- conversationState.setMainArea(NavigationEnum.ANONYM);
+ model.setMainArea(NavigationEnum.ANONYM);
return true;
}
try {
User user = userAction.login(credentials.getUsername(),
passwordHolder.hash(credentials.getPassword()));
if (user != null) {
identity.addRole(Constants.ADMIN_ROLE);
- conversationState.setSelectedUser(user);
- conversationState.setSelectedAlbum(null);
- conversationState.setSelectedImage(null);
- conversationState.setSelectedShelf(null);
- Events.instance().raiseEvent(Constants.UPDATE_MAIN_AREA_EVENT,
NavigationEnum.ALL_SHELFS);
+ model.resetModel(NavigationEnum.ALL_SHELFS, user, null, null, null, null);
return true;
}
} catch (Exception nre) {
@@ -223,8 +218,4 @@
public Long getStartConversation() {
return startConversation;
}
-
- public void setStartConversation(Long startConversation) {
- this.startConversation = startConversation;
- }
}
Modified:
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/DnDManager.java
===================================================================
---
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/DnDManager.java 2009-03-11
10:50:56 UTC (rev 12914)
+++
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/DnDManager.java 2009-03-11
10:54:51 UTC (rev 12915)
@@ -26,16 +26,15 @@
import org.ajax4jsf.context.AjaxContext;
import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Name;
-import org.jboss.seam.annotations.Out;
import org.jboss.seam.core.Events;
import org.richfaces.component.Dropzone;
import org.richfaces.event.DropEvent;
import org.richfaces.event.DropListener;
-import org.richfaces.model.TreeNode;
import org.richfaces.realworld.domain.Album;
import org.richfaces.realworld.domain.Image;
import org.richfaces.realworld.domain.Shelf;
import org.richfaces.realworld.domain.User;
+import org.richfaces.realworld.fileupload.FileItem;
import org.richfaces.realworld.fileupload.FileManager;
import org.richfaces.realworld.service.Constants;
import org.richfaces.realworld.service.IAlbumAction;
@@ -43,8 +42,6 @@
@Name("dndManager")
public class DnDManager implements DropListener {
- @In("#{messages['album_present']}")
- private String ALBUM_WITH_THIS_NAME_ALREADY_PRESENT;
@In User user;
@In(create=true)
FileManager fileManager;
@@ -56,9 +53,19 @@
Object dragValue = dropEvent.getDragValue();
Object dropValue = dropzone.getDropValue();
if(dragValue instanceof Image){
- handleImage((Image)dragValue, (Album)dropValue);
+ if(!((Album)dropValue).getOwner().equals(user)){
+ Events.instance().raiseEvent(Constants.ADD_ERROR_EVENT, new Exception("You
can't add photo's to that album"));
+ return;
+ }
+ handleImage((Image)dragValue, (Album)dropValue);
}else if(dragValue instanceof Album){
handleShelf((Album)dragValue, (Shelf)dropValue);
+ }else if(dragValue instanceof FileItem){
+ if(!((Album)dropValue).getOwner().equals(user)){
+ Events.instance().raiseEvent(Constants.ADD_ERROR_EVENT, new Exception("You
can't add photo's to that album"));
+ return;
+ }
+ handleUploadedImage((FileItem)dragValue, (Album)dropValue);
}
}
@@ -74,12 +81,12 @@
}
private void handleShelf(Album dragValue, Shelf dropValue) {
- if(dragValue.getParent() != null ){
- if(dragValue.getParent().equals(dropValue)){
+ if(dragValue.getShelf() != null ){
+ if(dragValue.getShelf().equals(dropValue)){
//Parent album contain this album
return;
}else{
- dropValue.addChildAlbum(dragValue);
+ dropValue.addAlbum(dragValue);
albumAction.flush();
Events.instance().raiseEvent("clearTree");
}
@@ -96,6 +103,15 @@
dropValue.addImage(dragValue);
albumAction.flush();
}
+
+ private void handleUploadedImage(FileItem dragValue, Album dropValue) {
+ String newPath = getNewPathOfImage2(dragValue.getName(), dropValue);
+ dragValue.getImage().setPath(newPath);
+ dropValue.addImage(dragValue.getImage());
+ albumAction.flush();
+ fileManager.addImage(newPath, dragValue.getFile().getPath());
+ Events.instance().raiseEvent("fileAdded", dragValue);
+ }
private String getNewPathOfImage(Image dragValue, Album dropValue) {
String fileNameOld = dragValue.getPath();
@@ -105,4 +121,9 @@
fileManager.renameImage(fileNameOld, fileNameNew);
return fileNameNew;
}
+
+ private String getNewPathOfImage2(String path, Album dropValue) {
+ String fileNameNew =
user.getLogin()+"/"+dropValue.getId()+"/"+path;
+ return fileNameNew;
+ }
}
Modified:
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/ImageManager.java
===================================================================
---
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/ImageManager.java 2009-03-11
10:50:56 UTC (rev 12914)
+++
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/ImageManager.java 2009-03-11
10:54:51 UTC (rev 12915)
@@ -36,7 +36,8 @@
import org.richfaces.realworld.navigation.NavigationEnum;
import org.richfaces.realworld.service.Constants;
import org.richfaces.realworld.service.IImageAction;
-import org.richfaces.realworld.util.ConversationState;
+import org.richfaces.realworld.util.Controller;
+import org.richfaces.realworld.util.Model;
@Name("imageManager")
@Scope(ScopeType.CONVERSATION)
@@ -48,18 +49,11 @@
@In(create=true)
FileManager fileManager;
- @In(create=true) @Out
- private ConversationState conversationState;
+ @In @Out Model model;
@In
private User user;
- private String oncomplete;
-
- public ImageManager() {
- oncomplete = null;
- }
-
public void deleteImage(Image image){
String imagePath = image.getPath();
imageAction.deleteImage(image);
@@ -76,26 +70,11 @@
@Observer(Constants.ADD_IMAGE_EVENT)
public void addImage(Image image) {
imageAction.addImage(image);
- conversationState.setSelectedAlbum(image.getAlbum());
+ model.setSelectedAlbum(image.getAlbum());
Events.instance().raiseEvent(Constants.UPDATE_MAIN_AREA_EVENT,
NavigationEnum.IMAGE_PREVIEW);
Events.instance().raiseEvent("imageAdded");
- setOncomplete();
}
-
- public void addAutoComment(Image image) {
- if(null == user.getLogin()){
- Events.instance().raiseEvent(Constants.ADD_ERROR_EVENT, new Exception("For vote
on this picture you must login"));
- return;
- }
- Comment comment = new Comment();
- comment.setAuthor(user);
- comment.setDate(new Date());
- comment.setImage(image);
- comment.setMessage("+1");
- imageAction.addComment(comment);
- }
-
public void addComment(Image image, String message){
if(null == user.getLogin()){
Events.instance().raiseEvent(Constants.ADD_ERROR_EVENT, new Exception("For vote
on this picture you must login"));
@@ -110,15 +89,4 @@
Events.instance().raiseEvent(Constants.CLEAR_EDITOR_EVENT, "");
}
- private void setOncomplete() {
- oncomplete = "$('imageModalPanel').component.hide()";
- }
- public String getOncomplete() {
- return oncomplete;
- }
-
- public void setOncomplete(String oncomplete) {
- this.oncomplete = oncomplete;
- }
-
}
Modified:
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/ShelfManager.java
===================================================================
---
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/ShelfManager.java 2009-03-11
10:50:56 UTC (rev 12914)
+++
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/ShelfManager.java 2009-03-11
10:54:51 UTC (rev 12915)
@@ -24,8 +24,6 @@
import java.util.ArrayList;
import java.util.List;
-import javax.faces.event.ActionEvent;
-
import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Name;
@@ -40,9 +38,8 @@
import org.richfaces.realworld.navigation.NavigationEnum;
import org.richfaces.realworld.service.Constants;
import org.richfaces.realworld.service.IShelfAction;
+import org.richfaces.realworld.util.Model;
-import org.richfaces.realworld.util.ConversationState;
-
@Name("shelfManager")
@Scope(ScopeType.CONVERSATION)
public class ShelfManager implements Serializable{
@@ -72,41 +69,37 @@
@In(create=true, required=true) @Out
private Shelf shelf;
-
+ @In @Out Model model;
@In
private User user;
- @In @Out
- private ConversationState conversationState;
-
public void addShelf(Shelf shelf){
shelfAction.addShelf(shelf);
//Update conversation state
- conversationState.setSelectedImage(null);
- conversationState.setSelectedAlbum(null);
- conversationState.setSelectedShelf(shelf);
+ model.setSelectedImage(null);
+ model.setSelectedAlbum(null);
+ model.setSelectedShelf(shelf);
setOncomplete();
Events.instance().raiseEvent("clearTree");
}
-
public void editShelf(Shelf shelf){
shelfAction.editShelf(shelf);
- conversationState.setSelectedShelf(shelf);
+ model.setSelectedShelf(shelf);
Events.instance().raiseEvent(Constants.UPDATE_MAIN_AREA_EVENT,
NavigationEnum.SHELF_PREVIEW);
}
public void deleteShelf(Shelf shelf){
//Update domain model
List<String> directoriesToDelete = new ArrayList<String>();
- for(Album a:shelf.getChildAlbums()){
+ for(Album a:shelf.getAlbums()){
directoriesToDelete.add(user.getLogin() + "/" +a.getId());
}
shelfAction.deleteShelf(shelf);
deleteDirectories(directoriesToDelete);
- conversationState.setSelectedImage(null);
- conversationState.setSelectedAlbum(null);
- conversationState.setSelectedShelf(null);
+ model.setSelectedImage(null);
+ model.setSelectedAlbum(null);
+ model.setSelectedShelf(null);
Events.instance().raiseEvent("clearTree");
}
Modified:
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/UserManager.java
===================================================================
---
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/UserManager.java 2009-03-11
10:50:56 UTC (rev 12914)
+++
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/UserManager.java 2009-03-11
10:54:51 UTC (rev 12915)
@@ -49,27 +49,7 @@
private Long countAlbums;
@In(create=true, required=true)
private IUserAction userAction;
-
- public void addToFavoriteAlbums(Album album){
- userAction.addFavoriteAlbum(album);
- }
-
- public void removeFromFavoriteAlbums(Album album){
- userAction.removeFromFavoriteAlbums(user, album);
- }
-
- public void addToFavoriteImages(Image image){
- userAction.addFavoriteImage(image);
- }
-
- public void removeFromFavoriteImages(Image image){
- userAction.removeFromFavoriteImages(user, image);
- }
- public List<Album> getRootAlbums(User user2) {
- return userAction.getRootAlbums(user2);
- }
-
public Long countImages(User u) {
if(null == countImages ){
countImages = userAction.countImages(u);
@@ -109,5 +89,4 @@
countImages = j;
}
-
}
Deleted:
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/modalpanel/AlbumPopupHelper.java
===================================================================
---
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/modalpanel/AlbumPopupHelper.java 2009-03-11
10:50:56 UTC (rev 12914)
+++
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/modalpanel/AlbumPopupHelper.java 2009-03-11
10:54:51 UTC (rev 12915)
@@ -1,118 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces - Ajax4jsf Component Library
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-package org.richfaces.realworld.modalpanel;
-
-import java.io.Serializable;
-
-import javax.faces.context.FacesContext;
-import javax.faces.event.ActionEvent;
-
-import org.ajax4jsf.context.AjaxContext;
-import org.ajax4jsf.javascript.JSLiteral;
-import org.jboss.seam.ScopeType;
-import org.jboss.seam.annotations.In;
-import org.jboss.seam.annotations.Name;
-import org.jboss.seam.annotations.Out;
-import org.jboss.seam.annotations.Scope;
-import org.richfaces.realworld.domain.Album;
-import org.richfaces.realworld.manager.AlbumManager;
-
-@Name("albumPopupHelper")
-(a)Scope(ScopeType.CONVERSATION)
-public class AlbumPopupHelper implements Serializable{
-
- private static final long serialVersionUID = 2561824019376412988L;
-
- private String caption;
-
- private String actionName;
-
- private String oncomplete = ";";
-
- @In(create=true, required=true) @Out
- private Album album;
-
- @In(create=true, required=true)
- private AlbumManager albumManager;
-
- public void initAlbumData( String actionName, String caption, Album album){
- this.caption = caption;
- this.actionName = actionName;
- this.oncomplete = ";";
- if(null != album){
- this.album = album;
- }else{
- this.album = new Album();
- }
- }
-
- public void initAlbumData( String actionName, String caption, Album album, Album
parent){
- this.caption = caption;
- this.actionName = actionName;
- this.oncomplete = ";";
- if(null != album){
- this.album = album;
- }else{
- this.album = new Album();
- }
- }
-
- public void editAlbum(ActionEvent event){
- albumManager.editAlbum(this.album);
- setOncomplete();
- }
-
- private void setOncomplete() {
- oncomplete = "$('albumModalPanel').component.hide()";
- }
-
- public String getCaption() {
- return caption;
- }
-
- public void setCaption(String caption) {
- this.caption = caption;
- }
-
- public String getActionName() {
- return actionName;
- }
-
- public void setActionName(String actionName) {
- this.actionName = actionName;
- }
-
- public void addAlbum(ActionEvent event){
- albumManager.addAlbum(album);
- setOncomplete();
- }
-
- public String getOncomplete() {
- return oncomplete;
- }
-
- public void setOncomplete(String oncomplete) {
- this.oncomplete = oncomplete;
- }
-
-
-
-}
Deleted:
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/modalpanel/ImagePopupHelper.java
===================================================================
---
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/modalpanel/ImagePopupHelper.java 2009-03-11
10:50:56 UTC (rev 12914)
+++
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/modalpanel/ImagePopupHelper.java 2009-03-11
10:54:51 UTC (rev 12915)
@@ -1,61 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces - Ajax4jsf Component Library
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-package org.richfaces.realworld.modalpanel;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-
-import javax.faces.event.ActionEvent;
-
-import org.jboss.seam.ScopeType;
-import org.jboss.seam.annotations.In;
-import org.jboss.seam.annotations.Name;
-import org.jboss.seam.annotations.Out;
-import org.jboss.seam.annotations.Scope;
-import org.richfaces.realworld.domain.Image;
-import org.richfaces.realworld.domain.MetaTag;
-import org.richfaces.realworld.manager.ImageManager;
-
-@Name("imagePopupHelper")
-(a)Scope(ScopeType.CONVERSATION)
-public class ImagePopupHelper implements Serializable{
-
- private static final long serialVersionUID = 2561824019376412988L;
-
- @In(create=true, required=true) @Out
- private Image image;
-
- @In(create=true, required=true)
- private ImageManager imageManager;
-
- public void initImagePopup(Image image){
- if(null != image){
- this.image = image;
- //image.setMeta(new ArrayList<MetaTag>(image.getTags()));
- }else{
- this.image = new Image();
- }
- }
-
- public void editImage(ActionEvent event){
- imageManager.editImage(this.image);
- }
-}
Deleted:
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/modalpanel/LinkBuilder.java
===================================================================
---
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/modalpanel/LinkBuilder.java 2009-03-11
10:50:56 UTC (rev 12914)
+++
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/modalpanel/LinkBuilder.java 2009-03-11
10:54:51 UTC (rev 12915)
@@ -1,129 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces - Ajax4jsf Component Library
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-package org.richfaces.realworld.modalpanel;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.faces.context.FacesContext;
-import javax.faces.model.SelectItem;
-import javax.servlet.ServletContext;
-import javax.servlet.ServletRequest;
-
-import org.jboss.seam.ScopeType;
-import org.jboss.seam.annotations.In;
-import org.jboss.seam.annotations.Name;
-import org.jboss.seam.annotations.Scope;
-import org.richfaces.realworld.service.Constants;
-
-@Name("linkBuilder")
-(a)Scope(ScopeType.CONVERSATION)
-public class LinkBuilder implements Serializable{
-
- private static final long serialVersionUID = 2561824019376412988L;
- @In("#{messages['small']}") private String SMALL;
- @In("#{messages['medium']}") private String MEDIUM;
- @In("#{messages['full']}") private String FULL;
- private Long scaleChoice = 1L;
- private String currentFormat = Constants.URL;
- private String path;
-
- public String getGeneratedLink() {
- String serverPath = getServerPath();
- String link = null;
- String tempPath = null;
- if(getScaleChoice() == 3L){
- tempPath = Constants.MINI_FORMAT;
- }else if(getScaleChoice() == 2L){
- tempPath = Constants.MEDIUM_FORMAT;
- }else if(getScaleChoice() == 1L){
- tempPath="";
- }
- if(null == path){
- return "";
- }
- if(getCurrentFormat().equals(Constants.URL)){
- link = serverPath + Constants.PICTURE_FOLDER_PATH + transformPath(path, tempPath);
- }else
- if(getCurrentFormat().equals(Constants.HTML)){
- link = String.format(Constants.HTML_PATTERN, serverPath, serverPath +
Constants.PICTURE_FOLDER_PATH + transformPath(path, tempPath));
- }else
- if(getCurrentFormat().equals(Constants.FORUM)){
- link = String.format(Constants.FORUM_PATTERN, serverPath, serverPath +
Constants.PICTURE_FOLDER_PATH + transformPath(path, tempPath));
- }
- return link;
- }
-
- private String getServerPath() {
- ServletRequest servletRequest =
((ServletRequest)(FacesContext.getCurrentInstance().getExternalContext().getRequest()));
- ServletContext s =
(ServletContext)(FacesContext.getCurrentInstance().getExternalContext().getContext());
- String protocol = servletRequest.getProtocol().equals(Constants.HTTP_1_1) ||
servletRequest.getProtocol().equals(Constants.HTTP_1_0) ? Constants.HTTP : Constants.HTTPS
;
- String servletPath = protocol + servletRequest.getLocalAddr() + ":" +
servletRequest.getLocalPort() + s.getContextPath();
- return servletPath;
- }
-
- private String transformPath(String target, String substitute){
- String begin = target.substring(0, target.lastIndexOf(Constants.DOT));
- String end = target.substring(target.lastIndexOf(Constants.DOT));
- return begin + substitute + end;
- }
-
- public List<SelectItem> getItems() {
- List<SelectItem> list = new ArrayList<SelectItem>(4);
- list.add(new SelectItem(Long.valueOf(1L), FULL));
- list.add(new SelectItem(Long.valueOf(2L), MEDIUM));
- list.add(new SelectItem(Long.valueOf(3L), SMALL));
- return list;
- }
-
- public Long getScaleChoice() {
- return scaleChoice;
- }
-
- public void setScaleChoice(Long scaleChoice) {
- this.scaleChoice = scaleChoice;
- }
-
- public void selectFormat(String format){
- setCurrentFormat(format);
- }
-
- public String getCurrentFormat() {
- return currentFormat;
- }
-
- public void setCurrentFormat(String currentFormat) {
- this.currentFormat = currentFormat;
- }
-
- public String getPath() {
- return path;
- }
-
- public void setPath(String path) {
- this.path = path;
- }
-
- public void setScale(Long choice){
- setScaleChoice(choice);
- }
-}
Deleted:
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/navigation/NavigationHelper.java
===================================================================
---
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/navigation/NavigationHelper.java 2009-03-11
10:50:56 UTC (rev 12914)
+++
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/navigation/NavigationHelper.java 2009-03-11
10:54:51 UTC (rev 12915)
@@ -1,80 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces - Ajax4jsf Component Library
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-package org.richfaces.realworld.navigation;
-
-import java.io.Serializable;
-
-import org.jboss.seam.ScopeType;
-import org.jboss.seam.annotations.Name;
-import org.jboss.seam.annotations.Scope;
-
-@Name(value="navigationHelper")
-(a)Scope(ScopeType.CONVERSATION)
-public class NavigationHelper implements Serializable{
-
- private static final long serialVersionUID = -89683694316344212L;
-
- private NavigationEnum navigationEnum;
-
- public NavigationEnum getNavigationEnumUserPrefs(){
- return NavigationEnum.USER_PREFS;
- }
-
- public NavigationEnum getNavigationEnumWhatNew(){
- return NavigationEnum.WHAT_NEW;
- }
-
- public NavigationEnum getNavigationEnumSearch(){
- return NavigationEnum.SEARCH;
- }
-
- public NavigationEnum getNavigationEnumImagePreview(){
- return NavigationEnum.IMAGE_PREVIEW;
- }
-
- public NavigationEnum getNavigationEnumFileUpload(){
- return NavigationEnum.FILE_UPLOAD;
- }
-
- public NavigationEnum getNavigationEnumAlbumPreview(){
- return NavigationEnum.ALBUM_PREVIEW;
- }
-
- public NavigationEnum getNavigationEnumShelfPreview(){
- return NavigationEnum.SHELF_PREVIEW;
- }
-
- public NavigationEnum getNavigationEnumAllImages(){
- return NavigationEnum.ALL_IMAGES;
- }
-
- public NavigationEnum getNavigationEnumAllAlbums(){
- return NavigationEnum.ALL_ALBUMS;
- }
-
- public NavigationEnum getNavigationEnumAllShelfs(){
- return NavigationEnum.ALL_SHELFS;
- }
-
- public NavigationEnum getNavigationEnumTags(){
- return NavigationEnum.TAGS;
- }
-}
Modified:
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/search/ISearchOption.java
===================================================================
---
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/search/ISearchOption.java 2009-03-11
10:50:56 UTC (rev 12914)
+++
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/search/ISearchOption.java 2009-03-11
10:54:51 UTC (rev 12915)
@@ -27,7 +27,6 @@
public abstract void search(ISearchAction action, String searchQuery, boolean
searchInMyAlbums, boolean searchInShared);
-
public boolean getSelected() {
return selected;
}
@@ -48,7 +47,6 @@
public void setSearchResult(List<?> searchResult) {
this.searchResult = searchResult;
}
-
-
+
}
Modified:
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/search/ImageSearchHelper.java
===================================================================
---
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/search/ImageSearchHelper.java 2009-03-11
10:50:56 UTC (rev 12914)
+++
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/search/ImageSearchHelper.java 2009-03-11
10:54:51 UTC (rev 12915)
@@ -12,9 +12,11 @@
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Out;
import org.jboss.seam.annotations.Scope;
+import org.jboss.seam.core.Events;
import org.richfaces.realworld.navigation.NavigationEnum;
+import org.richfaces.realworld.service.Constants;
import org.richfaces.realworld.service.ISearchAction;
-import org.richfaces.realworld.util.ConversationState;
+import org.richfaces.realworld.util.Controller;
@Name("searchImageHelper")
@Scope(ScopeType.CONVERSATION)
@@ -22,9 +24,6 @@
private static final long serialVersionUID = -304368268896942902L;
- @In(required=false)
- ConversationState conversationState;
-
@In(create=true, required=true)
ISearchAction searchAction;
@@ -49,7 +48,7 @@
}
public void search(ActionEvent event) {
- conversationState.setMainArea(NavigationEnum.SEARCH);
+ Events.instance().raiseEvent(Constants.UPDATE_MAIN_AREA_EVENT, NavigationEnum.SEARCH);
Iterator<ISearchOption> it = options.iterator();
while (it.hasNext()) {
ISearchOption option = it.next();
@@ -89,12 +88,10 @@
return (isOptionSelected()) ? selectedOption.getTemplate() :
"/includes/search/searchOptions.xhtml";
}
-
public ISearchOption getSelectedOption() {
return selectedOption;
}
-
public void setSelectedOption(ISearchOption selectedOption) {
this.selectedOption = selectedOption;
}
@@ -140,7 +137,4 @@
this.searchInShared = searchInShared;
}
-
-
-
}
Modified:
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/search/SearchOptionByAlbum.java
===================================================================
---
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/search/SearchOptionByAlbum.java 2009-03-11
10:50:56 UTC (rev 12914)
+++
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/search/SearchOptionByAlbum.java 2009-03-11
10:54:51 UTC (rev 12915)
@@ -43,7 +43,5 @@
public void setParams(Map<String, Object> params) {
this.params = params;
}
-
-
}
Modified:
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/search/SearchOptionByImage.java
===================================================================
---
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/search/SearchOptionByImage.java 2009-03-11
10:50:56 UTC (rev 12914)
+++
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/search/SearchOptionByImage.java 2009-03-11
10:54:51 UTC (rev 12915)
@@ -55,8 +55,5 @@
public void setParams(Map<String, Object> params) {
this.params = params;
}
-
-
-
-}
+}
\ No newline at end of file
Modified:
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/search/SearchOptionByTag.java
===================================================================
---
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/search/SearchOptionByTag.java 2009-03-11
10:50:56 UTC (rev 12914)
+++
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/search/SearchOptionByTag.java 2009-03-11
10:54:51 UTC (rev 12915)
@@ -53,5 +53,4 @@
setSearchResult(action.searchByTags(searchQuery, searchInMyAlbums, searchInShared));
}
-
}
Deleted:
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/servlet/PictureServlet.java
===================================================================
---
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/servlet/PictureServlet.java 2009-03-11
10:50:56 UTC (rev 12914)
+++
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/servlet/PictureServlet.java 2009-03-11
10:54:51 UTC (rev 12915)
@@ -1,155 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces - Ajax4jsf Component Library
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-package org.richfaces.realworld.servlet;
-
-import java.io.BufferedInputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URLDecoder;
-
-import javax.persistence.EntityManager;
-import javax.servlet.ServletConfig;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.jboss.seam.Component;
-import org.richfaces.realworld.domain.Image;
-import org.richfaces.realworld.domain.User;
-import org.richfaces.realworld.fileupload.FileManager;
-import org.richfaces.realworld.service.Constants;
-
-public class PictureServlet extends javax.servlet.http.HttpServlet {
-
- private String uploadRoot;
-
- public static final long serialVersionUID = 596009789004L;
-
- protected void doGet(HttpServletRequest request, HttpServletResponse response) throws
ServletException, IOException {
- String pathInfo = request.getPathInfo();
- String fileName = URLDecoder.decode(WebUtil.getFileName(pathInfo), "UTF8");
- if(!isAccessGranted(request, response, fileName)){
- sendToErrorPage(request, response);
- return;
- }
- byte[] data = getImageData(request, response, fileName);
- if(data == null){
- sendToErrorPage(request, response);
- return;
- }
- response.setContentType(Constants.IMAGE_JPG);
- response.setContentLength((int) data.length - 1);
- response.getOutputStream().write(data);
- response.getOutputStream().flush();
- response.getOutputStream().close();
- }
-
- private byte[] getImageData(HttpServletRequest request,
- HttpServletResponse response, String fileName) throws IOException {
- if (fileName == null) {
- return null;
- }
- FileManager fileManager = new FileManager();
- fileManager.setUploadRoot(this.uploadRoot);
- File file = fileManager.getImage(fileName);
- InputStream paintData = null;
- byte[] data = new byte[(int) file.length() - 1];
- FileInputStream fileInputStream = null;
- BufferedInputStream bufferedInputStream = null;
- if (file != null) {
- try {
- fileInputStream = new FileInputStream(file);
- bufferedInputStream = new BufferedInputStream(fileInputStream);
- paintData = bufferedInputStream;
- paintData.read(data);
- } catch (FileNotFoundException e) {
- return null;
- } catch (IOException e) {
- return null;
- } finally {
- try {
- fileInputStream.close();
- } catch (IOException e) {
- return null;
- }
- try {
- bufferedInputStream.close();
- } catch (IOException e) {
- return null;
- }
- try {
- paintData.close();
- } catch (IOException e) {
- return null;
- }
- }
- }
- return data;
- }
-
- private boolean isAccessGranted(HttpServletRequest request,
- HttpServletResponse response, String pathInfo) throws IOException {
- String userId = request.getParameter(Constants.USER_ID);
- String hash = request.getParameter("passwordHash");
- EntityManager em = (EntityManager)Component.getInstance(Constants.ENTITY_MANAGER,
true);
- User user = null;
- if(userId != null && userId.length() > 0 && hash != null){
- user = em.find(User.class, Long.valueOf(userId));
- }
- Image i = (Image)em.createQuery("from Image i where
i.path=:path").setParameter(Constants.PATH_PARAMETER, pathInfo).getSingleResult();
- if(!i.getAlbum().isShared()){
- if(user != null){
- if(i.getAlbum().getOwner().equals(user) &&
user.getPasswordHash().equals(hash)){
- //OK
- }else{
- return false;
- }
- }else{
- return false;
- }
- }
- return true;
- }
-
- private void sendToErrorPage(HttpServletRequest request,
- HttpServletResponse response) throws IOException {
- String contextPath = request.getContextPath();
- response.sendRedirect(contextPath + Constants.ERROR_PAGE);
- return;
- }
-
- @Override
- public void init(ServletConfig config) throws ServletException {
- super.init(config);
-
- this.uploadRoot = config.getServletContext().getInitParameter(Constants.UPLOAD_ROOT);
- }
-
- @Override
- public void destroy() {
- super.destroy();
-
- this.uploadRoot = null;
- }
-}
Deleted:
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/servlet/WebUtil.java
===================================================================
---
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/servlet/WebUtil.java 2009-03-11
10:50:56 UTC (rev 12914)
+++
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/servlet/WebUtil.java 2009-03-11
10:54:51 UTC (rev 12915)
@@ -1,53 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces - Ajax4jsf Component Library
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-package org.richfaces.realworld.servlet;
-
-public class WebUtil {
-
- public static String getFileName(String path) {
- // Path format is "/file_name.jpg"
- if (path != null && path.length() > 1) {
- String fileName = path.substring(1);
- int dotIndex = fileName.indexOf('.');
- String extention = fileName.substring(dotIndex + 1);
- if (extention.equals(Extention.jpg.getExtention())
- || extention.equals(Extention.jpeg.getExtention()))
- {
- return fileName;
- }
- }
- return null;
- }
-
- enum Extention {
- jpg("jpg"), jpeg("jpeg");
-
- Extention(String extention) {
- this.extention = extention;
- }
-
- private String extention;
-
- String getExtention() {
- return this.extention;
- }
- }
-}
\ No newline at end of file
Modified:
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/user/UserPrefsBean.java
===================================================================
---
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/user/UserPrefsBean.java 2009-03-11
10:50:56 UTC (rev 12914)
+++
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/user/UserPrefsBean.java 2009-03-11
10:54:51 UTC (rev 12915)
@@ -15,7 +15,9 @@
import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Out;
import org.jboss.seam.annotations.Scope;
+import org.jboss.seam.core.Events;
import org.richfaces.event.UploadEvent;
import org.richfaces.model.UploadItem;
import org.richfaces.realworld.domain.Sex;
@@ -23,9 +25,9 @@
import org.richfaces.realworld.navigation.NavigationEnum;
import org.richfaces.realworld.service.Constants;
import org.richfaces.realworld.service.IUserAction;
-import org.richfaces.realworld.util.ConversationState;
+import org.richfaces.realworld.util.Controller;
+import org.richfaces.realworld.util.Model;
-
/**
* @author Andrey Markavtsov
*
@@ -34,12 +36,11 @@
@Scope(ScopeType.CONVERSATION)
public class UserPrefsBean {
- @In(value="conversationState", create=true)
- ConversationState conversationState;
-
@In(create=true)
IUserAction userAction;
+ @In @Out Model model;
+
@In
User user;
@@ -62,10 +63,9 @@
new SelectItem(Sex.FEMALE, "Female")
};
-
public void clickUserListener(ActionEvent event) {
- conversationState.setMainArea(NavigationEnum.USER_PREFS);
- conversationState.setSelectedUser(user);
+ Events.instance().raiseEvent(Constants.UPDATE_MAIN_AREA_EVENT,
NavigationEnum.USER_PREFS);
+ model.setSelectedUser(user);
}
public void uploadAvatar(UploadEvent event) {
@@ -74,7 +74,7 @@
}
public void saveUser(ActionEvent event)throws IOException {
- User user = conversationState.getSelectedUser();
+ User user = model.getSelectedUser();
if (avatarData != null) {
String fileName = uploadRoot +
(uploadRoot.endsWith(Constants.SLASH) ? "" : Constants.SLASH) +
@@ -128,6 +128,4 @@
public void setAvatarData(File avatarData) {
this.avatarData = avatarData;
}
-
-
}
Copied:
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/util/Controller.java
(from rev 12910,
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/util/ConversationState.java)
===================================================================
---
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/util/Controller.java
(rev 0)
+++
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/util/Controller.java 2009-03-11
10:54:51 UTC (rev 12915)
@@ -0,0 +1,171 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+package org.richfaces.realworld.util;
+
+import java.io.Serializable;
+import java.util.Map;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+
+import org.jboss.seam.ScopeType;
+import org.jboss.seam.annotations.In;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Out;
+import org.jboss.seam.annotations.Scope;
+import org.jboss.seam.annotations.Synchronized;
+import org.jboss.seam.core.Events;
+import org.richfaces.component.UIDatascroller;
+import org.richfaces.realworld.domain.Album;
+import org.richfaces.realworld.domain.Image;
+import org.richfaces.realworld.domain.Shelf;
+import org.richfaces.realworld.domain.User;
+import org.richfaces.realworld.navigation.NavigationEnum;
+import org.richfaces.realworld.service.Constants;
+
+@Name("controller")
+(a)Scope(ScopeType.CONVERSATION)
+@Synchronized(timeout=200000)
+public class Controller implements Serializable{
+
+ private static final long serialVersionUID = 5656562187249324512L;
+
+ @In("#{messages['acess_not_granted']}")
+ private String HAVENT_ACCESS;
+
+ @In @Out Model model;
+
+ @In(create=true)
+ private User user;
+
+ public void selectShelfs(){
+ model.resetModel(NavigationEnum.ALL_SHELFS, user, null, null, null, null );
+ }
+
+ public void selectAlbums(){
+ model.resetModel(NavigationEnum.ALL_ALBUMS, user, null, null, null, null );
+ }
+
+ public void selectImages(){
+ model.resetModel(NavigationEnum.ALL_IMAGES, user, null, null, null, null );
+ }
+
+ public void incrementSlideShowIndex(){
+ Integer index = model.getSelectedAlbum().getIndex(model.getSelectedImage());
+ if(index == -1){
+ if(model.getSelectedAlbum().getImages() != null &&
model.getSelectedAlbum().getImages().size() > 1){
+ index =
model.getSelectedAlbum().getIndex(model.getSelectedAlbum().getImages().get(1));
+ }else{
+ pushEvent("stopSlideshow");
+ return;
+ }
+ }
+ updateDataScroller(index, Constants.DATASCROLLER2_ID);
+ if(index == model.getSelectedAlbum().getImages().size() - 1){
+ index=-1;
+ }
+ model.setSelectedImageIndex(index+1);
+ model.setSelectedImage(model.getSelectedAlbum().getImages().get(index + 1));
+ }
+
+ public void startEditShelf(Shelf shelf){
+ if(!canViewShelf(shelf)){
+ pushEvent(Constants.ADD_ERROR_EVENT, new Exception(HAVENT_ACCESS));
+ return;
+ }
+ model.setMainArea(NavigationEnum.SHELF_EDIT);
+ }
+
+ public void cancelEditShelf(Shelf shelf){
+ model.setMainArea(NavigationEnum.SHELF_PREVIEW);
+ }
+
+ public void showAlbum(Album album){
+ if(!canViewAlbum(album)){
+ pushEvent(Constants.ADD_ERROR_EVENT, new Exception(HAVENT_ACCESS));
+ return;
+ }
+ model.resetModel(NavigationEnum.ALBUM_PREVIEW, album.getOwner(), album.getShelf(),
album, null, null );
+ }
+
+ public void showImage(Image image){
+ if(!canViewImage(image)){
+ pushEvent(Constants.ADD_ERROR_EVENT, new Exception(HAVENT_ACCESS));
+ return;
+ }
+ model.resetModel(NavigationEnum.ALBUM_IMAGE_PREVIEW, image.getAlbum().getOwner(),
image.getAlbum().getShelf(), image.getAlbum(), null, null );
+ model.setSelectedImage(image);
+ Integer index = model.getSelectedAlbum().getIndex(model.getSelectedImage());
+ updateDataScroller(index, Constants.DATASCROLLER_ID);
+ model.setSelectedImageIndex(index+1);
+ }
+
+ public void startEditImage(Image image){
+ if(!canViewImage(image)){
+ pushEvent(Constants.ADD_ERROR_EVENT, new Exception(HAVENT_ACCESS));
+ return;
+ }
+ model.setMainArea(NavigationEnum.ALBUM_IMAGE_EDIT);
+ }
+
+ public void cancelEditImage(Image image){
+ model.setMainArea(NavigationEnum.ALBUM_IMAGE_PREVIEW);
+ }
+
+ public void startEditAlbum(Album album){
+ if(album.getOwner().equals(user)){
+ pushEvent(Constants.ADD_ERROR_EVENT, new Exception(HAVENT_ACCESS));
+ return;
+ }
+ model.setMainArea(NavigationEnum.ALBUM_EDIT);
+ }
+
+ public void cancelEditAlbum(Album album){
+ model.setMainArea(NavigationEnum.ALBUM_PREVIEW);
+ }
+
+ public void showFileUpload(){
+ model.setMainArea(NavigationEnum.FILE_UPLOAD);
+ }
+
+ private void updateDataScroller(Integer index, String dataScrollerId) {
+ UIComponent component = FacesContext.getCurrentInstance().getViewRoot();
+ UIDatascroller scroller = (UIDatascroller)component.findComponent(dataScrollerId);
+ Map<String, Object> attributes = scroller.getDataTable().getAttributes();
+ attributes.put(UIDatascroller.SCROLLER_STATE_ATTRIBUTE, index+1);
+ }
+
+ private boolean canViewShelf(Shelf shelf) {
+ return shelf.isShared() || shelf.getOwner().equals(user);
+ }
+
+ private boolean canViewImage(Image image) {
+ return image.getAlbum().getShelf().isShared() ||
image.getAlbum().getOwner().equals(user);
+ }
+
+ private boolean canViewAlbum(Album album) {
+ return album.getShelf().isShared() || album.getOwner().equals(user);
+ }
+
+ private void pushEvent(String type, Object... parameters) {
+ Events.instance().raiseEvent(type, parameters);
+ }
+}
\ No newline at end of file
Added:
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/util/Model.java
===================================================================
---
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/util/Model.java
(rev 0)
+++
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/util/Model.java 2009-03-11
10:54:51 UTC (rev 12915)
@@ -0,0 +1,99 @@
+package org.richfaces.realworld.util;
+
+import org.jboss.seam.ScopeType;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Observer;
+import org.jboss.seam.annotations.Scope;
+import org.richfaces.realworld.domain.Album;
+import org.richfaces.realworld.domain.Image;
+import org.richfaces.realworld.domain.MetaTag;
+import org.richfaces.realworld.domain.Shelf;
+import org.richfaces.realworld.domain.User;
+import org.richfaces.realworld.navigation.NavigationEnum;
+import org.richfaces.realworld.service.Constants;
+
+@Name("model")
+(a)Scope(ScopeType.CONVERSATION)
+public class Model {
+
+private Integer selectedImageIndex = 1;
+
+ private Image selectedImage;
+
+ private Album selectedAlbum;
+
+ private User selectedUser;
+
+ private Shelf selectedShelf;
+
+ private MetaTag selectedTag;
+
+ private NavigationEnum mainArea;
+
+ public void resetModel(NavigationEnum mainArea, User selectedUser, Shelf selectedShelf,
Album selectedAlbum, Image selectedImage, MetaTag selectedTag){
+ this.setMainArea(mainArea);
+ this.setSelectedAlbum(selectedAlbum);
+ this.setSelectedImage(selectedImage);
+ this.setSelectedShelf(selectedShelf);
+ this.setSelectedTag(selectedTag);
+ this.setSelectedUser(selectedUser);
+ }
+
+ @Observer(Constants.UPDATE_MAIN_AREA_EVENT)
+ public void setMainArea(NavigationEnum mainArea) {
+ this.mainArea = mainArea;
+ }
+
+ public Integer getSelectedImageIndex() {
+ return selectedImageIndex;
+ }
+
+ public NavigationEnum getMainArea() {
+ return mainArea;
+ }
+
+ public void setSelectedImageIndex(Integer selectedImageIndex) {
+ this.selectedImageIndex = selectedImageIndex;
+ }
+
+ public Image getSelectedImage() {
+ return selectedImage;
+ }
+
+ public void setSelectedImage(Image selectedImage) {
+ this.selectedImage = selectedImage;
+ }
+
+ public Album getSelectedAlbum() {
+ return selectedAlbum;
+ }
+
+ public void setSelectedAlbum(Album selectedAlbum) {
+ this.selectedAlbum = selectedAlbum;
+ }
+
+ public User getSelectedUser() {
+ return selectedUser;
+ }
+
+ public void setSelectedUser(User selectedUser) {
+ this.selectedUser = selectedUser;
+ }
+
+ public Shelf getSelectedShelf() {
+ return selectedShelf;
+ }
+
+ public void setSelectedShelf(Shelf selectedShelf) {
+ this.selectedShelf = selectedShelf;
+ }
+
+ public MetaTag getSelectedTag() {
+ return selectedTag;
+ }
+
+ @Observer("updateSelectedTag")
+ public void setSelectedTag(MetaTag selectedTag) {
+ this.selectedTag = selectedTag;
+ }
+}
Property changes on:
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/util/Model.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Modified:
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/util/RenderLogic.java
===================================================================
---
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/util/RenderLogic.java 2009-03-11
10:50:56 UTC (rev 12914)
+++
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/util/RenderLogic.java 2009-03-11
10:54:51 UTC (rev 12915)
@@ -28,9 +28,7 @@
import org.jboss.seam.annotations.Scope;
import org.jboss.seam.security.Identity;
import org.richfaces.realworld.domain.Album;
-import org.richfaces.realworld.domain.Image;
import org.richfaces.realworld.domain.User;
-import org.richfaces.realworld.navigation.NavigationEnum;
import org.richfaces.realworld.service.Constants;
@Name("renderLogic")
@@ -39,69 +37,15 @@
@In User user;
@In Identity identity;
- @In ConversationState conversationState;
private static final long serialVersionUID = 5656562187249324512L;
- public boolean shouldRenderShelf(){
- return conversationState.getSelectedUser()!=null &&
conversationState.getSelectedImage() == null &&
conversationState.getSelectedShelf() != null &&
conversationState.getSelectedAlbum() == null;
- }
-
- public boolean shouldRenderShelfs(){
- return conversationState.getSelectedUser()!=null &&
conversationState.getSelectedImage() == null &&
conversationState.getSelectedShelf() == null;
- }
-
- public boolean shouldRenderImage(){
- return conversationState.getSelectedAlbum()!=null &&
conversationState.getSelectedImage() != null;
- }
-
- public boolean shouldRenderImageList(){
- return conversationState.getSelectedAlbum()!=null &&
conversationState.getSelectedImage() == null;
- }
-
- public boolean isCurrentUserProfileSelected(){
- return user.equals(conversationState.getSelectedUser());
- }
-
- public boolean isSecondUserProfileSelected(){
- return conversationState.getSecondSelectedUser() != null;
- }
-
- public boolean isUserAlbumSelected(){
- return conversationState.getSelectedAlbum() != null &&
conversationState.getSelectedAlbum().getOwner().equals(user);
- }
-
public boolean isUserGuest(){
return !identity.hasRole(Constants.ADMIN_ROLE);
}
- public boolean isOwner(User u){
- return user.equals(u);
- }
-
- public boolean isProfileSelected(){
- return conversationState.getMainArea() == NavigationEnum.USER_PREFS;
- }
-
- public boolean shouldRenderFileUpload(){
- return conversationState.getSelectedAlbum()!=null &&
conversationState.getSelectedAlbum().getOwner().equals(user);
- }
-
- public boolean isUserSelected(){
- return user.equals(conversationState.getSelectedUser());
- }
-
-
- public boolean isAlbumSelected(){
- return conversationState.getSelectedAlbum() != null;
- }
-
- public boolean isImageSelected(){
- return conversationState.getSelectedImage() != null;
- }
-
public boolean isAccessToAlbumGranted(Album album){
- return album.getOwner().equals(user) || album.isShared();
+ return album.getOwner().equals(user) || album.getShelf().isShared();
}
public boolean isUserAlbum(Album album){
@@ -110,13 +54,4 @@
}
return album.getOwner().equals(user);
}
-
- public boolean isFavoriteAlbum(Album album){
- return user.getFavoriteAlbums().contains(album);
- }
-
- public boolean isFavoriteImage(Image image){
- return user.getFavoriteImages().contains(image);
- }
-
}
Added:
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/util/TreeManager.java
===================================================================
---
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/util/TreeManager.java
(rev 0)
+++
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/util/TreeManager.java 2009-03-11
10:54:51 UTC (rev 12915)
@@ -0,0 +1,69 @@
+package org.richfaces.realworld.util;
+
+import java.io.Serializable;
+
+import org.jboss.seam.ScopeType;
+import org.jboss.seam.annotations.In;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Out;
+import org.jboss.seam.annotations.Scope;
+import org.jboss.seam.core.Events;
+import org.richfaces.component.UITree;
+import org.richfaces.component.html.HtmlTree;
+import org.richfaces.event.NodeSelectedEvent;
+import org.richfaces.realworld.domain.Album;
+import org.richfaces.realworld.domain.Shelf;
+import org.richfaces.realworld.domain.User;
+import org.richfaces.realworld.navigation.NavigationEnum;
+import org.richfaces.realworld.service.Constants;
+
+@Name("treeManager")
+(a)Scope(ScopeType.CONVERSATION)
+public class TreeManager implements Serializable{
+
+ @In
+ private User user;
+ @In @Out Model model;
+ private static final long serialVersionUID = 5656562187249324512L;
+
+ @SuppressWarnings("unchecked")
+ public Boolean adviseNodeSelected(UITree tree) {
+ Object currentNode = tree.getRowData();
+ if (currentNode instanceof Album) {
+ boolean selected = currentNode == model.getSelectedAlbum();
+ return selected;
+ }else if(currentNode instanceof Shelf){
+ return currentNode == model.getSelectedShelf() && model.getSelectedAlbum() ==
null;
+ }
+ return null;
+ }
+
+ @SuppressWarnings("unchecked")
+ public Boolean adviseNodeOpened(UITree tree) {
+ Object currentNode = tree.getRowData();
+ if (currentNode instanceof Album) {
+ boolean selected = currentNode == model.getSelectedAlbum();
+ return selected;
+ }else if(currentNode instanceof Shelf){
+ return currentNode == model.getSelectedShelf();
+ }
+ return null;
+ }
+
+ @SuppressWarnings("unchecked")
+ public void processSelection(NodeSelectedEvent event) {
+ HtmlTree tree = (HtmlTree) event.getComponent();
+ Object currentNode = tree.getRowData();
+ if(currentNode instanceof Album){
+ Events.instance().raiseEvent(Constants.UPDATE_MAIN_AREA_EVENT,
NavigationEnum.ALBUM_PREVIEW);
+ model.setSelectedAlbum((Album)currentNode);
+ model.setSelectedShelf(((Album)currentNode).getShelf());
+ }else if(currentNode instanceof Shelf){
+ Events.instance().raiseEvent(Constants.UPDATE_MAIN_AREA_EVENT,
NavigationEnum.SHELF_PREVIEW);
+ model.setSelectedAlbum(null);
+ model.setSelectedShelf((Shelf)currentNode);
+ }
+ model.setSelectedUser(user);
+ model.setSelectedImage(null);
+ }
+}
Property changes on:
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/util/TreeManager.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Modified:
trunk/test-applications/realworld2/web/src/main/resources/messages_en.properties
===================================================================
---
trunk/test-applications/realworld2/web/src/main/resources/messages_en.properties 2009-03-11
10:50:56 UTC (rev 12914)
+++
trunk/test-applications/realworld2/web/src/main/resources/messages_en.properties 2009-03-11
10:54:51 UTC (rev 12915)
@@ -90,7 +90,7 @@
error=Error
errorStub=Something bad happened :-(
-fileUpload.header=You will upload files in album:
#{conversationState.selectedAlbum.name}. If you want upload in another album, select it.
+fileUpload.header=You will upload files in album: #{model.selectedAlbum.name}. If you
want upload in another album, select it.
fileUpload.header2=Choose album:
fileUpload.uploadedPanelHeader=Uploaded Files Info
fileUpload.fileNameLabel=File Name:
@@ -101,7 +101,7 @@
fileUpload.clearLabel=Clear Uploaded Data
fileUpload.clearSelectedLabel=Clear Selected
-comment.label=View comments(#{conversationState.selectedImage.comments.size})
+comment.label=View comments(#{model.selectedImage.comments.size})
comment.author=Author: #{comment.author.login}
comment.askForFriend=Ask for friendship
comment.askForFriend.message=Please, add me to your friends
@@ -157,9 +157,9 @@
scroller.last=Last
scroller.prev=Prev
scroller.next=Next
-scroller.pager=Image #{conversationState.selectedImageIndex} of
#{conversationState.selectedAlbum.images.size}
+scroller.pager=Image #{model.selectedImageIndex} of #{model.selectedAlbum.images.size}
-image.panelHeader=Image Preview: Selected Album: #{conversationState.selectedAlbum.name}
+image.panelHeader=Image Preview: Selected Album: #{model.selectedAlbum.name}
image.delete=Delete
image.delete.confirm=Are you sure? Click OK to proceed, else click Cancel.
image.edit=Edit Properties
Modified:
trunk/test-applications/realworld2/web/src/main/resources/messages_ru.properties
===================================================================
---
trunk/test-applications/realworld2/web/src/main/resources/messages_ru.properties 2009-03-11
10:50:56 UTC (rev 12914)
+++
trunk/test-applications/realworld2/web/src/main/resources/messages_ru.properties 2009-03-11
10:54:51 UTC (rev 12915)
@@ -31,7 +31,7 @@
error=\u041E\u0448\u0438\u0431\u043A\u0430
errorStub=\u0421\u043B\u0443\u0447\u0438\u043B\u043E\u0441\u044C
\u0447\u0442\u043E-\u0442\u043E
\u043D\u0435\u043F\u0440\u0435\u0434\u0432\u0438\u0434\u0435\u043D\u043D\u043E\u0435 \:-(
-fileUpload.header=\u0412\u0430\u0448\u0438 \u0444\u0430\u0439\u043B\u044B
\u0431\u0443\u0434\u0443\u0442 \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043D\u044B
\u0432 \u0430\u043B\u044C\u0431\u043E\u043C\: \#{conversationState.selectedAlbum.name}.
\u0415\u0441\u043B\u0438 \u0432\u044B \u0445\u043E\u0442\u0438\u0442\u0435
\u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044C \u0438\u0445 \u0432
\u0434\u0440\u0443\u0433\u043E\u0439 \u0430\u043B\u044C\u0431\u043E\u043C,
\u0432\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0435\u0433\u043E.
+fileUpload.header=\u0412\u0430\u0448\u0438 \u0444\u0430\u0439\u043B\u044B
\u0431\u0443\u0434\u0443\u0442 \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043D\u044B
\u0432 \u0430\u043B\u044C\u0431\u043E\u043C\: \#{model.selectedAlbum.name}.
\u0415\u0441\u043B\u0438 \u0432\u044B \u0445\u043E\u0442\u0438\u0442\u0435
\u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044C \u0438\u0445 \u0432
\u0434\u0440\u0443\u0433\u043E\u0439 \u0430\u043B\u044C\u0431\u043E\u043C,
\u0432\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0435\u0433\u043E.
fileUpload.header2=\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435
\u0430\u043B\u044C\u0431\u043E\u043C\:
fileUpload.uploadedPanelHeader=\u0418\u043D\u0444\u043E\u0440\u043C\u0430\u0446\u0438\u044F
\u043E \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043D\u043D\u044B\u0445
\u0444\u0430\u0439\u043B\u0430\u0445
fileUpload.fileNameLabel=\u0418\u043C\u044F \u0444\u0430\u0439\u043B\u0430\:
@@ -42,7 +42,7 @@
fileUpload.clearLabel=\u041E\u0447\u0438\u0441\u0442\u0438\u0442\u044C
\u0432\u0441\u0435
fileUpload.clearSelectedLabel=\u041E\u0447\u0438\u0441\u0442\u0438\u0442\u044C
\u0432\u044B\u0434\u0435\u043B\u0435\u043D\u043D\u044B\u0435
-comment.label=\u041A\u043E\u043C\u043C\u0435\u043D\u0442\u0430\u0440\u0438\u0438
(\#{conversationState.selectedImage.comments.size})
+comment.label=\u041A\u043E\u043C\u043C\u0435\u043D\u0442\u0430\u0440\u0438\u0438
(\#{model.selectedImage.comments.size})
comment.author=\u0410\u0432\u0442\u043E\u0440\: \#{comment.author.login}
comment.askForFriend=\u0417\u0430\u043F\u0440\u043E\u0441 \u043D\u0430
\u0434\u0440\u0443\u0436\u0431\u0443
comment.askForFriend.message=\u041F\u043E\u0436\u0430\u043B\u0443\u0439\u0441\u0442\u0430,
\u0434\u043E\u0431\u0430\u0432\u044C\u0442\u0435 \u043C\u0435\u043D\u044F \u0432
\u0441\u043F\u0438\u0441\u043E\u043A \u0432\u0430\u0448\u0438\u0445
\u0434\u0440\u0443\u0437\u0435\u0439.
@@ -97,9 +97,9 @@
scroller.last=\u041F\u043E\u0441\u043B\u0435\u0434\u043D\u044F\u044F
scroller.prev=\u041F\u0440\u0435\u0434\u044B\u0434\u0443\u0449\u0430\u044F
scroller.next=\u0421\u043B\u0435\u0434\u0443\u044E\u0449\u0430\u044F
-scroller.pager=\u0418\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0435
\#{conversationState.selectedImageIndex} \u0438\u0437
\#{conversationState.selectedAlbum.images.size}
+scroller.pager=\u0418\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0435
\#{model.selectedImageIndex} \u0438\u0437 \#{model.selectedAlbum.images.size}
-image.panelHeader=\u041F\u0440\u043E\u0441\u043C\u043E\u0442\u0440
\u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0439\:
\u0412\u044B\u0431\u0440\u0430\u043D\u043D\u044B\u0439
\u0430\u043B\u044C\u0431\u043E\u043C\: \#{conversationState.selectedAlbum.name}
+image.panelHeader=\u041F\u0440\u043E\u0441\u043C\u043E\u0442\u0440
\u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0439\:
\u0412\u044B\u0431\u0440\u0430\u043D\u043D\u044B\u0439
\u0430\u043B\u044C\u0431\u043E\u043C\: \#{model.selectedAlbum.name}
image.delete=\u0423\u0434\u0430\u043B\u0438\u0442\u044C
image.delete.confirm=\u0412\u044B \u0443\u0432\u0435\u0440\u0435\u043D\u044B?
image.edit=\u0420\u0435\u0434\u0430\u043A\u0442\u0438\u0440\u043E\u0432\u0430\u0442\u044C
\u0441\u0432\u043E\u0439\u0441\u0442\u0432\u0430
Modified: trunk/test-applications/realworld2/web/src/main/webapp/Thumbs.db
===================================================================
(Binary files differ)
Modified:
trunk/test-applications/realworld2/web/src/main/webapp/WEB-INF/tags/realWorld-taglib.xml
===================================================================
---
trunk/test-applications/realworld2/web/src/main/webapp/WEB-INF/tags/realWorld-taglib.xml 2009-03-11
10:50:56 UTC (rev 12914)
+++
trunk/test-applications/realworld2/web/src/main/webapp/WEB-INF/tags/realWorld-taglib.xml 2009-03-11
10:54:51 UTC (rev 12915)
@@ -16,14 +16,6 @@
<tag-name>confirm</tag-name>
<source>templates/confirmation.xhtml</source>
</tag>
- <tag>
- <tag-name>image</tag-name>
- <source>templates/image.xhtml</source>
- </tag>
- <tag>
- <tag-name>linkPanel</tag-name>
- <source>templates/linkPanel.xhtml</source>
- </tag>
<function>
<function-name>rectangle</function-name>
<function-class>org.richfaces.realworld.util.Functions</function-class>
Deleted:
trunk/test-applications/realworld2/web/src/main/webapp/WEB-INF/tags/templates/image.xhtml
===================================================================
(Binary files differ)
Deleted:
trunk/test-applications/realworld2/web/src/main/webapp/WEB-INF/tags/templates/linkPanel.xhtml
===================================================================
(Binary files differ)
Modified: trunk/test-applications/realworld2/web/src/main/webapp/WEB-INF/web.xml
===================================================================
--- trunk/test-applications/realworld2/web/src/main/webapp/WEB-INF/web.xml 2009-03-11
10:50:56 UTC (rev 12914)
+++ trunk/test-applications/realworld2/web/src/main/webapp/WEB-INF/web.xml 2009-03-11
10:54:51 UTC (rev 12915)
@@ -111,16 +111,6 @@
<url-pattern>*.seam</url-pattern>
</servlet-mapping>
- <servlet>
- <servlet-name>Picture Servlet</servlet-name>
- <servlet-class>org.richfaces.realworld.servlet.PictureServlet</servlet-class>
- <load-on-startup>2</load-on-startup>
- </servlet>
- <servlet-mapping>
- <servlet-name>Picture Servlet</servlet-name>
- <url-pattern>/picture/*</url-pattern>
- </servlet-mapping>
-
<security-constraint>
<display-name>Restrict raw XHTML Documents</display-name>
<web-resource-collection>
Modified: trunk/test-applications/realworld2/web/src/main/webapp/img/Thumbs.db
===================================================================
(Binary files differ)
Deleted: trunk/test-applications/realworld2/web/src/main/webapp/img/dtpick.gif
===================================================================
(Binary files differ)
Deleted: trunk/test-applications/realworld2/web/src/main/webapp/img/error.gif
===================================================================
(Binary files differ)
Deleted: trunk/test-applications/realworld2/web/src/main/webapp/img/folder.jpg
===================================================================
(Binary files differ)
Deleted: trunk/test-applications/realworld2/web/src/main/webapp/img/gb.png
===================================================================
(Binary files differ)
Deleted: trunk/test-applications/realworld2/web/src/main/webapp/img/locked.jpg
===================================================================
(Binary files differ)
Deleted: trunk/test-applications/realworld2/web/src/main/webapp/img/logo.gif
===================================================================
(Binary files differ)
Deleted: trunk/test-applications/realworld2/web/src/main/webapp/img/ru.png
===================================================================
(Binary files differ)
Deleted: trunk/test-applications/realworld2/web/src/main/webapp/img/tree/disc.gif
===================================================================
(Binary files differ)
Deleted: trunk/test-applications/realworld2/web/src/main/webapp/img/tree/singer.gif
===================================================================
(Binary files differ)
Deleted: trunk/test-applications/realworld2/web/src/main/webapp/img/tree/song.gif
===================================================================
(Binary files differ)
Modified:
trunk/test-applications/realworld2/web/src/main/webapp/includes/album/userAlbumEditBlock.xhtml
===================================================================
(Binary files differ)
Modified:
trunk/test-applications/realworld2/web/src/main/webapp/includes/album/userAlbumsPreview.xhtml
===================================================================
(Binary files differ)
Modified:
trunk/test-applications/realworld2/web/src/main/webapp/includes/contextMenu/CMForAlbum.xhtml
===================================================================
(Binary files differ)
Modified:
trunk/test-applications/realworld2/web/src/main/webapp/includes/contextMenu/CMForImage.xhtml
===================================================================
(Binary files differ)
Modified:
trunk/test-applications/realworld2/web/src/main/webapp/includes/contextMenu/CMForShelf.xhtml
===================================================================
(Binary files differ)
Modified:
trunk/test-applications/realworld2/web/src/main/webapp/includes/contextMenu/CMForUser.xhtml
===================================================================
(Binary files differ)
Modified:
trunk/test-applications/realworld2/web/src/main/webapp/includes/fileUpload/fileUploader.xhtml
===================================================================
(Binary files differ)
Modified:
trunk/test-applications/realworld2/web/src/main/webapp/includes/fileUpload/multyMode.xhtml
===================================================================
(Binary files differ)
Deleted:
trunk/test-applications/realworld2/web/src/main/webapp/includes/image/breadCrumb.xhtml
===================================================================
(Binary files differ)
Deleted:
trunk/test-applications/realworld2/web/src/main/webapp/includes/image/comments.xhtml
===================================================================
(Binary files differ)
Modified:
trunk/test-applications/realworld2/web/src/main/webapp/includes/image/imagePreview.xhtml
===================================================================
(Binary files differ)
Deleted:
trunk/test-applications/realworld2/web/src/main/webapp/includes/image/imageScroller.xhtml
===================================================================
(Binary files differ)
Modified:
trunk/test-applications/realworld2/web/src/main/webapp/includes/image/mainImage.xhtml
===================================================================
(Binary files differ)
Modified:
trunk/test-applications/realworld2/web/src/main/webapp/includes/image/shelf.xhtml
===================================================================
(Binary files differ)
Modified:
trunk/test-applications/realworld2/web/src/main/webapp/includes/image/shelfs.xhtml
===================================================================
(Binary files differ)
Modified:
trunk/test-applications/realworld2/web/src/main/webapp/includes/image/slideshow.xhtml
===================================================================
(Binary files differ)
Modified:
trunk/test-applications/realworld2/web/src/main/webapp/includes/image/userImageEditBlock.xhtml
===================================================================
(Binary files differ)
Modified:
trunk/test-applications/realworld2/web/src/main/webapp/includes/image/userImageMainBlock.xhtml
===================================================================
(Binary files differ)
Modified:
trunk/test-applications/realworld2/web/src/main/webapp/includes/image/userImagePreviewBlock.xhtml
===================================================================
(Binary files differ)
Modified:
trunk/test-applications/realworld2/web/src/main/webapp/includes/image/userImagesPreview.xhtml
===================================================================
(Binary files differ)
Deleted:
trunk/test-applications/realworld2/web/src/main/webapp/includes/imagePreview-backup.xhtml
===================================================================
(Binary files differ)
Deleted:
trunk/test-applications/realworld2/web/src/main/webapp/includes/imagePreview.xhtml
===================================================================
(Binary files differ)
Modified:
trunk/test-applications/realworld2/web/src/main/webapp/includes/misc/modalPanels.xhtml
===================================================================
(Binary files differ)
Modified:
trunk/test-applications/realworld2/web/src/main/webapp/includes/misc/slideShowPooler.xhtml
===================================================================
(Binary files differ)
Deleted:
trunk/test-applications/realworld2/web/src/main/webapp/includes/news/recent.xhtml
===================================================================
(Binary files differ)
Deleted:
trunk/test-applications/realworld2/web/src/main/webapp/includes/panelBar/favoriteAlbums.xhtml
===================================================================
(Binary files differ)
Modified:
trunk/test-applications/realworld2/web/src/main/webapp/includes/search/result/albumsResult.xhtml
===================================================================
---
trunk/test-applications/realworld2/web/src/main/webapp/includes/search/result/albumsResult.xhtml 2009-03-11
10:50:56 UTC (rev 12914)
+++
trunk/test-applications/realworld2/web/src/main/webapp/includes/search/result/albumsResult.xhtml 2009-03-11
10:54:51 UTC (rev 12915)
@@ -11,16 +11,16 @@
<h:panelGrid id="grid" columns="1">
<h:panelGroup id="group">
<a4j:commandLink
- action="#{conversationState.setMainArea(navigationHelper.navigationEnumImagePreview)}"
- actionListener="#{conversationState.setSelectedAlbum(album)}"
+ action="#{model.setMainArea(navigationHelper.navigationEnumImagePreview)}"
+ actionListener="#{model.setSelectedAlbum(album)}"
reRender="mainArea, tree">
<h:graphicImage
style="width:100px;height:100px" id="image"
value="/img/folder.jpg" />
</a4j:commandLink>
</h:panelGroup>
<a4j:commandLink
- action="#{conversationState.setMainArea(navigationHelper.navigationEnumImagePreview)}"
- actionListener="#{conversationState.setSelectedAlbum(album)}"
+ action="#{model.setMainArea(navigationHelper.navigationEnumImagePreview)}"
+ actionListener="#{model.setSelectedAlbum(album)}"
reRender="mainArea, tree" value="#{album.name}">
</a4j:commandLink>
</h:panelGrid>
Modified:
trunk/test-applications/realworld2/web/src/main/webapp/includes/search/result/imageResult.xhtml
===================================================================
---
trunk/test-applications/realworld2/web/src/main/webapp/includes/search/result/imageResult.xhtml 2009-03-11
10:50:56 UTC (rev 12914)
+++
trunk/test-applications/realworld2/web/src/main/webapp/includes/search/result/imageResult.xhtml 2009-03-11
10:54:51 UTC (rev 12915)
@@ -10,7 +10,7 @@
<tr>
<td style="text-align: center;vertical-align: middle; background:
white;border: 1px solid #909090">
<a4j:commandLink
- actionListener="#{conversationState.updateSelectedItems(item)}"
+ actionListener="#{controller.showImage(item)}"
reRender="mainArea">
<a4j:mediaOutput element="img"
createContent="#{imageLoader.paintImage}"
styleClass="all-images"
Modified:
trunk/test-applications/realworld2/web/src/main/webapp/includes/shelf/userShelfEditBlock.xhtml
===================================================================
(Binary files differ)
Modified:
trunk/test-applications/realworld2/web/src/main/webapp/includes/shelf/userShelfPreview.xhtml
===================================================================
(Binary files differ)
Modified: trunk/test-applications/realworld2/web/src/main/webapp/includes/tag.xhtml
===================================================================
(Binary files differ)
Modified: trunk/test-applications/realworld2/web/src/main/webapp/includes/userAlbum.xhtml
===================================================================
(Binary files differ)
Modified:
trunk/test-applications/realworld2/web/src/main/webapp/includes/userAlbumEdit.xhtml
===================================================================
(Binary files differ)
Modified:
trunk/test-applications/realworld2/web/src/main/webapp/includes/userImages.xhtml
===================================================================
(Binary files differ)
Deleted:
trunk/test-applications/realworld2/web/src/main/webapp/includes/userPrefs/loginPrefsTab.xhtml
===================================================================
(Binary files differ)
Modified: trunk/test-applications/realworld2/web/src/main/webapp/includes/userPrefs.xhtml
===================================================================
(Binary files differ)
Modified: trunk/test-applications/realworld2/web/src/main/webapp/includes/userShelf.xhtml
===================================================================
(Binary files differ)
Modified:
trunk/test-applications/realworld2/web/src/main/webapp/includes/userShelfEdit.xhtml
===================================================================
(Binary files differ)
Modified: trunk/test-applications/realworld2/web/src/main/webapp/index.xhtml
===================================================================
(Binary files differ)
Deleted: trunk/test-applications/realworld2/web/src/main/webapp/layout/menu-backup.xhtml
===================================================================
(Binary files differ)
Modified: trunk/test-applications/realworld2/web/src/main/webapp/layout/menu.xhtml
===================================================================
(Binary files differ)
Deleted:
trunk/test-applications/realworld2/web/src/main/webapp/layout/panelBar-backup.xhtml
===================================================================
(Binary files differ)
Deleted: trunk/test-applications/realworld2/web/src/main/webapp/layout/panelBar.xhtml
===================================================================
(Binary files differ)
Copied: trunk/test-applications/realworld2/web/src/main/webapp/layout/panelBar.xhtml (from
rev 12865,
trunk/test-applications/realworld2/web/src/main/webapp/layout/panelBar-backup.xhtml)
===================================================================
(Binary files differ)
Deleted: trunk/test-applications/realworld2/web/src/main/webapp/layout/template.xhtml
===================================================================
(Binary files differ)
Deleted: trunk/test-applications/realworld2/web/src/main/webapp/layout/template2.xhtml
===================================================================
(Binary files differ)
Modified: trunk/test-applications/realworld2/web/src/main/webapp/layout/template3.xhtml
===================================================================
(Binary files differ)
Modified: trunk/test-applications/realworld2/web/src/main/webapp/main.xhtml
===================================================================
(Binary files differ)
Deleted: trunk/test-applications/realworld2/web/src/main/webapp/stylesheet/realworld.css
===================================================================
---
trunk/test-applications/realworld2/web/src/main/webapp/stylesheet/realworld.css 2009-03-11
10:50:56 UTC (rev 12914)
+++
trunk/test-applications/realworld2/web/src/main/webapp/stylesheet/realworld.css 2009-03-11
10:54:51 UTC (rev 12915)
@@ -1,135 +0,0 @@
-body {
- font-size: 12px;
-}
-
-header {
- width: 120px;
- height: 200px;
- border: 1px solid #FFCC00;
- padding: 5px;
- margin-top: 5px;
- margin-bottom: 5px;
-}
-
-a:active, a:link, a:visited {
- color: #0D5798;
-}
-a:hover {
- color: #8CAFCD;
-}
-
-input, textarea {
- border: 1px solid #BBBBBB;
- font-size: 10px;
- background: #F0F8FF;
- color: black;
-}
-
-input[type='submit'], input[type='button'] {
- background: #4477AA;
- color: white;
- margin: 5px;
- border-color: gray;
-}
-
-.tableControl, .actionButtons {
- width: 100%;
-}
-
-.tableControl a {
- padding-left: 10px;
-}
-
-.tableControl {
- text-align: right;
-}
-
-.footer {
- text-align: center;
- font-size: 10px;
-}
-
-.rich-table {
- width:100%;
-}
-
-h1 {
- font-family: Arial,sans-serif;
- color: #578BB8;
- font-size: 1.6em;
- margin-top: 0;
-}
-
-body {
- margin: 0px;
- font-family: Arial,sans-serif;
- color: #616161;
-}
-
-.body {
- padding: 30px;
-}
-
-.columnHeader:hover
-{
- color: #FF6600;
-}
-
-.message {
- border: 1px solid #FFCC00;
- padding: 5px;
- margin-top: 5px;
- margin-bottom: 5px;
- background-color: #F0F8FF;
- font-size: 12px;
- color: red;
-}
-
-.name {
- vertical-align: top;
- font-weight: bold;
- width: 115px;
- float: left;
- padding: 5px;
- margin-top: 3px;
- clear: left;
-}
-.value {
- float: left;
- padding: 5px;
-}
-
-.error {
- float: left;
- padding: 5px;
- color: red;
-}
-.errors {
- color: red;
- vertical-align: middle;
-}
-img.errors {
- padding-right: 5px;
-}
-.errors input {
- border: 1px solid red;
-}
-.errors textarea {
- border: 1px solid red;
-}
-
-.required {
- color: red;
- padding-left: 2px;
-}
-
-.rich-stglpanel-body {
- overflow: auto;
-}
-.top {
- vertical-align: top;
-}
-.info {
- height: 202px;
- overflow: auto;
-}