Announcement Announcement Module
Collapse
No announcement yet.
parameter between views or controller Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    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

    Comment


    • #3
      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")

      Comment

      Working...
      X