unmap and map again

JeffW.'s Avatar

JeffW.

23 Jul, 2013 11:44 AM

hi,
I thought this would be simple but I get an error when I try to re-map a view to a Mediator

In my config class

mediatorMap.map( GameOverView).toMediator(GameOverViewMediatorA );
Then in some command later:
mediatorMap.unmap(GameOverView);
mediatorMap.map( GameOverView).toMediator(GameOverViewMediatorB);

But it gives me the evil eye:
Error: [object TypeFilter] already mapped to [object MediatorMapping]
If you have overridden this mapping intentionally you can use "unmap()" prior to your replacement mapping in order to avoid seeing this message.

thanks,
Jeff.

  1. Support Staff 1 Posted by creynders on 23 Jul, 2013 12:24 PM

    creynders's Avatar

    I don't have the time to go bug-hunting but I can confirm it is a bug:

    https://github.com/robotlegs/robotlegs-framework/issues/149

  2. 2 Posted by JeffW. on 23 Jul, 2013 12:56 PM

    JeffW.'s Avatar

    are you just getting a warning? Because I'm getting a warning and an error. Is there any other way to re-assign views to (other) mediators?

  3. Support Staff 3 Posted by creynders on 23 Jul, 2013 01:13 PM

    creynders's Avatar

    Hmmm, an error as well? Could you paste the stacktrace here?

  4. 4 Posted by JeffW. on 23 Jul, 2013 01:39 PM

    JeffW.'s Avatar

    Wasn't sure if you meant just the error output or the whole lot:

    295 DEBUG Context-0-96 [object ExtensionInstaller] Installing extension [object VigilanceExtension]
    299 DEBUG Context-0-96 [object ExtensionInstaller] Installing extension [object InjectableLoggerExtension]
    300 DEBUG Context-0-96 [object ExtensionInstaller] Installing extension [object ContextViewExtension]
    300 DEBUG Context-0-96 [object ExtensionInstaller] Installing extension [object EventDispatcherExtension]
    301 DEBUG Context-0-96 [object ExtensionInstaller] Installing extension [object ModularityExtension]
    302 DEBUG Context-0-96 [object ExtensionInstaller] Installing extension [object EventCommandMapExtension]
    303 DEBUG Context-0-96 [object ExtensionInstaller] Installing extension [object LocalEventMapExtension]
    304 DEBUG Context-0-96 [object ExtensionInstaller] Installing extension [object ViewManagerExtension]
    305 DEBUG Context-0-96 [object ExtensionInstaller] Installing extension [object StageObserverExtension]
    306 DEBUG Context-0-96 [object ExtensionInstaller] Installing extension [object MediatorMapExtension]
    306 DEBUG Context-0-96 [object ExtensionInstaller] Installing extension [object ViewProcessorMapExtension]
    307 DEBUG Context-0-96 [object ExtensionInstaller] Installing extension [object StageCrawlerExtension]
    308 DEBUG Context-0-96 [object ExtensionInstaller] Installing extension [object StageSyncExtension]
    309 DEBUG Context-0-96 [object ConfigManager] Not yet initialized. Queuing config class [class ContextViewListenerConfig]
    309 DEBUG Context-0-96 [object ExtensionInstaller] Installing extension [object SignalCommandMapBundle]
    309 DEBUG Context-0-96 [object ExtensionInstaller] Installing extension SignalCommandMapExtension-1-89
    310 DEBUG Context-0-96 [object ConfigManager] Not yet initialized. Queuing config class [class ShellConfig]
    310 DEBUG Context-0-96 [object ConfigManager] Not yet initialized. Queuing config class [class ModuleConnectorConfig]
    310 DEBUG Context-0-96 [object ConfigManager] Not yet initialized. Queuing config object [object ContextView]
    311 DEBUG Context-0-96 [object ContextViewExtension] Mapping [object Main] as contextView
    311 DEBUG Context-0-96 [object ModularityExtension] Context has a ViewManager. Configuring view manager based context existence watcher...
    320 DEBUG Context-0-96 [object ModularityExtension] Context configured to inherit. Broadcasting existence event...
    321 DEBUG Context-0-96 [object StageSyncExtension] Context view is now on stage. Initializing context...
    324 INFO Context-0-96 Context-0-96 Initializing...
    332 DEBUG Context-0-96 [object StageObserverExtension] Creating genuine StageObserver Singleton
    333 DEBUG Context-0-96 [object ConfigManager] Now initializing. Instantiating config class [class ContextViewListenerConfig]
    337 DEBUG Context-0-96 [object ViewManagerBasedExistenceWatcher] Adding context existence event listener to container [object Main]
    337 DEBUG Context-0-96 [object ConfigManager] Now initializing. Instantiating config class [class ShellConfig]
    344 DEBUG Context-0-96 [object MediatorMap] [object TypeFilter] mapped to [object MediatorMapping]
    366 DEBUG Context-0-96 [object ConfigManager] Now initializing. Instantiating config class [class ModuleConnectorConfig]
    369 DEBUG Context-0-96 [object ConfigManager] Now initializing. Injecting into config object [object ContextView]
    370 INFO Context-0-96 Context-0-96 Initialize complete
    370 DEBUG Context-0-96 [object StageCrawlerExtension] ViewManager is installed. Checking for managed containers...
    370 DEBUG Context-0-96 [object StageCrawlerExtension] StageCrawler scanning container [object Main] ...
    373 DEBUG Context-0-96 [object StageCrawlerExtension] StageCrawler finished scanning [object Main]
    StartUpCommand execute NUM OF SCREENS: 1
    [SWF] Main.swf - 1,237,444 bytes after decompression

    ShellModel setCurrentTheme: numbers
    ShellModel currentModule: module B
    ShellView switchModule, add: module B

    622 DEBUG Context-0-96 [object ViewManagerBasedExistenceWatcher] Removing context existence event listener from container [object Main]
    655 DEBUG Context-0-96 [object ViewManagerBasedExistenceWatcher] Adding context existence event listener to container [object ModuleB]
    655 DEBUG Context-0-96 [object ViewManagerBasedExistenceWatcher] Adding context existence event listener to container [object ModuleB]
    ModuleBContext
    684 DEBUG Context-2-58 [object ExtensionInstaller] Installing extension [object VigilanceExtension]
    684 DEBUG Context-2-58 [object ExtensionInstaller] Installing extension [object InjectableLoggerExtension]
    684 DEBUG Context-2-58 [object ExtensionInstaller] Installing extension [object ContextViewExtension]
    684 DEBUG Context-2-58 [object ExtensionInstaller] Installing extension [object EventDispatcherExtension]
    685 DEBUG Context-2-58 [object ExtensionInstaller] Installing extension [object ModularityExtension]
    685 DEBUG Context-2-58 [object ExtensionInstaller] Installing extension [object EventCommandMapExtension]
    685 DEBUG Context-2-58 [object ExtensionInstaller] Installing extension [object LocalEventMapExtension]
    685 DEBUG Context-2-58 [object ExtensionInstaller] Installing extension [object ViewManagerExtension]
    685 DEBUG Context-2-58 [object ExtensionInstaller] Installing extension [object StageObserverExtension]
    686 DEBUG Context-2-58 [object ExtensionInstaller] Installing extension [object MediatorMapExtension]
    686 DEBUG Context-2-58 [object ExtensionInstaller] Installing extension [object ViewProcessorMapExtension]
    686 DEBUG Context-2-58 [object ExtensionInstaller] Installing extension [object StageCrawlerExtension]
    686 DEBUG Context-2-58 [object ExtensionInstaller] Installing extension [object StageSyncExtension]
    687 DEBUG Context-2-58 [object ConfigManager] Not yet initialized. Queuing config class [class ContextViewListenerConfig]
    687 DEBUG Context-2-58 [object ExtensionInstaller] Installing extension [object SignalCommandMapBundle]
    687 DEBUG Context-2-58 [object ExtensionInstaller] Installing extension SignalCommandMapExtension-3-ae
    688 DEBUG Context-2-58 [object ConfigManager] Not yet initialized. Queuing config class [class ModuleBConfig]
    688 DEBUG Context-2-58 [object ConfigManager] Not yet initialized. Queuing config class [class ModuleConnectorConfig]
    688 DEBUG Context-2-58 [object ConfigManager] Not yet initialized. Queuing config object [object ContextView]
    688 DEBUG Context-2-58 [object ContextViewExtension] Mapping [object ModuleB] as contextView
    688 DEBUG Context-2-58 [object ModularityExtension] Context has a ViewManager. Configuring view manager based context existence watcher...
    689 DEBUG Context-2-58 [object ModularityExtension] Context configured to inherit. Broadcasting existence event...
    689 DEBUG Context-0-96 [object ViewManagerBasedExistenceWatcher] Context existence event caught. Configuring child context Context-2-58
    689 INFO Context-0-96 Context-0-96 Adding child context Context-2-58
    689 DEBUG Context-2-58 [object StageSyncExtension] Context view is now on stage. Initializing context...
    690 INFO Context-2-58 Context-2-58 Initializing...
    690 DEBUG Context-2-58 [object ConfigManager] Now initializing. Instantiating config class [class ContextViewListenerConfig]
    691 DEBUG Context-2-58 [object ViewManagerBasedExistenceWatcher] Adding context existence event listener to container [object ModuleB]
    691 DEBUG Context-2-58 [object ConfigManager] Now initializing. Instantiating config class [class ModuleBConfig]
    ModuleBConfig.configure()
    692 DEBUG Context-2-58 [object MediatorMap] [object TypeFilter] mapped to [object MediatorMapping]
    693 DEBUG Context-2-58 [object MediatorMap] [object TypeFilter] mapped to [object MediatorMapping]
    694 DEBUG Context-2-58 [object MediatorMap] [object TypeFilter] mapped to [object MediatorMapping]
    694 DEBUG Context-2-58 [object MediatorMap] [object TypeFilter] mapped to [object MediatorMapping]
    694 DEBUG Context-2-58 [object MediatorMap] [object TypeFilter] mapped to [object MediatorMapping]
    695 DEBUG Context-2-58 [object MediatorMap] [object TypeFilter] mapped to [object MediatorMapping]
    695 DEBUG Context-2-58 [object ConfigManager] Now initializing. Instantiating config class [class ModuleConnectorConfig]
    ModuleConnectorConfig.configure() Module B
    696 DEBUG Context-2-58 [object ConfigManager] Now initializing. Injecting into config object [object ContextView]
    696 INFO Context-2-58 Context-2-58 Initialize complete
    696 DEBUG Context-2-58 [object StageCrawlerExtension] ViewManager is installed. Checking for managed containers...
    696 DEBUG Context-2-58 [object StageCrawlerExtension] StageCrawler scanning container [object ModuleB] ...
    #################ViewBMediator.initialize()

    702 DEBUG Context-2-58 [object StageCrawlerExtension] StageCrawler finished scanning [object ModuleB]
    ModuleBConfig init
    MASTER RemapMediatorsCommand execute

    704 DEBUG Context-2-58 [object MediatorMap] [object TypeFilter] mapped to [object MediatorMapping]
    705 WARN Context-2-58 [object MediatorMap] [object TypeFilter] already mapped to [object MediatorMapping]
    If you have overridden this mapping intentionally you can use "unmap()" prior to your replacement mapping in order to avoid seeing this message.

    Error: [object TypeFilter] already mapped to [object MediatorMapping]
    If you have overridden this mapping intentionally you can use "unmap()" prior to your replacement mapping in order to avoid seeing this message.

    at robotlegs.bender.extensions.vigilance::VigilanceExtension/log()[/Development/Projects/Robotlegs/robotlegs-framework/src/robotlegs/bender/extensions/vigilance/VigilanceExtension.as:50]
    at robotlegs.bender.framework.impl::LogManager/log()[/Development/Projects/Robotlegs/robotlegs-framework/src/robotlegs/bender/framework/impl/LogManager.as:89]
    at robotlegs.bender.framework.impl::Logger/warn()[/Development/Projects/Robotlegs/robotlegs-framework/src/robotlegs/bender/framework/impl/Logger.as:70]
    at robotlegs.bender.extensions.mediatorMap.impl::MediatorMapper/overwriteMapping()[/Development/Projects/Robotlegs/robotlegs-framework/src/robotlegs/bender/extensions/mediatorMap/impl/MediatorMapper.as:110]
    at robotlegs.bender.extensions.mediatorMap.impl::MediatorMapper/toMediator()[/Development/Projects/Robotlegs/robotlegs-framework/src/robotlegs/bender/extensions/mediatorMap/impl/MediatorMapper.as:61]
    at modules.module_b.commands::RemapMediatorsCommand/execute()[/as3/some_client/some_game/src/modules/module_b/commands/RemapMediatorsCommand.as:56]
    at robotlegs.bender.extensions.commandCenter.impl::CommandExecutor/executeCommand()[/Development/Projects/Robotlegs/robotlegs-framework/src/robotlegs/bender/extensions/commandCenter/impl/CommandExecutor.as:100]
    at robotlegs.bender.extensions.commandCenter.impl::CommandExecutor/executeCommands()[/Development/Projects/Robotlegs/robotlegs-framework/src/robotlegs/bender/extensions/commandCenter/impl/CommandExecutor.as:65]
    at robotlegs.bender.extensions.signalCommandMap.impl::SignalCommandTrigger/routePayloadToCommands()[/as3/some_client/some_game/src/robotlegs/bender/extensions/signalCommandMap/impl/SignalCommandTrigger.as:105]
    at org.signals::Slot/execute()[/as3/some_client/some_game/src/org/signals/Slot.as:88]
    at org.signals::OnceSignal/dispatch()[/as3/some_client/some_game/src/org/signals/OnceSignal.as:132]
    at modules.module_b.commands::StartUpCommandB/execute()[/as3/some_client/some_game/src/modules/module_b/commands/StartUpCommandB.as:50]
    at robotlegs.bender.extensions.commandCenter.impl::CommandExecutor/executeCommand()[/Development/Projects/Robotlegs/robotlegs-framework/src/robotlegs/bender/extensions/commandCenter/impl/CommandExecutor.as:100]
    at robotlegs.bender.extensions.commandCenter.impl::CommandExecutor/executeCommands()[/Development/Projects/Robotlegs/robotlegs-framework/src/robotlegs/bender/extensions/commandCenter/impl/CommandExecutor.as:65]
    at robotlegs.bender.extensions.signalCommandMap.impl::SignalCommandTrigger/routePayloadToCommands()[/as3/some_client/some_game/src/robotlegs/bender/extensions/signalCommandMap/impl/SignalCommandTrigger.as:105]
    at org.signals::Slot/execute()[/as3/some_client/some_game/src/org/signals/Slot.as:88]
    at org.signals::OnceSignal/dispatch()[/as3/some_client/some_game/src/org/signals/OnceSignal.as:132]
    at modules.module_b.config::ModuleBConfig/init()[/as3/some_client/some_game/src/modules/module_b/config/ModuleBConfig.as:149]
    at Function/<anonymous>()[/Development/Projects/Robotlegs/robotlegs-framework/src/robotlegs/bender/framework/impl/Lifecycle.as:406]
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at robotlegs.bender.framework.impl::Lifecycle/dispatchEvent()[/Development/Projects/Robotlegs/robotlegs-framework/src/robotlegs/bender/framework/impl/Lifecycle.as:309]
    at robotlegs.bender.framework.impl::LifecycleTransition/dispatch()[/Development/Projects/Robotlegs/robotlegs-framework/src/robotlegs/bender/framework/impl/LifecycleTransition.as:212]
    at Function/<anonymous>()[/Development/Projects/Robotlegs/robotlegs-framework/src/robotlegs/bender/framework/impl/LifecycleTransition.as:189]
    at global/robotlegs.bender.framework.impl::safelyCallBack()[/Development/Projects/Robotlegs/robotlegs-framework/src/robotlegs/bender/framework/impl/safelyCallBack.as:43]
    at MessageRunner/next()[/Development/Projects/Robotlegs/robotlegs-framework/src/robotlegs/bender/framework/impl/MessageDispatcher.as:187]
    at MessageRunner/run()[/Development/Projects/Robotlegs/robotlegs-framework/src/robotlegs/bender/framework/impl/MessageDispatcher.as:135]
    at robotlegs.bender.framework.impl::MessageDispatcher/dispatchMessage()[/Development/Projects/Robotlegs/robotlegs-framework/src/robotlegs/bender/framework/impl/MessageDispatcher.as:87]
    at robotlegs.bender.framework.impl::LifecycleTransition/enter()[/Development/Projects/Robotlegs/robotlegs-framework/src/robotlegs/bender/framework/impl/LifecycleTransition.as:191]
    at robotlegs.bender.framework.impl::Lifecycle/initialize()[/Development/Projects/Robotlegs/robotlegs-framework/src/robotlegs/bender/framework/impl/Lifecycle.as:149]
    at robotlegs.bender.framework.impl::Context/initialize()[/Development/Projects/Robotlegs/robotlegs-framework/src/robotlegs/bender/framework/impl/Context.as:159]
    at robotlegs.bender.extensions.contextView::StageSyncExtension/initializeContext()[/Development/Projects/Robotlegs/robotlegs-framework/src/robotlegs/bender/extensions/contextView/StageSyncExtension.as:84]
    at robotlegs.bender.extensions.contextView::StageSyncExtension/handleContextView()[/Development/Projects/Robotlegs/robotlegs-framework/src/robotlegs/bender/extensions/contextView/StageSyncExtension.as:66]
    at ObjectHandler/handle()[/Development/Projects/Robotlegs/robotlegs-framework/src/robotlegs/bender/framework/impl/ObjectProcessor.as:89]
    at robotlegs.bender.framework.impl::ObjectProcessor/processObject()[/Development/Projects/Robotlegs/robotlegs-framework/src/robotlegs/bender/framework/impl/ObjectProcessor.as:48]
    at robotlegs.bender.framework.impl::ConfigManager/addConfig()[/Development/Projects/Robotlegs/robotlegs-framework/src/robotlegs/bender/framework/impl/ConfigManager.as:78]
    at robotlegs.bender.framework.impl::Context/configure()[/Development/Projects/Robotlegs/robotlegs-framework/src/robotlegs/bender/framework/impl/Context.as:313]
    at modules.module_b.config::ModuleBContext()[/as3/some_client/some_game/src/modules/module_b/config/ModuleBContext.as:22]
    at modules.module_b.view.components::ModuleB/onAdded()[/as3/some_client/some_game/src/modules/module_b/view/components/ModuleB.as:39]
    at flash.display::DisplayObjectContainer/addChild()
    at flash.display::Stage/addChild()
    at modules.shell.view.components::ShellView/switchModule()[/as3/some_client/some_game/src/modules/shell/view/components/ShellView.as:92]
    at modules.shell.view.mediators::ShellViewMediator/onSwitchModuleRequested()[/as3/some_client/some_game/src/modules/shell/view/mediators/ShellViewMediator.as:54]
    at org.signals::Slot/execute()[/as3/some_client/some_game/src/org/signals/Slot.as:96]
    at org.signals::OnceSignal/dispatch()[/as3/some_client/some_game/src/org/signals/OnceSignal.as:132]
    at modules.shell.models::ShellModel/set currentModule()[/as3/some_client/some_game/src/modules/shell/models/ShellModel.as:91]
    at modules.shell.commands::NewGameRequestedCommand/execute()[/as3/some_client/some_game/src/modules/shell/commands/NewGameRequestedCommand.as:23]
    at robotlegs.bender.extensions.commandCenter.impl::CommandExecutor/executeCommand()[/Development/Projects/Robotlegs/robotlegs-framework/src/robotlegs/bender/extensions/commandCenter/impl/CommandExecutor.as:100]
    at robotlegs.bender.extensions.commandCenter.impl::CommandExecutor/executeCommands()[/Development/Projects/Robotlegs/robotlegs-framework/src/robotlegs/bender/extensions/commandCenter/impl/CommandExecutor.as:65]
    at robotlegs.bender.extensions.signalCommandMap.impl::SignalCommandTrigger/routePayloadToCommands()[/as3/some_client/some_game/src/robotlegs/bender/extensions/signalCommandMap/impl/SignalCommandTrigger.as:105]
    at org.signals::Slot/execute()[/as3/some_client/some_game/src/org/signals/Slot.as:88]
    at org.signals::OnceSignal/dispatch()[/as3/some_client/some_game/src/org/signals/OnceSignal.as:132]
    at modules.shell.commands::StartUpCommand/execute()[/as3/some_client/some_game/src/modules/shell/commands/StartUpCommand.as:57]
    at robotlegs.bender.extensions.commandCenter.impl::CommandExecutor/executeCommand()[/Development/Projects/Robotlegs/robotlegs-framework/src/robotlegs/bender/extensions/commandCenter/impl/CommandExecutor.as:100]
    at robotlegs.bender.extensions.commandCenter.impl::CommandExecutor/executeCommands()[/Development/Projects/Robotlegs/robotlegs-framework/src/robotlegs/bender/extensions/commandCenter/impl/CommandExecutor.as:65]
    at robotlegs.bender.extensions.signalCommandMap.impl::SignalCommandTrigger/routePayloadToCommands()[/as3/some_client/some_game/src/robotlegs/bender/extensions/signalCommandMap/impl/SignalCommandTrigger.as:105]
    at org.signals::Slot/execute()[/as3/some_client/some_game/src/org/signals/Slot.as:88]
    at org.signals::OnceSignal/dispatch()[/as3/some_client/some_game/src/org/signals/OnceSignal.as:132]
    at modules.shell.config::ShellConfig/init()[/as3/some_client/some_game/src/modules/shell/config/ShellConfig.as:173]
    at Function/<anonymous>()[/Development/Projects/Robotlegs/robotlegs-framework/src/robotlegs/bender/framework/impl/Lifecycle.as:406]
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at robotlegs.bender.framework.impl::Lifecycle/dispatchEvent()[/Development/Projects/Robotlegs/robotlegs-framework/src/robotlegs/bender/framework/impl/Lifecycle.as:309]
    at robotlegs.bender.framework.impl::LifecycleTransition/dispatch()[/Development/Projects/Robotlegs/robotlegs-framework/src/robotlegs/bender/framework/impl/LifecycleTransition.as:212]
    
  5. 5 Posted by JeffW. on 23 Jul, 2013 01:47 PM

    JeffW.'s Avatar

    btw, I'm using a signal to execute the command in which the remapping takes place

    signalCommandMap.map(RemapMediatorsSignal).toCommand(RemapMediatorsCommand);
    
  6. Support Staff 6 Posted by creynders on 23 Jul, 2013 02:10 PM

    creynders's Avatar

    Ah yes, of course, the VigilanceExtension translates logged warnings to errors. I.e. it's normal you got an error and I didn't.

    I'll see if I can find the culprit.
    Train rides are ideal for bug hunting IMO :)

  7. 7 Posted by JeffW. on 23 Jul, 2013 02:10 PM

    JeffW.'s Avatar

    Has it smt to do with this?

    'The Vigilance Extension throws Errors when warnings are logged.'

    public function log(source:Object, level:uint, timestamp:int, message:String, params:Array = null):void
    {
        if (level <= LogLevel.WARN)
        {
             throw new VigilantError(_messageParser.parseMessage(message, params));
        }
    }
    
  8. 8 Posted by JeffW. on 23 Jul, 2013 02:11 PM

    JeffW.'s Avatar

    Okay :)

  9. Support Staff 9 Posted by creynders on 23 Jul, 2013 02:36 PM

    creynders's Avatar

    LOL. The heat is affecting my brain, clearly. Of course it doesn't work, the unmapping should be:

    mediatorMap.unmap(GameOverView).fromAll();
    

    or

    mediatorMap.unmap(GameOverView).fromMediator(GameOverViewMediatorA);
    
  10. 10 Posted by JeffW. on 23 Jul, 2013 02:39 PM

    JeffW.'s Avatar

    aaah, a hot day indeed, thanks!!

  11. Support Staff 11 Posted by creynders on 23 Jul, 2013 03:06 PM

    creynders's Avatar

    Closing this up, to hide our ramblings ;)

  12. creynders closed this discussion on 23 Jul, 2013 03:06 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac