Announcement Announcement Module
Collapse
No announcement yet.
Toggle button on toolbar Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Toggle button on toolbar

    I create the toolbar in the common way in "commands.xml" application context file:
    Code:
    <bean id="toolBar" class="org.springframework.richclient.command.CommandGroupFactoryBean">
    		<property name="members">
    			<list>
    				<ref bean="newXXXXCommand" />
    				<value>deleteCommand</value>
    				<value>searchCommand</value>
    			</list>
    		</property>
    	</bean>
    Where "searchCommand" is a GlobalCommand id. In my view I associate this command with a custom class extending "ActionCommand".

    I want to activate/desactivate the search view mode using a toggle button associated with the searchCommand, is it possible??

    Thanks

  • #2
    What exactly do you mean by a GlobalCommand id? Is the search command defined in the richclient-application-context.xml, or in commands-context.xml?

    Comment


    • #3
      I define the following bean in my commands-context.xml

      Code:
      <bean id="windowCommandManager" class="org.springframework.richclient.application.support.ApplicationWindowCommandManager">
      	<property name="sharedCommandIds">
      		<list>
      			<value>deleteCommand</value>
      			<value>propertiesCommand</value>
      			<value>searchCommand</value>
      		</list>
      	</property>
      </bean>
      Later, programatically I override the following method from my view.
      Code:
      @Override
      protected void registerLocalCommandExecutors(PageComponentContext context) {
      	context.register(GlobalCommandIds.DELETE, deleteExecutor);
      	context.register(GlobalCommandIds.PROPERTIES, propertiesExecutor);
      	context.register(MyProjectGlobalCommandIds.SEARCH, searchXXXXXCommand);
      }

      Comment


      • #4
        Ah, I see. The trick is to extend ToggleCommand rather than AbstractCommand.

        Comment


        • #5
          Thanks, this works fine!

          Comment

          Working...
          X