Closed rogozinds closed 7 years ago
Review status: 0 of 10 files reviewed at latest revision, 1 unresolved discussion, some commit checks failed.
integration-tests/src/main/java/com/vaadin/addon/board/examples/ImageCollage.java, line 94 at r1 (raw file):
Quoted 4 lines of code…
URL resource = ImageCollage.class.getResource(IMAGE_PATH + fileName + ".jpg"); resources[i] = new FileResource(new File(resource.getFile())); } }
what about avoiding the rename of images with something like:
private void createResources() {
final String IMAGE_PATH = "image-collage/small/";
URL folderResource = ImageCollage.class.getResource(IMAGE_PATH);
File folder = new File((folderResource.getFile()));
String[] fileNames = folder.list();
resources = new FileResource[fileNames.length];
for (int i = 0; i < fileNames.length; i++) {
URL resource = ImageCollage.class.getResource(IMAGE_PATH + fileNames[i]);
resources[i] = new FileResource(new File(resource.getFile()));
}
}
Comments from Reviewable
Review status: 0 of 1 files reviewed at latest revision, 1 unresolved discussion.
integration-tests/src/main/java/com/vaadin/addon/board/examples/ImageCollage.java, line 94 at r1 (raw file):
> private void createResources() { > final String IMAGE_PATH = "image-collage/small/"; > URL folderResource = ImageCollage.class.getResource(IMAGE_PATH); > File folder = new File((folderResource.getFile())); > int nImages = folder.list().length; > resources = new FileResource[nImages]; > for (int i = 0; i < nImages; i++) { > String fileName = "" + (i+1); > > URL resource = ImageCollage.class.getResource(IMAGE_PATH + fileName + ".jpg"); > resources[i] = new FileResource(new File(resource.getFile())); > } > } what about avoiding the rename of images with something like: ``` private void createResources() { final String IMAGE_PATH = "image-collage/small/"; URL folderResource = ImageCollage.class.getResource(IMAGE_PATH); File folder = new File((folderResource.getFile())); String[] fileNames = folder.list(); resources = new FileResource[fileNames.length]; for (int i = 0; i < fileNames.length; i++) { URL resource = ImageCollage.class.getResource(IMAGE_PATH + fileNames[i]); resources[i] = new FileResource(new File(resource.getFile())); } } ```
Done.
Comments from Reviewable
Review status: 0 of 1 files reviewed at latest revision, 2 unresolved discussions.
integration-tests/src/main/java/com/vaadin/addon/board/examples/ImageCollage.java, line 99 at r1 (raw file):
container.setStyleName("image-collage-item"); n = n % resources.length;
When calling createImageBox(1)
, it is actually taking the second image. Should it be n = (n - 1) % resources.length
?
Comments from Reviewable
Review status: 0 of 1 files reviewed at latest revision, 1 unresolved discussion, some commit checks failed.
integration-tests/src/main/java/com/vaadin/addon/board/examples/ImageCollage.java, line 99 at r1 (raw file):
When calling `createImageBox(1)`, it is actually taking the second image. Should it be `n = (n - 1) % resources.length`?
Done.
Comments from Reviewable
Reviewed 1 of 19 files at r2. Review status: all files reviewed at latest revision, all discussions resolved.
Comments from Reviewable
Add javadoc how to use it.
This change is