Author: amarkhel
Date: 2009-01-28 12:13:18 -0500 (Wed, 28 Jan 2009)
New Revision: 12471
Modified:
trunk/test-applications/realworld/tests/src/test/java/org/richfaces/realworld/SeleniumTestBase.java
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/fileupload/FileManager.java
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/fileupload/FileUploadBean.java
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/manager/SearchManager.java
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/servlet/PictureServlet.java
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/ConversationState.java
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/ImageUtils.java
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/RenderLogic.java
trunk/test-applications/realworld/web/src/main/webapp/includes/contextMenu/CMForUser.xhtml
trunk/test-applications/realworld/web/src/main/webapp/includes/fileUpload/multyMode.xhtml
trunk/test-applications/realworld/web/src/main/webapp/includes/image/imageScroller.xhtml
trunk/test-applications/realworld/web/src/main/webapp/includes/search/advancedSearch.xhtml
trunk/test-applications/realworld/web/src/main/webapp/includes/userPrefs/loginPrefsTab.xhtml
trunk/test-applications/realworld/web/src/main/webapp/includes/userPrefs/userPrefsTab.xhtml
trunk/test-applications/realworld/web/src/main/webapp/layout/menu.xhtml
trunk/test-applications/realworld/web/src/main/webapp/layout/template2.xhtml
Log:
Modified:
trunk/test-applications/realworld/tests/src/test/java/org/richfaces/realworld/SeleniumTestBase.java
===================================================================
---
trunk/test-applications/realworld/tests/src/test/java/org/richfaces/realworld/SeleniumTestBase.java 2009-01-28
16:04:23 UTC (rev 12470)
+++
trunk/test-applications/realworld/tests/src/test/java/org/richfaces/realworld/SeleniumTestBase.java 2009-01-28
17:13:18 UTC (rev 12471)
@@ -27,7 +27,7 @@
public abstract class SeleniumTestBase implements RichSeleniumTest {
/** Specifies the time to wait for page rendering */
- private static final Integer pageRenderTime = 20000;
+ private static final Integer pageRenderTime = 60000;
/** Specifies the time to wait for ajax processing */
protected static final int ajaxCompletionTime = 20000;
Modified:
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/fileupload/FileManager.java
===================================================================
---
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/fileupload/FileManager.java 2009-01-28
16:04:23 UTC (rev 12470)
+++
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/fileupload/FileManager.java 2009-01-28
17:13:18 UTC (rev 12471)
@@ -30,9 +30,9 @@
import javax.imageio.ImageIO;
import org.jboss.seam.ScopeType;
+import org.jboss.seam.annotations.AutoCreate;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;
-import org.jboss.seam.ui.graphicImage.Image;
import org.richfaces.realworld.service.Constants;
import org.richfaces.realworld.util.ImageUtils;
@@ -55,7 +55,9 @@
public FileManager(){
FacesContext fc = FacesContext.getCurrentInstance();
- this.setUploadRoot(fc.getExternalContext().getInitParameter(Constants.UPLOAD_ROOT));
+ if(fc!=null){
+ this.setUploadRoot(fc.getExternalContext().getInitParameter(Constants.UPLOAD_ROOT));
+ }
}
public String getFileSeparator() {
@@ -133,8 +135,8 @@
createDirectoryIfNotExist(fileName);
try {
writeFileTodisk(data, fileName, 0, 0, "" );
- writeFileTodisk(data, fileName, 50, 50, _MINI );
- writeFileTodisk(data, fileName, 600, 400, _MEDIUM );
+ writeFileTodisk(data, fileName, 100, 100, _MINI );
+ writeFileTodisk(data, fileName, 500, 500, _MEDIUM );
} catch (IOException e) {
return false;
}
@@ -149,7 +151,6 @@
ImageIO.write(bsrc, Constants.JPG, new File(dest));
return;
}
-
BufferedImage bdest = new ImageUtils(bsrc).resizeImage(width, height);
/*
BufferedImage bdest = new BufferedImage(width, height,
Modified:
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/fileupload/FileUploadBean.java
===================================================================
---
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/fileupload/FileUploadBean.java 2009-01-28
16:04:23 UTC (rev 12470)
+++
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/fileupload/FileUploadBean.java 2009-01-28
17:13:18 UTC (rev 12471)
@@ -43,6 +43,7 @@
import org.richfaces.realworld.domain.MetaTag;
import org.richfaces.realworld.domain.Rank;
import org.richfaces.realworld.domain.User;
+import org.richfaces.realworld.navigation.NavigationEnum;
import org.richfaces.realworld.service.Constants;
import org.richfaces.realworld.util.ConversationState;
@@ -157,6 +158,7 @@
Events.instance().raiseEvent(Constants.ADD_IMAGE_EVENT, file.getImage());
}
fileWrapper.getFiles().clear();
+ Events.instance().raiseEvent(Constants.UPDATE_MAIN_AREA_EVENT,NavigationEnum.IMAGE_PREVIEW);
}
public boolean isFileUploadRendered() {
@@ -176,10 +178,10 @@
public void changeMode() {
if (getSelectedMode().equals(Constants.SINGLE)) {
setFileQuantity(Constants.SINGLE_MODE_FILE_QUANTITY);
- setImmediateUpload(false);
+ setImmediateUpload(true);
} else if (getSelectedMode().equals(Constants.MULTY)) {
setFileQuantity(Constants.MULTY_MODE_FILE_QUANTITY);
- setImmediateUpload(true);
+ setImmediateUpload(false);
}
}
Modified:
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/manager/SearchManager.java
===================================================================
---
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/manager/SearchManager.java 2009-01-28
16:04:23 UTC (rev 12470)
+++
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/manager/SearchManager.java 2009-01-28
17:13:18 UTC (rev 12471)
@@ -69,11 +69,13 @@
}
public List<Image> popularImages(){
- return searchService.popularImages();
+ findedImages = searchService.popularImages();
+ return findedImages;
}
public List<Image> worstImages(){
- return searchService.worstImages();
+ findedImages = searchService.worstImages();
+ return findedImages;
}
private Map<String, Object> populateMap(String additionalParams) {
Modified:
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/servlet/PictureServlet.java
===================================================================
---
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/servlet/PictureServlet.java 2009-01-28
16:04:23 UTC (rev 12470)
+++
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/servlet/PictureServlet.java 2009-01-28
17:13:18 UTC (rev 12471)
@@ -66,7 +66,9 @@
if (fileName == null) {
return null;
}
- FileManager fileManager = (FileManager)Component.getInstance(Constants.FILE_MANAGER,
true);
+ FileManager fileManager = new FileManager();
+ String uploadRoot =
request.getSession().getServletContext().getInitParameter(Constants.UPLOAD_ROOT);
+ fileManager.setUploadRoot(uploadRoot);
File file = fileManager.getImage(fileName);
InputStream paintData = null;
byte[] data = new byte[(int) file.length() - 1];
Modified:
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/ConversationState.java
===================================================================
---
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/ConversationState.java 2009-01-28
16:04:23 UTC (rev 12470)
+++
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/ConversationState.java 2009-01-28
17:13:18 UTC (rev 12471)
@@ -285,7 +285,7 @@
setSelectedImage(null);
}
- public void incrementSlideshowIndex() {
+ public void incrementSlideShowIndex() {
int index = getSelectedAlbum().getIndex(getSelectedImage());
if(getSelectedAlbum().getImages().size() == index +1){
index = -1;
@@ -308,7 +308,7 @@
public boolean isNextExist(){
int index = getSelectedAlbum().getIndex(getSelectedImage());
int size = getSelectedAlbum().getCountImages();
- return index < size - 2;
+ return index < size - 1;
}
public boolean isPrevExist(){
Modified:
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/ImageUtils.java
===================================================================
---
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/ImageUtils.java 2009-01-28
16:04:23 UTC (rev 12470)
+++
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/ImageUtils.java 2009-01-28
17:13:18 UTC (rev 12471)
@@ -61,10 +61,16 @@
public BufferedImage resizeImage(double width, double height)
throws IOException {
-
+
if (width > height) {
+ if(this.bufferedImage.getWidth() < width){
+ return bufferedImage;
+ }
scaleToWidth((int) width);
} else {
+ if(this.bufferedImage.getHeight() < height){
+ return bufferedImage;
+ }
scaleToHeight((int) height);
}
Modified:
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/RenderLogic.java
===================================================================
---
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/RenderLogic.java 2009-01-28
16:04:23 UTC (rev 12470)
+++
trunk/test-applications/realworld/web/src/main/java/org/richfaces/realworld/util/RenderLogic.java 2009-01-28
17:13:18 UTC (rev 12471)
@@ -30,6 +30,7 @@
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")
@@ -74,6 +75,14 @@
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);
}
Modified:
trunk/test-applications/realworld/web/src/main/webapp/includes/contextMenu/CMForUser.xhtml
===================================================================
(Binary files differ)
Modified:
trunk/test-applications/realworld/web/src/main/webapp/includes/fileUpload/multyMode.xhtml
===================================================================
(Binary files differ)
Modified:
trunk/test-applications/realworld/web/src/main/webapp/includes/image/imageScroller.xhtml
===================================================================
(Binary files differ)
Modified:
trunk/test-applications/realworld/web/src/main/webapp/includes/search/advancedSearch.xhtml
===================================================================
(Binary files differ)
Modified:
trunk/test-applications/realworld/web/src/main/webapp/includes/userPrefs/loginPrefsTab.xhtml
===================================================================
(Binary files differ)
Modified:
trunk/test-applications/realworld/web/src/main/webapp/includes/userPrefs/userPrefsTab.xhtml
===================================================================
(Binary files differ)
Modified: trunk/test-applications/realworld/web/src/main/webapp/layout/menu.xhtml
===================================================================
--- trunk/test-applications/realworld/web/src/main/webapp/layout/menu.xhtml 2009-01-28
16:04:23 UTC (rev 12470)
+++ trunk/test-applications/realworld/web/src/main/webapp/layout/menu.xhtml 2009-01-28
17:13:18 UTC (rev 12471)
@@ -49,7 +49,7 @@
value="/img/shell/general_panelbar_bullet.gif" />
<a4j:commandLink rendered="#{!renderLogic.isUserGuest()}"
value="#{messages['menu.file']}"
- actionListener="#{treeManager.setMainArea(navigationHelper.navigationEnumFileUpload)}"
+ actionListener="#{conversationState.setMainArea(navigationHelper.navigationEnumFileUpload)}"
reRender="mainform:mainArea" />
</rich:toolBarGroup>
<rich:toolBarGroup location="right">
Modified: trunk/test-applications/realworld/web/src/main/webapp/layout/template2.xhtml
===================================================================
(Binary files differ)