<mx:HBox verticalAlign="middle"
width="100%"
height="100%" paddingTop="5" paddingRight="5" paddingLeft="5" paddingBottom="5">
<mx:DataGrid id="comp"
width="100%"
height="100%"
textAlign="center"
sortableColumns="false">
<mx:columns>
<mx:DataGridColumn headerText="选择" width="50">
<mx:itemRenderer>
<mx:Component>
<mx:RadioButton textAlign="center"
change="parentDocument.nodeSelectHandel(data,this.selected)"
creationComplete="parentDocument.radioButtonSelected(data,this);">
</mx:RadioButton>
</mx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
<mx:DataGridColumn headerText="名称"
showDataTips="true" textAlign="left"
dataField="@parentName"
dataTipField="@parentName"/>
<mx:DataGridColumn headerText="标识"
dataField="@id"
dataTipField="@id"
showDataTips="true" textAlign="left" />
<mx:DataGridColumn headerText="类"
dataField="@className"
dataTipField="@className"
showDataTips="true" textAlign="left"/>
</mx:columns>
</mx:DataGrid>
</mx:HBox>
width="100%"
height="100%" paddingTop="5" paddingRight="5" paddingLeft="5" paddingBottom="5">
<mx:DataGrid id="comp"
width="100%"
height="100%"
textAlign="center"
sortableColumns="false">
<mx:columns>
<mx:DataGridColumn headerText="选择" width="50">
<mx:itemRenderer>
<mx:Component>
<mx:RadioButton textAlign="center"
change="parentDocument.nodeSelectHandel(data,this.selected)"
creationComplete="parentDocument.radioButtonSelected(data,this);">
</mx:RadioButton>
</mx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
<mx:DataGridColumn headerText="名称"
showDataTips="true" textAlign="left"
dataField="@parentName"
dataTipField="@parentName"/>
<mx:DataGridColumn headerText="标识"
dataField="@id"
dataTipField="@id"
showDataTips="true" textAlign="left" />
<mx:DataGridColumn headerText="类"
dataField="@className"
dataTipField="@className"
showDataTips="true" textAlign="left"/>
</mx:columns>
</mx:DataGrid>
</mx:HBox>
外部获取文件
<mx:HTTPService id="reqConfigService" resultFormat="e4x" method="POST"
showBusyCursor="true" result="loadSucHandler(event)" fault="loadFaultHandler(event)"/>
/**
* 读取xml文件成功,对xml进行解析
* */
private function loadSucHandler(evt:ResultEvent):void
{
var oldXML:XML = evt.result as XML;
if(oldXML != null)
{
解析后台传过来的xml
parseXML(oldXML);
}
else
{
Alert.show("没有绑定任何链接方式,请在编辑状态绑定!");
}
}
/**
* 读取xml文件失败
* */
private function loadFaultHandler(evt:FaultEvent):void
{
Alert.show("加载页面跳转的XML失败!")
}
<mx:HTTPService id="reqConfigService" resultFormat="e4x" method="POST"
showBusyCursor="true" result="loadSucHandler(event)" fault="loadFaultHandler(event)"/>
/**
* 读取xml文件成功,对xml进行解析
* */
private function loadSucHandler(evt:ResultEvent):void
{
var oldXML:XML = evt.result as XML;
if(oldXML != null)
{
解析后台传过来的xml
parseXML(oldXML);
}
else
{
Alert.show("没有绑定任何链接方式,请在编辑状态绑定!");
}
}
/**
* 读取xml文件失败
* */
private function loadFaultHandler(evt:FaultEvent):void
{
Alert.show("加载页面跳转的XML失败!")
}
两种加载页面的方法
<mx:ViewStack width="100%" height="100%" id="vsLoader" selectedIndex="0" creationPolicy="all" >
<mx:Canvas width="100%" height="100%">
<mx:ModuleLoader id="moduleLoader" width="100%" height="100%"/>
</mx:Canvas>
<mx:Canvas width="100%" height="100%">
<iframe:IFrame id="iframe" width="100%" height="100%" />
</mx:Canvas>
</mx:ViewStack>
/**
* 点击关闭窗口时
* */
private function Close():void
{
PopUpManager.removePopUp(this);
}
/**
* 初始化
* */
private function init():void
{
//url
if (linkType == "1")
{
moduleLoader.unloadModule();
iframe.source = PagePath;
vsLoader.selectedIndex = 1;
}
else
{
//moduleLoader.url = "cc/NewModule_V1_2.SWF";
moduleLoader.url = PagePath;
moduleLoader.loadModule();
vsLoader.selectedIndex = 0;
if(moduleLoader.hasEventListener(ModuleEvent.ERROR))
{
Alert.show("加载系统页面失败!");
}
}
}
<mx:ViewStack width="100%" height="100%" id="vsLoader" selectedIndex="0" creationPolicy="all" >
<mx:Canvas width="100%" height="100%">
<mx:ModuleLoader id="moduleLoader" width="100%" height="100%"/>
</mx:Canvas>
<mx:Canvas width="100%" height="100%">
<iframe:IFrame id="iframe" width="100%" height="100%" />
</mx:Canvas>
</mx:ViewStack>
/**
* 点击关闭窗口时
* */
private function Close():void
{
PopUpManager.removePopUp(this);
}
/**
* 初始化
* */
private function init():void
{
//url
if (linkType == "1")
{
moduleLoader.unloadModule();
iframe.source = PagePath;
vsLoader.selectedIndex = 1;
}
else
{
//moduleLoader.url = "cc/NewModule_V1_2.SWF";
moduleLoader.url = PagePath;
moduleLoader.loadModule();
vsLoader.selectedIndex = 0;
if(moduleLoader.hasEventListener(ModuleEvent.ERROR))
{
Alert.show("加载系统页面失败!");
}
}
}
//访问后台
var params:URLVariables = new URLVariables();
params.action = "queryData";
var source:HTTPService = new HTTPService();
source.clearResult();
source.url = "/ISDP/masaGrpCustValuService.htm";
source.resultFormat="e4x";
source.addEventListener(ResultEvent.RESULT,loadData,false, 0, true);
source.addEventListener(FaultEvent.FAULT,fault,false,0,true);
source.send(params);
public function demoConnection(event:MouseEvent):void
{
var params:URLVariables=new URLVariables();
//params.beginTime=beginData.getTimeToString();
//params.endTime=endData.getTimeToString();
var _request:URLRequest=new URLRequest(Constants.GET_TREE_IDX_REL);
_request.method="POST";
_request.data=params;
navigateToURL(_request, "");
}
var params:URLVariables = new URLVariables();
params.action = "queryData";
var source:HTTPService = new HTTPService();
source.clearResult();
source.url = "/ISDP/masaGrpCustValuService.htm";
source.resultFormat="e4x";
source.addEventListener(ResultEvent.RESULT,loadData,false, 0, true);
source.addEventListener(FaultEvent.FAULT,fault,false,0,true);
source.send(params);
public function demoConnection(event:MouseEvent):void
{
var params:URLVariables=new URLVariables();
//params.beginTime=beginData.getTimeToString();
//params.endTime=endData.getTimeToString();
var _request:URLRequest=new URLRequest(Constants.GET_TREE_IDX_REL);
_request.method="POST";
_request.data=params;
navigateToURL(_request, "");
}
public class AddCatalogController extends AbstractController
{
/**
* 页面配置
*/
private IPageConfigService pageConfigService;
public void setPageConfigService(IPageConfigService pageConfigService)
{
this.pageConfigService = pageConfigService;
}
/**
* 新增目录控制类
* @param request request
* @param response response
* @return ModelAndView ModelAndView
*/
@Override
protected ModelAndView handleRequestInternal(HttpServletRequest request,
HttpServletResponse response)
{
String catalogName = request.getParameter("catalogName");
String pid = request.getParameter("parentId");
List<Catalog> list = pageConfigService.getCatalogByName(catalogName,pid);
//标题不存在
if (null == list || list.isEmpty())
{
Catalog catalog = new Catalog();
catalog.setCatalogId(UUIDGenerator.getUUID());
catalog.setCatalogName(catalogName);
catalog.setCatalogDesc(request.getParameter("catalogDesc"));
catalog.setParentId(pid);
catalog.setCreator(request.getParameter("userId"));
list = pageConfigService.addCatalog(catalog);
PageUtil pageUtil = new PageUtil();
pageUtil.setCatalogList(list);
return new ModelAndView("get_catalog_list.ftl", "pageUtil", pageUtil);
}
else
{
return new ModelAndView("execute_result.ftl", "result", "exist");
}
}
}
{
/**
* 页面配置
*/
private IPageConfigService pageConfigService;
public void setPageConfigService(IPageConfigService pageConfigService)
{
this.pageConfigService = pageConfigService;
}
/**
* 新增目录控制类
* @param request request
* @param response response
* @return ModelAndView ModelAndView
*/
@Override
protected ModelAndView handleRequestInternal(HttpServletRequest request,
HttpServletResponse response)
{
String catalogName = request.getParameter("catalogName");
String pid = request.getParameter("parentId");
List<Catalog> list = pageConfigService.getCatalogByName(catalogName,pid);
//标题不存在
if (null == list || list.isEmpty())
{
Catalog catalog = new Catalog();
catalog.setCatalogId(UUIDGenerator.getUUID());
catalog.setCatalogName(catalogName);
catalog.setCatalogDesc(request.getParameter("catalogDesc"));
catalog.setParentId(pid);
catalog.setCreator(request.getParameter("userId"));
list = pageConfigService.addCatalog(catalog);
PageUtil pageUtil = new PageUtil();
pageUtil.setCatalogList(list);
return new ModelAndView("get_catalog_list.ftl", "pageUtil", pageUtil);
}
else
{
return new ModelAndView("execute_result.ftl", "result", "exist");
}
}
}
/**
* 新增目录
* 新增目录,新增目录时,需要在同一个事务里面查看父目录是否存在,避免父目录被删除而造成添加失败的情况
* @param catalog 目录实体类
* @return List<Catalog> true 新增成功 false 新增失败
*/
public List<Catalog> addCatalog(Catalog catalog)
{
if (null == catalog)
{
return null;
}
//新增
pageConfigDao.addCatalog(catalog);
//增加成功后,查询该目录
List<Catalog> cataLogs = pageConfigDao.getCatalogByName(catalog
.getCatalogName(),catalog.getParentId());
return cataLogs;
}
* 新增目录
* 新增目录,新增目录时,需要在同一个事务里面查看父目录是否存在,避免父目录被删除而造成添加失败的情况
* @param catalog 目录实体类
* @return List<Catalog> true 新增成功 false 新增失败
*/
public List<Catalog> addCatalog(Catalog catalog)
{
if (null == catalog)
{
return null;
}
//新增
pageConfigDao.addCatalog(catalog);
//增加成功后,查询该目录
List<Catalog> cataLogs = pageConfigDao.getCatalogByName(catalog
.getCatalogName(),catalog.getParentId());
return cataLogs;
}