JBoss Rich Faces SVN: r13202 - in trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld: startup and 3 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2009-03-25 19:09:12 -0400 (Wed, 25 Mar 2009)
New Revision: 13202
Modified:
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/FileManager.java
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/startup/CopyImageStuff.java
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/tags/RealworldCommandButtonRenderer.java
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/tags/RealworldImageScrollerRenderer.java
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/ui/FileItem.java
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/ui/FileUploadBean.java
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/ui/ImageSizeHelper.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/FileUtils.java
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/util/ImageLoader.java
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/util/test.java
Log:
Code review results committed
Modified: trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/FileManager.java
===================================================================
--- trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/FileManager.java 2009-03-25 20:07:42 UTC (rev 13201)
+++ trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/FileManager.java 2009-03-25 23:09:12 UTC (rev 13202)
@@ -63,6 +63,7 @@
private File uploadRoot;
private String uploadRootPath;
+ //TODO nick - i suggest to hide this from external services at all
public File getUploadRoot() {
return uploadRoot;
}
Modified: trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/startup/CopyImageStuff.java
===================================================================
--- trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/startup/CopyImageStuff.java 2009-03-25 20:07:42 UTC (rev 13201)
+++ trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/startup/CopyImageStuff.java 2009-03-25 23:09:12 UTC (rev 13202)
@@ -32,6 +32,7 @@
static final String IMAGE_FOLDER = "/Upload";
+ //TODO nick - change constant value to include "richfaces"
static final String REALWORLD_FOLDER = "realworld";
@Out(scope = ScopeType.APPLICATION)
@@ -52,12 +53,15 @@
@Destroy
public void destroy()throws IOException {
+ //TODO nick - delete even data is stored in DB?
FileUtils.deleteDirectory(uploadRoot);
}
void resolveImageFolder() {
+ //TODO nick - what this cast is for?
URLClassLoader loader = (URLClassLoader)getClass().getClassLoader();
+ //TODO nick - rewrite that
URL path = loader.getResource("");
String classLoadPath = null;
String realPath = null;
Modified: trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/tags/RealworldCommandButtonRenderer.java
===================================================================
--- trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/tags/RealworldCommandButtonRenderer.java 2009-03-25 20:07:42 UTC (rev 13201)
+++ trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/tags/RealworldCommandButtonRenderer.java 2009-03-25 23:09:12 UTC (rev 13202)
@@ -17,6 +17,7 @@
* @author Andrey Markavtsov
*
*/
+//TODO nick - remove this
public class RealworldCommandButtonRenderer extends AjaxCommandRendererBase {
@Override
Modified: trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/tags/RealworldImageScrollerRenderer.java
===================================================================
--- trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/tags/RealworldImageScrollerRenderer.java 2009-03-25 20:07:42 UTC (rev 13201)
+++ trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/tags/RealworldImageScrollerRenderer.java 2009-03-25 23:09:12 UTC (rev 13202)
@@ -16,6 +16,7 @@
* @author Andrey Markavtsov
*
*/
+//TODO nick - remove this
public class RealworldImageScrollerRenderer extends DatascrollerTemplate {
@Override
Modified: trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/ui/FileItem.java
===================================================================
--- trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/ui/FileItem.java 2009-03-25 20:07:42 UTC (rev 13201)
+++ trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/ui/FileItem.java 2009-03-25 23:09:12 UTC (rev 13202)
@@ -24,6 +24,7 @@
import org.richfaces.realworld.domain.Image;
+//TODO nick - no references - dead class?
public class FileItem {
private Image image = new Image();
Modified: trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/ui/FileUploadBean.java
===================================================================
--- trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/ui/FileUploadBean.java 2009-03-25 20:07:42 UTC (rev 13201)
+++ trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/ui/FileUploadBean.java 2009-03-25 23:09:12 UTC (rev 13202)
@@ -103,9 +103,11 @@
String newPath = "/" +model.getSelectedAlbum().getOwner().getLogin() + "/" + model.getSelectedAlbum().getId() + "/" +item.getFileName();
image.setPath(newPath);
fileWrapper.getFiles().add(0, image);
+ //TODO nick - file manager should be protected from another users accessing images of another people
if(!fileManager.addImage(newPath, item.getFile().getPath())){
Events.instance().raiseEvent(Constants.ADD_ERROR_EVENT, new Exception(FILE_SAVE_ERROR));
}
+ //TODO nick - what's the point of storing image if image file save failed?
imageAction.addImage(image, flushStrategy.isDatabaseStoreStrategy());
Events.instance().raiseEvent("imageAdded");
item.getFile().delete();
@@ -124,6 +126,7 @@
private void extractMetadata(UploadItem item, Image image)
throws JpegProcessingException, MetadataException, FileNotFoundException {
InputStream in = new FileInputStream(item.getFile());
+ //TODO nick - close "in"?
Metadata metadata = JpegMetadataReader.readMetadata(in);
Directory exifDirectory = metadata.getDirectory(ExifDirectory.class);
Directory jpgDirectory = metadata.getDirectory(JpegDirectory.class);
Modified: trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/ui/ImageSizeHelper.java
===================================================================
--- trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/ui/ImageSizeHelper.java 2009-03-25 20:07:42 UTC (rev 13201)
+++ trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/ui/ImageSizeHelper.java 2009-03-25 23:09:12 UTC (rev 13202)
@@ -17,6 +17,7 @@
static final int DEFAULT_VALUE = 120;
+ //TODO nick - why not use dimension.x?
int value = DEFAULT_VALUE;
public static enum ImageDimension {
@@ -38,6 +39,7 @@
this.x = x;
this.bgStyle = String.format(IMAGE_BG_STYLE, x + 20);
cssClass = CSS_CLASS + x;
+ //TODO nick - what if x == 160?
imageBgSrc = String.format(IMAGE_BG, (x == 160) ? 200 : x);
filePostfix = FILE_POSTFIX + x;
@@ -71,6 +73,7 @@
}
}
+ //TODO nick - does enum really have 120th value?
return values()[DEFAULT_VALUE];
}
};
Modified: 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 2009-03-25 20:07:42 UTC (rev 13201)
+++ trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/ui/UserPrefsHelper.java 2009-03-25 23:09:12 UTC (rev 13202)
@@ -37,6 +37,7 @@
@In FileManager fileManager;
@In FlushStrategy flushStrategy;
+ //TODO nick - not used anywhere
@In(create=true) @Out Model model;
@In User user;
@@ -53,13 +54,16 @@
public void uploadAvatar(UploadEvent event) {
UploadItem item = event.getUploadItem();
avatarData = item.getFile();
+ //TODO nick - persist user?
user.setHasAvatar(true);
}
+ //TODO nick - are we saving current user?
public void saveUser(User user){
if (avatarData != null) {
try {
BufferedImage image = fileManager.bitmapToImage(avatarData.getPath(),"JPG" );
+ //TODO nick - use fileManager methods to access user image
fileManager.imageToBitmap(image, fileManager.getUploadRoot().getCanonicalPath()+ "/" + user.getLogin() +
"/avatar.jpg", "JPG");
} catch (IOException e) {
@@ -73,6 +77,7 @@
}
public void cancel() {
+ //TODO nick - restore value of user.hasAvatar?
avatarData = null;
}
Modified: 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/DirectLinkHelper.java 2009-03-25 20:07:42 UTC (rev 13201)
+++ trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/util/DirectLinkHelper.java 2009-03-25 23:09:12 UTC (rev 13202)
@@ -29,6 +29,7 @@
@Name("directLink")
@Scope(ScopeType.SESSION)
@AutoCreate
+//TODO nick - session-scoped bean depending on request parameters? i'm in doubts...
public class DirectLinkHelper {
@In(value="entityManager")
protected EntityManager em;
@@ -48,7 +49,9 @@
public synchronized void paintImage(OutputStream out, Object data)
throws IOException {
Image im = em.find(Image.class, id);
+ //TODO nick - '&&' so only admins can see their own unshared images?
if(im.getAlbum().getShelf().isShared() || (identity.hasRole("admin") && im.getAlbum().getOwner().getLogin().equals(identity.getUsername()))){
+ //TODO nick - copy-pasted 99% from ImageLoader
File imageResource = fileManager.getImage(im.getPath());
if (imageResource != null) {
FileInputStream fileInputStream = new FileInputStream(imageResource);
@@ -93,6 +96,7 @@
return null;
}
+ //TODO nick - see org.ajax4jsf.renderkit.RendererUtils#encodeResourceURL(TemplateContext, Object)
Object request = extc.getRequest();
if (request instanceof HttpServletRequest) {
Modified: 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/ErrorHandlerBean.java 2009-03-25 20:07:42 UTC (rev 13201)
+++ trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/util/ErrorHandlerBean.java 2009-03-25 23:09:12 UTC (rev 13202)
@@ -60,6 +60,7 @@
public void addToErrors(Exception e){
FacesContext context = FacesContext.getCurrentInstance();
AjaxContext ac = AjaxContext.getCurrentInstance(context);
+ //TODO nick - should add to AjaxContext#getAjaxAreasToRender()
ac.addRenderedArea(Constants.ERROR_ID);
errors.add(e);
}
Modified: trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/util/FileUtils.java
===================================================================
--- trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/util/FileUtils.java 2009-03-25 20:07:42 UTC (rev 13201)
+++ trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/util/FileUtils.java 2009-03-25 23:09:12 UTC (rev 13202)
@@ -10,6 +10,8 @@
*
* @author Marco Schmidt
*/
+
+//TODO nick - COPYRIGHT!!!
public class FileUtils {
// constant values for the override option
public static final int OVERWRITE_ALWAYS = 1;
@@ -25,6 +27,7 @@
public static Long copyFile(File srcFile, File destFile) throws IOException {
if(!srcFile.getPath().toLowerCase().endsWith("jpg") && !srcFile.getPath().toLowerCase().endsWith("jpeg")){
+ //TODO nick - should be return null
return -1L;
}
InputStream in = new FileInputStream(srcFile);
@@ -43,6 +46,8 @@
}
out.write(buffer, 0, bytesRead);
}
+
+ //TODO nick - this should be in finally block
out.close();
in.close();
if (clock) {
@@ -188,6 +193,7 @@
public static void copyDirectory(File srcDir, File dstDir)
throws IOException {
+ //TODO nick - skip hidden/system directories
if (".svn".equals(srcDir.getName())) {
return;
}
@@ -212,6 +218,7 @@
if (dir.exists()) {
File [] children = dir.listFiles();
for (int i = 0; i < children.length; i++) {
+ //TODO nick - add try/finally so that deletion continues if something failed
deleteDirectory(children[i]);
}
}
Modified: trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/util/ImageLoader.java
===================================================================
--- trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/util/ImageLoader.java 2009-03-25 20:07:42 UTC (rev 13201)
+++ trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/util/ImageLoader.java 2009-03-25 23:09:12 UTC (rev 13202)
@@ -41,6 +41,7 @@
@Name("imageLoader")
@Scope(ScopeType.CONVERSATION)
+//TODO nick - why is this conversation-scoped?
public class ImageLoader implements Serializable {
private static final long serialVersionUID = -1572789608594870285L;
Modified: 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/test.java 2009-03-25 20:07:42 UTC (rev 13201)
+++ trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/util/test.java 2009-03-25 23:09:12 UTC (rev 13202)
@@ -16,6 +16,7 @@
import javax.imageio.ImageWriter;
import javax.imageio.stream.ImageInputStream;
+//TODO nick - delete this class
public class test {
// private static String directory = "E:\\realworldnew\\web\\src\\main\\webapp\\WEB-INF\\Upload\\Viking\\15";
private static String directory = "E:\\temp\\out_images\\";
15 years, 9 months
JBoss Rich Faces SVN: r13201 - in trunk/test-applications/seleniumTest/richfaces/src: main/webapp/WEB-INF and 3 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: dsvyatobatsko
Date: 2009-03-25 16:07:42 -0400 (Wed, 25 Mar 2009)
New Revision: 13201
Added:
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/TooltipBean.java
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/WEB-INF/faces-config.xml
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/layout/layout.xhtml
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/tooltip/tooltipAutoTest.xhtml
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/TooltipTest.java
Log:
https://jira.jboss.org/jira/browse/RF-6381 in progress
Added: trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/TooltipBean.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/TooltipBean.java (rev 0)
+++ trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/TooltipBean.java 2009-03-25 20:07:42 UTC (rev 13201)
@@ -0,0 +1,70 @@
+/**
+ * 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.ajax4jsf.bean;
+
+public class TooltipBean {
+
+ private String mode = "ajax";
+
+ private int hitCount = 0;
+
+ /**
+ * Gets value of mode field.
+ * @return value of mode field
+ */
+ public String getMode() {
+ return mode;
+ }
+
+ /**
+ * Set a new value for mode field.
+ * @param mode a new value for mode field
+ */
+ public void setMode(String mode) {
+ this.mode = mode;
+ }
+
+ /**
+ * Gets value of hitCount field.
+ * @return value of hitCount field
+ */
+ public int getHitCount() {
+ return hitCount++;
+ }
+
+ /**
+ * Set a new value for hitCount field.
+ * @param hitCount a new value for hitCount field
+ */
+ public void setHitCount(int hitCount) {
+ this.hitCount = hitCount;
+ }
+
+ public void initClientTest() {
+ reset();
+ mode = "client";
+ }
+
+ public void reset() {
+ hitCount = 0;
+ mode = "ajax";
+ }
+}
Property changes on: trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/TooltipBean.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Modified: trunk/test-applications/seleniumTest/richfaces/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/main/webapp/WEB-INF/faces-config.xml 2009-03-25 19:29:00 UTC (rev 13200)
+++ trunk/test-applications/seleniumTest/richfaces/src/main/webapp/WEB-INF/faces-config.xml 2009-03-25 20:07:42 UTC (rev 13201)
@@ -373,6 +373,11 @@
<managed-bean-name>logBean</managed-bean-name>
<managed-bean-class>org.ajax4jsf.bean.AjaxLogBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
+ </managed-bean>
+ <managed-bean>
+ <managed-bean-name>tooltipBean</managed-bean-name>
+ <managed-bean-class>org.ajax4jsf.bean.TooltipBean</managed-bean-class>
+ <managed-bean-scope>session</managed-bean-scope>
</managed-bean>
<navigation-rule>
<from-view-id>/pages/ajaxInclude/step1.xhtml</from-view-id>
Modified: trunk/test-applications/seleniumTest/richfaces/src/main/webapp/layout/layout.xhtml
===================================================================
(Binary files differ)
Modified: trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/tooltip/tooltipAutoTest.xhtml
===================================================================
(Binary files differ)
Modified: trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/TooltipTest.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/TooltipTest.java 2009-03-25 19:29:00 UTC (rev 13200)
+++ trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/TooltipTest.java 2009-03-25 20:07:42 UTC (rev 13201)
@@ -25,11 +25,16 @@
import org.ajax4jsf.template.Template;
import org.richfaces.AutoTester;
+import org.richfaces.SeleniumEvent;
import org.richfaces.SeleniumTestBase;
import org.testng.annotations.Test;
public class TooltipTest extends SeleniumTestBase {
+ private final static String RESET_METHOD = "#{tooltipBean.reset}";
+
+ private final static String INIT_CLIENT_TEST = "#{tooltipBean.initClientTest}";
+
private static Map<String, String> params = new HashMap<String, String>();
static {
@@ -41,7 +46,7 @@
@Test
public void testNestedParams(Template template) {
AutoTester tester = getAutoTester(this);
- tester.renderPage(template, null);
+ tester.renderPage(template, RESET_METHOD);
writeStatus("Test component encodes nested f:param tags and their values are present as request parameters");
tester.testRequestParameters(params);
}
@@ -49,7 +54,7 @@
@Test
public void testRenderedAttribute(Template template) {
AutoTester tester = getAutoTester(this);
- tester.renderPage(template, null);
+ tester.renderPage(template, RESET_METHOD);
writeStatus("Test component with rendered = false is not present on the page");
tester.testRendered();
}
@@ -57,7 +62,7 @@
@Test
public void testImmediate(Template template) {
AutoTester tester = getAutoTester(this);
- tester.renderPage(template, null);
+ tester.renderPage(template, RESET_METHOD);
writeStatus("Test immediate attribute");
tester.testImmediate();
}
@@ -65,7 +70,7 @@
@Test
public void testImmediateWithExternalValidationFailed(Template template) {
AutoTester tester = getAutoTester(this);
- tester.renderPage(template, null);
+ tester.renderPage(template, RESET_METHOD);
writeStatus("Test immediate attribute with external validation failed");
tester.testImmediateWithExternalValidationFailed();
}
@@ -73,7 +78,7 @@
@Test
public void testAjaxSingle(Template template) {
AutoTester tester = getAutoTester(this);
- tester.renderPage(template, null);
+ tester.renderPage(template, RESET_METHOD);
writeStatus("Test ajaxSingle attribute");
tester.testAjaxSingle();
}
@@ -81,17 +86,110 @@
@Test
public void testWithExternalValidationFailure(Template template) {
AutoTester autoTester = getAutoTester(this);
- autoTester.renderPage(template, null);
+ autoTester.renderPage(template, RESET_METHOD);
writeStatus("Check that listeners are not invoked in case of external validation failure");
autoTester.testExtrenalValidationFailure();
}
+ @Test
+ public void testCoreClientMode(Template template) {
+ AutoTester autoTester = getAutoTester(this);
+ autoTester.renderPage(template, INIT_CLIENT_TEST);
+ //TODO: ToolTip: component is activated by defined event; its positioning and dimensions are ok
+ }
+
+ @Test
+ public void testCoreAjaxMode(Template template) {
+ AutoTester autoTester = getAutoTester(this);
+ autoTester.renderPage(template, RESET_METHOD);
+ //TODO: ToolTip: the same for ajax mode; component retrieves data from server; "defaultContent" facet is handled; listeners fire
+ }
+
+ @Test
+ public void testJSAPI(Template template) {
+ AutoTester autoTester = getAutoTester(this);
+ autoTester.renderPage(template, RESET_METHOD);
+ writeStatus("Check JS API is present and works");
+ String componentId = autoTester.getClientId(AutoTester.COMPONENT_ID);
+ String contentId = autoTester.getClientId(AutoTester.COMPONENT_ID + "content");
+
+ String event = "createMouseEvent('" + componentId + "',click, 1, 1, false)";
+
+ writeStatus("Check show() function");
+ AssertNotVisible(componentId);
+ invokeFromComponent(componentId, "show", event);
+ waitForAjaxCompletion();
+ AssertVisible(componentId);
+ AssertTextEquals(contentId, "Tooltip hit count 0");
+
+ writeStatus("Check hide() function");
+ invokeFromComponent(componentId, "hide", event);
+ AssertNotVisible(componentId);
+
+ writeStatus("Check disable() function");
+ writeStatus("Check disabled tooltip cannot be shown neither by js event nor by js api");
+ invokeFromComponent(componentId, "disable", event);
+ triggerTooltip();
+ AssertNotVisible(componentId);
+ invokeFromComponent(componentId, "show", event);
+ AssertNotVisible(componentId);
+
+ writeStatus("Check enable() function");
+ invokeFromComponent(componentId, "enable", event);
+ triggerTooltipAndWait();
+ AssertVisible(componentId);
+ AssertTextEquals(contentId, "Tooltip hit count 1");
+ invokeFromComponent(componentId, "show", event);
+ waitForAjaxCompletion();
+ AssertVisible(componentId);
+ AssertTextEquals(contentId, "Tooltip hit count 2");
+ }
+
+ @Test
+ public void testDisabledAttribute(Template template) {
+ AutoTester autoTester = getAutoTester(this);
+ autoTester.renderPage(template, RESET_METHOD);
+ writeStatus("Check disabled attribute");
+
+ autoTester.disableComponent(true);
+ writeStatus("Check tooltip is not shown up, server is not hit, listeners are not invoked");
+ triggerTooltip();
+ String componentId = autoTester.getClientId(AutoTester.COMPONENT_ID);
+ AssertNotVisible(componentId);
+ autoTester.checkActionListener(false);
+ }
+
+ //@Test
+ public void testStylesAndClassesAndHtmlAttributes(Template template) {
+ //TODO: ToolTip: style and classes, standard HTML attributes are output to client
+ AutoTester autoTester = getAutoTester(this);
+ autoTester.renderPage(template, RESET_METHOD);
+ String componentId = autoTester.getClientId(AutoTester.COMPONENT_ID);
+
+ writeStatus("Check styles and classes are output to client");
+
+ writeStatus("Check styleClass/style attributes");
+ assertStyleAttributeContains(componentId, "font-size: 13px", "Style attribute was not output to client");
+ assertClassAttributeContains(componentId, "noclass", "Class attribute was not output to client");
+
+ writeStatus("Test component html events");
+ assertEvents(componentId, SeleniumEvent.STANDARD_HTML_EVENTS);
+ }
+
@Override
public void sendAjax() {
+ triggerTooltipAndWait();
+ }
+
+ private void triggerTooltip() {
selenium.clickAt(getAutoTester(this).getClientId("tooltipArea"), "1,1");
- waitForAjaxCompletion();
}
+ private void triggerTooltipAndWait() {
+ selenium.clickAt(getAutoTester(this).getClientId("tooltipArea"), "1,1");
+ waitForAjaxCompletion();
+ }
+
@Override
public String getAutoTestUrl() {
return "pages/tooltip/tooltipAutoTest.xhtml";
15 years, 9 months
JBoss Rich Faces SVN: r13200 - trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/util.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2009-03-25 15:29:00 -0400 (Wed, 25 Mar 2009)
New Revision: 13200
Modified:
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/util/FileManagerTest.java
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/util/ImageLoader.java
Log:
Code review results committed
Modified: trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/util/FileManagerTest.java
===================================================================
--- trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/util/FileManagerTest.java 2009-03-25 19:07:03 UTC (rev 13199)
+++ trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/util/FileManagerTest.java 2009-03-25 19:29:00 UTC (rev 13200)
@@ -4,6 +4,8 @@
import org.richfaces.realworld.manager.FileManager;
+//TODO nick - test should be moved to src\main\test
+//TODO nick - test doesn't pass
public class FileManagerTest extends TestCase {
protected void setUp() throws Exception {
Modified: trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/util/ImageLoader.java
===================================================================
--- trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/util/ImageLoader.java 2009-03-25 19:07:03 UTC (rev 13199)
+++ trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/util/ImageLoader.java 2009-03-25 19:29:00 UTC (rev 13200)
@@ -50,6 +50,8 @@
@In("#{messages['file_processing_error']}")
private String FILE_PROCESSING_ERROR;
+ //TODO nick - synchronized would make this a bottleneck, especially considering that this method
+ // consumes plenty of CPU time
public synchronized void paintImage(OutputStream out, Object data) throws IOException {
if (null == data) {
return;
@@ -59,17 +61,23 @@
FileInputStream fileInputStream = new FileInputStream(imageResource);
BufferedInputStream bufferedInputStream = new BufferedInputStream(fileInputStream);
InputStream paintData = bufferedInputStream;
+ //TODO nick - paintData is never null
if (null == paintData) {
Events.instance().raiseEvent(Constants.ADD_ERROR_EVENT, new Exception(FILE_PROCESSING_ERROR));
return;
}
try {
- BufferedImage images = ImageIO.read(paintData);
+ //TODO nick - pass-through writing will save us large amount of CPU time and images quality
+ BufferedImage images = ImageIO.read(paintData);
ImageIO.write(images, Constants.JPEG, out);
} catch (Exception e) {
- Events.instance().raiseEvent(Constants.ADD_ERROR_EVENT, new Exception(FILE_PROCESSING_ERROR));
- return;
+ //TODO nick - any particular reason to catch not to take the whole method body into try/catch?
+ //TODO nick - how useful is new Exception(...)? why not use just String?
+ Events.instance().raiseEvent(Constants.ADD_ERROR_EVENT, new Exception(FILE_PROCESSING_ERROR));
+ //TODO nick - that's not necessary at all
+ return;
} finally {
+ //TODO nick - calling bufferedInputStream.close() is enough
fileInputStream.close();
bufferedInputStream.close();
paintData.close();
@@ -77,6 +85,7 @@
}
}
+ //TODO nick - this is copy-pasted 99% from paintImage()
public synchronized void paintImageFromFile(OutputStream out, Object data) throws IOException {
if (null == data) {
return;
15 years, 9 months
JBoss Rich Faces SVN: r13199 - trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/util.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2009-03-25 15:07:03 -0400 (Wed, 25 Mar 2009)
New Revision: 13199
Modified:
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/util/FlushStrategy.java
Log:
Code review results committed
Modified: trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/util/FlushStrategy.java
===================================================================
--- trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/util/FlushStrategy.java 2009-03-25 19:04:18 UTC (rev 13198)
+++ trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/util/FlushStrategy.java 2009-03-25 19:07:03 UTC (rev 13199)
@@ -35,6 +35,7 @@
this.strategy = strategy;
}
+ //TODO nick - make this a static method
public boolean isDatabaseStoreStrategy(){
return getStrategy().equals("database");
}
15 years, 9 months
JBoss Rich Faces SVN: r13198 - in trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld: service and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2009-03-25 15:04:18 -0400 (Wed, 25 Mar 2009)
New Revision: 13198
Modified:
trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/domain/Album.java
trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/domain/Comment.java
trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/domain/Image.java
trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/domain/MetaTag.java
trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/domain/Shelf.java
trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/domain/User.java
trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/AlbumAction.java
trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/Constants.java
trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/IAlbumAction.java
trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/IImageAction.java
trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/ImageAction.java
trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/SearchAction.java
trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/ShelfAction.java
Log:
Code review results committed
Modified: trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/domain/Album.java
===================================================================
--- trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/domain/Album.java 2009-03-25 17:53:03 UTC (rev 13197)
+++ trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/domain/Album.java 2009-03-25 19:04:18 UTC (rev 13198)
@@ -73,6 +73,7 @@
@NotNull
@NotEmpty
@Length(min = 3)
+ //TODO nick - add maxLength validation here and everywhere?
private String name;
@Column(length = 1024)
@@ -80,6 +81,7 @@
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "ALBUM_USER_ID", referencedColumnName = "USER_ID")
+ //TODO nick - add @NotNull?
private User owner;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "album")
@@ -99,6 +101,7 @@
private List<Image> unvisitedImages = new ArrayList<Image>();
@Transient
+ //TODO nick == unvisitedImages.size
private Long countUnvisitedImages;
@OneToOne(cascade = CascadeType.ALL, optional = true)
@@ -175,6 +178,7 @@
throw new IllegalArgumentException("Null image!");
}
if (image.getAlbum() != null && !this.equals(image.getAlbum())) {
+ //TODO nick - use removeImage()
image.getAlbum().getImages().remove(image);
}
image.setAlbum(this);
@@ -191,6 +195,7 @@
if (image == null) {
throw new IllegalArgumentException("Null image");
}
+ //TODO nick - check if image is in the current album
image.setAlbum(null);
images.remove(image);
}
@@ -218,6 +223,8 @@
}
public int getIndex(Image image) {
+ //TODO nick - use indexOf
+ //TODO nick - check images == null?
for (int i = 0; i < this.images.size(); i++) {
if (this.images.get(i).equals(image)) {
return i;
@@ -231,6 +238,7 @@
return coveringImage;
}
if (images != null && images.size() > 0) {
+ //TODO nick - i suggest we use random images
coveringImage = images.get(0);
return images.get(0);
} else {
Modified: trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/domain/Comment.java
===================================================================
--- trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/domain/Comment.java 2009-03-25 17:53:03 UTC (rev 13197)
+++ trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/domain/Comment.java 2009-03-25 19:04:18 UTC (rev 13198)
@@ -56,6 +56,7 @@
@ManyToOne
@JoinColumn(name = "IMAGE_COMMENT_ID", referencedColumnName = "IMAGE_ID")
+ //TODO nick - add @NotNull
private Image image;
@ManyToOne(fetch = FetchType.LAZY)
Modified: trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/domain/Image.java
===================================================================
--- trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/domain/Image.java 2009-03-25 17:53:03 UTC (rev 13197)
+++ trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/domain/Image.java 2009-03-25 19:04:18 UTC (rev 13198)
@@ -88,6 +88,7 @@
@Length(min = 3)
private String name;
@Transient
+ //TODO nick - remove this
private Boolean covering;
@Column(length = 1024, nullable = false)
@@ -118,6 +119,7 @@
private int height;
+ //TODO nick - should be changed to int
private double size;
private int width;
@@ -234,6 +236,7 @@
if (comment == null) {
throw new IllegalArgumentException("Null comment");
}
+ //TODO nick - check that comments belongs to "this" image
comment.setImage(null);
comments.remove(comment);
}
@@ -256,7 +259,13 @@
s.append(tag.getTag()).append(", ");
}
- return s.substring(0, s.length() - 2);
+ //TODO nick - changed by nick
+ if (s.length() >= 2) {
+ s.delete(s.length() - 2, s.length());
+ }
+
+ String string = s.toString();
+ return string;
}
public void setMeta(String meta) {
Modified: trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/domain/MetaTag.java
===================================================================
--- trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/domain/MetaTag.java 2009-03-25 17:53:03 UTC (rev 13197)
+++ trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/domain/MetaTag.java 2009-03-25 19:04:18 UTC (rev 13198)
@@ -52,6 +52,7 @@
@NotNull
@NotEmpty
@Length(min = 3)
+ //TODO nick - meta tags should not contain ',', add constraint
private String tag;
@ManyToMany(mappedBy = "imageTags")
Modified: trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/domain/Shelf.java
===================================================================
--- trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/domain/Shelf.java 2009-03-25 17:53:03 UTC (rev 13197)
+++ trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/domain/Shelf.java 2009-03-25 19:04:18 UTC (rev 13198)
@@ -30,6 +30,8 @@
@Name("shelf")
@Scope(ScopeType.CONVERSATION)
@Table(name = "shelfs")
+//TODO nick - rename table to "shelves"
+//TODO nick - should we store this in conversation?
public class Shelf implements Serializable {
private static final long serialVersionUID = -7042878411608396483L;
@@ -64,6 +66,7 @@
private Date created;
@Transient
+ //TODO nick - == unvisitedImages.size()
private Long countUnvisitedImages;
/**
@@ -129,6 +132,7 @@
if (album == null)
throw new IllegalArgumentException("Null child!");
if (album.getShelf() != null)
+ //TODO nick - use removeChildAlbum()
album.getShelf().getAlbums().remove(album);
album.setShelf(this);
albums.add(album);
@@ -137,6 +141,7 @@
public void removeChildAlbum(Album album) {
if (album == null)
throw new IllegalArgumentException("Null child!");
+ //TODO nick - check that shelf is "this"
album.setShelf(null);
albums.remove(album);
}
@@ -202,6 +207,7 @@
}
public Album getFirstAlbum() {
+ //TODO nick - use random album for cover?
if (this.albums.size() > 0) {
return this.albums.get(0);
}
Modified: trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/domain/User.java
===================================================================
--- trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/domain/User.java 2009-03-25 17:53:03 UTC (rev 13197)
+++ trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/domain/User.java 2009-03-25 19:04:18 UTC (rev 13198)
@@ -99,6 +99,7 @@
@Column(length = 255, nullable = false)
@NotNull
@NotEmpty
+ //TODO nick - use e-mail validator
@Pattern(regex=".+@.+\\.[a-z]+", message="Not valid e-mail")
private String email;
@@ -120,6 +121,7 @@
@NotNull
private Sex sex;
+ //TODO nick - this should be persistent, right?
private Boolean doNotShowMail;
private Boolean informAboutNews;
@@ -199,10 +201,12 @@
//---------------------------Business methods
+ //TODO nick - do we really need this? we can just aggregate data from all albums
public void addAlbum(Album album) {
if (album == null) {
throw new IllegalArgumentException("Null album!");
- }
+ }
+ //TODO nick - remove album from the previous user?
album.setOwner(this);
albums.add(album);
}
@@ -211,6 +215,7 @@
if (album == null) {
throw new IllegalArgumentException("Null album");
}
+ //TODO nick - check if owner is current user?
album.setOwner(null);
albums.remove(album);
}
@@ -219,6 +224,7 @@
if (shelf == null) {
throw new IllegalArgumentException("Null shelf!");
}
+ //TODO nick - remove shelf from the previous user?
shelf.setOwner(this);
shelfs.add(shelf);
}
@@ -227,7 +233,9 @@
if (shelf == null) {
throw new IllegalArgumentException("Null shelf");
}
+ //TODO nick - check if owner is current user?
shelf.setOwner(null);
+ //TODO nick - why to remove albums?
for(Album a : shelf.getAlbums()){
removeAlbum(a);
}
Modified: trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/AlbumAction.java
===================================================================
--- trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/AlbumAction.java 2009-03-25 17:53:03 UTC (rev 13197)
+++ trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/AlbumAction.java 2009-03-25 19:04:18 UTC (rev 13198)
@@ -43,6 +43,8 @@
@In(value="entityManager")
EntityManager em;
+
+ //TODO nick - do we need @Out here?
@In @Out
private User user;
@@ -79,16 +81,20 @@
}
public Long getCountUnvisitedImages(Album album){
+ //TODO nick - use Shelf/Album.unvisitedImages
return (Long)em.createQuery("select count(i) from Image i where i.album=:album and i.created >= :date").setParameter("album", album).setParameter("date", getDate()).getSingleResult();
}
public List<Image> getUnvisitedImages(Album album){
+ //TODO nick - use Shelf/Album.unvisitedImages
return (List<Image>)em.createQuery("from Image i where i.album=:album and i.created >= :date").setParameter("album", album).setParameter("date", getDate()).getResultList();
}
private Date getDate() {
+ //TODO nick - use Calendar.getInstance()
Calendar c = new GregorianCalendar();
c.add(Calendar.DAY_OF_YEAR, -15);
+ //TODO nick - return c.getTime()
return c.getInstance().getTime();
}
}
Modified: trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/Constants.java
===================================================================
--- trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/Constants.java 2009-03-25 17:53:03 UTC (rev 13197)
+++ trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/Constants.java 2009-03-25 19:04:18 UTC (rev 13198)
@@ -20,7 +20,8 @@
*/
package org.richfaces.realworld.service;
-
+//TODO nick - review constants and remove old ones
+//TODO nick - separate view and service layer constants
public class Constants {
public static final String ERROR_ID = "mainform:error";
Modified: trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/IAlbumAction.java
===================================================================
--- trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/IAlbumAction.java 2009-03-25 17:53:03 UTC (rev 13197)
+++ trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/IAlbumAction.java 2009-03-25 19:04:18 UTC (rev 13198)
@@ -36,6 +36,7 @@
public void editAlbum(Album album, boolean isFlushNeeded);
+ //TODO nick - explicit flush doesn't seem like a good solution
public abstract void flush();
public Long getCountUnvisitedImages(Album album);
Modified: trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/IImageAction.java
===================================================================
--- trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/IImageAction.java 2009-03-25 17:53:03 UTC (rev 13197)
+++ trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/IImageAction.java 2009-03-25 19:04:18 UTC (rev 13198)
@@ -31,6 +31,8 @@
@Local
public interface IImageAction {
+ //TODO nick - remove isFlushNeeded
+
public abstract void deleteImage(Image image, boolean isFlushNeeded);
public abstract void editImage(Image image, boolean isFlushNeeded);
@@ -43,6 +45,7 @@
public abstract MetaTag getTagByName(String tag);
+ //TODO nick - rename to getPopularTags()
public abstract List<MetaTag> popularTags();
public abstract List<MetaTag> getTagsLikeString(String suggest);
Modified: trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/ImageAction.java
===================================================================
--- trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/ImageAction.java 2009-03-25 17:53:03 UTC (rev 13197)
+++ trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/ImageAction.java 2009-03-25 19:04:18 UTC (rev 13198)
@@ -65,6 +65,7 @@
if (!image.containTag(s)) {
MetaTag tag = getTagByName(s);
if (tag == null) {
+ //TODO nick - how about concurrent creation of meta tags with the same name?
tag = new MetaTag();
tag.setTag(s);
}
Modified: trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/SearchAction.java
===================================================================
--- trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/SearchAction.java 2009-03-25 17:53:03 UTC (rev 13197)
+++ trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/SearchAction.java 2009-03-25 19:04:18 UTC (rev 13198)
@@ -18,6 +18,7 @@
@Stateless
@AutoCreate
@SuppressWarnings("unchecked")
+//TODO add JavaDocs
public class SearchAction implements ISearchAction {
@In(value="entityManager")
Modified: trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/ShelfAction.java
===================================================================
--- trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/ShelfAction.java 2009-03-25 17:53:03 UTC (rev 13197)
+++ trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/ShelfAction.java 2009-03-25 19:04:18 UTC (rev 13198)
@@ -72,6 +72,7 @@
}
public List<Shelf> getShelfs(User user) {
+ //TODO nick - preserve shelves ordering? Maybe use TreeSet with Comparator?
Set<Shelf> sh = new HashSet<Shelf>();
List<Shelf> shelfs = em.createQuery("from Shelf s where s.shared=true")
.getResultList();
@@ -83,14 +84,17 @@
}
public Long getCountUnvisitedImages(Shelf shelf){
+ //TODO nick - use data from user
return (Long)em.createQuery("select count(i) from Image i where i.album.shelf=:shelf and i.uploaded > :date").setParameter("shelf", shelf).setParameter("date", getDate()).getSingleResult();
}
public List<Image> getUnvisitedImages(Shelf shelf){
+ //TODO nick - use data from user
return (List<Image>)em.createQuery("from Image i where i.album.shelf=:shelf and i.uploaded > :date").setParameter("shelf", shelf).setParameter("date", getDate()).getResultList();
}
private Date getDate() {
+ //TODO nick - copy-pasted from AlbumAction, see TODOs there
Calendar c = new GregorianCalendar();
c.add(Calendar.DAY_OF_YEAR, -15);
return c.getInstance().getTime();
15 years, 9 months
JBoss Rich Faces SVN: r13197 - in trunk/test-applications/realworld2/web/src/main: webapp/includes/image and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: andrei_exadel
Date: 2009-03-25 13:53:03 -0400 (Wed, 25 Mar 2009)
New Revision: 13197
Modified:
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/ui/ImageSizeHelper.java
trunk/test-applications/realworld2/web/src/main/webapp/includes/image/imageList.xhtml
trunk/test-applications/realworld2/web/src/main/webapp/stylesheet/realworld.css
Log:
Fix image size slider
Modified: trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/ui/ImageSizeHelper.java
===================================================================
--- trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/ui/ImageSizeHelper.java 2009-03-25 17:43:48 UTC (rev 13196)
+++ trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/ui/ImageSizeHelper.java 2009-03-25 17:53:03 UTC (rev 13197)
@@ -26,16 +26,19 @@
final static String CSS_CLASS = "preview_box_photo_";
final static String FILE_POSTFIX = "_small";
final static String IMAGE_BG = "/img/shell/frame_photo_%1$d.png";
+ final static String IMAGE_BG_STYLE = "width: %1$dpx; height: %1$dpx";
int x;
+ String bgStyle;
String cssClass;
String imageBgSrc;
String filePostfix;
private ImageDimension(int x) {
this.x = x;
+ this.bgStyle = String.format(IMAGE_BG_STYLE, x + 20);
cssClass = CSS_CLASS + x;
- imageBgSrc = String.format(IMAGE_BG, x);
+ imageBgSrc = String.format(IMAGE_BG, (x == 160) ? 200 : x);
filePostfix = FILE_POSTFIX + x;
}
@@ -51,6 +54,10 @@
public String getImageBg() {
return imageBgSrc;
}
+
+ public String getImageBgStyle() {
+ return bgStyle;
+ }
public String getFilePostfix() {
return filePostfix;
Modified: trunk/test-applications/realworld2/web/src/main/webapp/includes/image/imageList.xhtml
===================================================================
(Binary files differ)
Modified: trunk/test-applications/realworld2/web/src/main/webapp/stylesheet/realworld.css
===================================================================
--- trunk/test-applications/realworld2/web/src/main/webapp/stylesheet/realworld.css 2009-03-25 17:43:48 UTC (rev 13196)
+++ trunk/test-applications/realworld2/web/src/main/webapp/stylesheet/realworld.css 2009-03-25 17:53:03 UTC (rev 13197)
@@ -350,6 +350,14 @@
.preview_box_photo_160 div.photo_name {text-align : center; overflow : hidden; width : 180px; white-space : nowrap; margin-top : 3px; text-overflow: ellipsis; height : 14px;}
.preview_box_photo_160 div.photo_data {text-align : center; overflow : hidden; width : 180px; white-space : nowrap; text-overflow: ellipsis; color : #666666; font-size : 10px; height : 14px}
+.preview_box_photo_200 {width : 220px; position : relative; float : left; margin : 0px 10px 10px 0px;}
+.preview_box_photo_200 img.pr_photo_bg {width : 220px; height : 220px; position : absolute; border: 0px;}
+.preview_box_photo_200 table{position : relative; width : 220px; height : 220px; text-align : center; vertical-align : middle; border-collapse : collapse;}
+.preview_box_photo_200 table img{margin: 0px 0px 0px 0px; border : 1px solid #FFFFFF;}
+.preview_box_photo_200 div.photo_name {text-align : center; overflow : hidden; width : 220px; white-space : nowrap; margin-top : 3px; text-overflow: ellipsis; height : 14px;}
+.preview_box_photo_200 div.photo_data {text-align : center; overflow : hidden; width : 220px; white-space : nowrap; text-overflow: ellipsis; color : #666666; font-size : 10px; height : 14px}
+
+
.preview_box_photo_nav {width : 100px; height : 100px; position : relative; float : left; margin : 0px 2px 0px 0px;}
.preview_box_photo_nav img.pr_photo_bg {width : 100px; height : 100px; position : absolute; border: 0px;}
.preview_box_photo_nav table{position : relative; width : 100px; height : 100px; text-align : center; vertical-align : middle; border-collapse : collapse;}
15 years, 9 months
JBoss Rich Faces SVN: r13196 - trunk/samples/richfaces-demo/src/main/webapp/richfaces/progressBar.
by richfaces-svn-commits@lists.jboss.org
Author: ilya_shaikovsky
Date: 2009-03-25 13:43:48 -0400 (Wed, 25 Mar 2009)
New Revision: 13196
Modified:
trunk/samples/richfaces-demo/src/main/webapp/richfaces/progressBar/usage.xhtml
Log:
https://jira.jboss.org/jira/browse/RF-5750
Modified: trunk/samples/richfaces-demo/src/main/webapp/richfaces/progressBar/usage.xhtml
===================================================================
--- trunk/samples/richfaces-demo/src/main/webapp/richfaces/progressBar/usage.xhtml 2009-03-25 17:40:23 UTC (rev 13195)
+++ trunk/samples/richfaces-demo/src/main/webapp/richfaces/progressBar/usage.xhtml 2009-03-25 17:43:48 UTC (rev 13196)
@@ -25,6 +25,11 @@
<ui:include src="/templates/include/sourceview.xhtml">
<ui:param name="sourcepath" value="/richfaces/progressBar/examples/polling.xhtml"/>
</ui:include>
+ <ui:include src="/templates/include/sourceview.xhtml">
+ <ui:param name="sourcepath" value="/WEB-INF/src/org/richfaces/demo/progressBar/ProgressBarBean.java"/>
+ <ui:param name="openlabel" value="View Java Bean Source" />
+ <ui:param name="sourcetype" value="java" />
+ </ui:include>
</div>
</fieldset>
<p>
15 years, 9 months
JBoss Rich Faces SVN: r13195 - in trunk/test-applications/realworld2/web: src/main/java/org/richfaces/realworld/manager and 7 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: amarkhel
Date: 2009-03-25 13:40:23 -0400 (Wed, 25 Mar 2009)
New Revision: 13195
Modified:
trunk/test-applications/realworld2/web/pom.xml
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/FileManager.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/ui/FileUploadBean.java
trunk/test-applications/realworld2/web/src/main/webapp/includes/album/albumInfo.xhtml
trunk/test-applications/realworld2/web/src/main/webapp/includes/help/tree_build_descr.xhtml
trunk/test-applications/realworld2/web/src/main/webapp/includes/image/imageInfo.xhtml
trunk/test-applications/realworld2/web/src/main/webapp/includes/image/slideshow.xhtml
trunk/test-applications/realworld2/web/src/main/webapp/includes/images.xhtml
trunk/test-applications/realworld2/web/src/main/webapp/includes/index/tree.xhtml
trunk/test-applications/realworld2/web/src/main/webapp/includes/misc/errorPanel.xhtml
trunk/test-applications/realworld2/web/src/main/webapp/includes/shelfUnvisited.xhtml
trunk/test-applications/realworld2/web/src/main/webapp/includes/userSharedAlbums.xhtml
trunk/test-applications/realworld2/web/src/main/webapp/includes/userSharedImages.xhtml
Log:
Fix some bugs
Modified: trunk/test-applications/realworld2/web/pom.xml
===================================================================
--- trunk/test-applications/realworld2/web/pom.xml 2009-03-25 17:40:09 UTC (rev 13194)
+++ trunk/test-applications/realworld2/web/pom.xml 2009-03-25 17:40:23 UTC (rev 13195)
@@ -34,6 +34,11 @@
<scope>provided</scope>
</dependency>
<dependency>
+ <groupId>com.uwyn</groupId>
+ <artifactId>jhighlight</artifactId>
+ <version>1.0</version>
+ </dependency>
+ <dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
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-25 17:40:09 UTC (rev 13194)
+++ trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/AlbumManager.java 2009-03-25 17:40:23 UTC (rev 13195)
@@ -85,7 +85,7 @@
String string = album.getId().toString();
albumAction.deleteAlbum(album, flushStrategy.isDatabaseStoreStrategy());
deleteDirectory(string);
- model.resetModel(model.getMainArea(), model.getSelectedUser(), model.getSelectedShelf(), null, null);
+ model.resetModel(NavigationEnum.ALL_ALBUMS, model.getSelectedUser(), model.getSelectedShelf(), null, null);
Events.instance().raiseEvent("albumDeleted");
Events.instance().raiseEvent("clearTree");
}
Modified: trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/FileManager.java
===================================================================
--- trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/FileManager.java 2009-03-25 17:40:09 UTC (rev 13194)
+++ trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/FileManager.java 2009-03-25 17:40:23 UTC (rev 13195)
@@ -53,6 +53,7 @@
private static final String _SMALL160 = "_small160";
private static final String _SMALL120 = "_small120";
private static final String _SMALL80 = "_small80";
+ private static final String _SMALL200 = "_small200";
private static final String _MEDIUM = "_medium";
private static final String _MINI = "_mini";
@@ -164,6 +165,7 @@
writeFile(fileName, tempFilePath, _SMALL80, 80, true);
writeFile(fileName, tempFilePath, _SMALL120, 120, true);
writeFile(fileName, tempFilePath, _SMALL160, 160, true);
+ writeFile(fileName, tempFilePath, _SMALL200, 200, true);
writeFile(fileName, tempFilePath, _MINI, 150, true);
writeFile(fileName, tempFilePath, _MEDIUM, 600, true);
return true;
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-25 17:40:09 UTC (rev 13194)
+++ trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/ImageManager.java 2009-03-25 17:40:23 UTC (rev 13195)
@@ -65,6 +65,7 @@
public void deleteImage(Image image) {
String imagePath = image.getPath();
+ model.resetModel(NavigationEnum.ALBUM_PREVIEW, image.getAlbum().getOwner(), image.getAlbum().getShelf(), image.getAlbum(), null);
imageAction.deleteImage(image, flushStrategy.isDatabaseStoreStrategy());
fileManager.deleteImage(imagePath);
Events.instance().raiseEvent("imageDeleted");
@@ -87,6 +88,9 @@
if (null == user.getLogin()) {
Events.instance().raiseEvent(Constants.ADD_ERROR_EVENT, new Exception("For vote on this picture you must login"));
return;
+ }if(message.trim().equals("")){
+ Events.instance().raiseEvent(Constants.ADD_ERROR_EVENT, new Exception("Comment must be not-null"));
+ return;
}
Comment comment = new Comment();
comment.setAuthor(user);
Modified: trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/ui/FileUploadBean.java
===================================================================
--- trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/ui/FileUploadBean.java 2009-03-25 17:40:09 UTC (rev 13194)
+++ trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/ui/FileUploadBean.java 2009-03-25 17:40:23 UTC (rev 13195)
@@ -117,6 +117,7 @@
image.setDescription(SAMPLE_DESCRIPTION);
image.setName(SAMPLE_NAME);
image.setSize(item.getFileSize());
+ image.setAllowComments(true);
return image;
}
Modified: trunk/test-applications/realworld2/web/src/main/webapp/includes/album/albumInfo.xhtml
===================================================================
(Binary files differ)
Modified: trunk/test-applications/realworld2/web/src/main/webapp/includes/help/tree_build_descr.xhtml
===================================================================
(Binary files differ)
Modified: trunk/test-applications/realworld2/web/src/main/webapp/includes/image/imageInfo.xhtml
===================================================================
(Binary files differ)
Modified: trunk/test-applications/realworld2/web/src/main/webapp/includes/image/slideshow.xhtml
===================================================================
(Binary files differ)
Modified: trunk/test-applications/realworld2/web/src/main/webapp/includes/images.xhtml
===================================================================
(Binary files differ)
Modified: trunk/test-applications/realworld2/web/src/main/webapp/includes/index/tree.xhtml
===================================================================
(Binary files differ)
Modified: trunk/test-applications/realworld2/web/src/main/webapp/includes/misc/errorPanel.xhtml
===================================================================
(Binary files differ)
Modified: trunk/test-applications/realworld2/web/src/main/webapp/includes/shelfUnvisited.xhtml
===================================================================
(Binary files differ)
Modified: trunk/test-applications/realworld2/web/src/main/webapp/includes/userSharedAlbums.xhtml
===================================================================
(Binary files differ)
Modified: trunk/test-applications/realworld2/web/src/main/webapp/includes/userSharedImages.xhtml
===================================================================
(Binary files differ)
15 years, 9 months
JBoss Rich Faces SVN: r13194 - in trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld: service and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: amarkhel
Date: 2009-03-25 13:40:09 -0400 (Wed, 25 Mar 2009)
New Revision: 13194
Modified:
trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/domain/Image.java
trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/domain/User.java
trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/AlbumAction.java
trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/ImageAction.java
Log:
Fix some bugs
Modified: trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/domain/Image.java
===================================================================
--- trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/domain/Image.java 2009-03-25 17:39:24 UTC (rev 13193)
+++ trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/domain/Image.java 2009-03-25 17:40:09 UTC (rev 13194)
@@ -104,7 +104,7 @@
inverseJoinColumns =
@JoinColumn(name = "CI_METATAG_ID",
referencedColumnName = "METATAG_ID"))
- protected List<MetaTag> imageTags;
+ protected List<MetaTag> imageTags = new ArrayList<MetaTag>();
/*
Modified: trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/domain/User.java
===================================================================
--- trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/domain/User.java 2009-03-25 17:39:24 UTC (rev 13193)
+++ trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/domain/User.java 2009-03-25 17:40:09 UTC (rev 13194)
@@ -303,25 +303,4 @@
}
return images;
}
-
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
-
- User user = (User) o;
-
- if (email != null ? !email.equals(user.email) : user.email != null) return false;
- if (id != null ? !id.equals(user.id) : user.id != null) return false;
- if (login != null ? !login.equals(user.login) : user.login != null) return false;
-
- return true;
- }
-
- public int hashCode() {
- int result;
- result = (id != null ? id.hashCode() : 0);
- result = 31 * result + (email != null ? email.hashCode() : 0);
- result = 31 * result + (login != null ? login.hashCode() : 0);
- return result;
- }
}
\ No newline at end of file
Modified: trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/AlbumAction.java
===================================================================
--- trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/AlbumAction.java 2009-03-25 17:39:24 UTC (rev 13193)
+++ trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/AlbumAction.java 2009-03-25 17:40:09 UTC (rev 13194)
@@ -58,6 +58,8 @@
public void deleteAlbum(Album album, boolean isFlushNeeded){
if(album.getShelf()!=null){
album.getShelf().removeChildAlbum(album);
+ album.getShelf().setCountUnvisitedImages(null);
+ album.getShelf().setUnvisitedImages(null);
}else{
user.removeAlbum(album);
}
Modified: trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/ImageAction.java
===================================================================
--- trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/ImageAction.java 2009-03-25 17:39:24 UTC (rev 13193)
+++ trunk/test-applications/realworld2/ejb/src/main/java/org/richfaces/realworld/service/ImageAction.java 2009-03-25 17:40:09 UTC (rev 13194)
@@ -45,6 +45,9 @@
EntityManager em;
public void deleteImage(Image image, boolean isFlushNeeded) {
+ if(image.getAlbum().getCoveringImage().equals(image)){
+ image.getAlbum().setCoveringImage(null);
+ }
image.getAlbum().removeImage(image);
if (isFlushNeeded) {
em.flush();
15 years, 9 months
JBoss Rich Faces SVN: r13193 - trunk/samples/richfaces-demo/src/main/webapp/richfaces/extendedDataTable.
by richfaces-svn-commits@lists.jboss.org
Author: ilya_shaikovsky
Date: 2009-03-25 13:39:24 -0400 (Wed, 25 Mar 2009)
New Revision: 13193
Modified:
trunk/samples/richfaces-demo/src/main/webapp/richfaces/extendedDataTable/usage.xhtml
Log:
https://jira.jboss.org/jira/browse/RF-5764
Modified: trunk/samples/richfaces-demo/src/main/webapp/richfaces/extendedDataTable/usage.xhtml
===================================================================
--- trunk/samples/richfaces-demo/src/main/webapp/richfaces/extendedDataTable/usage.xhtml 2009-03-25 17:33:19 UTC (rev 13192)
+++ trunk/samples/richfaces-demo/src/main/webapp/richfaces/extendedDataTable/usage.xhtml 2009-03-25 17:39:24 UTC (rev 13193)
@@ -25,10 +25,6 @@
<li><b>State saving </b>via value binding</li>
<li><b>Grouping rows </b>by any column</li>
</ul>
- <p>
- <b>Note</b><i>: This component is in a preview state for 3.2.2 release cause it was
- not fully tested/reviewed by the RF team.</i>
- </p>
<fieldset class="demo_fieldset">
<legend class="demo_legend">Extended DataTable example</legend>
<div class="sample-container">
15 years, 9 months