Changes between Version 2 and Version 3 of HowToCustomizeLegend
- Timestamp:
- 09/16/08 07:29:51 (16 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
HowToCustomizeLegend
v2 v3 1 1 [[PageOutline]] 2 = How To Customize !Legend widget =2 = How To Customize Legend widget = 3 3 4 4 == Introduction == 5 5 6 This !HowTo describe how customize the !Legend widget for display the groups/layers the way you want. In this !HowTo, we'll see what are the two possible methods to customize this widget and make a example for each. It's basicly the same pattern as the !SelectionPanel widget.6 This !HowTo describes how customize the Legend widget for display the groups/layers the way you want. In this !HowTo, we'll see what are the two possible methods to customize this widget and make a example for each. It's basicly the same pattern as the !SelectionPanel widget. 7 7 8 8 == First method: customize by defining a function == … … 53 53 == Second method: customize by creating a renderer class == 54 54 55 This method let you define a special behavior for the !Legend. It can be a little bit more complicated than the first one but it can be very useful for those who have to make a complex behavior. It also keep a structured application using the ''Object Oriented programming''.55 This method let you define a special behavior for the Legend. It can be a little bit more complicated than the first one but it can be very useful for those who have to make a complex behavior. It also keep a structured application using the ''Object Oriented programming''. 56 56 57 Basicly, creating a renderer class is not very complicated. You'll have to create a class that inherit from the '''Fusion.Widget. !Legend.!LegendRenderer''' and implement these five functions: ''initialize'', ''renderLegend'', ''mapLoaded'', ''mapReloaded'', ''mapLoading''. The first function is for initialize the base class and initialize all specific properties of your renderer (creating div, button, image, adding CSS, etc.). The second is the main function that will draw the legend. The last three functions are only for handle the events and do specificsactions. (Fusion.Event.MAP_LOADED, Fusion.Event.MAP_RELOADED, Fusion.Event.MAP_LOADING).57 Basicly, creating a renderer class is not very complicated. You'll have to create a class that inherit from the '''Fusion.Widget.Legend.!LegendRenderer''' and implement these five functions: ''initialize'', ''renderLegend'', ''mapLoaded'', ''mapReloaded'', ''mapLoading''. The first function is for initialize the base class and initialize all specific properties of your renderer (creating div, button, image, adding CSS, etc.). The second is the main function that will draw the legend. The last three functions are only for handle the events and do specific actions. (Fusion.Event.MAP_LOADED, Fusion.Event.MAP_RELOADED, Fusion.Event.MAP_LOADING). 58 58 59 59 '''Example 1: simple renderer'''