Author: amarkhel
Date: 2009-03-11 09:03:18 -0400 (Wed, 11 Mar 2009)
New Revision: 12917
Added:
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/Controller.java
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/Model.java
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/NavigationEnum.java
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/SlideshowManager.java
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/TreeManager.java
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/ui/ConfirmationPopupHelper.java
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/ui/SlideshowHelper.java
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/ui/TagCloudHelper.java
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/ui/UserPrefsHelper.java
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/util/DirectLinkHelper.java
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/util/ErrorHandlerBean.java
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/util/test.java
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/util/test2.java
Removed:
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/error/ErrorHandlerBean.java
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/slideshow/SlideshowBean.java
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/slideshow/SlideshowHelper.java
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/tagClound/TagCloudBean.java
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/DirectLink.java
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/util/ImageUtils.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/RenderLogic.java
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/util/TreeManager.java
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/FileUploadBean.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/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/search/ImageSearchHelper.java
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/image/imagePreview.xhtml
trunk/test-applications/realworld2/web/src/main/webapp/includes/image/shelf.xhtml
trunk/test-applications/realworld2/web/src/main/webapp/includes/search/result/imageResult.xhtml
trunk/test-applications/realworld2/web/src/main/webapp/includes/shelf/userShelfPreview.xhtml
trunk/test-applications/realworld2/web/src/main/webapp/layout/template3.xhtml
Log:
Deleted:
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/error/ErrorHandlerBean.java
===================================================================
---
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/error/ErrorHandlerBean.java 2009-03-11
10:56:05 UTC (rev 12916)
+++
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/error/ErrorHandlerBean.java 2009-03-11
13:03:18 UTC (rev 12917)
@@ -1,66 +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.error;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.faces.context.FacesContext;
-
-import org.ajax4jsf.context.AjaxContext;
-import org.jboss.seam.ScopeType;
-import org.jboss.seam.annotations.AutoCreate;
-import org.jboss.seam.annotations.Name;
-import org.jboss.seam.annotations.Observer;
-import org.jboss.seam.annotations.Scope;
-import org.richfaces.realworld.service.Constants;
-
-@Name("errorHandlerBean")
-(a)Scope(ScopeType.EVENT)
-@AutoCreate
-public class ErrorHandlerBean {
- private List<Exception> errors = new ArrayList<Exception>();
-
- public List<Exception> getErrors() {
- return errors;
- }
-
- public void setErrors(List<Exception> errors) {
- this.errors = errors;
- }
-
- public boolean isErrorExist(){
- return errors.size() > 0 ;
- }
-
- @Observer(Constants.CLEAR_ERROR_EVENT)
- public void clearEvents(){
- errors.clear();
- }
-
- @Observer(Constants.ADD_ERROR_EVENT)
- public void addToErrors(Exception e){
- FacesContext context = FacesContext.getCurrentInstance();
- AjaxContext ac = AjaxContext.getCurrentInstance(context);
- ac.addRenderedArea(Constants.ERROR_ID);
- errors.add(e);
- }
-}
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:56:05 UTC (rev 12916)
+++
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/fileupload/FileManager.java 2009-03-11
13:03:18 UTC (rev 12917)
@@ -150,11 +150,11 @@
public boolean addImage(String fileName, String tempFilePath) {
createDirectoryIfNotExist(fileName);
- 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);
+ writeFile(fileName, tempFilePath, _SMALL80, 80, true);
+ writeFile(fileName, tempFilePath, _SMALL120, 120, true);
+ writeFile(fileName, tempFilePath, _SMALL160, 160, true);
+ writeFile(fileName, tempFilePath, _MINI, 150, true);
+ writeFile(fileName, tempFilePath, _MEDIUM, 600, true);
return true;
}
@@ -249,7 +249,7 @@
return ret;
}
- private void writeFile(String newFileName, String fileName,String pattern, int size)
{
+ public void writeFile(String newFileName, String fileName,String pattern, int size,
boolean includeUploadRoot) {
BufferedImage bsrc =null;
try {
bsrc = bitmapToImage(fileName, "JPG");
@@ -265,7 +265,7 @@
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);
+ String dest = includeUploadRoot? this.uploadRootPath + transformPath(newFileName,
pattern) : transformPath(newFileName, pattern);
try {
imageToBitmap(bdest, dest, "JPG");
} catch (IOException ex) {
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:56:05 UTC (rev 12916)
+++
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/fileupload/FileUploadBean.java 2009-03-11
13:03:18 UTC (rev 12917)
@@ -40,9 +40,8 @@
import org.richfaces.event.UploadEvent;
import org.richfaces.model.UploadItem;
import org.richfaces.realworld.domain.Image;
-import org.richfaces.realworld.navigation.NavigationEnum;
+import org.richfaces.realworld.manager.NavigationEnum;
import org.richfaces.realworld.service.Constants;
-import org.richfaces.realworld.util.ImageUtils;
import com.drew.imaging.jpeg.JpegMetadataReader;
import com.drew.imaging.jpeg.JpegProcessingException;
@@ -92,7 +91,7 @@
file.setSelected(false);
file.setName(event.getUploadItem().getFileName());
Image image = constructImage(item, file);
- resizeImages(item,file.getFile().getPath());
+ fileManager.writeFile(file.getFile().getPath(), file.getFile().getPath(),
"_mini", 100, false);
try {
extractMetadata(file, image);
} catch (JpegProcessingException e1) {
@@ -113,10 +112,6 @@
}
}
- private void resizeImages(UploadItem src, String pathToUpload) throws IOException {
- ImageUtils.resizeImage(src, pathToUpload, ImageUtils.MINI);
- }
-
@Observer(Constants.FILE_UPLOAD_CLEAR_EVENT)
public void clearUploadData() {
fileWrapper.getFiles().clear();
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:56:05 UTC (rev 12916)
+++
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/AlbumManager.java 2009-03-11
13:03:18 UTC (rev 12917)
@@ -32,11 +32,8 @@
import org.richfaces.realworld.domain.Shelf;
import org.richfaces.realworld.domain.User;
import org.richfaces.realworld.fileupload.FileManager;
-import org.richfaces.realworld.navigation.NavigationEnum;
import org.richfaces.realworld.service.Constants;
import org.richfaces.realworld.service.IAlbumAction;
-import org.richfaces.realworld.util.Controller;
-import org.richfaces.realworld.util.Model;
@Name("albumManager")
@Scope(ScopeType.CONVERSATION)
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:56:05 UTC (rev 12916)
+++
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/Authenticator.java 2009-03-11
13:03:18 UTC (rev 12917)
@@ -44,11 +44,8 @@
import org.jboss.seam.web.Session;
import org.richfaces.realworld.domain.User;
import org.richfaces.realworld.fileupload.FileManager;
-import org.richfaces.realworld.navigation.NavigationEnum;
import org.richfaces.realworld.service.IUserAction;
import org.richfaces.realworld.ui.PasswordHolder;
-import org.richfaces.realworld.util.Controller;
-import org.richfaces.realworld.util.Model;
import org.richfaces.realworld.service.Constants;
@Name("authenticator")
Copied:
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/Controller.java
(from rev 12915,
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/manager/Controller.java
(rev 0)
+++
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/Controller.java 2009-03-11
13:03:18 UTC (rev 12917)
@@ -0,0 +1,186 @@
+/**
+ * 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.manager;
+
+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.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.resetModel(NavigationEnum.SHELF_EDIT, shelf.getOwner(), shelf, null, null, null
);
+ }
+
+ 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);
+ }
+
+ public boolean isAccessToAlbumGranted(Album album){
+ return album.getOwner().equals(user) || album.getShelf().isShared();
+ }
+
+ public boolean isUserAlbum(Album album){
+ if(album == null || album.getOwner() == null){
+ return false;
+ }
+ return album.getOwner().equals(user);
+ }
+
+ public void showUser(User user){
+ Events.instance().raiseEvent(Constants.UPDATE_MAIN_AREA_EVENT,
NavigationEnum.USER_PREFS);
+ model.setSelectedUser(user);
+ }
+
+ 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.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
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:56:05 UTC (rev 12916)
+++
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/ImageManager.java 2009-03-11
13:03:18 UTC (rev 12917)
@@ -33,11 +33,8 @@
import org.richfaces.realworld.domain.Image;
import org.richfaces.realworld.domain.User;
import org.richfaces.realworld.fileupload.FileManager;
-import org.richfaces.realworld.navigation.NavigationEnum;
import org.richfaces.realworld.service.Constants;
import org.richfaces.realworld.service.IImageAction;
-import org.richfaces.realworld.util.Controller;
-import org.richfaces.realworld.util.Model;
@Name("imageManager")
@Scope(ScopeType.CONVERSATION)
Copied:
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/Model.java
(from rev 12915,
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/manager/Model.java
(rev 0)
+++
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/Model.java 2009-03-11
13:03:18 UTC (rev 12917)
@@ -0,0 +1,98 @@
+package org.richfaces.realworld.manager;
+
+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.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;
+ }
+}
Copied:
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/NavigationEnum.java
(from rev 12909,
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/navigation/NavigationEnum.java)
===================================================================
---
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/NavigationEnum.java
(rev 0)
+++
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/NavigationEnum.java 2009-03-11
13:03:18 UTC (rev 12917)
@@ -0,0 +1,49 @@
+/**
+ * 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.manager;
+
+public enum NavigationEnum {
+ IMAGE_PREVIEW("includes/imagePreview.xhtml"),
+ ANONYM("includes/anonimShelfs.xhtml"),
+ FILE_UPLOAD("includes/fileUpload.xhtml"),
+ USER_PREFS("includes/userPrefs.xhtml"),
+ SEARCH("includes/search.xhtml"),
+ WHAT_NEW("includes/recent.xhtml"),
+ ALBUM_PREVIEW("includes/userAlbum.xhtml"),
+ ALBUM_IMAGE_PREVIEW("/includes/userImage.xhtml"),
+ SHELF_PREVIEW("/includes/userShelf.xhtml"),
+ ALL_SHELFS("/includes/userShelfs.xhtml"),
+ TAGS("includes/tag.xhtml"),
+ ALL_ALBUMS("/includes/userAlbums.xhtml"),
+ ALL_IMAGES("/includes/userImages.xhtml"),
+ ALBUM_IMAGE_EDIT("/includes/userImageEdit.xhtml"),
+ ALBUM_EDIT("/includes/userAlbumEdit.xhtml"),
+ SHELF_EDIT("/includes/userShelfEdit.xhtml");
+
+
+ private NavigationEnum(String t){
+ template=t;
+ }
+ private String template;
+ public String getTemplate() {
+ return template;
+ }
+}
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:56:05 UTC (rev 12916)
+++
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/ShelfManager.java 2009-03-11
13:03:18 UTC (rev 12917)
@@ -35,10 +35,8 @@
import org.richfaces.realworld.domain.Shelf;
import org.richfaces.realworld.domain.User;
import org.richfaces.realworld.fileupload.FileManager;
-import org.richfaces.realworld.navigation.NavigationEnum;
import org.richfaces.realworld.service.Constants;
import org.richfaces.realworld.service.IShelfAction;
-import org.richfaces.realworld.util.Model;
@Name("shelfManager")
@Scope(ScopeType.CONVERSATION)
Added:
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/SlideshowManager.java
===================================================================
---
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/SlideshowManager.java
(rev 0)
+++
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/SlideshowManager.java 2009-03-11
13:03:18 UTC (rev 12917)
@@ -0,0 +1,73 @@
+/**
+ * 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.manager;
+
+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.richfaces.realworld.service.Constants;
+import org.richfaces.realworld.ui.SlideshowHelper;
+
+@Name("slideshow")
+(a)Scope(ScopeType.CONVERSATION)
+public class SlideshowManager implements Serializable{
+
+ private static final long serialVersionUID = 7801877176558409702L;
+
+ @In(required=false) @Out(required=false)
+ SlideshowHelper slideshowHelper;
+
+ private boolean active;
+
+ private int interval = Constants.INITIAL_DELAY;
+
+ public int getInterval() {
+ return interval;
+ }
+
+ public void setInterval(int interval) {
+ this.interval = interval;
+ }
+
+ public boolean isActive() {
+ return active;
+ }
+
+ public void setActive(boolean active) {
+ this.active = active;
+ }
+
+ public void startSlideshow(){
+ active = true;
+ }
+
+ public void stopSlideshow(){
+ active = false;
+ }
+
+ public void updateInterval(){
+ this.setInterval((int)(Constants.DELAY *
Long.valueOf(slideshowHelper.getInputSlider().getValue().toString())));
+ }
+}
Property changes on:
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/SlideshowManager.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Copied:
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/TreeManager.java
(from rev 12915,
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/manager/TreeManager.java
(rev 0)
+++
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/TreeManager.java 2009-03-11
13:03:18 UTC (rev 12917)
@@ -0,0 +1,68 @@
+package org.richfaces.realworld.manager;
+
+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.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);
+ }
+}
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:56:05 UTC (rev 12916)
+++
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/search/ImageSearchHelper.java 2009-03-11
13:03:18 UTC (rev 12917)
@@ -13,10 +13,10 @@
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.manager.Controller;
+import org.richfaces.realworld.manager.NavigationEnum;
import org.richfaces.realworld.service.Constants;
import org.richfaces.realworld.service.ISearchAction;
-import org.richfaces.realworld.util.Controller;
@Name("searchImageHelper")
@Scope(ScopeType.CONVERSATION)
@@ -47,7 +47,7 @@
options.add(new SearchOptionByTag());
}
- public void search(ActionEvent event) {
+ public void search() {
Events.instance().raiseEvent(Constants.UPDATE_MAIN_AREA_EVENT, NavigationEnum.SEARCH);
Iterator<ISearchOption> it = options.iterator();
while (it.hasNext()) {
@@ -64,7 +64,7 @@
return selectedOption != null;
}
- public void processSelection(ActionEvent event) {
+ public void processSelection() {
Iterator<ISearchOption> it = options.iterator();
while (it.hasNext()) {
ISearchOption option = it.next();
@@ -75,7 +75,7 @@
}
}
- public void back(ActionEvent event) {
+ public void back() {
Iterator<ISearchOption> it = options.iterator();
while (it.hasNext()) {
it.next().setSelected(false);
Deleted:
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/slideshow/SlideshowBean.java
===================================================================
---
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/slideshow/SlideshowBean.java 2009-03-11
10:56:05 UTC (rev 12916)
+++
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/slideshow/SlideshowBean.java 2009-03-11
13:03:18 UTC (rev 12917)
@@ -1,74 +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.slideshow;
-
-import java.io.Serializable;
-
-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.service.Constants;
-
-@Name("slideshow")
-(a)Scope(ScopeType.CONVERSATION)
-public class SlideshowBean implements Serializable{
-
- private static final long serialVersionUID = 7801877176558409702L;
-
- @In(required=false) @Out(required=false)
- SlideshowHelper slideshowHelper;
-
- private boolean active;
-
- private int interval = Constants.INITIAL_DELAY;
-
- public int getInterval() {
- return interval;
- }
-
- public void setInterval(int interval) {
- this.interval = interval;
- }
-
- public boolean isActive() {
- return active;
- }
-
- public void setActive(boolean active) {
- this.active = active;
- }
-
- public void startSlideshow(ActionEvent event){
- active = true;
- }
-
- public void stopSlideshow(ActionEvent event){
- active = false;
- }
-
- public void updateInterval(ActionEvent event){
- this.setInterval((int)(Constants.DELAY *
Long.valueOf(slideshowHelper.getInputSlider().getValue().toString())));
- }
-}
Deleted:
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/slideshow/SlideshowHelper.java
===================================================================
---
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/slideshow/SlideshowHelper.java 2009-03-11
10:56:05 UTC (rev 12916)
+++
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/slideshow/SlideshowHelper.java 2009-03-11
13:03:18 UTC (rev 12917)
@@ -1,43 +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.slideshow;
-
-import org.jboss.seam.ScopeType;
-import org.jboss.seam.annotations.Name;
-import org.jboss.seam.annotations.Scope;
-import org.richfaces.component.UIInputNumberSlider;
-
-@Name("slideshowHelper")
-(a)Scope(ScopeType.EVENT)
-public class SlideshowHelper {
-
- private UIInputNumberSlider inputSlider;
-
- public UIInputNumberSlider getInputSlider() {
- return inputSlider;
- }
-
- public void setInputSlider(UIInputNumberSlider inputSlider) {
- this.inputSlider = inputSlider;
- }
-
-
-}
Deleted:
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/tagClound/TagCloudBean.java
===================================================================
---
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/tagClound/TagCloudBean.java 2009-03-11
10:56:05 UTC (rev 12916)
+++
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/tagClound/TagCloudBean.java 2009-03-11
13:03:18 UTC (rev 12917)
@@ -1,66 +0,0 @@
-/**
- *
- */
-package org.richfaces.realworld.tagClound;
-
-import java.util.HashMap;
-import java.util.Map;
-
-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.realworld.navigation.NavigationEnum;
-import org.richfaces.realworld.service.IImageAction;
-
-
-/**
- * Tag cloud backing bean
- * @author Andrey Markavtsov
- *
- */
-
-@Name("tagCloudBean")
-(a)Scope(ScopeType.CONVERSATION)
-public class TagCloudBean {
- @In(create=true) IImageAction imageAction;
- /** Min possible rank for tag */
- static final int MIN_RANK = 0;
-
- /** Max possible rank for tag */
- static final int MAX_RANK = 100;
-
- /** Scope of existed css classes for each rank. Should be defined ordered ASC by rank
*/
- static final String [] TAG_CSS_CLASSSES = new String []
- {"tag-cloud-rank1", "tag-cloud-rank2",
- "tag-cloud-rank3", "tag-cloud-rank4",
- "tag-cloud-rank5", "tag-cloud-rank6",
- "tag-cloud-rank7" } ;
-
- /** Count of possible ranks' css classes */
- static final int TAG_RANK_LEVELS_COUNT = TAG_CSS_CLASSSES.length;
-
- /** Defines the step to the neighbouring rank */
- int RANK_LEVEL_STEP = (MAX_RANK ) / TAG_RANK_LEVELS_COUNT;;
-
-
-
- /**
- * Calculates css class name for tag with rank defined
- * @param rank - tags rank
- * @return css class name
- */
- public String getTagCssClass(Integer rank) {
- int i = rank / RANK_LEVEL_STEP;
- return TAG_CSS_CLASSSES[i];
- }
-
- public void selectTag(String tag){
- Events.instance().raiseEvent("updateMainArea", NavigationEnum.TAGS);
- Events.instance().raiseEvent("updateSelectedTag",imageAction.getTagByName(tag));
- }
-}
Copied:
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/ui/ConfirmationPopupHelper.java
(from rev 12864,
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/modalpanel/ConfirmationPopupHelper.java)
===================================================================
---
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/ui/ConfirmationPopupHelper.java
(rev 0)
+++
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/ui/ConfirmationPopupHelper.java 2009-03-11
13:03:18 UTC (rev 12917)
@@ -0,0 +1,115 @@
+/**
+ * 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.ui;
+
+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.Album;
+import org.richfaces.realworld.domain.Image;
+import org.richfaces.realworld.domain.MetaTag;
+import org.richfaces.realworld.domain.Shelf;
+import org.richfaces.realworld.manager.AlbumManager;
+import org.richfaces.realworld.manager.ImageManager;
+import org.richfaces.realworld.manager.ShelfManager;
+
+@Name("confirmationPopupHelper")
+(a)Scope(ScopeType.CONVERSATION)
+public class ConfirmationPopupHelper implements Serializable{
+
+ private static final long serialVersionUID = 2561824019376412988L;
+
+ private String caption;
+
+ private String actionName;
+
+ @In(create=true, required=true) @Out(required=false)
+ private Image image;
+
+ @In(create=true, required=true) @Out(required=false)
+ private Shelf shelf;
+
+ @In(create=true, required=true) @Out(required=false)
+ private Album album;
+
+ @In(create=true)
+ private AlbumManager albumManager;
+
+ @In(create=true)
+ private ShelfManager shelfManager;
+
+ @In(create=true)
+ private ImageManager imageManager;
+
+ public void initImagePopup( String actionName, String caption, Image image){
+ this.caption = caption;
+ this.actionName = actionName;
+ this.image = image;
+ }
+
+ public void initAlbumData( String actionName, String caption, Album album){
+ this.caption = caption;
+ this.actionName = actionName;
+ this.album = album;
+ }
+
+ public void initShelfData( String actionName, String caption, Shelf shelf){
+ this.caption = caption;
+ this.actionName = actionName;
+ this.shelf = shelf;
+ }
+
+ public void deleteAlbum(){
+ albumManager.deleteAlbum(this.album);
+ }
+
+ public void deleteShelf(){
+ shelfManager.deleteShelf(this.shelf);
+ }
+
+ 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 deleteImage(){
+ imageManager.deleteImage(this.image);
+ }
+
+}
Copied:
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/ui/SlideshowHelper.java
(from rev 12864,
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/slideshow/SlideshowHelper.java)
===================================================================
---
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/ui/SlideshowHelper.java
(rev 0)
+++
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/ui/SlideshowHelper.java 2009-03-11
13:03:18 UTC (rev 12917)
@@ -0,0 +1,43 @@
+/**
+ * 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.ui;
+
+import org.jboss.seam.ScopeType;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Scope;
+import org.richfaces.component.UIInputNumberSlider;
+
+@Name("slideshowHelper")
+(a)Scope(ScopeType.EVENT)
+public class SlideshowHelper {
+
+ private UIInputNumberSlider inputSlider;
+
+ public UIInputNumberSlider getInputSlider() {
+ return inputSlider;
+ }
+
+ public void setInputSlider(UIInputNumberSlider inputSlider) {
+ this.inputSlider = inputSlider;
+ }
+
+
+}
Added:
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/ui/TagCloudHelper.java
===================================================================
---
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/ui/TagCloudHelper.java
(rev 0)
+++
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/ui/TagCloudHelper.java 2009-03-11
13:03:18 UTC (rev 12917)
@@ -0,0 +1,60 @@
+/**
+ *
+ */
+package org.richfaces.realworld.ui;
+
+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.jboss.seam.core.Events;
+import org.richfaces.realworld.manager.NavigationEnum;
+import org.richfaces.realworld.service.IImageAction;
+
+
+/**
+ * Tag cloud backing bean
+ * @author Andrey Markavtsov
+ *
+ */
+
+@Name("tagCloudBean")
+(a)Scope(ScopeType.CONVERSATION)
+public class TagCloudHelper {
+ @In(create=true) IImageAction imageAction;
+ /** Min possible rank for tag */
+ static final int MIN_RANK = 0;
+
+ /** Max possible rank for tag */
+ static final int MAX_RANK = 100;
+
+ /** Scope of existed css classes for each rank. Should be defined ordered ASC by rank
*/
+ static final String [] TAG_CSS_CLASSSES = new String []
+ {"tag-cloud-rank1", "tag-cloud-rank2",
+ "tag-cloud-rank3", "tag-cloud-rank4",
+ "tag-cloud-rank5", "tag-cloud-rank6",
+ "tag-cloud-rank7" } ;
+
+ /** Count of possible ranks' css classes */
+ static final int TAG_RANK_LEVELS_COUNT = TAG_CSS_CLASSSES.length;
+
+ /** Defines the step to the neighbouring rank */
+ int RANK_LEVEL_STEP = (MAX_RANK ) / TAG_RANK_LEVELS_COUNT;;
+
+
+
+ /**
+ * Calculates css class name for tag with rank defined
+ * @param rank - tags rank
+ * @return css class name
+ */
+ public String getTagCssClass(Integer rank) {
+ int i = rank / RANK_LEVEL_STEP;
+ return TAG_CSS_CLASSSES[i];
+ }
+
+ public void selectTag(String tag){
+ Events.instance().raiseEvent("updateMainArea", NavigationEnum.TAGS);
+ Events.instance().raiseEvent("updateSelectedTag",imageAction.getTagByName(tag));
+ }
+}
Property changes on:
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/ui/TagCloudHelper.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Added:
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/ui/UserPrefsHelper.java
===================================================================
---
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/ui/UserPrefsHelper.java
(rev 0)
+++
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/ui/UserPrefsHelper.java 2009-03-11
13:03:18 UTC (rev 12917)
@@ -0,0 +1,107 @@
+/**
+ *
+ */
+package org.richfaces.realworld.ui;
+
+import java.awt.image.BufferedImage;
+import java.io.File;
+import java.io.IOException;
+
+import javax.faces.model.SelectItem;
+
+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;
+import org.richfaces.realworld.domain.User;
+import org.richfaces.realworld.fileupload.FileManager;
+import org.richfaces.realworld.manager.Model;
+import org.richfaces.realworld.service.Constants;
+import org.richfaces.realworld.service.IUserAction;
+
+/**
+ * @author Andrey Markavtsov
+ *
+ */
+@Name("userPrefsBean")
+(a)Scope(ScopeType.CONVERSATION)
+public class UserPrefsHelper {
+
+ @In(create=true)
+ IUserAction userAction;
+
+ @In(create=true)
+ FileManager fileManager;
+
+ @In @Out Model model;
+
+ @In
+ User user;
+
+ Boolean avatarModalOpened = false;
+
+ File avatarData = null;
+
+ static final SelectItem [] sexs = new SelectItem []
+ {
+ new SelectItem(Sex.MALE, "Male"),
+ new SelectItem(Sex.FEMALE, "Female")
+ };
+
+ public void uploadAvatar(UploadEvent event) {
+ UploadItem item = event.getUploadItem();
+ avatarData = item.getFile();
+ }
+
+ public void saveUser(){
+ User user = model.getSelectedUser();
+ if (avatarData != null) {
+ try {
+ BufferedImage image = fileManager.bitmapToImage(avatarData.getPath(),"JPG"
);
+ fileManager.imageToBitmap(image, fileManager.getUploadRoot() + user.getLogin() +
+ "/avatar.jpg", "JPG");
+ } catch (IOException e) {
+ Events.instance().raiseEvent(Constants.ADD_ERROR_EVENT, new Exception("File IO
Error"));
+ }
+ avatarData.delete();
+ avatarData = null;
+ user.setHasAvatar(true);
+ }
+ userAction.updateUser(user);
+ }
+
+ public void registerUser() {
+ if (user != null) {
+ userAction.register(user);
+ }
+ }
+
+ public void cancel() {
+ avatarData = null;
+ }
+
+ public SelectItem [] getSexs () {
+ return sexs;
+ }
+
+ public Boolean getAvatarModalOpened() {
+ return avatarModalOpened;
+ }
+
+ public void setAvatarModalOpened(Boolean avatarModalOpened) {
+ this.avatarModalOpened = avatarModalOpened;
+ }
+
+ public File getAvatarData() {
+ return avatarData;
+ }
+
+ public void setAvatarData(File avatarData) {
+ this.avatarData = avatarData;
+ }
+}
Property changes on:
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/ui/UserPrefsHelper.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Deleted:
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/Controller.java 2009-03-11
10:56:05 UTC (rev 12916)
+++
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/util/Controller.java 2009-03-11
13:03:18 UTC (rev 12917)
@@ -1,171 +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.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
Deleted:
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/util/DirectLink.java
===================================================================
---
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/util/DirectLink.java 2009-03-11
10:56:05 UTC (rev 12916)
+++
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/util/DirectLink.java 2009-03-11
13:03:18 UTC (rev 12917)
@@ -1,67 +0,0 @@
-package org.richfaces.realworld.util;
-
-import java.awt.image.BufferedImage;
-import java.io.BufferedInputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-
-import javax.imageio.ImageIO;
-import javax.persistence.EntityManager;
-
-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.jboss.seam.annotations.web.RequestParameter;
-import org.jboss.seam.core.Events;
-import org.richfaces.realworld.domain.Image;
-import org.richfaces.realworld.fileupload.FileManager;
-import org.richfaces.realworld.service.Constants;
-
-@Name("directLink")
-(a)Scope(ScopeType.SESSION)
-public class DirectLink {
- @In(value="entityManager")
- protected EntityManager em;
- @In(create = true)
- FileManager fileManager;
- @RequestParameter
- protected Long imageId;
-
- private Long id;
-
- public synchronized void paintImage(OutputStream out, Object data)
- throws IOException {
- Image im = em.find(Image.class, id);
- File imageResource = fileManager.getImage(im.getPath());
- 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(""));
- 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(""));
- return;
- } finally {
- fileInputStream.close();
- bufferedInputStream.close();
- paintData.close();
- }
- }
- }
- public void start(){
- id=imageId;
- }
-}
\ No newline at end of file
Copied:
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/util/DirectLinkHelper.java
(from rev 12864,
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/util/DirectLink.java)
===================================================================
---
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/util/DirectLinkHelper.java
(rev 0)
+++
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/util/DirectLinkHelper.java 2009-03-11
13:03:18 UTC (rev 12917)
@@ -0,0 +1,67 @@
+package org.richfaces.realworld.util;
+
+import java.awt.image.BufferedImage;
+import java.io.BufferedInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+import javax.imageio.ImageIO;
+import javax.persistence.EntityManager;
+
+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.jboss.seam.annotations.web.RequestParameter;
+import org.jboss.seam.core.Events;
+import org.richfaces.realworld.domain.Image;
+import org.richfaces.realworld.fileupload.FileManager;
+import org.richfaces.realworld.service.Constants;
+
+@Name("directLink")
+(a)Scope(ScopeType.SESSION)
+public class DirectLinkHelper {
+ @In(value="entityManager")
+ protected EntityManager em;
+ @In(create = true)
+ FileManager fileManager;
+ @RequestParameter
+ protected Long imageId;
+
+ private Long id;
+
+ public synchronized void paintImage(OutputStream out, Object data)
+ throws IOException {
+ Image im = em.find(Image.class, id);
+ File imageResource = fileManager.getImage(im.getPath());
+ 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(""));
+ 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(""));
+ return;
+ } finally {
+ fileInputStream.close();
+ bufferedInputStream.close();
+ paintData.close();
+ }
+ }
+ }
+ public void start(){
+ id=imageId;
+ }
+}
\ No newline at end of file
Copied:
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/util/ErrorHandlerBean.java
(from rev 12864,
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/error/ErrorHandlerBean.java)
===================================================================
---
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/util/ErrorHandlerBean.java
(rev 0)
+++
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/util/ErrorHandlerBean.java 2009-03-11
13:03:18 UTC (rev 12917)
@@ -0,0 +1,66 @@
+/**
+ * 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.util.ArrayList;
+import java.util.List;
+
+import javax.faces.context.FacesContext;
+
+import org.ajax4jsf.context.AjaxContext;
+import org.jboss.seam.ScopeType;
+import org.jboss.seam.annotations.AutoCreate;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Observer;
+import org.jboss.seam.annotations.Scope;
+import org.richfaces.realworld.service.Constants;
+
+@Name("errorHandlerBean")
+(a)Scope(ScopeType.EVENT)
+@AutoCreate
+public class ErrorHandlerBean {
+ private List<Exception> errors = new ArrayList<Exception>();
+
+ public List<Exception> getErrors() {
+ return errors;
+ }
+
+ public void setErrors(List<Exception> errors) {
+ this.errors = errors;
+ }
+
+ public boolean isErrorExist(){
+ return errors.size() > 0 ;
+ }
+
+ @Observer(Constants.CLEAR_ERROR_EVENT)
+ public void clearEvents(){
+ errors.clear();
+ }
+
+ @Observer(Constants.ADD_ERROR_EVENT)
+ public void addToErrors(Exception e){
+ FacesContext context = FacesContext.getCurrentInstance();
+ AjaxContext ac = AjaxContext.getCurrentInstance(context);
+ ac.addRenderedArea(Constants.ERROR_ID);
+ errors.add(e);
+ }
+}
Deleted:
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/util/ImageUtils.java
===================================================================
---
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/util/ImageUtils.java 2009-03-11
10:56:05 UTC (rev 12916)
+++
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/util/ImageUtils.java 2009-03-11
13:03:18 UTC (rev 12917)
@@ -1,148 +0,0 @@
-/**
- *
- */
-package org.richfaces.realworld.util;
-
-import java.awt.Color;
-import java.awt.Dimension;
-import java.awt.Graphics2D;
-import java.awt.RenderingHints;
-import java.awt.image.BufferedImage;
-import java.io.File;
-import java.io.IOException;
-
-import javax.imageio.ImageIO;
-import javax.imageio.stream.FileImageInputStream;
-import javax.imageio.stream.ImageInputStream;
-
-import org.richfaces.model.UploadItem;
-import org.richfaces.realworld.service.Constants;
-
-/**
- * @author Andrey Markavtsov
- *
- */
-public class ImageUtils {
-
- public static class ImageDimension {
- public int WIDTH;
- public int HEIGHT;
- public String POSTFIX_NAME;
- public ImageDimension(int width, int height, String postfix_name) {
- super();
- WIDTH = width;
- HEIGHT = height;
- POSTFIX_NAME = postfix_name;
- }
- };
-
- public static final String _MEDIUM = "_medium";
- public static final String _MINI = "_mini";
-
-
- public static ImageDimension MINI = new ImageDimension(100, 100, _MINI);
- public static ImageDimension MEDIUM = new ImageDimension(640, 480, _MEDIUM);
-
-
- BufferedImage bufferedImage;
-
- double width;
- double height;
-
- public ImageUtils(BufferedImage bufferedImage) {
- if (bufferedImage == null) {
- throw new NullPointerException("Buffered image is null");
- }
-
- this.height = bufferedImage.getHeight();
- this.width = bufferedImage.getWidth();
- this.bufferedImage = bufferedImage;
- }
-
- private BufferedImage scaleToWidth(int width) throws IOException {
- double height = width * this.height / this.width;
- BufferedImage newImage = new BufferedImage(width, (int) height,
- BufferedImage.TYPE_INT_RGB);
- Graphics2D graphics2D = createGraphics(newImage);
- graphics2D.drawImage(bufferedImage, 0, 0, (int) width, (int) height,
- null);
- return newImage;
- }
-
- private BufferedImage scaleToHeight(int height) throws IOException {
- double width = height * this.width / this.height;
- BufferedImage newImage = new BufferedImage((int) width, (int) height,
- BufferedImage.TYPE_INT_RGB);
- Graphics2D graphics2D = createGraphics(newImage);
- graphics2D.drawImage(bufferedImage, 0, 0, (int) width, (int) height,
- null);
- return newImage;
- }
-
- private Graphics2D createGraphics(BufferedImage image) {
- Graphics2D graphics2D = image.createGraphics();
- graphics2D.setBackground(new Color(255, 255, 255));
- graphics2D.clearRect(0, 0, image.getWidth(), image.getHeight());
- graphics2D.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
- RenderingHints.VALUE_INTERPOLATION_BICUBIC);
- return graphics2D;
- }
-
- public BufferedImage resizeImage(double width, double height)
- throws IOException {
-
- if (width > height) {
- if (this.bufferedImage.getWidth() < width) {
- return bufferedImage;
- }
- return scaleToWidth((int) width);
- } else {
- if (this.bufferedImage.getHeight() < height) {
- return bufferedImage;
- }
- return scaleToHeight((int) height);
- }
-
- }
-
- public static void resizeImage(UploadItem image, String pathToUpload, ImageDimension ...
dimensions)
- throws IOException {
-
- BufferedImage bufferedImage = ImageIO.read(new FileImageInputStream(image.getFile()));
-
- ImageUtils utils = new ImageUtils(bufferedImage);
- int width, height;
-
- ImageIO.write(bufferedImage, Constants.JPG, new File(pathToUpload));
-
- for (ImageDimension dimension : dimensions) {
- String fileName = transformPath(pathToUpload,dimension.POSTFIX_NAME);
- width = dimension.WIDTH;
- height = dimension.HEIGHT;
- BufferedImage resizedBuffer = bufferedImage;
-
- if (width > height) {
- if (bufferedImage.getWidth() > width) {
- resizedBuffer = utils.scaleToWidth((int) width);
- }
- } else {
- if (bufferedImage.getHeight() > height) {
- resizedBuffer = utils.scaleToHeight((int) height);
- }
- }
-
- if (resizedBuffer != null) {
- ImageIO.write(resizedBuffer, Constants.JPG, new File(fileName));
- }
-
- }
-
- }
-
- public static 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;
- }
-
-}
Deleted:
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 2009-03-11
10:56:05 UTC (rev 12916)
+++
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/util/Model.java 2009-03-11
13:03:18 UTC (rev 12917)
@@ -1,99 +0,0 @@
-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;
- }
-}
Deleted:
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:56:05 UTC (rev 12916)
+++
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/util/RenderLogic.java 2009-03-11
13:03:18 UTC (rev 12917)
@@ -1,57 +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.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.Scope;
-import org.jboss.seam.security.Identity;
-import org.richfaces.realworld.domain.Album;
-import org.richfaces.realworld.domain.User;
-import org.richfaces.realworld.service.Constants;
-
-@Name("renderLogic")
-(a)Scope(ScopeType.CONVERSATION)
-public class RenderLogic implements Serializable{
-
- @In User user;
- @In Identity identity;
-
- private static final long serialVersionUID = 5656562187249324512L;
-
- public boolean isUserGuest(){
- return !identity.hasRole(Constants.ADMIN_ROLE);
- }
-
- public boolean isAccessToAlbumGranted(Album album){
- return album.getOwner().equals(user) || album.getShelf().isShared();
- }
-
- public boolean isUserAlbum(Album album){
- if(album == null || album.getOwner() == null){
- return false;
- }
- return album.getOwner().equals(user);
- }
-}
Deleted:
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 2009-03-11
10:56:05 UTC (rev 12916)
+++
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/util/TreeManager.java 2009-03-11
13:03:18 UTC (rev 12917)
@@ -1,69 +0,0 @@
-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);
- }
-}
Copied:
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/util/test.java
(from rev 12864,
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/modalpanel/test.java)
===================================================================
---
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/util/test.java
(rev 0)
+++
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/util/test.java 2009-03-11
13:03:18 UTC (rev 12917)
@@ -0,0 +1,181 @@
+package org.richfaces.realworld.util;
+
+import java.awt.Graphics2D;
+import java.awt.RenderingHints;
+import java.awt.Transparency;
+import java.awt.image.BufferedImage;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+import javax.imageio.ImageIO;
+import javax.imageio.ImageReader;
+import javax.imageio.ImageWriter;
+import javax.imageio.stream.ImageInputStream;
+
+public class test {
+
+ /**
+ * @param args
+ * @throws IOException
+ */
+ public static void main(String[] args) throws IOException {
+ String directory
="E:\\realworldnew\\web\\src\\main\\webapp\\WEB-INF\\Upload\\Viking\\15";
+ writeFiles(directory, "_small80", 80);
+ writeFiles(directory, "_small120", 120);
+ writeFiles(directory, "_small160", 160);
+ writeFiles(directory, "_mini", 150);
+ writeFiles(directory, "_medium", 600);
+ }
+
+ private static void writeFiles(String directory, String pattern, int size) {
+ File f = new File(directory);
+ for(String s: f.list()){
+ if(s.endsWith(".jpg") &&
!s.endsWith("_mini.jpg")&&
!s.endsWith("_medium.jpg")&&
!s.endsWith("_small80.jpg")&& !s.endsWith("_small120.jpg")
&& !s.endsWith("_small160.jpg")){
+ BufferedImage bsrc =null;
+ try {
+ bsrc = bitmapToImage(directory +"\\"+ s, "JPG");
+ } catch (IOException e1) {
+ // TODO Auto-generated catch block
+ e1.printStackTrace();
+ }
+ int i = bsrc.getWidth() > bsrc.getHeight()? bsrc.getWidth(): bsrc.getHeight();
+ int width2 = bsrc.getWidth();
+ 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 = transformPath(directory +"\\"+ s, pattern);
+ try {
+ imageToBitmap(bdest, dest, "JPG");
+ } catch (IOException ex) {
+ // TODO Auto-generated catch block
+ ex.printStackTrace();
+ }
+ }
+ }
+ }
+
+ private static String transformPath(String target, String substitute){
+ String begin = target.substring(0, target.lastIndexOf("."));
+ String end = target.substring(target.lastIndexOf("."));
+ return begin + substitute + end;
+ }
+
+ private static void generateTags(){
+ try {
+ BufferedWriter out = new BufferedWriter(new
FileWriter("C:\\1114.txt"));
+ //String a ="INSERT INTO comments(comment_id, date, message,
image_comment_id, from_user_id) VALUES ("+commentId+", '1985-01-08',
'Hello I am user',"+ imageId+", 2);\n"+ "INSERT INTO
comments(comment_id, date, message, image_comment_id, from_user_id) VALUES
("+commentId2+", '1985-01-08', 'Hello I am user2',"+
imageId+", 3);\n";
+
+ //out.write("INSERT INTO IMAGES_METATAGS(CI_IMAGE_ID, CI_METATAG_ID)
VALUES("+"1"+"," +"1"+ ");\n");
+ for(int i =2; i<84; i++){
+ String imageId =(new Integer(i)).toString();
+ String commentId = (new Integer(i*2 -1)).toString();
+ String commentId2 = (new Integer(i*2)).toString();
+ out.append("INSERT INTO comments(comment_id, date, message, image_comment_id,
from_user_id) VALUES ("+commentId +", '1985-01-08', 'Hello I am
user',"+ imageId+", 2);\n"+ "INSERT INTO comments(comment_id,
date, message, image_comment_id, from_user_id) VALUES ("+commentId2+",
'1985-01-08', 'Hello I am user2',"+ imageId+", 3);\n");
+ }
+ out.close();
+ } catch (IOException e) {
+ }
+
+ }
+
+ 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;
+ }
+
+ 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;
+ }
+}
Copied:
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/util/test2.java
(from rev 12864,
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/modalpanel/test2.java)
===================================================================
---
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/util/test2.java
(rev 0)
+++
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/util/test2.java 2009-03-11
13:03:18 UTC (rev 12917)
@@ -0,0 +1,113 @@
+package org.richfaces.realworld.util;
+
+import java.awt.Graphics2D;
+import java.awt.RenderingHints;
+import java.awt.Transparency;
+import java.awt.image.BufferedImage;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+import javax.imageio.ImageIO;
+import javax.imageio.ImageReader;
+import javax.imageio.ImageWriter;
+import javax.imageio.stream.ImageInputStream;
+public class test2 {
+ 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;
+ }
+
+ 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;
+ }
+ public static void main(String[] args) throws Exception {
+ BufferedImage bitmapToImage =
bitmapToImage("E:\\realworldnew\\web\\src\\main\\webapp\\WEB-INF\\Upload\\amarkhel\\20\\sport
(14).jpg", "JPG");
+ BufferedImage scaledInstance = getScaledInstance(bitmapToImage, 80, 60,
RenderingHints.VALUE_INTERPOLATION_BICUBIC, true);
+ imageToBitmap(scaledInstance,
"E:\\realworldnew\\web\\src\\main\\webapp\\WEB-INF\\Upload\\amarkhel\\20\\sport
(14)_copy.jpg", "JPG");
+ }
+}
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/image/imagePreview.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/search/result/imageResult.xhtml
===================================================================
---
trunk/test-applications/realworld2/web/src/main/webapp/includes/search/result/imageResult.xhtml 2009-03-11
10:56:05 UTC (rev 12916)
+++
trunk/test-applications/realworld2/web/src/main/webapp/includes/search/result/imageResult.xhtml 2009-03-11
13:03:18 UTC (rev 12917)
@@ -15,7 +15,7 @@
<a4j:mediaOutput element="img"
createContent="#{imageLoader.paintImage}"
styleClass="all-images"
value="#{fileManager.transformPath(item.path, '_mini')}">
- <rich:dragSupport rendered="#{renderLogic.isUserAlbum(item.album)}"
+ <rich:dragSupport rendered="#{controller.isUserAlbum(item.album)}"
dragIndicator="dragIndicator" dragType="image"
dragValue="#{item}"
reRender=" mainArea">
<rich:dndParam name="label" value="#{item.name}" />
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/layout/template3.xhtml
===================================================================
(Binary files differ)