Select to view content in your preferred language

Table of Contents - Legend Widget for FlexViewer 2.x

184460
664
12-01-2010 07:30 AM
RobertScheitlin__GISP
MVP Emeritus
All,

Here is the next in my line of widgets for the FlexViewer 2.x.

The legend portion of this widget is the same code as my dynamic legend widget so,

IT IS FOR ARCGIS SERVER 10 OR GREATER ONLY

This is just a simple TOC Widget that includes my dynamic legend component.
This widget also includes my enhancement for map service transparency,
right click context menu for zoom to make layer visible, and my scale
dependent renderer for the TOC checkboxes.
Tags (2)
0 Kudos
664 Replies
NathanEnge
Esri Contributor
Robert
I see you removed the white background on the TOC.
However some of my symbologies need to be quite light, and against the widget background its almost all washed out.
Is there a way to change the background colour or reduce the transparancey/opacity either through mxml or the config without changing the transparancey for all the other widgets if I were to do it from config.xml
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Nathan,

   Sure in the TOCWidget.mxml just replace this portion:

<viewer:WidgetTemplate id="wTemplate"
                       height="300"
                       skinClass="com.esri.viewer.skins.WidgetTemplateSkin"
                       width="380">
    <s:BorderContainer borderVisible="false"
         backgroundColor="#ffffff"
         backgroundAlpha="0.6"
         height="100%" width="100%">
        <s:VGroup id="showTOC"
                  visible="true"
                  gap="8"
                  height="100%"
                  paddingTop="4"
                  width="100%">
            <s:HGroup gap="10" verticalAlign="middle" visible="{alphaVis}" includeInLayout="{alphaVis}">
                <s:Label styleName="WidgetText" text="Layer Visibility" paddingLeft="6"/>
                <mx:Image source="{alphaIcon}" width="20" height="20" toolTip="{AlphaToolTip}"/>
                <s:HSlider id="slider" 
                           minimum="0" 
                           maximum="1"
                           change="setLayerAlpha()"
                           dataTipFormatFunction="sldrDataTipFormatter"
                           liveDragging="true"
                           snapInterval="0.001" 
                           skinClass="widgets.TOC.alphaSliderSkin"
                           enabled="{layerIsSelected}"/>
            </s:HGroup>
            <s:Scroller id="scr" width="100%" height="100%">
                <s:Group>
                    <s:layout>
                        <s:VerticalLayout gap="1"/>
                    </s:layout>
                    <s:HGroup id="boxMessage"
                              width="100%"
                              includeInLayout="false"
                              visible="false" 
                              verticalAlign="middle"
                              horizontalAlign="center">
                        <mx:Image id="swfMessage"
                                  source="widgets/TOC/assets/images/loader.swf"/>
                        <s:Label id="txtMessage"
                                 width="90%"
                                 text="{GeneratingLegendMsg}"/>
                    </s:HGroup>
                    <toccomp:TOC id="toc"
                                 width="100%"
                                 height="100%"
                                 itemRollOver="setLastTreeItem(event)"
                                 itemClick="setSelectedTreeItem(event)"
                                 metadataToolTip="{MetadataToolTip}"
                                 showMetadataButton="{showDesc}"
                                 expanded="{expanded}"
                                 legendCollapsed="{legendCollapsed}"
                                 liveScrolling="false"
                                 variableRowHeight="true"
                                 tocMinWidth="{wTemplate.width - 45}"
                                 scroller="{scr}"
                                 loader="{boxMessage}"/>
                </s:Group>
            </s:Scroller>
    </s:VGroup>
    </s:BorderContainer>
    <s:BorderContainer width="{slider.width}" height="{slider.height}" includeInLayout="{alphaVis}"
    x="{slider.x}" y="{slider.y}" alpha="0.01" visible="{!slider.enabled}"
    toolTip="{AlphaToolTip}"/>
    </viewer:WidgetTemplate>
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Danny and Andrew,

   I have uploaded version 2.4.1 today that has the memory leak fixed and I added back in the Flex Viewer 2.3.1 compiled version to the download in case you have yet to update to Flex Viewer 2.4.
0 Kudos
DanDowning
Regular Contributor
Danny and Andrew,

   I have uploaded version 2.4.1 today that has the memory leak fixed and I added back in the Flex Viewer 2.3.1 compiled version to the download in case you have yet to update to Flex Viewer 2.4.


Used the 2.3.1 update and everything is working great now.

Thanks Robert!
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Roi.Mar,

   I have fixed the issue with REALLY long label names in version 2.4.1 in the 3:10 PM release. Let me know if it resolves your issue.
0 Kudos
JacksonTrappett
Frequent Contributor
Hi, thanks Robert for creating a widget that finally does TOC the right way!  Also thanks for todays release that fixed the leak bug.

Sorry to be the bearer of new bug reports, but after today's update, I'm getting one where my layer names are disappearing as I interact with the legend.  I attached a shot of the problem.  The longer I interact (expand, scroll, turn on/off, etc) the more of them seem to go, but I haven't managed to narrow down exactly when they disappear, it doesn't seem to be the same every time.  If you need my config/services or anything else to help track it down, let me know!

Thanks,
Jackson
0 Kudos
AndrewBlakey1
Emerging Contributor
Danny and Andrew,

   I have uploaded version 2.4.1 today that has the memory leak fixed and I added back in the Flex Viewer 2.3.1 compiled version to the download in case you have yet to update to Flex Viewer 2.4.


Thanks a lot for your timely help. It's a fantastic widget and works great now.
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
All,

   Stay tuned Jackson posted that there is a bug in the latest version that is causing the labels to randomly disappear. I have this fixed already but I am trying to see if I can add KML support before I release again.
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
All,

   A new version for FV-2.3.1 and FV-2.4 has been uploaded

Version 2.4.2 - 1 August, 2011, 8:40 PM
* Fix for the disappearing labels
* TOCWidget now respects what has been set in the MapSwitcherWidget and vise versa.
*  Minimal support for KML layers has been added. Legend swatches are not  supported yet as the API's support of KMLLayer is not matured yet.
* Uncompiled code is written for Flex Viewer 2.4 ONLY!

Version 2.3.9.2 - 1 August, 2011, 8:40 PM
*  This probably will not happen ever again but I wanted to have a good  stable Flex Viewer 2.3.1 version of this widget available so I have  added the compiled version with the memory leak fix and the follow-up  fix for the disapearing labels.
* Uncompiled code is written for Flex Viewer 2.4 ONLY!
0 Kudos
CharlesHarris
Emerging Contributor
Hi Robert-

I've noticed that your TOC widget doesn't seem to work properly with the Sample "ThematicQuery" widget.  When the ThematicQuery widget is initialized a new layer is shown in the TOC called "Thematic Selection Layer" but the Legend is never generated.  It seems as though the ThematicQuery widget is only intended to be used with the StaticImage widget as it only has a string property which points to an image of the intended legend.

Can you point me in the right direction of getting these two widgets to work together properly?  What we would like to see is that when the ThematicQuery widget is initialized the TOC/Legend will show the layer who's radio button is pressed in the widget (both name and legend component).

Thanks!

Jeremy
0 Kudos