SliderDataTip border skinning patch

In the previous post I discussed an issue with the SliderDataTip class' border skinning. http://www.as3offcuts.com/?p=57

Since then I've submitted a fix as a patch to the Adobe bugs system. This was the first time I'd submitted a patch, so had to jump through a few hoops to get there, but it was all pretty straightforward.

It basically involved:

  • Signing Adobe's contributor license forms, emailing them in, and waiting for a reply.
  • Checking out the 3.x branch and testing my fix in it.
  • Building the altered branch and running Abode's check in tests on it.
  • Making a patch of the fix with tortoise or something similar.
  • Submitting the patch on Adobe's bug site.
  • A good run through of the process can be found here and here.

    The patch is essentially the same as the fix described in the previous post, with the addition of removing the border construction from createChildren and just having it exist in styleChanged. There was no need for the code in createChildren; the border was already being created before createChildren was called in the first call to styleChanged.

    Have a look at the patch file here: Patch (sdk-24282)

    SliderDataTip border skinning fix (work in progress).

    There's a small issue with the border of the data tip in the two Flex Slider classes (VSlider and HSlider) (which I raised yesterday. https://bugs.adobe.com/jira/browse/SDK-24282)

    I quickly knocked up a fix for it that could either be placed in ToolTip, SliderDataTip or in an extension to SliderDataTip.

    If the fix is going into the ToolTip class, then the styleChanged method becomes the following:

    
    override public function styleChanged(styleProp:String):void 
    { 
        // This will take care of doing invalidateSize() if styleProp 
        // is "styleName" or a registered layout style such as "borderStyle". 
        super.styleChanged(styleProp); 
        // However, if the borderStyle changes from "errorTipAbove" to 
        // "errorTipBelow" or vice versa, the measured size won't change. 
        // (The pointy part of the skin simply changes from the bottom 
        // to the top or vice versa.) This means that the LayoutManager 
        // won't call updateDisplayList() because the size hasn't changed. 
        // But the TextField has to be repositioned, so we need to 
        // invalidate the layout as well as the size. 
        if (styleProp == "borderStyle" ||         styleProp == "styleName" ||         styleProp == "borderSkin" ||         styleProp == null         ) 
        { 
            if( !(border is getStyle("borderSkin")) ) 
            {
                if(border) 
                    removeChild(DisplayObject(border)); 					                     var borderClass:Class = getStyle("borderSkin");
                border = new borderClass();
                if (border is ISimpleStyleClient)                 ISimpleStyleClient(border).styleName = this;
                addChildAt(DisplayObject(border), 0); 
            }
     
            invalidateDisplayList(); 
        } 
    }
    
    
    

    This basically adds a check to see if the borderSkin style has changed. If so it remakes the border in the same way it's originally made in createChildren.

    If it's going into SliderDataTip or a subclass of ToolTip or SliderDataTip then add the above as an override to the styleChanged method, but also remember to import the mx_internal namespace and add the use namespace mx_internal line so that you can access the border property.

    So far I've tested runtime changes to border styles in the style defined for dataTipSlideName in the relevant slider, and they appear to work fine. Changing the dataTipSlideName itself won't update the data tip while it's open, but will when it is next opened. Fixing this would require a seperate addition to the styleChanged method of the Slider class.

    I'll try and get round to testing this a bit more and submitting it as a patch.