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