Bug 315960 Improve multiday view's relayout time by adding batching r=dmose

This commit is contained in:
jminta%gmail.com 2005-11-18 16:01:17 +00:00
parent 6498da3c28
commit 989dd0e5f1

View File

@ -409,7 +409,7 @@
if (aOccurrence) {
var chunk = this.findChunkForOccurrence(aOccurrence);
if (!chunk) {
if (!chunk.eventbox) {
dump ("++ Couldn't find chunk to select!!!\n");
return;
}
@ -641,6 +641,19 @@
// chunkBox.setAttribute("flex", "1");
chunkBox.setAttribute("tooltip", "itemTooltip");
var categoriesSelectorList = "";
if (chunk.event.event.getProperty("CATEGORIES") != null) {
var categoriesList = chunk.event.event.getProperty("CATEGORIES").split(",");
for (var i = 0; i < categoriesList.length; i++ ) {
// Remove illegal chars.
categoriesList[i] = categoriesList[i].replace(' ','_');
categoriesSelectorList = categoriesSelectorList + categoriesList[i].toLowerCase();
}
}
chunkBox.setAttribute("item-category", categoriesSelectorList);
if (orient == "vertical")
chunkBox.setAttribute("height", duration * this.mPixPerMin);
else
@ -1436,6 +1449,13 @@
this.mInMouseDown = false;
]]></handler>
<handler event="mouseover"><![CDATA[
if (this.calendarView && this.calendarView.controller) {
event.preventBubble();
onMouseOverItem(event);
}
]]></handler>
</handlers>
</binding>
@ -1525,6 +1545,30 @@
<field name="mStartMin">8*60</field>
<field name="mEndMin">20*60</field>
<field name="mTasksInView">true</field>
<field name="mSelectionObserver"><![CDATA[
({ calView: this,
onSelectionChanged: function(itemSelectionArray) {
if (this.calView.mSelectedItem) {
var col = this.calView.findColumnForItem(this.calView.mSelectedItem);
if (col)
col.column.selectOccurrence(null);
}
this.calView.mSelectedItem = itemSelectionArray[0];
if (!this.calView.mSelectedItem)
return;
if (this.calView.mSelectedItem.startDate)
this.calView.showDate(this.calView.mSelectedItem.startDate);
if (this.calView.mSelectedItem.entryDate)
this.calView.showDate(this.calView.mSelectedItem.entryDate);
var col = this.calView.findColumnForItem(this.calView.mSelectedItem);
if (col)
col.column.selectOccurrence(this.calView.mSelectedItem);
}
})
]]></field>
<field name="mObserver"><![CDATA[
// the calIObserver, and calICompositeObserver
@ -1631,8 +1675,10 @@
calView: this,
onOperationComplete: function(aCalendar, aStatus, aOperationType, aId, aDetail) {
// nothing to do
//dump ("+++ OnOperationComplete (detail: " + aDetail + ")\n");
if (this.calView.controller.selectionManager &&
this.calView.controller.selectionManager.selectedEvents[0])
this.calView.selectedItem = (this.calView.controller
.selectionManager.selectedEvents[0]);
},
onGetResult: function(aCalendar, aStatus, aItemType, aDetail, aCount, aItems) {
if (!Components.isSuccessCode(aStatus))
@ -1702,6 +1748,16 @@
]]></getter>
</property>
<property name="tasksInView">
<getter><![CDATA[
return this.mTasksInView;
]]></getter>
<setter><![CDATA[
this.mTasksInView = val;
this.refresh();
]]></setter>
</property>
<method name="showDate">
<parameter name="aDate"/>
@ -1844,7 +1900,7 @@
<setter><![CDATA[
if (this.mSelectedItem != val) {
if (this.mSelectedItem) {
var col = this.findColumnForEvent(this.mSelectedItem);
var col = this.findColumnForItem(this.mSelectedItem);
if (col) {
col.column.selectOccurrence(null);
} else {
@ -1853,11 +1909,14 @@
}
if (val) {
var col = this.findColumnForEvent(val);
if (col)
var col = this.findColumnForItem(val);
if (col) {
col.column.selectOccurrence(val);
else
if(this.mController.selectionManager)
this.mController.selectionManager.replaceSelection(val);
} else {
val = null;
}
}
return (this.mSelectedItem = val);
@ -2040,6 +2099,15 @@
// we get all the items, and just filter out the ones we don't
// care about in addItem
var filter = this.mCalendar.ITEM_FILTER_COMPLETED_ALL |
this.mCalendar.ITEM_FILTER_CLASS_OCCURRENCES;
if(this.mTasksInView)
filter |= this.mCalendar.ITEM_FILTER_TYPE_ALL;
else
filter |= this.mCalendar.ITEM_FILTER_TYPE_EVENT;
//XXX Once tasks are supported use filter here instead of this list
this.mCalendar.getItems(this.mCalendar.ITEM_FILTER_COMPLETED_ALL |
this.mCalendar.ITEM_FILTER_TYPE_EVENT |
this.mCalendar.ITEM_FILTER_CLASS_OCCURRENCES,
@ -2142,9 +2210,10 @@
labeldaybox.appendChild(labelbox);
d.isDate = true;
var d2 = d.clone();
d2.isDate = true;
this.mDateColumns.push ( { date: d, column: dayEventsBox, header: dayHeaderBox } );
this.mDateColumns.push ( { date: d2, column: dayEventsBox, header: dayHeaderBox } );
}
// fix pixels-per-minute
@ -2164,10 +2233,18 @@
</method>
<method name="findColumnForEvent">
<parameter name="aEvent"/>
<method name="findColumnForItem">
<parameter name="aItem"/>
<body><![CDATA[
return this.findColumnForDate(aEvent.startDate);
var estart;
if(aItem.startDate)
estart = aItem.startDate;
if(aItem.entryDate)
estart = aItem.entryDate;
if(!estart)
return null;
return this.findColumnForDate(estart);
]]></body>
</method>
@ -2195,7 +2272,7 @@
<parameter name="aEvent"/>
<body><![CDATA[
//dump ("++ doAddevent\n");
var col = this.findColumnForEvent(aEvent);
var col = this.findColumnForItem(aEvent);
if (!col)
return;
@ -2214,7 +2291,7 @@
<method name="doDeleteEvent">
<parameter name="aEvent"/>
<body><![CDATA[
var col = this.findColumnForEvent(aEvent);
var col = this.findColumnForItem(aEvent);
if (!col)
return;