Optimize View creation
This commit is contained in:
parent
49444ab3df
commit
b935a0e372
@ -19,26 +19,19 @@ class UIBuilder {
|
||||
void build(EntityCollection entitiesCollection) {
|
||||
_entities = entitiesCollection;
|
||||
_views.clear();
|
||||
_createViewsContainers(entitiesCollection.viewList);
|
||||
_createViews(entitiesCollection.viewList);
|
||||
}
|
||||
|
||||
void _createViewsContainers(List<String> viewsList) {
|
||||
void _createViews(List<String> viewsList) {
|
||||
int counter = 0;
|
||||
viewsList.forEach((viewId) {
|
||||
counter += 1;
|
||||
_views[viewId] = View(viewId, counter);
|
||||
});
|
||||
//TODO merge this two func into one
|
||||
_createViews();
|
||||
}
|
||||
View view = View(viewId, counter);
|
||||
|
||||
void _createViews() {
|
||||
TheLogger.log("Debug","Gethering views");
|
||||
_views.forEach((viewId, view) { //Each view
|
||||
try {
|
||||
Entity viewGroupEntity = _entities.get(viewId);
|
||||
viewGroupEntity.childEntities.forEach((
|
||||
entityId) { //Each entity or group in view
|
||||
entityId) { //Each entity or group in view
|
||||
if (_entities.isExist(entityId)) {
|
||||
view.add(_entities.get(entityId));
|
||||
} else {
|
||||
@ -48,6 +41,8 @@ class UIBuilder {
|
||||
} catch (error) {
|
||||
TheLogger.log("Error","Error parsing view: $viewId");
|
||||
}
|
||||
|
||||
_views[viewId] = view;
|
||||
});
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user