Results 1 to 3 of 3

Thread: parameter between views or controller

  1. #1
    Join Date
    Apr 2009
    Posts
    25

    Default parameter between views or controller

    Hello Everybody

    I'm working with spring-rcp 2.5.5
    Does anybody know how to pass parameters

    - from one view to another view- from on command to a view

    Thanks for your help

  2. #2
    Join Date
    Apr 2009
    Posts
    25

    Default command to view

    In your view
    you display the view
    Application.instance().getActiveWindow().getPage() .showView("myview");
    You add a oublish event to the view
    Application.instance().getApplicationContext().pub lishEvent(new MyEvent(myObject));

    --- My Event class
    public class MyEvent extends ApplicationEvent{
    private MyObject myObject=null;
    public ScenarioEvent(MyObject myObjecto) {
    super(myObjecto);
    this.myObjecto=myObjecto;
    }
    public Scenario getMyObject() {
    return myObject;
    }
    }
    ----In the view
    public class MyView extends AbstractView implements ApplicationListener{
    public void onApplicationEvent(ApplicationEvent arg0) {
    if (arg0 instanceof MyEvent ) {
    MyEvent myEvent = (MyEvent ) arg0;
    this.myObject=myEvent .getScenario();
    }


    }
    }

    Doing that the view will receive an object from the Command

    I thing there is code nicer than this one but this one works

    I'm still working for form one view to another

  3. #3
    Join Date
    Apr 2009
    Posts
    25

    Default passing parameter from controller to another controller

    In doExecuteCommand of you Command file

    protected void doExecuteCommand() {
    ---------------------
    MyCommand e = (MyCommand )Application.instance().getActiveWindow().getComma ndManager().getCommand("myCommand ",MyCommand .class);
    e.addParameter("myObject", myObject);
    e.execute();
    -------------
    }

    To retrieve your object in the command you've just executed
    just this.getParameter("myObject")

Posting Permissions

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