Search code examples
javaopenxava

JPA: perform showDialog() in a new browser tab?


As the title above, I want the behaviour of showDialog() to display on a new browser tab but I don't know whether is there any Java code written for that.

My code:

public class ListSportImagesMethod2Action extends TabBaseAction {

    private int row;

    @Inject  
    private Tab tab;

    public void execute() throws Exception {

        Map sportKey = (Map) tab.getTableModel().getObjectAt(row);
        //Map sportKey =  (Map) getView().getSubview("sport").getValues();
        int sportId = ((Integer) sportKey.get("sportId")).intValue(); 
        sportKey.put("sportId", sportId);
        showDialog();  //What should it replace with?
        getView().setModelName("Sport");
        getView().setValues(sportKey);  System.out.println("data============" + getView().getValues());
        getView().findObject();
        getView().setKeyEditable(false);
        getView().setEditable(true);
        setControllers("Sport");
    }

    public int getRow() {                                                   
        return row;
    }
    public void setRow(int row) {                                          
        this.row = row;
    }

    public Tab getTab() {
        return tab;
    }
    public void setTab(Tab tab) {
        this.tab = tab;
    }

  }

PS: I know I can use a link to redirect but with this method, I fail to get the parent's data. Am still trying.


Solution

  • showDialog() shows a JavaScript dialog, not a browser windows. showDialog() cannot be used to show something in other browser tab, for that use IForwardAction. IForwardAction goes to a new browser windows, but if you use IForwardAction you have to change all the logic of your action because you redirect to other module that has its own state. The OpenXava documentation explains how to manage this last case.