User:Jminta:Views

From MozillaWiki
Jump to: navigation, search

Migration to the new views

So, it looks like the xbl model won out. Unlike my previous patches to bring in the new views, this one cannot be easily implemented in one step. Here's how I'm proposing to go about this:

Step 1:

  • Create xbl elements for each of the 4 views we want to implement
  • These views will implement the following API
    • readonly attribute observerID (not used until Step 2)
    • readonly attribute startDay
    • readonly attribute endDay
    • attribute selectedDay
    • attribute controller
    • void goToDay(day)
    • void moveView(numberOfTimes)
  • These views will still be controlled by a shell of gCalendarWindow, mostly to control enabling/disabling commands

Step 2:

Make the views truly pluggable:

  • Remove all traces of gCalendarWindow
    • make CalendarEventSelection stand on its own
  • switching to a view will activate its observer. Commands related to the view should update themselves accordingly (disable/enable)

xbl model

<deck id="view-deck">

 <cal-day-view id="day-view"/>
 <cal-week-view id="week-view"/>
 <cal-multiweek-view id="multiweek-view"/>
 <cal-month-view id="month-view"/>

</deck>

Javascript: function switchView(elementId) {

   document.getElementById('view-deck').selectedPanel = document.getElementById(elementId);

}

gCalendarWindow.currentView becomes document.getElementById('view-deck').selectedPanel

gCalendarWindow.switchToDayView() becomes switchView('day-view');