displaying images not from the default directory [message #1807092] |
Wed, 22 May 2019 08:57  |
Eclipse User |
|
|
|
Hi,
I would like to add a lot of images to my application and for better clarity and order, I would like to store each group of images in an independent sub-directory.
Thus, for example: in the default directory /org/eclipse/scout/apps/myapp/client/icons in the "src/main/resources" folder of the * .client module I created a new sub-directory called flags, where I saved some of the images. To display one of them (flag1.jpg) I used this code:
public class FlagImageField extends AbstractImageField {
@Override
protected String getConfiguredImageId() {
return "flags/flag1";
}
@Override
protected String getConfiguredLabel() {
return "Country";
}
@Override
protected byte getConfiguredLabelPosition() {
return LABEL_POSITION_TOP;
}
@Override
protected int getConfiguredGridH() {
return 4;
}
}
However, it does not work. The image is not displayed.
I did debugging the DefaultIconProviderService class, which I did not change compared to the default implementation as follows:
public class DefaultIconProviderService extends AbstractIconProviderService {
@Override
protected URL findResource(String relativePath) {
return ResourceBase.class.getResource("icons/" + relativePath);
}
}
I see that the Scout Platform calls above findResource method for the relativePath = "flags/flag1.jpg" parameter and finds the resource.
So where is the catch? What am I doing wrong?
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04354 seconds