From 292c89dd1e5ff3650cff2effca4f05cd67290796 Mon Sep 17 00:00:00 2001 From: Dave Stubbs Date: Sun, 10 Jan 2010 11:29:27 +0000 Subject: [PATCH] speed up selection by making editors added lazily with tabs --- net/systemeD/potlatch2/CategorySelector.mxml | 3 ++- net/systemeD/potlatch2/TagViewer.mxml | 18 ++++++++++++++++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/net/systemeD/potlatch2/CategorySelector.mxml b/net/systemeD/potlatch2/CategorySelector.mxml index 69fdbf34..c7647d78 100644 --- a/net/systemeD/potlatch2/CategorySelector.mxml +++ b/net/systemeD/potlatch2/CategorySelector.mxml @@ -1,7 +1,8 @@ + xmlns:halcyon="net.systemeD.halcyon.*" + backgroundColor="white" borderStyle="inset"> diff --git a/net/systemeD/potlatch2/TagViewer.mxml b/net/systemeD/potlatch2/TagViewer.mxml index f8ee6b78..d76b2dc3 100644 --- a/net/systemeD/potlatch2/TagViewer.mxml +++ b/net/systemeD/potlatch2/TagViewer.mxml @@ -17,7 +17,7 @@ + scrollSpeed="20" change="ensureEditorsPopulated(IndexChangedEvent(event).relatedObject as VBox)"/> @@ -139,6 +139,8 @@ helpLabel.visible = false; } + private var tabComponents:Object = {}; + private function initialiseEditors():void { editorStack.removeAllChildren(); if ( selectedEntity == null || feature == null ) @@ -149,6 +151,7 @@ editorStack.addChild(editorBox); var tabs:Object = {}; + tabComponents = {}; for each (var factory:EditorFactory in feature.editors) { if ( factory.presence.isEditorPresent(factory, selectedEntity, null) ) { @@ -163,10 +166,12 @@ tab.label = category; editorStack.addChild(tab); tabs[category] = tab; + tabComponents[tab] = []; } var catEditor:DisplayObject = factory.createEditorInstance(selectedEntity); if ( catEditor != null ) - tab.addChild(catEditor); + tabComponents[tab].push(catEditor); + // tab.addChild(catEditor); } } @@ -177,6 +182,15 @@ return box; } + private function ensureEditorsPopulated(tab:VBox):void { + var components:Array = tabComponents[tab]; + if ( components == null || tab == null || tab.numChildren >= components.length ) + return; + for each (var component:DisplayObject in components ) { + tab.addChild(component); + } + } + private function checkAdvanced():void { if ( selectedEntity != null ) setupAdvanced(selectedEntity); -- 2.36.1