vaadin / board

Framework 8 version of vaadin-board
Other
8 stars 10 forks source link

Fix imageCollage example #87

Closed rogozinds closed 7 years ago

rogozinds commented 7 years ago

Add javadoc how to use it.


This change is Reviewable

alvarezguille commented 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 8 lines of code… > 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);

 

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

rogozinds commented 7 years ago

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):

Previously, alvarezguille (Guille) wrote…
> 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

DiegoCardoso commented 7 years ago

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

rogozinds commented 7 years ago

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):

Previously, DiegoCardoso (Diego Cardoso) wrote…
When calling `createImageBox(1)`, it is actually taking the second image. Should it be `n = (n - 1) % resources.length`?

Done.


Comments from Reviewable

alvarezguille commented 7 years ago

Reviewed 1 of 19 files at r2. Review status: all files reviewed at latest revision, all discussions resolved.


Comments from Reviewable