Announcement Announcement Module
Collapse
No announcement yet.
how to add more than one toolbar ? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • how to add more than one toolbar ?

    just as title

  • #2
    Can't you just add commands to the existing toolbar?

    you can get the toolbar from the ApplicationWindow, and then contribute commands or commandgroups.

    Comment


    • #3
      I try add and remove commands from/to toolbar and it doesn't work

      I create toolbar and commands programatic like :

      ActionCommand com = new ActionCommand ...
      CommandGroup group = getActiveWindow().getCommandManager()
      .createCommandGroup ...
      JToolbar toolbar = group.createToolBar ()

      When I try group.add(..) or group.remove ... nothing happen

      regards

      Comment


      • #4
        By calling the createToolBar method on the CommandGroup you created, you create a JToolBar instance, but it never gets added to the gui.

        Do the following instead (in your view):

        // first get the CommandGroup that forms the ToolBar
        CommandGroup toolBar = getContext().getWindow().getToolBar();
        // add a command
        ActionCommand cmd = ...;
        toolBar.add(cmd);
        toolBar.addSeparator();

        // add a CommandGroup
        CommandGroup group = ...;
        toolBar.add(group);


        Hope this helps,

        Peter

        Comment


        • #5
          Peter,
          I can't use spring RCP commands from command-context.xml because I have more views on
          screen in the same time and I create command group and commands "manual" with new operator

          toolbar is created fine, but I want that add or remove any command depend from context

          I try group.add and group.remove and it don't work

          Thanks

          Comment


          • #6
            Do you add the commandgroup you created to the toolbar as I suggested? I tried it, and it works.

            I'm also working with multiple views per page, and everything works fine.

            I added a PageComponentListener to the ApplicationPage that adds the commands when the view is opened or gains focus, and removes them when the view is closed or loses focus.

            Everything works fine,

            Peter

            Comment


            • #7
              CommandGroup toolBar = getContext().getWindow().getToolBar();
              I can't use it because I create commandGroup programatic :

              This is code :
              Code:
              ...
              dbRefresh = new ActionCommand("dbRefresh") {
                          protected void doExecuteCommand() {
                              dbForm.getDbModel().refresh();
                          }
                      };
                      searchPreferencesPopupMenu = new SearchPopupMenuMouseListener(
                              createSearchPreferencesPopupMenu());
                      dbSearchPreferences = new ActionCommand("dbSearchPreferences") {
                          public AbstractButton createButton(String faceDescriptorId,
                                  ButtonFactory buttonFactory,
                                  CommandButtonConfigurer buttonConfigurer) {
                              AbstractButton button = buttonFactory.createButton();
                              attach(button, buttonConfigurer);
                              button.addMouseListener(searchPreferencesPopupMenu);
                              return button;
                          }
              
                          protected void doExecuteCommand() {
                              //dbForm.searchPreferencesPopupMenu.
                          }
                      };
              
                      String CommandGroupName = dbForm.getFormName() + "." + DATABASE_COMMAND;
                      CommandGroup group = getActiveWindow().getCommandManager()
                              .createCommandGroup(
                                      CommandGroupName,
                                      new Object[] { dbNewRow, dbSearchMode,
                                              dbCancelSearchMode, dbRefresh, "separator",
                                              dbSave, dbRollback, dbDelete, "separator",
                                              dbFirst, dbPreviousPage, dbPrevious,
                                              "separator", dbNext, dbNextPage, dbLast,
                                              dbSearchPreferences });
                      return group.createToolBar();
              I have CommandGroup group (id DATABASE_COMMAND) and toolbar toolbar

              How I can add and remove command from group or toolbar. I try with group.add and remove
              and it doesn't work


              I'm also working with multiple views per page, and everything works fine.

              I added a PageComponentListener to the ApplicationPage that adds the commands when the view is opened or gains focus, and removes them when the view is closed or loses focus.

              Everything works fine,
              I have views in tabs (idw docking window) and listener is called when view open, but don't
              when view selected/deselected

              Thanks

              Comment


              • #8
                Snpe,

                You already solve this problem ?
                If yes can you explain !!!

                Thanks

                Comment


                • #9
                  I don't add/remove commands - I set disable/enable only (for now)
                  I try resolve problem with database logistic first and then I will add visual details

                  regards

                  Comment

                  Working...
                  X