Select to view content in your preferred language

InfoWindowRenderer with States based on the graphic attributes

653
2
04-11-2011 08:43 AM
PrashanthSukumaran
Emerging Contributor
Hi,

My infowindow renderer supports states and implements the IGraphicRenderer, so i have access to the graphic.  The infowindow has 5 links.  I would like to show the links based on the value stored in the graphics attributes (Switch States).  Based on which step i am in the workflow i will update the attributes of the graphic with the state ("step1", "step2" etc) or i can pull the state of the workflow from a helper class.

1) How can the infowindow renderer know about the changes to the graphic?
2) Is there any method in the infowindow renderer that is called everytime i click the graphic.  I could override this method to accomplish my task.
3) Is there a simpler way to do this.
Tags (2)
0 Kudos
2 Replies
ReneRubalcava
Esri Frequent Contributor
Since you're implementing IGraphicRenderer you can set that logic in the graphic setter.
public function set graphic(value:Graphic):void{}

When dealing with states in a SkinnableComponent you may need to override the following functions.
        override public function initialize():void
        {
            super.initialize();
            states.push(new State({name:"state1"}));
            states.push(new State({name:"state2"}));
            currentState = "state1";
        }
        
        override protected function getCurrentSkinState():String
        {
            return currentState;
        }
        
        override protected function stateChanged(oldState:String, newState:String, recursive:Boolean):void
        {
            super.stateChanged(oldState, newState, recursive);
            invalidateSkinState();
        }


Then in the graphic setter, change the state based on the attribute data.
0 Kudos
PrashanthSukumaran
Emerging Contributor
I see that the set graphic is called every time i click the graphic and the infowindow is shown.  I am able to change the state in this method. 

I assumed that infowindow is just shown and hidden after the first time it is created.  It is a good thing that the set graphics(..) is called every time it is shown.

Thank you Rene.
0 Kudos