use of org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTreeNodeComparator in project OpenOLAT by OpenOLAT.
the class TaxonomyTreeTableController method loadModel.
private void loadModel(boolean resetPage, boolean resetInternal) {
TaxonomyLevelSearchParameters searchParams = new TaxonomyLevelSearchParameters();
searchParams.setQuickSearch(tableEl.getQuickSearchString());
List<TaxonomyLevel> taxonomyLevels = taxonomyService.getTaxonomyLevels(taxonomy, searchParams);
List<TaxonomyLevelRow> rows = new ArrayList<>(taxonomyLevels.size());
Map<Long, TaxonomyLevelRow> levelToRows = new HashMap<>();
for (TaxonomyLevel taxonomyLevel : taxonomyLevels) {
TaxonomyLevelRow row = forgeRow(taxonomyLevel);
rows.add(row);
levelToRows.put(taxonomyLevel.getKey(), row);
}
for (TaxonomyLevelRow row : rows) {
Long parentLevelKey = row.getParentLevelKey();
TaxonomyLevelRow parentRow = levelToRows.get(parentLevelKey);
row.setParent(parentRow);
}
for (TaxonomyLevelRow row : rows) {
for (FlexiTreeTableNode parent = row.getParent(); parent != null; parent = parent.getParent()) {
((TaxonomyLevelRow) parent).incrementNumberOfChildren();
}
}
Collections.sort(rows, new FlexiTreeNodeComparator());
model.setObjects(rows);
tableEl.reset(resetPage, resetInternal, true);
}
use of org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTreeNodeComparator in project openolat by klemens.
the class TaxonomyTreeTableController method loadModel.
private void loadModel(boolean resetPage, boolean resetInternal) {
TaxonomyLevelSearchParameters searchParams = new TaxonomyLevelSearchParameters();
searchParams.setQuickSearch(tableEl.getQuickSearchString());
List<TaxonomyLevel> taxonomyLevels = taxonomyService.getTaxonomyLevels(taxonomy, searchParams);
List<TaxonomyLevelRow> rows = new ArrayList<>(taxonomyLevels.size());
Map<Long, TaxonomyLevelRow> levelToRows = new HashMap<>();
for (TaxonomyLevel taxonomyLevel : taxonomyLevels) {
TaxonomyLevelRow row = forgeRow(taxonomyLevel);
rows.add(row);
levelToRows.put(taxonomyLevel.getKey(), row);
}
for (TaxonomyLevelRow row : rows) {
Long parentLevelKey = row.getParentLevelKey();
TaxonomyLevelRow parentRow = levelToRows.get(parentLevelKey);
row.setParent(parentRow);
}
for (TaxonomyLevelRow row : rows) {
for (FlexiTreeTableNode parent = row.getParent(); parent != null; parent = parent.getParent()) {
((TaxonomyLevelRow) parent).incrementNumberOfChildren();
}
}
Collections.sort(rows, new FlexiTreeNodeComparator());
model.setObjects(rows);
tableEl.reset(resetPage, resetInternal, true);
}
Aggregations