flexviewer LayerListWidget,editwidget 应用纪要

来源:互联网 发布:网络金融营销模式 编辑:程序博客网 时间:2024/06/07 06:02

config.xml下节点:

<operationallayers>

<!---图层控制中的动态服务 -->
  <layer url="http://127.0.0.1/ArcGIS/rest/services/MapName/MapServer" visible="true" type="dynamic"
  label="MapName"/>
  <layer label="海域名称" type="feature" visible="false" alpha="1.0"  popupconfig="LT/Forms/HYMCPopUp.xml"
      url="http://127.0.0.1/ArcGIS/rest/services/MapName2/FeatureServer/1"/>

<layer label="MapName3" type="feature" visible="false" alpha="1.0"  popupconfig="LT/Forms/HYMCPopUp.xml"
      url="http://127.0.0.1/ArcGIS/rest/services/MapName2/FeatureServer/2"/>

 

LayerListWidget应用,首先可以过滤不需要显示在tree中的图层

海域名称

<configuration label="LayerList (example)">
    <excludelayer>海域名称</excludelayer>

则后面LayerListWidget中只会用2个父节点:MapName,MapName3

其中MapName为dynamic服务所以对应的子图层可以隐藏显示,但是无法查看图层的具体属性

MapName3为FeatureServer的一个图层则popupconfig="LT/Forms/HYMCPopUp.xml" 为对应的鼠标点击后可以查看的对应属性

HYMCPopUp.xml:

<?xml version="1.0" ?>
<configuration>
    <title>{海域名称}</title>
    <fields>
        <field name="海域名称"/>
        <field name="海域划分" alias="海域划分:" visible="true"/>       
    </fields>
 <description><![CDATA[<p/>海域划分:<b>{海域划分}</b><b>              <a href="../Yzqsj_Detail.aspx?CMD=View&objectid={OBJECTID}" target="_blank">详细信息</a></b></p>]]></description>
 <showattachments>true</showattachments>
</configuration>

EditWidget应用,自定义编辑页面的情况下,首先需要建立一个组件HYMC.mxml 基于mx:Form

如下

<?xml version="1.0" encoding="utf-8"?>
<mx:Form xmlns:fx="http://ns.adobe.com/mxml/2009"
   xmlns:s="library://ns.adobe.com/flex/spark"
   xmlns:mx="library://ns.adobe.com/flex/mx"
   creationPolicy="all" width="100%" height="100%">
 <fx:Declarations>
  <!-- 将非可视元素(例如服务、值对象)放在此处 -->
 </fx:Declarations>
 <mx:FormItem id="kmlnm" label="海域名称" indicatorGap="6" required="false" width="100%">
  <mx:TextInput id="kmlname" width="180" text="@{data.海域名称}">
  </mx:TextInput>
 </mx:FormItem> 
 <mx:FormItem label="海域划分" indicatorGap="6" required="false" width="100%">
  <mx:TextInput id="kmlname1" width="180" text="@{data.海域划分}">
  </mx:TextInput>
 </mx:FormItem>
</mx:Form>

在EditWidgetAttributeInspectorSkin.mxml中引用

import LT.Forms.*;
    
import LT.Forms.HYMC;

private var form1: LT.Forms.HYMC;

 

在EditWdiget.xml中如下:

<configuration>

 <forms>
    <form value="LT.Forms.HYMC">海域名称</form>

 

原创粉丝点击