HomePhabricator

[BREAKING CHANGE] Refactor dialog and window sets

Authored by Krinkle.

Description

[BREAKING CHANGE] Refactor dialog and window sets

  • Document Window#name as @abstract. Window#name and Dialog#titleMessage are both abstract and must be implemented by a subclass. Without these there will be an unexpected "[null]" somewhere in the interface.
  • Add WindowSet#addWindow When instantiating a WindowSet and giving it to a Dialog, and then opening the dialog, it won't open because the window set doesn't actually properly register the dialog window in its system until you call getWindow by symbolic name.

    Whether we want to require each dialog to be a separate and complete instantiable stateless class with name and registered in a dialog factory is a separate discussion. This registration logic does not belong in some random getter that is no way supposed to be required to be called in order for the dialog to work.

    Moved this logic out to addWindow for now. Since no name is available, hacked a separate list in there that doesn't require a name.
  • Frame used to have an overly complex initialization flow. Method and event names were confusing as 'initialize' is commonly used for a specific type of method/event in OOjs UI. Frame#load is now a private method that must only be called once. The logic for abstracting whether to call load() or to run right away was moved from calling code into Frame#run which now takes care of it and Frame#load is now documented as a private method that shouldn't be called from outside this class.
  • Remove windowSet parameter from Window and Dialog as it doesn't really need it for anything. Contrary to what it suggested, the Window did not take care of registering itself with the WindowSet. Instead this was handled by calling WindowSet#getWindow (now in WindowSet#addWindow).

    WindowSets can now deal with Dialog and Window objects directly without needing control over the instantiation.
  • There were a few things that made Dialogs still not work properly without a WindowSet, these are now fixed and dealt with automatically instead of having to do it manually.
    • Calling Frame#load (used to be in WindowSet#addWindow, now handled automatically when Window#open calls Frame#run).
    • Zoom animation when Dialog opens
  • Refactor dialog open/close animations to use a toggle class instead of temporary "closing" class being added and then removed again. Also refactored the animations to use CSS transitions instead, which simplifies it a lot by just setting properties and letting the browser deal with the animation. This also allowed us to keep the class on it without needing to remove it in time for the animation to end.

Change-Id: Ibf45656f4cbb1df278c32c09ce264cceb793a9a5

Details