NativeSelect: re-arranging the pick list and recursive events

I am working with a NatvieSelect in which selecting certain items can require the pick list to be re-ordered or re-computed (along with other changes to the GUI).

It seems like there are no fine-grained controls on the NativeSelect container, such as insert this item here, delete that item there, move this item to the top, etc.

So I have identified two alternate approaches:

  1. first removeAllItems(), then rebuild the pick list one item at a time the way you want it
  2. create a new container having the contents that I want, then set it, then set the new selected value

With either approach it seems like the methods you call within your ValueChangeListener can generate recursive events back to the same ValueChangeListener. The second approach one has only two recursive events: 1) setting the new container, and 2) setting the selected value. The first approach can have an arbitrary number of events, depending on how big a list you are building.

I am using the container-replacement approach because that seemed to generate fewer events. After a few StackOverflowErrors, I put in code to handle the recursion and every thing is working very nicely.

But my question is: is there a better approach? For example, is there some way to turn off recursive events until you are done fidling with the container? Are there any negative consequences to just ignoring those (recursive) events?