Results 1 to 3 of 3

Thread: Global commands and TextComponentPopupInterceptorFactory

  1. #1
    Join Date
    Aug 2004
    Location
    Liège, Belgique
    Posts
    47

    Default Global commands and TextComponentPopupInterceptorFactory

    In my application, I doesn't need global commands. So I removed all the defined global commands
    from the command manager definition :

    Code:
      <bean id="commandManager" class="org.springframework.richclient.command.support.DefaultCommandManager">
        <property name="globalCommandIds">
          <list>
            <value>startCommand</value>
            <value>stopCommand</value>
            <value>executeCommand</value>
          </list>
        </property>
      </bean>
    When I use the TextComponentPopupInterceptorFactory like in the Petclinic sample,
    my dialog doesn't show because of a NullPointerException in org.springframework.richclient.text.TextComponentP opup :

    Code:
        public void registerAccelerators&#40;&#41; &#123;
            CommandManager commandManager = getCommandManager&#40;&#41;;        
            Keymap keymap = textComponent.getKeymap&#40;&#41;;
            ActionCommand command = commandManager.getActionCommand&#40;
                    GlobalCommandIds.UNDO&#41;;
            keymap.addActionForKeyStroke&#40;command.getAccelerator&#40;&#41;, command.getSwingActionAdapter&#40;&#41;&#41;;
            command = commandManager.getActionCommand&#40;
                    GlobalCommandIds.REDO&#41;;
            keymap.addActionForKeyStroke&#40;command.getAccelerator&#40;&#41;, command.getSwingActionAdapter&#40;&#41;&#41;;
            command = commandManager.getActionCommand&#40;
                    GlobalCommandIds.COPY&#41;;
            keymap.addActionForKeyStroke&#40;command.getAccelerator&#40;&#41;, command.getSwingActionAdapter&#40;&#41;&#41;;
            command = commandManager.getActionCommand&#40;
                    GlobalCommandIds.CUT&#41;;
            keymap.addActionForKeyStroke&#40;command.getAccelerator&#40;&#41;, command.getSwingActionAdapter&#40;&#41;&#41;;
            command = commandManager.getActionCommand&#40;
                    GlobalCommandIds.PASTE&#41;;
            keymap.addActionForKeyStroke&#40;command.getAccelerator&#40;&#41;, command.getSwingActionAdapter&#40;&#41;&#41;;
            command = commandManager.getActionCommand&#40;
                    GlobalCommandIds.SELECT_ALL&#41;;
            keymap.addActionForKeyStroke&#40;command.getAccelerator&#40;&#41;, command.getSwingActionAdapter&#40;&#41;&#41;;
        &#125;
    I put "if (command != null)" before each keymap.addActionForKeyStroke(...). My dialog shows and works but
    I get a series of complaints about commands not found.

    I think it would be a good idea not considering that the predifined global commands must exists. Or define
    them automatically.

  2. #2
    Join Date
    Aug 2004
    Location
    Melbourne, Australia
    Posts
    335

    Default

    Patrick,

    I've fixed it. I think... can you test this out. You may have to wait for CVS to update.

    Ollie

  3. #3
    Join Date
    Aug 2004
    Location
    Liège, Belgique
    Posts
    47

    Default

    Ollie,

    It works. Great job.

    Patrick

Similar Threads

  1. Replies: 4
    Last Post: Sep 4th, 2006, 10:08 PM
  2. about controller commands
    By thenakedsingularity in forum Web
    Replies: 3
    Last Post: Aug 4th, 2005, 05:11 PM
  3. Replies: 11
    Last Post: Jun 22nd, 2005, 10:12 PM
  4. Context Aware Commands
    By adepue in forum Swing
    Replies: 11
    Last Post: Nov 22nd, 2004, 06:38 PM
  5. Transaction problem with DDL commands
    By jwray in forum Data
    Replies: 2
    Last Post: Aug 26th, 2004, 05:36 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •