use of com.manydesigns.elements.options.SearchDisplayMode in project Portofino by ManyDesigns.
the class AbstractCrudAction method getAllSelectionProviders.
// **************************************************************************
// Configuration
// **************************************************************************
@GET
@Path(":allSelectionProviders")
@Produces(MediaType.APPLICATION_JSON)
@Operation(summary = "The list of selection providers configured on this crud action.")
public CrudSelectionProviderEdit[] getAllSelectionProviders() {
Map<List<String>, Collection<String>> availableSelectionProviders = selectionProviderSupport.getAvailableSelectionProviderNames();
CrudSelectionProviderEdit[] selectionProviderEdits = new CrudSelectionProviderEdit[availableSelectionProviders.size()];
int i = 0;
for (Map.Entry<List<String>, Collection<String>> entry : availableSelectionProviders.entrySet()) {
CrudSelectionProviderEdit selectionProviderEdit = new CrudSelectionProviderEdit();
selectionProviderEdits[i] = selectionProviderEdit;
String[] fieldNames = entry.getKey().toArray(new String[0]);
selectionProviderEdit.fieldNames = fieldNames;
selectionProviderEdit.availableSelectionProviders = entry.getValue();
selectionProviderEdit.displayModeName = DisplayMode.DROPDOWN.name();
selectionProviderEdit.searchDisplayModeName = SearchDisplayMode.DROPDOWN.name();
for (CrudSelectionProvider cp : selectionProviderSupport.getCrudSelectionProviders()) {
if (Arrays.equals(cp.fieldNames, fieldNames)) {
SelectionProvider selectionProvider = cp.getSelectionProvider();
if (selectionProvider != null) {
selectionProviderEdit.selectionProviderName = selectionProvider.getName();
DisplayMode displayMode = selectionProvider.getDisplayMode();
if (displayMode != null) {
selectionProviderEdit.displayModeName = displayMode.name();
}
SearchDisplayMode searchDisplayMode = selectionProvider.getSearchDisplayMode();
if (searchDisplayMode != null) {
selectionProviderEdit.searchDisplayModeName = searchDisplayMode.name();
}
}
}
}
i++;
}
return selectionProviderEdits;
}
Aggregations