Skip to content

Commit

Permalink
JNG-4728 sorted imports (#50)
Browse files Browse the repository at this point in the history
  • Loading branch information
noherczeg authored Apr 11, 2023
1 parent b7bb8c6 commit 4c49742
Showing 1 changed file with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public static String getMuiDateTimePickerImportsForPage(PageDefinition pageDefin
Set<String> uniqueVisualElementNames = getUniqueVisualElementNamesForPage(pageDefinition).stream()
.map(String::toLowerCase)
.collect(Collectors.toSet());
Set<String> imports = new HashSet<>();
SortedSet<String> imports = new TreeSet<>();

muiDatePickerWidgetImportPairs.forEach((key, value) -> {
if (uniqueVisualElementNames.contains(key)) {
Expand All @@ -90,11 +90,11 @@ public static String getMuiDateTimePickerImportsForPage(PageDefinition pageDefin
return String.join(", ", imports).concat(imports.size() > 0 ? "," : "");
}

public static Set<String> getMuiDataGridImports(PageDefinition pageDefinition) {
public static SortedSet<String> getMuiDataGridImports(PageDefinition pageDefinition) {
Set<String> uniqueVisualElementNames = getUniqueVisualElementNamesForPage(pageDefinition).stream()
.map(String::toLowerCase)
.collect(Collectors.toSet());
Set<String> imports = new HashSet<>();
SortedSet<String> imports = new TreeSet<>();

muiDataGridWidgetImportPairs.forEach((key, value) -> {
if (uniqueVisualElementNames.contains(key)) {
Expand All @@ -108,26 +108,26 @@ public static Set<String> getMuiDataGridImports(PageDefinition pageDefinition) {
}

public static String getMuiDataGridImportsForPage(PageDefinition pageDefinition) {
Set<String> imports = getMuiDataGridImports(pageDefinition);
SortedSet<String> imports = getMuiDataGridImports(pageDefinition);

imports.addAll(Set.of("GridSelectionModel", "GridRenderCellParams", "GridColDef"));

return String.join(", ", imports).concat(imports.size() > 0 ? "," : "");
}

public static String getMuiDataGridImportsForActionForm(PageDefinition pageDefinition) {
Set<String> imports = getMuiDataGridImports(pageDefinition);
SortedSet<String> imports = getMuiDataGridImports(pageDefinition);

imports.addAll(Set.of("GridSelectionModel", "GridRenderCellParams", "GridColDef"));

return String.join(", ", imports).concat(imports.size() > 0 ? "," : "");
}

public static Set<String> getMaterialImportsForPage(PageDefinition pageDefinition) {
public static SortedSet<String> getMaterialImportsForPage(PageDefinition pageDefinition) {
Set<String> uniqueVisualElementNames = getUniqueVisualElementNamesForPage(pageDefinition).stream()
.map(String::toLowerCase)
.collect(Collectors.toSet());
Set<String> imports = new HashSet<>();
SortedSet<String> imports = new TreeSet<>();

imports.addAll(Set.of("Button"));

Expand All @@ -141,22 +141,22 @@ public static Set<String> getMaterialImportsForPage(PageDefinition pageDefinitio
}

public static String getMuiMaterialImportsForPage(PageDefinition pageDefinition) {
Set<String> imports = getMaterialImportsForPage(pageDefinition);
SortedSet<String> imports = getMaterialImportsForPage(pageDefinition);

return String.join(", ", imports).concat(imports.size() > 0 ? "," : "");
}

public static String getMuiMaterialImportsForActionForm(PageDefinition pageDefinition) {
Set<String> imports = getMaterialImportsForPage(pageDefinition);
SortedSet<String> imports = getMaterialImportsForPage(pageDefinition);

imports.addAll(Set.of("Button", "IconButton", "DialogActions", "DialogContent", "DialogContentText", "DialogTitle"));

return String.join(", ", imports).concat(imports.size() > 0 ? "," : "");
}

public static Set<String> getUniqueVisualElementNamesForPage(PageDefinition pageDefinition) {
public static SortedSet<String> getUniqueVisualElementNamesForPage(PageDefinition pageDefinition) {
Set<VisualElement> flattenedVisualElements = createFlattenedSetOfVisualElements(pageDefinition);
Set<String> uniqueVisualElementNames = new HashSet<>();
SortedSet<String> uniqueVisualElementNames = new TreeSet<>();

flattenedVisualElements.forEach(v -> uniqueVisualElementNames.add(getVisualElementWidgetName(v)));

Expand Down

0 comments on commit 4c49742

Please sign in to comment.