Announcement Announcement Module
Collapse
No announcement yet.
Question about Action Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Question about Action

    Hello,
    I try create DbForm with database action (new,save,rollback,next,previous etc)
    DbForm extends AbstractForm and add toolbar with database actions, but I have problem with
    creating action
    I try this :

    private class DbNextCommand extends ActionCommand {

    public DbNextCommand() {
    super("dbNext");
    }

    protected void doExecuteCommand() {
    // do next action
    }
    }

    and create toolbar button with :

    JToolBar toolbar = new JToolBar();
    JButton dbNext = (JButton) new DbNextCommand().createButton();
    toolbar.add(dbNext);
    return toolbar;

    It work fine, action do work, but I don't know action face : label,tooltip, icon ...

    I add in images.properties

    dbNext.icon=next.gif

    and in messages.properties :

    dbNext.label=&Next@ctrl N
    dbNext.caption=Next Row

    It is ignored and RCP create button with label 'commandLabel', without tooltip and icon
    (action do work, but I want icon and tooltip)

    What is missing ?

    Thanks
    Haris Peco

  • #2
    Haris,

    When you create these guys programatically they're not auto-configured by default. Manual configuration of a AbstractCommand involves invoking the "CommandConfigurer" service, passing in the specified command. You can get a handle to the global instance by using your Application.services() locator.

    Now, there is another option. You can use the static factory methods in the CommandGroup class to create an auto-configured group of commands (for example, next, back, first, last, etc.), and easily produce a JToolBar from the returned group (commandGroup.createToolBar()). I'd generally recommend this approach, particularly if you're already instantiating a ToolBar control by hand. Let CommandGroup create the grouping controls you need for you, and leverage the CommandGroup factory methods for convenient group creation and configuration of group members (which can be action commands, other nested command groups, separators, glue, etc.)

    Comment


    • #3
      Keith,
      It work.Thanks.
      Can I adapt toolbar.For instance, separator create blank space, and I want vertical line

      regards

      Comment


      • #4
        Hmm... you should be able to subclass SeparatorMember -- which manages bound separator controls for command groups. Better yet, we should probably make the existing one configurable.

        Keith

        Comment

        Working...
        X