mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-02 18:08:58 +00:00
Bug 298524 - Add init() method to richlistbox. r=robstrong,mconnor a=bsmedberg
This commit is contained in:
parent
512da6f988
commit
b011da6386
@ -102,7 +102,7 @@
|
||||
|
||||
if (val) {
|
||||
val.selected = true;
|
||||
this.scrollBoxObject.ensureElementIsVisible(val);
|
||||
this.scrollBoxObject.scrollToElement(val);
|
||||
this.fireActiveItemEvent();
|
||||
}
|
||||
|
||||
@ -149,6 +149,39 @@
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="init">
|
||||
<body>
|
||||
<![CDATA[
|
||||
var lastSelected = this.getAttribute("last-selected");
|
||||
|
||||
if (lastSelected != "")
|
||||
lastSelected = document.getElementById(lastSelected);
|
||||
|
||||
if (!lastSelected)
|
||||
this.goDown();
|
||||
else
|
||||
this.selectedItem = lastSelected;
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="ensureElementIsVisible">
|
||||
<parameter name="aElement"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
this.scrollBoxObject.ensureElementIsVisible(aElement);
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="ensureSelectedElementIsVisible">
|
||||
<body>
|
||||
<![CDATA[
|
||||
this.scrollBoxObject.ensureElementIsVisible(this.selectedItem);
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="fireEvent">
|
||||
<parameter name="aEventType"/>
|
||||
<body>
|
||||
@ -208,15 +241,6 @@
|
||||
</content>
|
||||
|
||||
<implementation implements="nsIAccessibleProvider, nsIDOMXULSelectControlItemElement">
|
||||
<constructor>
|
||||
<![CDATA[
|
||||
// When first item is created, select it if we don't have a selection yet
|
||||
var listbox = this.control;
|
||||
if (!listbox.selectedItem) {
|
||||
setTimeout(listbox.goDown, 0);
|
||||
}
|
||||
]]>
|
||||
</constructor>
|
||||
<!-- ///////////////// nsIAccessibleProvider ///////////////// -->
|
||||
<property name="accessible">
|
||||
<getter>
|
||||
@ -259,7 +283,8 @@
|
||||
onset="return this.setAttribute('selected',val);"/>
|
||||
|
||||
<property name="control">
|
||||
<getter><![CDATA[
|
||||
<getter>
|
||||
<![CDATA[
|
||||
var parent = this.parentNode;
|
||||
while (parent) {
|
||||
if (parent.localName == "richlistbox")
|
||||
@ -267,7 +292,8 @@
|
||||
parent = parent.parentNode;
|
||||
}
|
||||
return null;
|
||||
]]></getter>
|
||||
]]>
|
||||
</getter>
|
||||
</property>
|
||||
</implementation>
|
||||
|
||||
|
@ -187,14 +187,9 @@ function Startup()
|
||||
optionsButton.hidden = true;
|
||||
}
|
||||
|
||||
// Restore the last-selected extension
|
||||
var lastSelected = gExtensionsView.getAttribute("last-selected");
|
||||
if (lastSelected != "")
|
||||
lastSelected = document.getElementById(lastSelected);
|
||||
if (!lastSelected)
|
||||
gExtensionsView.goDown();
|
||||
else
|
||||
gExtensionsView.selectedItem = lastSelected;
|
||||
// Initialize the richlistbox. This will select the last selected extension
|
||||
// or default to the first listed one.
|
||||
gExtensionsView.init();
|
||||
|
||||
var extensionsStrings = document.getElementById("extensionsStrings");
|
||||
document.title = extensionsStrings.getString(gWindowState + "Title");
|
||||
|
Loading…
Reference in New Issue
Block a user