Details
-
Improvement
-
Status: Closed
-
Normal
-
Resolution: Won't Fix
-
ext-document-picker-6.0.0
-
None
Description
At the moment, ExternalTreeItemFieldBrowserDialog#expandPickedExternalTreeItemNodes() depends on ExternalDocumentTreeService#getParent() method invocation to resolve the parent of the specific tree node item, when it needs to expand all the ancestor node of the selected tree node:
private void expandPickedExternalTreeItemNodes(ExternalDocumentServiceFacade<Serializable> extDocService) { for (Serializable item : getPickedExternalDocuments()) { Serializable parent = extDocService.getParent(item); while (parent != null) { treeExpansionSet.add(parent); parent = getExternalDocumentServiceFacade().getParent(parent); } } }
This is not convenient in reality because:
- When opening the document in cms editor, it invokes #getFieldExternalDocuments() to get the data of the current selected items. However, in many real use cases, the backend api call may just return only the single item, not including parent-child relationship for the single item query (in REST api for example).
Also, when looking at the ExternalTreeItemFieldBrowserDialog#expandPickedExternalTreeItemNodes() implementation, I've just realized that it is only about expanding the existing tree nodes of ancestors of the selected tree node item and so it does not have to retrieve the parent from the facade of the backend at all at this moment.
An improvement would be to resolve the parent item data from the existing (UI) tree provider itself as it already exists there, instead of invoking facade#getParent() again.