I have a class that provides basic functionality of a modal window. For different situations I need to provide different modals(different number of buttons, titles, etc...). I have a kind of factory that can compose those modal windows, like in the example below. 

```
class ModalProvider {
   static ModalWindow makeModalWindowOne(callback)  {
       AcceptButton acceptButton = new AcceptButton();
       ModalWindow mw = new ModalWindow();
       mw.addButton(acceptButton);
       acceptButton.onClick() {
          callback();
       }
       return mw;
   }
   static ModalWindow makeModalWindow2(callback) {
   // similar to previous but with different number of buttons   
   }

}

```

This approach works however it doesn't feel right. Especially the fact that I need to bind callback to button in a static function. 

Is it an acceptable approach to compose object in this fashion in static functions? 

To elaborate on this a little, the alternative solution I'm thinking of is creating subclasses of ModalWindow for each static function. So, I would have something like AcceptModalWindow, CreateModalWindow, etc...