|
From: Rogan D. (JIRA) <no...@at...> - 2006-08-14 16:52:58
|
[ http://opensource.atlassian.com/projects/spring/browse/RCP-381?page=comments#action_19043 ] Rogan Dawes commented on RCP-381: --------------------------------- Ok, so I managed to figure out a way to do this. It's not very clean, though :-( In my richclient-application-context.xml, I pass a reference to the LifecycleAdvisor to the global ToggleCommand. <bean id="showProxyControlBarToggle" class="org.owasp.webscarab.plugins.proxy.swing.ShowProxyControlBarToggleCommand" singleton="true"> <property name="proxyControlBar" ref="proxyControlBar"/> <property name="applicationLifecycleAdvisor" ref="lifecycleAdvisor"/> </bean> In my ToggleCommand, I manually configure the command: public void setApplicationLifecycleAdvisor( ApplicationLifecycleAdvisor applicationLifecycleAdvisor) { applicationLifecycleAdvisor.createWindowCommandManager().configure(this); } The reason I say it is not clean is that I end up creating a WindowCommandManager for each global command, and never using it after the command is configured. So, I guess that this could be considered to be the way to do it, but I don't like it much. Any better suggestions? Rogan > Autoconfigure global commands defined in the main richclient-application-context.xml file > ----------------------------------------------------------------------------------------- > > Key: RCP-381 > URL: http://opensource.atlassian.com/projects/spring/browse/RCP-381 > Project: Spring Framework Rich Client Project > Type: Improvement > Components: Command System > Versions: 0.2.0 > Environment: XP SP2, 1.5.0_06 > Reporter: Rogan Dawes > > As discussed on the list, I have a requirement to define some global commands that are not application window specific, and need to be synchronized between window instances (i.e. if I define a ToggleCommand, and I select it in one window, it should be selected in ALL other open or future windows.) > It makes most sense to define such commands in the global application context, rather than in a window-specific commands-context.xml file, since the commands-context file is reread for each window that is opened. Consequently, approaches such as defining commands as singletons is ineffective, since a new Context it created each time a window is opened, and each object IS a singleton in that context, but there are multiple contexts, and hence multiple Command instances! > The problem with defining commands in the Application context is that they are not autoconfigured with labels, etc, as they are when defined in the commands-context. > The solution proposed by Larry was to make it easier to autoconfigure commands defined in the application context. > This issue serves to document the discussion, and remind relevant parties that there is still interest in a solution ;-) Alternatively, some guidance as so how to begin fixing the issue, so that I can create a patch. > Regards, > Rogan -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/spring/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |