Select to view content in your preferred language

Table of Contents - Legend Widget for FlexViewer 2.x

122667
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
NadeemShaukat
Deactivated User
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.


Robert,

I looked at the demo of your TOC widget and found it as a great addition of you work to other widgets you have written. However, when I added it to my project, registered to module, and compiled, it gave an error on line 12 of layerAlpha.mxml complaining about not finding the WidgetCloseButtonSkin. Here is the error message.
1172: Definition com.esri.viewer.skins:WidgetCloseButtonSkin could not be found.

Nadeem
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Nadeem,

   Yep, that is a bug in the uncompiled version. to fix it all you have to do is change line 12 to:
import widgets.TOC.WidgetCloseButtonSkin;
I will get this fixed and release another version with the fix.
0 Kudos
by Anonymous User
Not applicable
Great widget!

I was wondering how I might disable the more.... button that is in the map switcher.  I would much rather our folks use the TOC widget to view layers when needed, and not have both areas available.  Also i was wondering if it is possible to show the features (that are displayed on the second tab) with the layers?

Thanks for the help!
TC
0 Kudos
MarshallPlants
Emerging Contributor
I don't know about showing the legend and visibility together but here is the answer to your first question.

In the config.xml file for your flexviewer, remove this line:
    <widget right="20" top="55"    config="widgets/MapSwitcher/MapSwitcherWidget.xml" url="widgets/MapSwitcher/MapSwitcherWidget.swf"/>

I also modified the portion of the code where Robert adds the widget to the config.xlm file to read:
  <widget label="More Layers..." right="20" top="55"
This renames the widget to More Layers... to replace the code that you removed as per my instructions above and opens it the location of the old More Layers... button.  I only have one Base Map in my project so this works for me.  If you have more than one Base map this might cover up the base map selection buttons.  After it is open, you can always move it or experiment with the numbers above to open it in a more convenient place.

Also, go to the TOCWidget.xml file in the \widgets\TOC folder and change the excluedeBasemapLayers from true to false and you can now turn off the Base Maps and/or change their visibility.

<excludeBasemapLayers>false</excludeBasemapLayers>
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Todd,

Or if you want to keep the basemaps in the togglebutton format that the mapswitcher provides than just edit you MapSwitcherWidget.xml to the below:

<?xml version="1.0" ?>
<configuration>
    <layerlist label="More..." visible="false">
        <!-- <excludelayer>TheLabelOfSomeLayerInMainConfig</excludelayer> -->
    </layerlist>
</configuration>


As far as adding the legend swatch to the tree, No you can not do that, Well yes you could if you are a good programmer, but I don't have any intention of doing that in my code.
0 Kudos
by Anonymous User
Not applicable
Thanks for both options.  I'll play around with it and see which will work for our needs. 

as far as the legend option, not a big deal just wondering if it could be done painlessly.  i'm no programmer by any means.

Thanks again.
0 Kudos
RaymondBlack
Emerging Contributor
Hi Robert,

I have added your combined TOC/Legend widget to a project that I am working on, but I am having problems.  I have built the widget from the source code.  It is connected to an ArcGIS 10 Mapservice (Dynamic Layers).  The TOC displays correctly, but when I click on the legend button, I just get a blank page.  Even the legend label doesn't display.  Have I missed something in the configuration?

Thanks,
++ Ray
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Ray,

   The legend will only display layer that are in scale range to be visible and are checked to be visible in the toc. Also you might want to ensure that when you go to the rest services directory and to a specific layer that it contains drawingInfos.
0 Kudos
RaymondBlack
Emerging Contributor
Hi Robert,

Thanks for the response.  I have checked the items that you suggested and all appears to be correct - just no legend displayed.  See attached screenshots.  Could it be something to do with the group layers?

Thanks,

++ Ray
0 Kudos