You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by ah...@apache.org on 2021/06/24 13:33:40 UTC
[isis] branch master updated: ISIS-2761: RO Viewer: don't hardcode
object-icon type to image/png
This is an automated email from the ASF dual-hosted git repository.
ahuber pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/isis.git
The following commit(s) were added to refs/heads/master by this push:
new 062da0c ISIS-2761: RO Viewer: don't hardcode object-icon type to image/png
062da0c is described below
commit 062da0c8872a18aec935e0d96f16a7312adde84a
Author: Andi Huber <ah...@apache.org>
AuthorDate: Thu Jun 24 15:33:30 2021 +0200
ISIS-2761: RO Viewer: don't hardcode object-icon type to image/png
use image/* instead
also fixes icon search order in local class path
---
.../decorator/icon/ObjectIconServiceDefault.java | 22 ++++++++++++++--------
.../restfulobjects/applib/RepresentationType.java | 4 ++--
2 files changed, 16 insertions(+), 10 deletions(-)
diff --git a/viewers/common/src/main/java/org/apache/isis/viewer/common/model/decorator/icon/ObjectIconServiceDefault.java b/viewers/common/src/main/java/org/apache/isis/viewer/common/model/decorator/icon/ObjectIconServiceDefault.java
index d0ec5a0..99ec4a1 100644
--- a/viewers/common/src/main/java/org/apache/isis/viewer/common/model/decorator/icon/ObjectIconServiceDefault.java
+++ b/viewers/common/src/main/java/org/apache/isis/viewer/common/model/decorator/icon/ObjectIconServiceDefault.java
@@ -98,7 +98,7 @@ implements ObjectIconService {
return icon;
- //XXX cannot use computeIfAbsent, as does not support recursive update
+ //XXX cannot use computeIfAbsent, as it does not support recursive update
// return iconByKey.computeIfAbsent(iconResourceKey, key->
// findIcon(spec, iconNameModifier));
}
@@ -119,9 +119,11 @@ implements ObjectIconService {
? domainClass.getSimpleName() + "-" + iconNameModifier
: domainClass.getSimpleName();
+ // search for image in corresponding class'es resource path
+
for(val imageType : IMAGE_TYPES) {
- val objectIcon1 = imageType
+ val objectIcon = imageType
.getProposedFileExtensions()
.stream()
.map(suffix->iconResourceNameNoExt + "." + suffix)
@@ -135,13 +137,17 @@ implements ObjectIconService {
.map(Optional::get)
.findFirst();
- if(objectIcon1.isPresent()) {
- return objectIcon1.get(); // short-circuit if found
+ if(objectIcon.isPresent()) {
+ return objectIcon.get(); // short-circuit if found
}
- // also search the default image resource path
+ }
+
+ // also search the default image resource path
+
+ for(val imageType : IMAGE_TYPES) {
- val objectIcon2 = imageType
+ val objectIcon = imageType
.getProposedFileExtensions()
.stream()
.map(suffix->DEFAULT_IMAGE_RESOURCE_PATH + "/" + iconResourceNameNoExt + "." + suffix)
@@ -155,8 +161,8 @@ implements ObjectIconService {
.map(Optional::get)
.findFirst();
- if(objectIcon2.isPresent()) {
- return objectIcon2.get(); // short-circuit if found
+ if(objectIcon.isPresent()) {
+ return objectIcon.get(); // short-circuit if found
}
}
diff --git a/viewers/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/RepresentationType.java b/viewers/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/RepresentationType.java
index 93ba153..c0e9073 100644
--- a/viewers/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/RepresentationType.java
+++ b/viewers/restfulobjects/applib/src/main/java/org/apache/isis/viewer/restfulobjects/applib/RepresentationType.java
@@ -109,8 +109,8 @@ public enum RepresentationType {
RestfulMediaType.APPLICATION_XML_OBJECT_LAYOUT_BS3,
null),
OBJECT_ICON(
- "image/png",
- "image/png",
+ "image/*",
+ "image/*",
null),
MENUBARS(
RestfulMediaType.APPLICATION_JSON_LAYOUT_MENUBARS,