Is there a reason that fireEvent is protected?


I have a situation where I have created a composite component including a TextField and a Button.

This component needs to implement the BlurNotifier interface.

Ideally I would like to implement it by a pass through, adding the listener to the TextField. However, the button produces a dialog which changes the text field, and I would like to call the blur event at that time as well. However, since this component is not descended form TextField I’m not allowed to call fireEvent.

Is there a design decision reason for this restriction? If not, could this be a public method for future implementations? Is there some other way I should be implementing this that would be a better solution?

Jenica Jacobsen
MountainView Software

Yes - it is definitely too low level API to be public. Even the methods fireXyzEvent() in the subclasses of AbstractComponent are meant to be called by the component itself, not by others directly.

What could perhaps be public (but does not exist at the moment) would be methods like, which would in turn call the protected Button.fireClick(…) which would call the protected AbstractComponent.fireEvent(…).

If you need to get around this, simply define a subclass of TextField which provides e.g. a public fireBlurEvent(), and use that class instead of a TextField.