Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for inlined properties, by displaying them as links. #209

Merged
merged 1 commit into from
Nov 11, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,25 @@ public static Preview getPreview(final AbstractResource aResource, List<String>
value = constructPropertyValue(PropertyDefintion.RepresentationType.LINK, multiple, l);
} else {
Link link = (Link) getterMethod.invoke(aResource);
value = constructPropertyValue(PropertyDefintion.RepresentationType.LINK, multiple,
constructLink(link));
value = constructPropertyValue(PropertyDefintion.RepresentationType.LINK, multiple, constructLink(link));
}
} else {
value = constructPropertyValue(PropertyDefintion.RepresentationType.TEXT, multiple,
getterMethod.invoke(aResource));
if (!isNotInlinedRepresentation) {
if (multiple) {
Collection<AbstractResource> rs = (Collection<AbstractResource>) getterMethod.invoke(aResource);
berezovskyi marked this conversation as resolved.
Show resolved Hide resolved
List<org.eclipse.lyo.server.ui.model.Link> l = new ArrayList<>();
for (AbstractResource r: rs) {
l.add(constructLink(r.getAbout().toString(), r.toString()));
}
Comment on lines +77 to +80
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this can be rewritten with Java 8 stream in 1 line, eg https://mkyong.com/java8/java-8-streams-map-examples/

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

of course.

value = constructPropertyValue(PropertyDefintion.RepresentationType.LINK, multiple, l);
} else {
AbstractResource r = (AbstractResource) getterMethod.invoke(aResource);
value = constructPropertyValue(PropertyDefintion.RepresentationType.LINK, multiple, constructLink(r.getAbout().toString(), r.toString()));
}
}
else {
value = constructPropertyValue(PropertyDefintion.RepresentationType.TEXT, multiple, getterMethod.invoke(aResource));
}
}
previewItems.add(constructProperty(key, value));
}
Expand Down