src/main/java/org/efaps/ui/wicket/components/modalwindow/ModalWindowContainer.java
public CharSequence getReloadJavaScript(final ICmdUIObject _uiObject)
    {
        final StringBuilder javascript = new StringBuilder();
        if (_uiObject instanceof IPageObject) {
            try {
                final Page page;
                final Object modelObject = getPage().getDefaultModelObject();
                if (modelObject instanceof UIGrid) {
                    final UIGrid uiGrid = (UIGrid) modelObject;
                    page = new GridPage(Model.of(UIGrid.get(uiGrid.getCmdUUID(), uiGrid.getPagePosition())
                                    .setCallInstance(uiGrid.getCallInstance())));
                } else if (modelObject instanceof UIForm) {
                    final UIForm uiForm = (UIForm) modelObject;
                    uiForm.resetModel();
                    page = new FormPage(Model.of(uiForm));
                } else if (modelObject instanceof UITable) {
                    final UITable uiTable = (UITable) modelObject;
                    uiTable.resetModel();
                    page = new TablePage(Model.of(uiTable));
                } else if (modelObject instanceof UIStructurBrowser) {
                    final UIStructurBrowser uiStrBrws = (UIStructurBrowser) modelObject;
                    uiStrBrws.resetModel();
                    page = new StructurBrowserPage(Model.of(uiStrBrws));
                } else {
                    ModalWindowContainer.LOG.error("NO PAGE");
                    page = new UnexpectedErrorPage();
                }

                final IRequestHandler handler = new RenderPageRequestHandler(new PageProvider(page));
                final String url = getRequestCycle().urlFor(handler).toString();

                switch (((IPageObject) _uiObject).getPagePosition()) {
                    case TREE:
                    case TREEMODAL:
                        javascript
                            .append("var mF = top.dojo.doc.getElementById(\"").append(MainPage.IFRAME_ID)
                                .append("\");\n")
                            .append("if (mF != null) {\n")
                            .append("mF.contentWindow.dojo.query('.dijitContentPane.eFapsCenterPanel')")
                                .append(".forEach(function(_p){\n")
                            .append("var d = mF.contentWindow.dijit.registry.byNode(_p);\n")
                            .append("d.set('content', domConstruct.create('iframe', {\n")
                            .append("\"src\": \"").append(url)
                            .append("\",\"style\": \"border: 0; width: 100%; height: 99%\"}")
                            .append("));\n")
                            .append("});\n")
                            .append("mF.contentWindow.").append(MenuUpdateBehavior.FUNCTION_NAME).append("(\"")
                            .append(MenuUpdateBehavior.PARAMETERKEY4UPDATE).append("\");\n")
                            .append("}");
                        break;
                    case CONTENT:
                    case CONTENTMODAL:
                    default:
                        javascript.append(" top.dijit.registry.byId(\"mainPanel\").set(\"content\",")
                            .append(" domConstruct.create(\"iframe\",{")
                            .append("\"id\": \"").append(MainPage.IFRAME_ID)
                            .append("\",\"src\": \"./wicket/").append(url)
                            .append("\",\"style\": \"border: 0; width: 100%; height: 99%\" }")
                            .append("))");
                }
            } catch (final EFapsException e) {
                throw new RestartResponseException(new ErrorPage(e));
            }
        } else {
            final AbstractUIPageObject uiObject = (AbstractUIPageObject) getPage().getDefaultModelObject();

            if (uiObject != null) {
                try {
                    PageReference calledByPageRef = ((AbstractContentPage) getPage()).getCalledByPageReference();
                    if (calledByPageRef != null && calledByPageRef.getPage() instanceof AbstractContentPage) {
                        calledByPageRef = ((AbstractContentPage) calledByPageRef.getPage()).getCalledByPageReference();
                    }
                    final String href = _uiObject.getCommand() == null ? null : _uiObject.getCommand().getReference();
                    final Page page;
                    boolean tree = false;
                    if ("TREE?".equalsIgnoreCase(href) && _uiObject.getInstance() != null
                                    && _uiObject.getInstance().isValid()) {
                        final Menu menu = Menu.getTypeTreeMenu(_uiObject.getInstance().getType());
                        if (menu == null) {
                            final Exception ex = new Exception("no tree menu defined for type "
                                            + _uiObject.getInstance().getType().getName());
                            throw new RestartResponseException(new ErrorPage(ex));
                        }
                        page = new ContentContainerPage(menu.getUUID(), _uiObject.getInstance().getKey());
                        tree = true;
                    } else {
                        uiObject.resetModel();
                        if (uiObject instanceof UITable) {
                            page = new TablePage(Model.of((UITable) uiObject), calledByPageRef);
                        } else if (uiObject instanceof UIForm) {
                            page = new FormPage(Model.of((UIForm) uiObject), calledByPageRef);
                        } else if (uiObject instanceof UIStructurBrowser) {
                            page = new StructurBrowserPage(Model.of((UIStructurBrowser) uiObject), calledByPageRef);
                        } else {
                            page = new MockHomePage();
                        }
                    }
                    final IRequestHandler handler = new RenderPageRequestHandler(new PageProvider(page));
                    // touch the page to ensure that the pagemanager stores it to be accessible
                    getSession().getPageManager().touchPage(page);
                    final String url = getRequestCycle().urlFor(handler).toString();
                    if (calledByPageRef != null && calledByPageRef.getPage() instanceof ContentContainerPage && !tree) {
                        final String panelId = ((ContentContainerPage) calledByPageRef.getPage()).getCenterPanelId();
                        javascript
                            .append("var mF = top.dojo.doc.getElementById(\"").append(MainPage.IFRAME_ID).append("\");")
                            .append("if (mF != null) {")
                            .append("mF.contentWindow.dijit.registry.byId(\"").append(panelId)
                            .append("\").set(\"content\",")
                                .append(" domConstruct.create(\"iframe\", {")
                                    .append("\"src\": \"").append(url)
                                    .append("\",\"style\": \"border: 0; width: 100%; height: 99%\"}")
                                .append(")); ")
                            .append("mF.contentWindow.").append(MenuUpdateBehavior.FUNCTION_NAME).append("(\"")
                            .append(MenuUpdateBehavior.PARAMETERKEY4UPDATE).append("\");")
                            .append("}");
                    } else {
                        javascript
                            .append(" top.dijit.registry.byId(\"mainPanel\").set(\"content\",")
                                .append(" domConstruct.create(\"iframe\",{")
                                    .append("\"id\": \"").append(MainPage.IFRAME_ID)
                                    .append("\",\"src\": \"./wicket/").append(url)
                                    .append("\",\"style\": \"border: 0; width: 100%; height: 99%\" }")
                                 .append("))");
                    }
                } catch (final EFapsException e) {
                    throw new RestartResponseException(new ErrorPage(e));
                }
            } else if (getPage() instanceof MainPage) {
                try {
                    // this was called by the DashBoard
                    final DashboardPage page = new DashboardPage(getPage().getPageReference());
                    final IRequestHandler handler = new RenderPageRequestHandler(new PageProvider(page));
                    // touch the page to ensure that the pagemanager stores it to be accessible
                    getSession().getPageManager().touchPage(page);
                    final String url = getRequestCycle().urlFor(handler).toString();
                    javascript
                        .append(" top.dijit.registry.byId(\"mainPanel\").set(\"content\",")
                            .append(" domConstruct.create(\"iframe\",{")
                                .append("\"id\": \"").append(MainPage.IFRAME_ID)
                                .append("\",\"src\": \"./wicket/").append(url)
                                .append("\",\"style\": \"border: 0; width: 100%; height: 99%\" }")
                             .append("))");
                } catch (final EFapsException e) {
                    throw new RestartResponseException(new ErrorPage(e));
                }
            }
        }
        return DojoWrapper.require(javascript, DojoClasses.domConstruct);
    }
public CharSequence getReloadJavaScript(final ICmdUIObject _uiObject)
    {
        final StringBuilder javascript = new StringBuilder();
        if (_uiObject instanceof IPageObject) {
            try {
                final Page page;
                final Object modelObject = getPage().getDefaultModelObject();
                if (modelObject instanceof UIGrid) {
                    final UIGrid uiGrid = (UIGrid) modelObject;
                    page = new GridPage(Model.of(UIGrid.get(uiGrid.getCmdUUID(), uiGrid.getPagePosition())
                                    .setCallInstance(uiGrid.getCallInstance())));
                } else if (modelObject instanceof UIForm) {
                    final UIForm uiForm = (UIForm) modelObject;
                    uiForm.resetModel();
                    page = new FormPage(Model.of(uiForm));
                } else if (modelObject instanceof UITable) {
                    final UITable uiTable = (UITable) modelObject;
                    uiTable.resetModel();
                    page = new TablePage(Model.of(uiTable));
                } else if (modelObject instanceof UIStructurBrowser) {
                    final UIStructurBrowser uiStrBrws = (UIStructurBrowser) modelObject;
                    uiStrBrws.resetModel();
                    page = new StructurBrowserPage(Model.of(uiStrBrws));
                } else {
                    ModalWindowContainer.LOG.error("NO PAGE");
                    page = new UnexpectedErrorPage();
                }

                final IRequestHandler handler = new RenderPageRequestHandler(new PageProvider(page));
                final String url = getRequestCycle().urlFor(handler).toString();

                switch (((IPageObject) _uiObject).getPagePosition()) {
                    case TREE:
                    case TREEMODAL:
                        javascript
                            .append("var mF = top.dojo.doc.getElementById(\"").append(MainPage.IFRAME_ID)
                                .append("\");\n")
                            .append("if (mF != null) {\n")
                            .append("mF.contentWindow.dojo.query('.dijitContentPane.eFapsCenterPanel')")
                                .append(".forEach(function(_p){\n")
                            .append("var d = mF.contentWindow.dijit.registry.byNode(_p);\n")
                            .append("d.set('content', domConstruct.create('iframe', {\n")
                            .append("\"src\": \"").append(url)
                            .append("\",\"style\": \"border: 0; width: 100%; height: 99%\"}")
                            .append("));\n")
                            .append("});\n")
                            .append("mF.contentWindow.").append(MenuUpdateBehavior.FUNCTION_NAME).append("(\"")
                            .append(MenuUpdateBehavior.PARAMETERKEY4UPDATE).append("\");\n")
                            .append("}");
                        break;
                    case CONTENT:
                    case CONTENTMODAL:
                    default:
                        javascript.append(" top.dijit.registry.byId(\"mainPanel\").set(\"content\",")
                            .append(" domConstruct.create(\"iframe\",{")
                            .append("\"id\": \"").append(MainPage.IFRAME_ID)
                            .append("\",\"src\": \"./wicket/").append(url)
                            .append("\",\"style\": \"border: 0; width: 100%; height: 99%\" }")
                            .append("))");
                }
            } catch (final EFapsException e) {
                throw new RestartResponseException(new ErrorPage(e));
            }
        } else {
            final AbstractUIPageObject uiObject = (AbstractUIPageObject) getPage().getDefaultModelObject();

            if (uiObject != null) {
                try {
                    PageReference calledByPageRef = ((AbstractContentPage) getPage()).getCalledByPageReference();
                    if (calledByPageRef != null && calledByPageRef.getPage() instanceof AbstractContentPage) {
                        calledByPageRef = ((AbstractContentPage) calledByPageRef.getPage()).getCalledByPageReference();
                    }
                    final String href = _uiObject.getCommand() == null ? null : _uiObject.getCommand().getReference();
                    final Page page;
                    boolean tree = false;
                    if ("TREE?".equalsIgnoreCase(href) && _uiObject.getInstance() != null
                                    && _uiObject.getInstance().isValid()) {
                        final Menu menu = Menu.getTypeTreeMenu(_uiObject.getInstance().getType());
                        if (menu == null) {
                            final Exception ex = new Exception("no tree menu defined for type "
                                            + _uiObject.getInstance().getType().getName());
                            throw new RestartResponseException(new ErrorPage(ex));
                        }
                        page = new ContentContainerPage(menu.getUUID(), _uiObject.getInstance().getKey());
                        tree = true;
                    } else {
                        uiObject.resetModel();
                        if (uiObject instanceof UITable) {
                            page = new TablePage(Model.of((UITable) uiObject), calledByPageRef);
                        } else if (uiObject instanceof UIForm) {
                            page = new FormPage(Model.of((UIForm) uiObject), calledByPageRef);
                        } else if (uiObject instanceof UIStructurBrowser) {
                            page = new StructurBrowserPage(Model.of((UIStructurBrowser) uiObject), calledByPageRef);
                        } else {
                            page = new MockHomePage();
                        }
                    }
                    final IRequestHandler handler = new RenderPageRequestHandler(new PageProvider(page));
                    // touch the page to ensure that the pagemanager stores it to be accessible
                    getSession().getPageManager().touchPage(page);
                    final String url = getRequestCycle().urlFor(handler).toString();
                    if (calledByPageRef != null && calledByPageRef.getPage() instanceof ContentContainerPage && !tree) {
                        final String panelId = ((ContentContainerPage) calledByPageRef.getPage()).getCenterPanelId();
                        javascript
                            .append("var mF = top.dojo.doc.getElementById(\"").append(MainPage.IFRAME_ID).append("\");")
                            .append("if (mF != null) {")
                            .append("mF.contentWindow.dijit.registry.byId(\"").append(panelId)
                            .append("\").set(\"content\",")
                                .append(" domConstruct.create(\"iframe\", {")
                                    .append("\"src\": \"").append(url)
                                    .append("\",\"style\": \"border: 0; width: 100%; height: 99%\"}")
                                .append(")); ")
                            .append("mF.contentWindow.").append(MenuUpdateBehavior.FUNCTION_NAME).append("(\"")
                            .append(MenuUpdateBehavior.PARAMETERKEY4UPDATE).append("\");")
                            .append("}");
                    } else {
                        javascript
                            .append(" top.dijit.registry.byId(\"mainPanel\").set(\"content\",")
                                .append(" domConstruct.create(\"iframe\",{")
                                    .append("\"id\": \"").append(MainPage.IFRAME_ID)
                                    .append("\",\"src\": \"./wicket/").append(url)
                                    .append("\",\"style\": \"border: 0; width: 100%; height: 99%\" }")
                                 .append("))");
                    }
                } catch (final EFapsException e) {
                    throw new RestartResponseException(new ErrorPage(e));
                }
            } else if (getPage() instanceof MainPage) {
                try {
                    // this was called by the DashBoard
                    final DashboardPage page = new DashboardPage(getPage().getPageReference());
                    final IRequestHandler handler = new RenderPageRequestHandler(new PageProvider(page));
                    // touch the page to ensure that the pagemanager stores it to be accessible
                    getSession().getPageManager().touchPage(page);
                    final String url = getRequestCycle().urlFor(handler).toString();
                    javascript
                        .append(" top.dijit.registry.byId(\"mainPanel\").set(\"content\",")
                            .append(" domConstruct.create(\"iframe\",{")
                                .append("\"id\": \"").append(MainPage.IFRAME_ID)
                                .append("\",\"src\": \"./wicket/").append(url)
                                .append("\",\"style\": \"border: 0; width: 100%; height: 99%\" }")
                             .append("))");
                } catch (final EFapsException e) {
                    throw new RestartResponseException(new ErrorPage(e));
                }
            }
        }
        return DojoWrapper.require(javascript, DojoClasses.domConstruct);
    }
Method creates a JavaScript to reload the parent page.

@param _uiObject uiObject of the page that was opened in the current modal
@return JavaScript
@throws EFapsException