-
Notifications
You must be signed in to change notification settings - Fork 0
/
eSearchWidget.mxml
4888 lines (4621 loc) · 171 KB
/
eSearchWidget.mxml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?xml version="1.0" encoding="utf-8"?>
<!--
////////////////////////////////////////////////////////////////////////////////
//
// Copyright © 2010 ESRI
//
// All rights reserved under the copyright laws of the United States.
// You may freely redistribute and use this software, with or
// without modification, provided you include the original copyright
// and use restrictions. See use restrictions in the file:
// <install location>/FlexViewer/License.txt
//
////////////////////////////////////////////////////////////////////////////////
-->
<!--
See ReadMe.txt for Version updates and bug fixes
-->
<viewer:BaseWidget xmlns:esri ="http://www.esri.com/2008/ags"
xmlns:fx ="http://ns.adobe.com/mxml/2009"
xmlns:s ="library://ns.adobe.com/flex/spark"
xmlns:mx ="library://ns.adobe.com/flex/mx"
xmlns:mxeffects ="com.adobe.ac.mxeffects.*"
xmlns:viewer ="com.esri.viewer.*"
xmlns:Search ="widgets.eSearch.*"
xmlns:supportClasses ="com.esri.ags.tasks.supportClasses.*"
currentState ="textInput"
widgetConfigLoaded ="init()">
<viewer:states>
<s:State name="graphicalInput"/>
<s:State name="textInput"/>
<s:State name="spatialInput" />
<s:State name="resultsList"/>
</viewer:states>
<viewer:transitions>
<s:Transition autoReverse="true" toState="*">
<s:Fade targets="{[graphicalInput, textInput, spatialInput, resultsList]}"/>
</s:Transition>
</viewer:transitions>
<fx:Declarations>
<s:GlowFilter id="glowFilter"
alpha="1"
color="{getStyle('focusColor')}"
inner="true"
strength="2"/>
<esri:GeometryService id="geometryService"
fault="geometryService_faultHandler(event)"
url="http://tasks.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer"/>
<s:ColorMatrixFilter id="cOver" matrix="[0.5,0.5,0.5,0,0,0.5,0.5,0.5,0,0,0.5,0.5,0.5,0,0,0,0,0,0.6,0]"/>
<supportClasses:RelationshipQuery id="relatesQuery" outFields="[*]"/>
<s:Animate id="anim" duration="500">
<s:motionPaths>
<s:SimpleMotionPath id="pth" property="verticalScrollPosition" />
</s:motionPaths>
</s:Animate>
<s:Sequence id="showGraPops">
<s:SetAction target="{graphicPopUp}" property="displayPopUp" value="true"/>
<s:Scale target="{graphicPopUp.popUp}"
scaleXFrom=".0001"
scaleYFrom=".0001"
scaleXTo="1"
scaleYTo="1"
duration="200"/>
</s:Sequence>
<s:Sequence id="hideGraPops">
<s:Scale target="{graphicPopUp.popUp}"
scaleXFrom="1"
scaleYFrom="1"
scaleXTo=".0001"
scaleYTo=".0001"
duration="250"/>
<s:SetAction target="{graphicPopUp}" property="displayPopUp" value="false"/>
</s:Sequence>
<s:Sequence id="showGraPops2">
<s:SetAction target="{graphicPopUp2}" property="displayPopUp" value="true"/>
<s:Scale target="{graphicPopUp2.popUp}"
scaleXFrom=".0001"
scaleYFrom=".0001"
scaleXTo="1"
scaleYTo="1"
duration="200"/>
</s:Sequence>
<s:Sequence id="hideGraPops2">
<s:Scale target="{graphicPopUp2.popUp}"
scaleXFrom="1"
scaleYFrom="1"
scaleXTo=".0001"
scaleYTo=".0001"
duration="250"/>
<s:SetAction target="{graphicPopUp2}" property="displayPopUp" value="false"/>
</s:Sequence>
</fx:Declarations>
<fx:Script>
<![CDATA[
import com.esri.ags.FeatureSet;
import com.esri.ags.Graphic;
import com.esri.ags.Map;
import com.esri.ags.SpatialReference;
import com.esri.ags.events.DrawEvent;
import com.esri.ags.events.ExtentEvent;
import com.esri.ags.events.GeometryServiceEvent;
import com.esri.ags.events.GraphicEvent;
import com.esri.ags.events.GraphicsLayerEvent;
import com.esri.ags.events.LayerEvent;
import com.esri.ags.events.MapEvent;
import com.esri.ags.geometry.Extent;
import com.esri.ags.geometry.Geometry;
import com.esri.ags.geometry.MapPoint;
import com.esri.ags.geometry.Multipoint;
import com.esri.ags.geometry.Polygon;
import com.esri.ags.geometry.Polyline;
import com.esri.ags.layers.ArcGISDynamicMapServiceLayer;
import com.esri.ags.layers.FeatureLayer;
import com.esri.ags.layers.GraphicsLayer;
import com.esri.ags.layers.Layer;
import com.esri.ags.layers.supportClasses.CodedValue;
import com.esri.ags.layers.supportClasses.CodedValueDomain;
import com.esri.ags.layers.supportClasses.FeatureType;
import com.esri.ags.layers.supportClasses.Field;
import com.esri.ags.layers.supportClasses.LayerDetails;
import com.esri.ags.layers.supportClasses.RangeDomain;
import com.esri.ags.layers.supportClasses.Relationship;
import com.esri.ags.portal.PopUpRenderer;
import com.esri.ags.portal.supportClasses.PopUpInfo;
import com.esri.ags.portal.supportClasses.PopUpMediaInfo;
import com.esri.ags.symbols.PictureMarkerSymbol;
import com.esri.ags.symbols.SimpleFillSymbol;
import com.esri.ags.symbols.SimpleLineSymbol;
import com.esri.ags.symbols.SimpleMarkerSymbol;
import com.esri.ags.symbols.Symbol;
import com.esri.ags.tasks.GeometryService;
import com.esri.ags.tasks.GeometryServiceSingleton;
import com.esri.ags.tasks.QueryTask;
import com.esri.ags.tasks.supportClasses.BufferParameters;
import com.esri.ags.tasks.supportClasses.Query;
import com.esri.ags.tools.DrawTool;
import com.esri.ags.utils.GeometryUtil;
import com.esri.ags.utils.GraphicUtil;
import com.esri.ags.utils.StringUtil;
import com.esri.viewer.AppEvent;
import com.esri.viewer.ViewerContainer;
import com.esri.viewer.components.TitlebarButton;
import com.esri.viewer.components.toc.utils.MapUtil;
import mx.collections.*;
import mx.controls.Alert;
import mx.controls.ToolTip;
import mx.core.FlexGlobals;
import mx.core.IToolTip;
import mx.core.IUIComponent;
import mx.core.IVisualElement;
import mx.core.UIComponent;
import mx.events.FlexEvent;
import mx.events.ListEvent;
import mx.events.ScrollEvent;
import mx.events.ToolTipEvent;
import mx.events.ValidationResultEvent;
import mx.managers.PopUpManager;
import mx.managers.PopUpManagerChildList;
import mx.managers.ToolTipManager;
import mx.rpc.AsyncResponder;
import mx.rpc.Fault;
import mx.rpc.events.FaultEvent;
import mx.rpc.events.ResultEvent;
import mx.utils.ObjectUtil;
import mx.utils.StringUtil;
import mx.validators.NumberValidator;
import spark.components.supportClasses.ItemRenderer;
import spark.formatters.CurrencyFormatter;
import spark.formatters.DateTimeFormatter;
import spark.formatters.NumberFormatter;
//labels
[Bindable] private var lblInclueTextQuery:String;
[Bindable] private var lblbufferUserGraphic:String;
[Bindable] private var noRelatesFound:String;
[Bindable] private var noRelatesFoundAlertTitle:String;
[Bindable] private var enableMultiPartSearch:String;
[Bindable] private var lblTolerance:String;
[Bindable] private var layerLabel:String;
[Bindable] private var layerExprLabel:String;
[Bindable] private var submitLabel:String;
[Bindable] private var pointLabel:String;
[Bindable] private var buffergrapicpropsLbl:String;
[Bindable] private var bufferAlphaLabel:String;
[Bindable] private var bufferColorLabel:String;
[Bindable] private var nobuffercolorlbl:String;
[Bindable] private var bufferoutlinecolorlbl:String;
[Bindable] private var nobufferoutlinecolorlbl:String;
[Bindable] private var bufferoutlinewidthlbl:String;
[Bindable] private var configbuffergraTip:String;
[Bindable] private var includetextquerywarnTip:String;
[Bindable] private var lineLabel:String;
[Bindable] private var rectangleLabel:String;
[Bindable] private var polygonLabel:String;
[Bindable] private var clearLabel:String;
[Bindable] private var zoomallLabel:String;
[Bindable] private var zoomallTip:String;
[Bindable] private var drawGraLabel:String;
[Bindable] private var bufferGraLabel:String;
[Bindable] private var msgVisible:Boolean = false;
[Bindable] private var searchLayerLabel:String;
[Bindable] private var relatLayerWhereLabel:String;
[Bindable] private var bufferLabel:String;
[Bindable] private var drawGraphicsLayer:GraphicsLayer;
[Bindable] private var bufferGraphicsLayer:GraphicsLayer;
private var graphicalsearchLabel:String;
private var textsearchLabel:String;
private var resultsLabel:String;
private var gridresultsLabel:String;
private var loadingLabel:String;
private var selectionLabel:String;
private var nolayerLabel:String;
//Properties
[Bindable] private var graphicsLayer:GraphicsLayer;
[Bindable] public var searchResultAC:ArrayCollection;
[Bindable] private var eDrawEnabled:Boolean = false;
[Bindable] private var pBufferEnabled:Boolean = false;
[Bindable] private var applyBufferLabel:String;
[Bindable] private var multiPartGraphicSearch:Boolean;
[Bindable] private var applyTolleranceByDefault:Boolean;
[Bindable] private var widgetAndGridIteract:Boolean;
private var layerDetails:*;
private var gridFields:Array = [];
private var gridHyperFields:Array = [];
private var relateFields:Array = [];
private var qrelateFields:Array = [];
private var relateHyperFields:Array = [];
private var configSearchGraphical:Array;
private var configSearchText:Array;
private var configDomainVals:Array;
private var configUserVals:Array;
private var queryLayerRels:Array;
private var qLinks:Array = [];
private var lyrQLinks:Array = [];
private var configLayerExprs:Array;
private var configLayerExprsVals:Array;
private var configTableExprs:Array;
private var configTableExprsVals:Array;
private var configLayerRels:Array;
private var configTableRels:Array;
private var configBufferUnits:Array;
private var configSpatialSearchLayers:Array;
private var configSpatialSearchRelation:Array;
private var geomArr:Array;
private var wFields:ArrayCollection;
private var keepGraSearchEnabled:Boolean;
private var autoZoom:Boolean;
private var queryLinkIconIsField:Boolean;
private var queryEnableExport:Boolean;
private var queryExprForSpatRel:Boolean;
private var queryAttachments:Boolean;
private var openDataGrid:Boolean;
private var executingURLquery:Boolean;
private var disRelatesInFixed:Boolean;
private var qLayer:FeatureLayer;
private var queryLayer:FeatureLayer;
private var relqueryLayer:FeatureLayer;
private var resultsFeatureSet:FeatureSet;
private var queryGeom:Geometry;
private var graphicsLayerBuffer:GraphicsLayer;
private var graGraphicsLayer:GraphicsLayer;
private var selectedDrawingIcon:Image;
private var zoomScale:Number = 5000;
private var zoomPercent:Number = 1.2;
private var pointSearchTolerance:Number = 6;
private var numberValidator:NumberValidator;
private var gridDataProvider:Object;
private var fldAliases:Object;
private var relfldAliases:Object;
private var popUpRenderer:PopUpRenderer = new PopUpRenderer();
private var rWindow:RelatesWindow;
private var myfloatdg:SearchWidgetFloatDG;
private var relfloatdg:SearchWidgetRelateFloatDG;
private var sWidget:eSearchWidget;
private var sReff:SpatialReference;
private var relateIcon:String;
private var relateToolTip:String;
private var queryExpr:String;
private var queryDefExpr:String = "";
private const ICON_URL:String = "assets/images/";
[Bindable] private var WIDGET_URL:String = "widgets/eSearch/assets/images/";
private var _csvName:String;
private var relatescsvName:String;
private var queryMultiImgField:String;
private var csvSep:String;
private var expBtnLbl:String;
private var exp2csvOptLbl:String;
private var exp2txtOptLbl:String;
private var lblSum:String;
private var sumField:String;
private var disableButtons:String;
private var spatialsearchLabel:String;
private var floatorfixed:String;
private var selectedGraphicalTool:String;
private var lastTool:String;
private var lState:String = "textInput";
private var queryTitleField:String;
private var defaultSelectionOption:String;
private var timer:Timer;
private var myTip:ToolTip;
private var queryFields:XMLList;
//Formatters
private var dateFormatter:DateTimeFormatter = new DateTimeFormatter();
private var numFormatter:NumberFormatter = new NumberFormatter();
private var currFormatter:CurrencyFormatter = new CurrencyFormatter();
//Symbols
private var drawSymbol:Symbol;
private var resultMarkerSymbol:Symbol;
private var resultLineSymbol:Symbol;
private var resultFillSymbol:Symbol;
private var resultSATSymbol:Symbol;
private var overFillSymbol:Symbol;
//Build Constants
protected const VERSION:String = "3.0.7";
protected const BUILDDATE:String = "8/21/2012";
//Resources
[Embed(source="assets/images/i_about.png")]
private var iconClass:Class;
[Embed(source="widgets/eSearch/assets/images/i_relate.png")]
private var relateClass:Class;
[Embed(source="assets/images/i_table.png")]
private var satClass:Class;
private function init():void
{
sWidget = this;
WIDGET_URL = config.substring(0,config.lastIndexOf("/")) + "/assets/images/";
if (configXML){
if (GeometryServiceSingleton.instance.url){
geometryService.url = GeometryServiceSingleton.instance.url;
geometryService.token = GeometryServiceSingleton.instance.token;
geometryService.proxyURL = GeometryServiceSingleton.instance.proxyURL;
}
relateIcon = configXML.relateicon || WIDGET_URL + "i_relate.png";
//labels
lblInclueTextQuery = configXML.labels.includetextquery || "include text query in selection criteria";
lblbufferUserGraphic = configXML.labels.bufferusergraphics || "Buffer Graphic";
noRelatesFound = configXML.labels.norelatesfound || "No related features found";
noRelatesFoundAlertTitle = configXML.labels.norelatesfoundalerttitle || "No Results";
buffergrapicpropsLbl = configXML.labels.buffergrapicprops || "Buffer graphic properties";
bufferColorLabel = configXML.labels.buffercolor || "Select buffer color";
bufferAlphaLabel = configXML.labels.bufferalpha || "Adjust buffer alpha";
nobuffercolorlbl = configXML.labels.nobuffercolor || "No fill color";
bufferoutlinecolorlbl = configXML.labels.bufferoutlinecolor || "Outline color";
nobufferoutlinecolorlbl = configXML.labels.nobufferoutlinecolor || "No outline color";
bufferoutlinewidthlbl = configXML.labels.bufferoutlinewidth || "Outline Width";
configbuffergraTip = configXML.labels.configbuffergra || "Configure buffer graphic properties...";
lblTolerance = configXML.labels.addtolerance || "Add search tolerance to point selection";
drawGraLabel = configXML.labels.existingdrawgraphicslabel || "Use Existing Draw Widget Graphics";
bufferGraLabel = configXML.labels.existingbuffergraphicslabel || "Use Existing Point Buffer Widget Graphics";
graphicalsearchLabel = configXML.labels.graphicalsearchlabel || "Graphical Search";
textsearchLabel = configXML.labels.textsearchlabel || "Text Search";
includetextquerywarnTip = configXML.labels.includetextquerywarn || "Must be the same search layer in both\ngraphical and text search pages.";
resultsLabel = configXML.labels.resultslabel || "Results";
layerLabel = configXML.labels.layerlabel || "Search Layer:";
layerExprLabel = configXML.labels.layerfieldlabel || "Search Layer Field:";
nolayerLabel = configXML.labels.nolayerlabel || "No search layer defined.";
submitLabel = configXML.labels.submitlabel || "Search";
pointLabel = configXML.labels.pointlabel || "Select by Point";
lineLabel = configXML.labels.linelabel || "Select by Line";
rectangleLabel = configXML.labels.rectanglelabel || "Select by Rectangle";
polygonLabel = configXML.labels.polygonlabel || "Select by Polygon";
clearLabel = configXML.labels.clearlabel || "Clear";
zoomallLabel = configXML.labels.zoomalllabel || "Zoom";
zoomallTip = configXML.labels.zoomalltip || "Zoom to all results";
loadingLabel = configXML.labels.loadinglabel || "Loading...";
selectionLabel = configXML.labels.selectionlabel || "Features Selected:";
gridresultsLabel = configXML.labels.gridresultslabel || "Show Results in Grid";
exp2csvOptLbl = configXML.labels.export2csvbuttonlabel || "Export to CSV...";
exp2txtOptLbl = configXML.labels.export2txtbuttonlabel || "Export to Txt...";
expBtnLbl = configXML.labels.exportbtnlabel || "Export...";
_csvName = configXML.labels.csvdefaultname || "Selected Records";
relatescsvName = configXML.labels.relatescsvdefaultname || "Related Records";
csvSep = configXML.csvseparator;
spatialsearchLabel = configXML.labels.spatialsearchlabel || "Spatial search";
searchLayerLabel = configXML.labels.searchlayerlabel || "Search entities of:";
bufferLabel = configXML.labels.bufferlabel || "apply a search distance:";
applyBufferLabel = configXML.labels.applybufferlabel || "Apply buffer";
relateToolTip = configXML.relatetooltip || "Show Relates";
sReff = new SpatialReference(configXML.spatialreference);
defaultSelectionOption = configXML.defaultselectionoption || "textInput";
currentState = defaultSelectionOption;
disableButtons = configXML.disablebuttons || "";
selectedGraphicalTool = configXML.selectedgraphicaltool || "";
enableMultiPartSearch = configXML.labels.enablemultipartsearch || "enable multi-part graphics";
applyTolleranceByDefault = configXML.tolerancebydefault && configXML.tolerancebydefault == "true";
widgetAndGridIteract = configXML.enabledatagridinteractionwithwidget && configXML.enabledatagridinteractionwithwidget == "true";
configSpatialSearchRelation = [];
var operList:XMLList = configXML..spatialrelationship;
var sOpBtn:Image;
for (var s:Number = 0; s < operList.length(); s++){
var srName:String = operList[s].name;
var srLabel:String = operList[s].label;
var spatialRelationship:Object = {
name: srName,
label: srLabel
};
sOpBtn = new Image();
sOpBtn.name = srName;
sOpBtn.source = getSopImg(srName);
sOpBtn.toolTip = srLabel;
sOpBtn.addEventListener(MouseEvent.CLICK, sOpBtnClickHandler);
sOpBtn.useHandCursor = true;
sOpBtn.buttonMode = true;
SpatialOps.addElement(sOpBtn);
configSpatialSearchRelation.push(spatialRelationship);
}
if(operList.length() == 0){
lblSearchLayerSpatial.visible = false;
cboSearchLayerSpatial.visible = false;
SpatialOps.visible = false;
lblSearchLayerSpatial.includeInLayout = false;
cboSearchLayerSpatial.includeInLayout = false;
SpatialOps.includeInLayout = false;
}
keepGraSearchEnabled = configXML.keepgraphicalsearchenabled && configXML.keepgraphicalsearchenabled == "true";
autoZoom = configXML.autozoomtoresults && configXML.autozoomtoresults == "true";
eDrawEnabled = configXML.enabledrawgraphicbutton && configXML.enabledrawgraphicbutton == "true";
pBufferEnabled = configXML.enablebuffergraphicbutton && configXML.enablebuffergraphicbutton == "true";
multiPartGraphicSearch = configXML.multipartgraphicsearch && configXML.multipartgraphicsearch == "true";
(multiPartGraphicSearch.valueOf() == true) ? graFeatureQueryBtn.visible = true : graFeatureQueryBtn.visible = false;
floatorfixed = configXML.floatorfixed || "float";
disRelatesInFixed = configXML.floatorfixed.@disablerelatestabinfixed && configXML.floatorfixed.@disablerelatestabinfixed == "true";
if(eDrawEnabled){
eDrawBtn.filters = [cOver];
eDrawBtn.buttonMode = eDrawBtn.useHandCursor = eDrawBtn.enabled = false;
map.addEventListener(MapEvent.LAYER_ADD, checkForeDrawGL);
MapUtil.forEachMapLayer(map, function(layer:Layer):void
{
if(layer.name.toLowerCase() == "draw features"){
drawGraphicsLayer = layer as GraphicsLayer;
if(drawGraphicsLayer.numGraphics > 0){
checkeDrawNumGras(null);
}
drawGraphicsLayer.addEventListener(GraphicEvent.GRAPHIC_ADD, checkeDrawNumGras);
drawGraphicsLayer.addEventListener(GraphicEvent.GRAPHIC_REMOVE, checkeDrawNumGras);
drawGraphicsLayer.addEventListener(GraphicsLayerEvent.GRAPHICS_CLEAR, checkeDrawNumGras);
}
});
}
if(pBufferEnabled){
pBufferBtn.filters = [cOver];
pBufferBtn.buttonMode = pBufferBtn.useHandCursor = pBufferBtn.enabled = false;
map.addEventListener(MapEvent.LAYER_ADD, checkForpntBufferGL);
MapUtil.forEachMapLayer(map, function(layer:Layer):void
{
if(layer.name.toLowerCase() == "buffer results"){
bufferGraphicsLayer = layer as GraphicsLayer;
if(bufferGraphicsLayer.numGraphics > 0){
checkBufferNumGras(null);
}
bufferGraphicsLayer.addEventListener(GraphicEvent.GRAPHIC_ADD, checkBufferNumGras);
bufferGraphicsLayer.addEventListener(GraphicEvent.GRAPHIC_REMOVE, checkBufferNumGras);
bufferGraphicsLayer.addEventListener(GraphicsLayerEvent.GRAPHICS_CLEAR, checkBufferNumGras);
}
});
}
configBufferUnits = [];
var bufferUnitsList:XMLList = configXML..bufferunit;
for (var b:int = 0; b < bufferUnitsList.length(); b++){
var buffUnitName:String = bufferUnitsList[b].name;
var buffUnitLabel:String = bufferUnitsList[b].label;
var bufferUnit:Object = {
name: buffUnitName,
label: buffUnitLabel
};
configBufferUnits.push(bufferUnit);
}
cboGraBufferUnit.dataProvider = new ArrayCollection(configBufferUnits);
cboGraBufferUnit.width = determineDropDownWidth(configBufferUnits);
if((cboGraBufferUnit.width + 102 + bufferUserGraphic.measureText(lblbufferUserGraphic).width + 37) > wTemplate.width){
cboGraBufferUnit.width = (wTemplate.width - (102 + bufferUserGraphic.measureText(lblbufferUserGraphic).width + 37));
}
cboGraBufferUnit.selectedIndex = 0;
configSearchGraphical = [];
configSearchText = [];
configSpatialSearchLayers = [];
configDomainVals = [];
var r:Number;
var i:Number;
var j:Number;
var l:Number;
var v:Number;
var lyrList:XMLList = configXML..layer;
for (i = 0; i < lyrList.length(); i++){
configLayerExprs = [];
configLayerRels = [];
var lyrURL:String = lyrList[i].url;
var lyrLabel:String = lyrList[i].name;
var lyrGraphicalLabel:String = lyrList[i].graphicalsearchlabel;
var lyrRelList:XMLList = configXML.layers.layer[i]..relate;
for (r = 0; r < lyrRelList.length(); r++){
var lyrRelLabel:String = lyrRelList[r].@label;
var lyrRelId:String = lyrRelList[r].@id;
var lyrRelIcon:String = lyrRelList[r].@icon || WIDGET_URL + "i_relate.png";
var lyrRelFields:XMLList = lyrRelList[r].fields;
var lyrRelEnableExport:Boolean = lyrRelList[r].@enableexport && lyrRelList[r].@enableexport == "true";
var lyrRel:Object = {
id: lyrRelId,
fields: lyrRelFields,
label: lyrRelLabel,
enableexport: lyrRelEnableExport,
icon: lyrRelIcon
};
configLayerRels.push(lyrRel);
}
var lyrExprList:XMLList = configXML.layers.layer[i]..expression;
for (j = 0; j < lyrExprList.length(); j++){
var lyrExprAlias:String = lyrExprList[j].@alias;
var lyrTextLabel:String = lyrExprList[j].@textsearchlabel;
var lyrRequiresAValue:Boolean = lyrExprList[j].@isValueRequired && lyrExprList[j].@isValueRequired == "true";
var lyrExprVals:XMLList = lyrExprList[j]..value;
configLayerExprsVals = [];
for (v = 0; v < lyrExprVals.length(); v++){
var valPrompt:String = lyrExprVals[v].@prompt;
var valExpr:String = lyrExprVals[v];
var valField:String = lyrExprVals[v].@field;
var valUserList:String = lyrExprVals[v].@userlist;
var valDomain:Boolean = lyrExprVals[v].@usedomain && lyrExprVals[v].@usedomain == "true";
// if config is given and set to false explicitly, then make it optional (aka not required). Otherwise, default to being required
var isOptional:Boolean = lyrExprVals[v].@isValueRequired && lyrExprVals[v].@isValueRequired == "false";
var prependToValue:String = lyrExprVals[v].@prepend;
var exprVals:Object = {
prompt: valPrompt,
expression: valExpr,
field: valField,
usedomain: valDomain,
userlist: valUserList,
isValueRequired : !isOptional,
prepend : prependToValue
};
configLayerExprsVals.push(exprVals)
}
var expr:Object = {
label: lyrExprAlias,
textlabel: lyrTextLabel,
values: configLayerExprsVals,
isValueRequired : lyrRequiresAValue
};
configLayerExprs.push(expr);
}
var lyrDefExpr:String = lyrList[i].definitionexpression;
var lyrFields:XMLList = lyrList[i].fields;
var lyrTitleField:String = lyrList[i].titlefield;
var lyrLinks:Array = [];
var lyrLinkList:XMLList = lyrList[i]..link;
for (l = 0; l < lyrLinkList.length(); l++){
var lyrLink:String = XML(lyrLinkList[l]).text() || "";
var lyrLinkAlias:String = lyrLinkList[l].@alias || "";
var lyrIcon:String = XML(lyrLinkList[l]).child("icon") || "";
var linkObj:Object = {
link: lyrLink,
alias: lyrLinkAlias,
icon: lyrIcon
};
lyrLinks.push(linkObj);
}
var lyrQueryAttach:Boolean = lyrList[i].queryattachments && lyrList[i].queryattachments == "true";
var lyrEnableExport:Boolean = lyrList[i].enableexport && lyrList[i].enableexport == "true";
var lyrMultiImgField:String = lyrList[i].multiimagefield;
var useProxy:Boolean = lyrList[i].useproxy && lyrList[i].useproxy == "true";
var useAMF:String = lyrList[i].useamf;
var openDG:Boolean = lyrList[i].autoopendatagrid && lyrList[i].autoopendatagrid == "true";
if ((lyrList[i].zoomscale.@usegeometry) && (lyrList[i].zoomscale.@usegeometry == "true")){
zoomScale = Number.NaN;
if(lyrList[i].zoomscale.@zoompercent){
zoomPercent = Number(lyrList[i].zoomscale.@zoompercent)
}else{
zoomPercent = 1.2
}
}else{
if (Number(lyrList[i].zoomscale) > 0){
zoomScale = Number(lyrList[i].zoomscale);
}
}
var lyrSpatialLabel:String = lyrList[i].spatialquerylabel;
var lyrSpatialSearchLyr:String = lyrList[i].spatialsearchlayer;
const layer:FeatureLayer = new FeatureLayer(lyrURL);
layer.name = layer.id = lyrLabel;
if (useProxy && configData.proxyUrl){
layer.proxyURL = configData.proxyUrl;
}
if (useAMF){
layer.useAMF = useAMF == "true";
}
if (lyrFields && lyrFields[0].@all[0] == "true"){
layer.outFields = ["*"];
}else if (lyrFields){
var fields:XMLList = lyrFields.field;
layer.outFields = [];
for each (var fieldXML:XML in fields){
if (fieldXML.@name[0]){
layer.outFields.push(fieldXML.@name[0]);
}
}
}
var searchLayer:Object = {
layer: layer,
label: lyrLabel,
titlefield: lyrTitleField,
spatialsearchlabel: lyrSpatialLabel,
spatialsearchlayer: lyrSpatialSearchLyr,
graphicallabel: lyrGraphicalLabel,
expr: configLayerExprs,
fields: lyrFields,
links: lyrLinks,
multi: lyrMultiImgField,
zoomscale: zoomScale,
zoompercent: zoomPercent,
enableexport: lyrEnableExport,
defexpr: lyrDefExpr,
opendg: openDG,
relates: configLayerRels,
attachments: lyrQueryAttach
};
configSearchGraphical.push(searchLayer);
if (searchLayer.spatialsearchlayer == "true"){
configSpatialSearchLayers.push(searchLayer);
}
if (configLayerExprs && configLayerExprs.length > 0){
configSearchText.push(searchLayer);
}
}
var tblList:XMLList = configXML..table;
for (i = 0; i < tblList.length(); i++){
configTableExprs = [];
configTableRels = [];
var tblURL:String = tblList[i].url;
var tblLabel:String = tblList[i].name;
var tblRelList:XMLList = configXML.tables.table[i]..relate;
for (r = 0; r < tblRelList.length(); r++){
var tblRelLabel:String = tblRelList[r].@label;
var tblRelId:String = tblRelList[r].@id;
var tblRelIcon:String = tblRelList[r].@icon || WIDGET_URL + "i_relate.png";
var tblRelFields:XMLList = tblRelList[r].fields;
var tblRelEnableExport:Boolean = tblRelList[r].@enableexport && tblRelList[r].@enableexport == "true";
var tblRel:Object = {
id: tblRelId,
fields: tblRelFields,
label: tblRelLabel,
enableexport: tblRelEnableExport,
icon: tblRelIcon
};
configTableRels.push(tblRel);
}
var tblExprList:XMLList = configXML.tables.table[i]..expression;
for (j = 0; j < tblExprList.length(); j++){
var tblExprAlias:String = tblExprList[j].@alias;
var tblTextLabel:String = tblExprList[j].@textsearchlabel;
var tblRequiresAValue:Boolean = tblExprList[j].@isValueRequired && tblExprList[j].@isValueRequired == "true";
var tblExprVals:XMLList = tblExprList[j]..value;
configTableExprsVals = [];
for (v = 0; v < tblExprVals.length(); v++){
var tblPrompt:String = tblExprVals[v].@prompt;
var tblExpr:String = tblExprVals[v];
var tblField:String = tblExprVals[v].@field;
var tblUserList:String = tblExprVals[v].@userlist;
var tblDomain:Boolean = tblExprVals[v].@usedomain && tblExprVals[v].@usedomain == "true";
// if config is given and set to false explicitly, then make it optional (aka not required). Otherwise, default to being required
var isOptional:Boolean = tblExprVals[v].@isValueRequired && tblExprVals[v].@isValueRequired == "false";
var prependToValue:String = tblExprVals[v].@prepend;
var tblexprVals:Object = {
prompt: tblPrompt,
expression: tblExpr,
field: tblField,
usedomain: tblDomain,
userlist: tblUserList,
isValueRequired : !isOptional,
prepend : prependToValue
};
configTableExprsVals.push(tblexprVals)
}
var tblexpr:Object ={
label: tblExprAlias,
textlabel: tblTextLabel,
values: configTableExprsVals,
isValueRequired : tblRequiresAValue
};
configTableExprs.push(tblexpr);
}
var tblDefExpr:String = tblList[i].definitionexpression;
var tblFields:XMLList = tblList[i].fields;
var tblTitleField:String = tblList[i].titlefield;
var tblLinks:Array = [];
var tblLinkList:XMLList = tblList[i]..link;
for (l = 0; l < tblLinkList.length(); l++){
var tblLink:String = XML(tblLinkList[l]).text() || "";
var tblLinkAlias:String = tblLinkList[l].@alias || "";
var tblIcon:String = XML(tblLinkList[l]).child("icon") || "";
var tbllinkObj:Object = {
link: tblLink,
alias: tblLinkAlias,
icon: tblIcon
};
tblLinks.push(tbllinkObj);
}
var tblEnableExport:Boolean = tblList[i].enableexport && tblList[i].enableexport == "true";
var tblMultiImgField:String = tblList[i].multiimagefield;
var tbluseProxy:Boolean = tblList[i].useproxy && tblList[i].useproxy == "true";
var tbluseAMF:String = tblList[i].useamf;
var tblopenDG:Boolean = tblList[i].autoopendatagrid && tblList[i].autoopendatagrid == "true";
var tblQueryAttach:Boolean = tblList[i].@queryattachments && tblList[i].@queryattachments == "true";
var table:FeatureLayer = new FeatureLayer(tblURL);
if (useProxy && configData.proxyUrl){
table.proxyURL = configData.proxyUrl;
}
if (useAMF){
table.useAMF = useAMF == "true";
}
if (tblFields && tblFields[0].@all[0] == "true"){
table.outFields = ["*"];
}else if (tblFields){
var tblfields:XMLList = tblFields.field;
table.outFields = [];
for each (var tblfieldXML:XML in tblfields){
if (tblfieldXML.@name[0]){
table.outFields.push(tblfieldXML.@name[0]);
}
}
}
var searchTable:Object = {
table: table,
label: tblLabel,
titlefield: tblTitleField,
expr: configTableExprs,
fields: tblFields,
links: tblLinks,
multi: tblMultiImgField,
enableexport: tblEnableExport,
defexpr: tblDefExpr,
opendg: tblopenDG,
relates: configTableRels,
attachments: tblQueryAttach
};
if (configTableExprs && configTableExprs.length > 0){
configSearchText.push(searchTable);
}
}
//marker symbol
if(configXML.symbols.picturemarkersymbol.@url[0] != null){
const resultMarkerSymbolURL:String = configXML.symbols.picturemarkersymbol.@url || widgetIcon;
const resultMarkerSymbolHeight:Number = (configXML.symbols.picturemarkersymbol.@height[0] != null) ? configXML.symbols.picturemarkersymbol.@height : 30;
const resultMarkerSymbolWidth:Number = (configXML.symbols.picturemarkersymbol.@width[0] != null) ? configXML.symbols.picturemarkersymbol.@width : 30;
const resultMarkerSymbolXOffset:Number = (configXML.symbols.picturemarkersymbol.@xoffset[0] != null) ? configXML.symbols.picturemarkersymbol.@xoffset : 0;
const resultMarkerSymbolYOffset:Number = (configXML.symbols.picturemarkersymbol.@yoffset[0] != null) ? configXML.symbols.picturemarkersymbol.@yoffset : 0;
const resultMarkerSymbolAngle:Number = (configXML.symbols.simplemarkersymbol.@angle[0] != null) ? configXML.symbols.simplemarkersymbol.@angle : 0;
resultMarkerSymbol = new PictureMarkerSymbol(resultMarkerSymbolURL, resultMarkerSymbolWidth, resultMarkerSymbolHeight, resultMarkerSymbolXOffset, resultMarkerSymbolYOffset, resultMarkerSymbolAngle);
}else{
const resultMarkerSymbolStyle:String = configXML.symbols.simplemarkersymbol.@style || "circle";
const resultMarkerSymbolSize:Number = (configXML.symbols.simplemarkersymbol.@size[0] != null) ? configXML.symbols.simplemarkersymbol.@size : 15;
const resultMarkerSymbolColor:uint = (configXML.symbols.simplemarkersymbol.@color[0] != null) ? configXML.symbols.simplemarkersymbol.@color : 0xFF0000;
const resultMarkerSymbolAlpha:Number = (configXML.symbols.simplemarkersymbol.@alpha[0] != null) ? configXML.symbols.simplemarkersymbol.@alpha : 0.8;
const resultMarkerSymbolXOffset2:Number = (configXML.symbols.simplemarkersymbol.@xoffset[0] != null) ? configXML.symbols.simplemarkersymbol.@xoffset : 0;
const resultMarkerSymbolYOffset2:Number = (configXML.symbols.simplemarkersymbol.@yoffset[0] != null) ? configXML.symbols.simplemarkersymbol.@yoffset : 0;
const resultMarkerSymbolAngle2:Number = (configXML.symbols.simplemarkersymbol.@angle[0] != null) ? configXML.symbols.simplemarkersymbol.@angle : 0;
const resultMarkerSymbolOutlineStyle:String = configXML.symbols.simplemarkersymbol.outline.@style || "solid";
const resultMarkerSymbolOutlineColor:uint = (configXML.symbols.simplemarkersymbol.outline.@color[0] != null) ? configXML.symbols.simplemarkersymbol.outline.@color : 0x0000ff;
const resultMarkerSymbolOutlineAlpha:Number = (configXML.symbols.simplemarkersymbol.outline.@alpha[0] != null) ? configXML.symbols.simplemarkersymbol.outline.@alpha : 0.8;
const resultMarkerSymbolOutlineWidth:Number = (configXML.symbols.simplemarkersymbol.outline.@width[0] != null) ? configXML.symbols.simplemarkersymbol.outline.@width : 2;
resultMarkerSymbol = new SimpleMarkerSymbol(resultMarkerSymbolStyle,resultMarkerSymbolSize,resultMarkerSymbolColor,resultMarkerSymbolAlpha,resultMarkerSymbolXOffset2,resultMarkerSymbolYOffset2,resultMarkerSymbolAngle2,new SimpleLineSymbol(resultMarkerSymbolOutlineStyle, resultMarkerSymbolOutlineColor, resultMarkerSymbolOutlineAlpha, resultMarkerSymbolOutlineWidth));
}
//Symbol for stand alone tables
resultSATSymbol = new PictureMarkerSymbol(satClass,20,20);
//line symbol
const resultLineSymbolColor:uint = (configXML.symbols.simplelinesymbol.@color[0] != null) ? configXML.symbols.simplelinesymbol.@color : 0xFF0000;
const resultLineSymbolAlpha:Number = (configXML.symbols.simplelinesymbol.@alpha[0] != null) ? configXML.symbols.simplelinesymbol.@alpha : 0.8;
const resultLineSymbolWidth:Number = (configXML.symbols.simplelinesymbol.@width[0] != null) ? configXML.symbols.simplelinesymbol.@width : 2;
resultLineSymbol = new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID, resultLineSymbolColor, resultLineSymbolAlpha, resultLineSymbolWidth);
// fill symbol
const resultFillSymbolColor:uint = (configXML.symbols.simplefillsymbol.@color[0] != null) ? configXML.symbols.simplefillsymbol.@color : 0xFF0000;
const resultFillSymbolAlpha:Number = (configXML.symbols.simplefillsymbol.@alpha[0] != null) ? configXML.symbols.simplefillsymbol.@alpha : 0.5;
const resultFillSymbolOutlineColor:uint = (configXML.symbols.simplefillsymbol.outline.@color[0] != null) ? configXML.symbols.simplefillsymbol.outline.@color : 0xFF0000;
const resultFillSymbolOutlineAlpha:Number = (configXML.symbols.simplefillsymbol.outline.@alpha[0] != null) ? configXML.symbols.simplefillsymbol.outline.@alpha : 0.8;
const resultFillSymbolOutlineWidth:Number = (configXML.symbols.simplefillsymbol.outline.@width[0] != null) ? configXML.symbols.simplefillsymbol.outline.@width : 2;
resultFillSymbol = new SimpleFillSymbol(SimpleFillSymbol.STYLE_SOLID, resultFillSymbolColor, resultFillSymbolAlpha, new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID, resultFillSymbolOutlineColor, resultFillSymbolOutlineAlpha, resultFillSymbolOutlineWidth));
graphicsLayerBuffer = new GraphicsLayer();
graphicsLayerBuffer.name = "Search Buffer Results";
map.addLayer(graphicsLayerBuffer);
graphicsLayer = new GraphicsLayer();
graphicsLayer.name = "eSearch Results";
graphicsLayer.symbol = resultMarkerSymbol;
graphicsLayer.addEventListener(FlexEvent.HIDE, graphicsLayer_hideHandler);
map.addLayer(graphicsLayer);
graGraphicsLayer = new GraphicsLayer();
graGraphicsLayer.name = "Graphical Search Layer";
map.addLayer(graGraphicsLayer);
var userTolerance:Number = Number(configXML.toleranceforpointgraphicalselection);
if (userTolerance > 0){
pointSearchTolerance = userTolerance;
}
if (selectedGraphicalTool != "" && defaultSelectionOption == "graphicalInput"){
activateSearchTool(null, selectedGraphicalTool);
}
}
if(disableButtons != ""){
var dbArr:Array = disableButtons.split(",");
}
var disText:Boolean = false;
var disGra:Boolean = false;
var disSpat:Boolean = false;
var disGrid:Boolean = false;
var disDataGrid:Boolean = false;
if(dbArr){
for (var d:int = 0; d<dbArr.length; d++){
switch (dbArr[d]){
case "text":{
disText = true;
break;
}
case "graphic":{
disGra = true;
break;
}
case "spatial":{
disSpat = true;
break;
}
case "grid":{
disGrid = true;
break;
}
case "datagrid":{
disDataGrid = true;
break;
}
}
}
}
if(floatorfixed != "fixed" && !disDataGrid){
wTemplate.addTitlebarButton(WIDGET_URL + "i_table2.png", gridresultsLabel,showGridResults,false);
}
if(!disGra){
wTemplate.addTitlebarButton(ICON_URL + "i_searchgraphical.png", graphicalsearchLabel, showStateGraphicalSearch);
}
if (configSearchText.length && disText != true){
wTemplate.addTitlebarButton(ICON_URL + "i_searchtext.png", textsearchLabel, showStateTextSearch);
}
if (configSpatialSearchLayers.length && disSpat != true){
wTemplate.addTitlebarButton(WIDGET_URL + "i_searchspatial.png", spatialsearchLabel, showStateSpatialSearch);
}
if(!disGrid){
wTemplate.addTitlebarButton(ICON_URL + "i_table.png", resultsLabel, showStateResults);
}
//Setup Text Search
var sItemVal:SearchExpValueItem;
if (configSearchText.length){
cboLayerText.dataProvider = new ArrayCollection(configSearchText);
cboLayerText.width = determineDropDownWidth(configSearchText);
if((cboLayerText.width + lblLayerText.measureText(layerLabel).width + 57) > wTemplate.width){
cboLayerText.width = (wTemplate.width - (lblLayerText.measureText(layerLabel).width + 57));
}
cboLayerText.selectedIndex = 0;
txtLabelText.text = configSearchText[0].expr[0].textlabel;
for(v=0; v<configSearchText[0].expr[0].values.length; v++){
var cfg = configSearchText[0].expr[0].values[v];
if(v == 0){
sItemVal = searchGroup.getElementAt(0) as SearchExpValueItem;
sItemVal.changeToTextBox();
sItemVal.setPrompt = cfg.prompt;
sItemVal.isValueRequired = cfg.isValueRequired;// set the required property from the config
if (cfg.prepend)
{
sItemVal.prepend = cfg.prepend;
};
sItemVal.addEventListener("valueChanged", onValueChanged);
sItemVal.addEventListener("submitSearch", onSearchSubmitted);
sItemVal.addEventListener(FocusEvent.FOCUS_IN, searchGroupItem_focusInHandler);
}else{
sItemVal = new SearchExpValueItem;
sItemVal.wTemplateWidth = wTemplate.width;
sItemVal.percentWidth = 100;
sItemVal.setPrompt = cfg.prompt;
sItemVal.isValueRequired = cfg.isValueRequired;// set the required property from the config
if (cfg.prepend)
{
sItemVal.prepend = cfg.prepend;
};
sItemVal.addEventListener("valueChanged", onValueChanged);
sItemVal.addEventListener("submitSearch", onSearchSubmitted);
sItemVal.addEventListener(FocusEvent.FOCUS_IN, searchGroupItem_focusInHandler);
searchGroup.addElement(sItemVal);
}
var cfg:Object = configSearchText[0].expr[0].values[v];
// set the required property from the config
sItemVal.isValueRequired = cfg.isValueRequired;
if (cfg.prepend)
{
sItemVal.prepend = cfg.prepend;
};
if(configSearchText[0].expr[0].values[v].usedomain){
popCBwithDomain(configSearchText[0].expr[0].values[v].field, sItemVal);
}else if(configSearchText[0].expr[0].values[v].userlist != ""){
popCBwithUserList(configSearchText[0].expr[0].values[v].userlist, sItemVal);
}
}
if (configSearchText.length == 1){
boxText.visible = false;
boxText.includeInLayout = false;
}
cboLayerExpr.dataProvider = new ArrayCollection(configSearchText[0].expr);
cboLayerExpr.width = determineDropDownWidth(configSearchText[0].expr);
if((cboLayerExpr.width + lblExprText.measureText(layerExprLabel).width + 57) > wTemplate.width){
cboLayerExpr.width = (wTemplate.width - (lblExprText.measureText(layerExprLabel).width + 57));
}
cboLayerExpr.selectedIndex = 0;
if (configSearchText[0].expr.length == 1){
boxTextexpr.visible = false;
boxTextexpr.includeInLayout = false;
}
}else{
boxText.visible = false;
txtLabelText.text = nolayerLabel;
}
//Setup Graphical Search
if (configSearchGraphical.length){
cboLayerGraphical.dataProvider = new ArrayCollection(configSearchGraphical);
cboLayerGraphical.width = determineDropDownWidth(configSearchGraphical);
if((cboLayerGraphical.width + lblLayerGraphical.measureText(layerLabel).width + 57) > wTemplate.width){
cboLayerGraphical.width = wTemplate.width - (lblLayerGraphical.measureText(layerLabel).width + 57);
}
cboLayerGraphical.selectedIndex = 0;
txtLabelGraphical.text = configSearchGraphical[0].graphicallabel;
if (configSearchGraphical.length == 1){
boxGraphical.visible = false;
boxGraphical.includeInLayout = false;
}
}else{
boxGraphical.visible = false;
txtLabelGraphical.text = nolayerLabel;
}
if (configSpatialSearchLayers.length){
cboSearchLayerSpatial.dataProvider = new ArrayCollection(configSpatialSearchLayers);
cboSearchLayerSpatial.width = determineDropDownWidth(configSpatialSearchLayers);
if(cboSearchLayerSpatial.width > (wTemplate.width - 57)){
cboSearchLayerSpatial.width = (wTemplate.width - 57);
}
cboSearchLayerSpatial.selectedIndex = 0;
cboBufferUnit.dataProvider = new ArrayCollection(configBufferUnits);
cboBufferUnit.width = determineDropDownWidth(configBufferUnits);
if((cboBufferUnit.width + 117) > wTemplate.width){
cboBufferUnit.width = (wTemplate.width - 117);
}
cboBufferUnit.selectedIndex = 0;
}
//Determine which button to select based on the default selection option
for(var tb:int=0; tb < wTemplate.headerToolGroup.numElements; tb++){
var tbb:TitlebarButton = wTemplate.headerToolGroup.getElementAt(tb) as TitlebarButton;
if(tbb.toolTip == graphicalsearchLabel && defaultSelectionOption == "graphicalInput"){