`

Ext.Window

阅读更多

Ext.Window
1 在一个Ext web应用中,在每一个用到Ext的程序页面中都必须引入ext的js和css等文件,因此我们定义了一个include.jsp文件,此文件的内容大致为:
jsp代码:

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@ page session="true"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>   
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>  
<%@ taglib prefix="x" uri="http://java.sun.com/jsp/jstl/xml" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@page import="org.apache.commons.logging.Log,org.apache.commons.logging.LogFactory"%> 
<anyxmlelement xmlns:fn="http://java.sun.com/jsp/jstl/functions" />
<%
        request.setAttribute("path", request.getContextPath());
    application.setAttribute("parameter",ParameterFactory.getColMap());
%>
<Script Language="javaScript" src="${path}/commons/commons.js"></Script>
<link rel="stylesheet" type="text/css" media="all" href="<c:out value="${path}" />/jsLibs/extJS/resources/css/ext-all.css" />
<link rel="stylesheet" type="text/css" media="all" href="<c:out value="${path}" />/jsLibs/extJS/resources/css/xtheme-gray.css" />
<link rel="stylesheet" type="text/css" media="all" href="<c:out value="${path}" />/jsLibs/extJS/resources/css/fileuploadfield.css" />
<script type="text/javascript" src="<c:out value="${path}" />/jsLibs/extJS/adapter/ext/ext-base.js"></script>  
<script type="text/javascript" src="<c:out value="${path}" />/jsLibs/extJS/ext-all.js"></script>  
<script type="text/javascript" src="<c:out value="${path}" />/jsLibs/extJS/ext-lang-zh_CN.js"></script>
<script type="text/javascript" src="<c:out value="${path}" />/jsLibs/extJS/ux/FileUploadField.js"></script>
<LINK href="${path}/commons/style.css" type="text/css" rel=stylesheet>
 
<Script LANGUAGE="JavaScript">
     
       Ext.BLANK_IMAGE_URL = "<c:out value="${path}" />/jsLibs/extJS/resources/images/default/s.gif";
    /**
    *创建Ext.Window时,设置创建事件所在的window对象
    */
    Ext.Window.prototype.setCreateWin=function(win){
        this.createWin=win;
    }
    Ext.Window.prototype.getCreateWin=function(){
        return this.createWin;
    }

    //取最上層EXT
    function getTopExt(){
        var topExt;
        try{
            topExt=top.Ext;
        }catch(ex){
            topExt=Ext;
        }
        return topExt;
    }
   
</Script>

在每个具体的jsp页面,我们可以将此 include.jsp文件保护进来:
<%@ include  file="/WEB-INF/view/include/include.jsp"%>

2 Ext.Window:
将此window创建在顶层页面作用域中。
var parExt = getTopExt();
var addWin = new parExt.Window({
        id: 'marcInfoWin',
    title: "物料新增",
    width: 1000,
    height: 600,
    resizable: true,
    maximizable: true,
    modal: true,
    html: '<iframe style="width:100%;height:100%;" frameborder="0" '+
        'src="<c:out value="${path}"/>/marcInfo.htm?method=turnToModifyMarcInfoView&flag=add"></iframe>'
    });
//将当前window设置为创建拖动窗口的window
addWin.setCreateWin(window);
addWin.show();

//取得创建的拖动窗口
var marcInfoWin = parExt.ComponentMgr.get('marcInfoWin');
//取得创建 拖动窗口的 window
var domWin = marcInfoWin.getCreateWin();
domWin.indexFun.callBack(marcInfObj);

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics