зеркало из https://github.com/mozilla/pjs.git
104401 - eliminate mOuter aggregate from nsXULElement, r=waterson, sr=hyatt
This commit is contained in:
Родитель
6bb61e9651
Коммит
55a509e710
|
@ -51,7 +51,6 @@
|
|||
class nsIDocument;
|
||||
class nsIScrollableView;
|
||||
class nsIPresShell;
|
||||
class nsITreeFrame;
|
||||
class nsIFrameSelection;
|
||||
class nsIDocShell;
|
||||
class nsIDocShellTreeNode;
|
||||
|
|
|
@ -54,7 +54,6 @@ CPPSRCS = \
|
|||
nsXULAttributes.cpp \
|
||||
nsXULElement.cpp \
|
||||
nsXULPopupListener.cpp \
|
||||
nsXULTreeElement.cpp \
|
||||
$(NULL)
|
||||
|
||||
# we don't want the shared lib, but we want to force the creation of a static lib.
|
||||
|
|
|
@ -51,7 +51,6 @@ CPP_OBJS= \
|
|||
.\$(OBJDIR)\nsXULAttributes.obj \
|
||||
.\$(OBJDIR)\nsXULElement.obj \
|
||||
.\$(OBJDIR)\nsXULPopupListener.obj \
|
||||
.\$(OBJDIR)\nsXULTreeElement.obj \
|
||||
$(NULL)
|
||||
|
||||
LINCS= \
|
||||
|
|
|
@ -77,6 +77,7 @@
|
|||
#include "nsIDOMNodeList.h"
|
||||
#include "nsIDOMXULCommandDispatcher.h"
|
||||
#include "nsIDOMXULElement.h"
|
||||
#include "nsIDOMXULSelectCntrlItemEl.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIEventListenerManager.h"
|
||||
#include "nsIEventStateManager.h"
|
||||
|
@ -117,7 +118,6 @@
|
|||
#include "nsXPIDLString.h"
|
||||
#include "nsXULAttributes.h"
|
||||
#include "nsXULControllers.h"
|
||||
#include "nsXULTreeElement.h"
|
||||
#include "nsIBoxObject.h"
|
||||
#include "nsPIBoxObject.h"
|
||||
#include "nsXULDocument.h"
|
||||
|
@ -649,8 +649,6 @@ nsXULElement::QueryInterface(REFNSIID iid, void** result)
|
|||
return NS_ERROR_NULL_POINTER;
|
||||
*result = nsnull;
|
||||
|
||||
nsresult rv;
|
||||
|
||||
if (iid.Equals(NS_GET_IID(nsIStyledContent)) ||
|
||||
iid.Equals(NS_GET_IID(nsIContent)) ||
|
||||
iid.Equals(NS_GET_IID(nsISupports))) {
|
||||
|
@ -679,46 +677,13 @@ nsXULElement::QueryInterface(REFNSIID iid, void** result)
|
|||
else if (iid.Equals(NS_GET_IID(nsIChromeEventHandler))) {
|
||||
*result = NS_STATIC_CAST(nsIChromeEventHandler*, this);
|
||||
}
|
||||
else if ((iid.Equals(NS_GET_IID(nsIDOMXULTreeElement)) ||
|
||||
iid.Equals(NS_GET_IID(nsIXULTreeContent))) &&
|
||||
(NodeInfo()->NamespaceEquals(kNameSpaceID_XUL))){
|
||||
nsCOMPtr<nsIAtom> tag;
|
||||
PRInt32 dummy;
|
||||
nsIXBLService *xblService = GetXBLService();
|
||||
xblService->ResolveTag(NS_STATIC_CAST(nsIStyledContent*, this), &dummy, getter_AddRefs(tag));
|
||||
if (tag == nsXULAtoms::tree) {
|
||||
// We delegate XULTreeElement APIs to an aggregate object
|
||||
if (! InnerXULElement()) {
|
||||
rv = EnsureSlots();
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
if ((mSlots->mInnerXULElement = new nsXULTreeElement(this)) == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
return InnerXULElement()->QueryInterface(iid, result);
|
||||
}
|
||||
else
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
else if (iid.Equals(NS_GET_IID(nsIDOM3Node))) {
|
||||
*result = new nsNode3Tearoff(this);
|
||||
NS_ENSURE_TRUE(*result, NS_ERROR_OUT_OF_MEMORY);
|
||||
}
|
||||
else if (iid.Equals(NS_GET_IID(nsIClassInfo))) {
|
||||
nsISupports *inst = nsnull;
|
||||
|
||||
nsCOMPtr<nsIAtom> tag;
|
||||
PRInt32 dummy;
|
||||
nsIXBLService *xblService = GetXBLService();
|
||||
xblService->ResolveTag(NS_STATIC_CAST(nsIStyledContent*, this), &dummy, getter_AddRefs(tag));
|
||||
if (tag == nsXULAtoms::tree) {
|
||||
inst = nsContentUtils::
|
||||
GetClassInfoInstance(eDOMClassInfo_XULTreeElement_id);
|
||||
} else {
|
||||
inst = nsContentUtils::
|
||||
nsISupports *inst = nsContentUtils::
|
||||
GetClassInfoInstance(eDOMClassInfo_XULElement_id);
|
||||
}
|
||||
|
||||
NS_ENSURE_TRUE(inst, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
|
@ -2394,7 +2359,7 @@ nsXULElement::RemoveChildAt(PRInt32 aIndex, PRBool aNotify)
|
|||
// the possibility exists that some of the items in the removed subtree
|
||||
// are selected (and therefore need to be deselected). We need to account for this.
|
||||
nsCOMPtr<nsIAtom> tag;
|
||||
nsCOMPtr<nsIDOMXULTreeElement> treeElement;
|
||||
nsCOMPtr<nsIDOMXULMultiSelectControlElement> controlElement;
|
||||
nsCOMPtr<nsITreeBoxObject> treeBox;
|
||||
PRBool fireSelectionHandler = PR_FALSE;
|
||||
|
||||
|
@ -2404,50 +2369,40 @@ nsXULElement::RemoveChildAt(PRInt32 aIndex, PRBool aNotify)
|
|||
|
||||
oldKid->GetTag(*getter_AddRefs(tag));
|
||||
if (tag && (tag == nsXULAtoms::treechildren || tag == nsXULAtoms::treeitem ||
|
||||
tag == nsXULAtoms::treecell)) {
|
||||
tag == nsXULAtoms::treecell || tag == nsXULAtoms::listitem)) {
|
||||
// This is the nasty case. We have (potentially) a slew of selected items
|
||||
// and cells going away.
|
||||
// First, retrieve the tree.
|
||||
// Check first whether this element IS the tree
|
||||
treeElement = do_QueryInterface((nsIDOMXULElement*)this);
|
||||
controlElement = do_QueryInterface((nsIDOMXULElement*)this);
|
||||
|
||||
// If it's not, look at our parent
|
||||
if (!treeElement)
|
||||
rv = GetParentTree(getter_AddRefs(treeElement));
|
||||
if (treeElement) {
|
||||
nsCOMPtr<nsIDOMNodeList> itemList;
|
||||
treeElement->GetSelectedItems(getter_AddRefs(itemList));
|
||||
|
||||
if (!controlElement)
|
||||
rv = GetParentTree(getter_AddRefs(controlElement));
|
||||
if (controlElement) {
|
||||
nsCOMPtr<nsIDOMNode> parentKid = do_QueryInterface(oldKid);
|
||||
if (itemList) {
|
||||
// Iterate over all of the items and find out if they are contained inside
|
||||
// the removed subtree.
|
||||
PRUint32 length;
|
||||
itemList->GetLength(&length);
|
||||
for (PRUint32 i = 0; i < length; i++) {
|
||||
nsCOMPtr<nsIDOMNode> node;
|
||||
itemList->Item(i, getter_AddRefs(node));
|
||||
if (IsAncestor(parentKid, node)) {
|
||||
nsCOMPtr<nsIContent> content = do_QueryInterface(node);
|
||||
content->UnsetAttr(kNameSpaceID_None, nsXULAtoms::selected, PR_FALSE);
|
||||
nsCOMPtr<nsIXULTreeContent> tree = do_QueryInterface(treeElement);
|
||||
nsCOMPtr<nsIDOMXULElement> domxulnode = do_QueryInterface(node);
|
||||
if (tree && domxulnode)
|
||||
tree->CheckSelection(domxulnode);
|
||||
length--;
|
||||
i--;
|
||||
fireSelectionHandler = PR_TRUE;
|
||||
}
|
||||
// Iterate over all of the items and find out if they are contained inside
|
||||
// the removed subtree.
|
||||
PRInt32 length;
|
||||
controlElement->GetSelectedCount(&length);
|
||||
for (PRInt32 i = 0; i < length; i++) {
|
||||
nsCOMPtr<nsIDOMXULSelectControlItemElement> node;
|
||||
controlElement->GetSelectedItem(i, getter_AddRefs(node));
|
||||
if (IsAncestor(parentKid, node)) {
|
||||
controlElement->RemoveItemFromSelection(node);
|
||||
length--;
|
||||
i--;
|
||||
fireSelectionHandler = PR_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMXULElement> curItem;
|
||||
treeElement->GetCurrentItem(getter_AddRefs(curItem));
|
||||
nsCOMPtr<nsIDOMXULSelectControlItemElement> curItem;
|
||||
controlElement->GetCurrentItem(getter_AddRefs(curItem));
|
||||
nsCOMPtr<nsIDOMNode> curNode = do_QueryInterface(curItem);
|
||||
if (IsAncestor(parentKid, curNode)) {
|
||||
// Current item going away
|
||||
nsCOMPtr<nsIBoxObject> box;
|
||||
treeElement->GetBoxObject(getter_AddRefs(box));
|
||||
controlElement->GetBoxObject(getter_AddRefs(box));
|
||||
treeBox = do_QueryInterface(box);
|
||||
if (treeBox) {
|
||||
nsCOMPtr<nsIDOMElement> domElem = do_QueryInterface(parentKid);
|
||||
|
@ -2471,7 +2426,7 @@ nsXULElement::RemoveChildAt(PRInt32 aIndex, PRBool aNotify)
|
|||
}
|
||||
|
||||
if (newCurrentIndex == -2)
|
||||
treeElement->SetCurrentItem(nsnull);
|
||||
controlElement->SetCurrentItem(nsnull);
|
||||
else if (newCurrentIndex > -1) {
|
||||
// Make sure the index is still valid
|
||||
PRInt32 treeRows;
|
||||
|
@ -2481,19 +2436,23 @@ nsXULElement::RemoveChildAt(PRInt32 aIndex, PRBool aNotify)
|
|||
nsCOMPtr<nsIDOMElement> newCurrentItem;
|
||||
treeBox->GetItemAtIndex(newCurrentIndex, getter_AddRefs(newCurrentItem));
|
||||
if (newCurrentItem) {
|
||||
nsCOMPtr<nsIDOMXULElement> xulCurItem = do_QueryInterface(newCurrentItem);
|
||||
nsCOMPtr<nsIDOMXULSelectControlItemElement> xulCurItem = do_QueryInterface(newCurrentItem);
|
||||
if (xulCurItem)
|
||||
treeElement->SetCurrentItem(xulCurItem);
|
||||
controlElement->SetCurrentItem(xulCurItem);
|
||||
}
|
||||
} else {
|
||||
treeElement->SetCurrentItem(nsnull);
|
||||
controlElement->SetCurrentItem(nsnull);
|
||||
}
|
||||
}
|
||||
|
||||
if (fireSelectionHandler) {
|
||||
nsCOMPtr<nsIXULTreeContent> tree = do_QueryInterface(treeElement);
|
||||
if (tree) {
|
||||
tree->FireOnSelectHandler();
|
||||
nsCOMPtr<nsIDOMDocumentEvent> doc(do_QueryInterface(mDocument));
|
||||
nsCOMPtr<nsIDOMEvent> event;
|
||||
doc->CreateEvent(NS_LITERAL_STRING("Events"), getter_AddRefs(event));
|
||||
if (event) {
|
||||
event->InitEvent(NS_LITERAL_STRING("select"), PR_FALSE, PR_TRUE);
|
||||
PRBool noDefault;
|
||||
DispatchEvent(event, &noDefault);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2626,31 +2585,6 @@ nsXULElement::SetAttr(nsINodeInfo* aNodeInfo,
|
|||
// XXX Some kind of special document update might need to happen here.
|
||||
}
|
||||
|
||||
// Need to check for the SELECTED attribute
|
||||
// being set. If we're a <treeitem>, <treerow>, or <treecell>, the act of
|
||||
// setting these attributes forces us to update our selected arrays.
|
||||
nsCOMPtr<nsIAtom> tag;
|
||||
GetTag(*getter_AddRefs(tag));
|
||||
if (mDocument && aNodeInfo->NamespaceEquals(kNameSpaceID_None)) {
|
||||
// See if we're a treeitem atom.
|
||||
nsCOMPtr<nsIRDFNodeList> nodeList;
|
||||
if (tag && (tag == nsXULAtoms::treeitem) &&
|
||||
aNodeInfo->Equals(nsXULAtoms::selected)) {
|
||||
nsCOMPtr<nsIDOMXULTreeElement> treeElement;
|
||||
GetParentTree(getter_AddRefs(treeElement));
|
||||
if (treeElement) {
|
||||
nsCOMPtr<nsIDOMNodeList> nodes;
|
||||
treeElement->GetSelectedItems(getter_AddRefs(nodes));
|
||||
nodeList = do_QueryInterface(nodes);
|
||||
}
|
||||
}
|
||||
|
||||
if (nodeList) {
|
||||
// Append this node to the list.
|
||||
nodeList->AppendNode(this);
|
||||
}
|
||||
}
|
||||
|
||||
// XXX need to check if they're changing an event handler: if so, then we need
|
||||
// to unhook the old one.
|
||||
|
||||
|
@ -2902,39 +2836,17 @@ nsXULElement::UnsetAttr(PRInt32 aNameSpaceID,
|
|||
// XXXwaterson if aNotify == PR_TRUE, do we want to call
|
||||
// nsIDocument::BeginUpdate() now?
|
||||
if (aNameSpaceID == kNameSpaceID_None) {
|
||||
if (aName == nsXULAtoms::selected) {
|
||||
// Need to check for the SELECTED attribute
|
||||
// being unset. If we're a <treeitem>, <treerow>, or <treecell>, the act of
|
||||
// unsetting these attributes forces us to update our selected arrays.
|
||||
nsCOMPtr<nsIAtom> tag;
|
||||
GetTag(*getter_AddRefs(tag));
|
||||
|
||||
// See if we're a treeitem atom.
|
||||
if (tag && (tag == nsXULAtoms::treeitem)) {
|
||||
nsCOMPtr<nsIDOMXULTreeElement> treeElement;
|
||||
GetParentTree(getter_AddRefs(treeElement));
|
||||
if (treeElement) {
|
||||
nsCOMPtr<nsIDOMNodeList> nodes;
|
||||
treeElement->GetSelectedItems(getter_AddRefs(nodes));
|
||||
nsCOMPtr<nsIRDFNodeList> nodeList(do_QueryInterface(nodes));
|
||||
if (nodeList) {
|
||||
// Remove this node from the list.
|
||||
nodeList->RemoveNode(this);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
} else if (mDocument) {
|
||||
if (aName == nsXULAtoms::clazz) {
|
||||
// If CLASS is being unset, delete our class list.
|
||||
Attributes()->UpdateClassList(nsAutoString());
|
||||
} else if (aName == nsXULAtoms::style) {
|
||||
nsCOMPtr <nsIURI> docURL;
|
||||
mDocument->GetBaseURL(*getter_AddRefs(docURL));
|
||||
Attributes()->UpdateStyleRule(docURL, nsAutoString());
|
||||
// XXX Some kind of special document update might need to happen here.
|
||||
}
|
||||
if (mDocument) {
|
||||
if (aName == nsXULAtoms::clazz) {
|
||||
// If CLASS is being unset, delete our class list.
|
||||
Attributes()->UpdateClassList(nsAutoString());
|
||||
} else if (aName == nsXULAtoms::style) {
|
||||
nsCOMPtr <nsIURI> docURL;
|
||||
mDocument->GetBaseURL(*getter_AddRefs(docURL));
|
||||
Attributes()->UpdateStyleRule(docURL, nsAutoString());
|
||||
// XXX Some kind of special document update might need to happen here.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// XXX Know how to remove POPUP event listeners when an attribute is unset?
|
||||
|
@ -3385,7 +3297,7 @@ nsXULElement::HandleDOMEvent(nsIPresContext* aPresContext,
|
|||
parent = mParent;
|
||||
}
|
||||
|
||||
if (retarget || (parent != mParent)) {
|
||||
if (!retarget || (parent != mParent)) {
|
||||
if (!*aDOMEvent) {
|
||||
// We haven't made a DOMEvent yet. Force making one now.
|
||||
nsCOMPtr<nsIEventListenerManager> listenerManager;
|
||||
|
@ -4402,15 +4314,15 @@ nsXULElement::GetStyle(nsIDOMCSSStyleDeclaration** aStyle)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULElement::GetParentTree(nsIDOMXULTreeElement** aTreeElement)
|
||||
nsXULElement::GetParentTree(nsIDOMXULMultiSelectControlElement** aTreeElement)
|
||||
{
|
||||
nsCOMPtr<nsIContent> current;
|
||||
GetParent(*getter_AddRefs(current));
|
||||
while (current) {
|
||||
nsCOMPtr<nsIAtom> tag;
|
||||
current->GetTag(*getter_AddRefs(tag));
|
||||
if (tag && (tag == nsXULAtoms::tree)) {
|
||||
nsCOMPtr<nsIDOMXULTreeElement> element = do_QueryInterface(current);
|
||||
if (tag && (tag == nsXULAtoms::tree || tag == nsXULAtoms::listbox)) {
|
||||
nsCOMPtr<nsIDOMXULMultiSelectControlElement> element = do_QueryInterface(current);
|
||||
*aTreeElement = element;
|
||||
NS_IF_ADDREF(*aTreeElement);
|
||||
return NS_OK;
|
||||
|
@ -4819,8 +4731,7 @@ nsresult nsXULElement::MakeHeavyweight()
|
|||
|
||||
nsXULElement::Slots::Slots(nsXULElement* aElement)
|
||||
: mAttributes(nsnull),
|
||||
mLazyState(0),
|
||||
mInnerXULElement(nsnull)
|
||||
mLazyState(0)
|
||||
{
|
||||
MOZ_COUNT_CTOR(nsXULElement::Slots);
|
||||
}
|
||||
|
@ -4831,9 +4742,6 @@ nsXULElement::Slots::~Slots()
|
|||
MOZ_COUNT_DTOR(nsXULElement::Slots);
|
||||
|
||||
NS_IF_RELEASE(mAttributes);
|
||||
|
||||
// Delete the aggregated interface, if one exists.
|
||||
delete mInnerXULElement;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@
|
|||
#include "nsIDOMElement.h"
|
||||
#include "nsIDOMEventReceiver.h"
|
||||
#include "nsIDOMXULElement.h"
|
||||
#include "nsIDOMXULTreeElement.h"
|
||||
#include "nsIDOMXULMultSelectCntrlEl.h"
|
||||
#include "nsIEventListenerManager.h"
|
||||
#include "nsINameSpace.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
|
@ -309,42 +309,6 @@ public:
|
|||
nsString mValue;
|
||||
};
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
|
||||
This class serves as a base for aggregates that will implement a
|
||||
per-element XUL API.
|
||||
|
||||
*/
|
||||
|
||||
class nsXULAggregateElement : public nsISupports
|
||||
{
|
||||
protected:
|
||||
nsIDOMXULElement* mOuter;
|
||||
nsXULAggregateElement(nsIDOMXULElement* aOuter) : mOuter(aOuter) {}
|
||||
|
||||
public:
|
||||
virtual ~nsXULAggregateElement() {};
|
||||
|
||||
// nsISupports interface. Subclasses should use the
|
||||
// NS_DECL/IMPL_ISUPPORTS_INHERITED macros to implement the
|
||||
// nsISupports interface.
|
||||
NS_IMETHOD_(nsrefcnt) AddRef() {
|
||||
return mOuter->AddRef();
|
||||
}
|
||||
|
||||
NS_IMETHOD_(nsrefcnt) Release() {
|
||||
return mOuter->Release();
|
||||
}
|
||||
|
||||
NS_IMETHOD QueryInterface(REFNSIID aIID, void** aResult) {
|
||||
return mOuter->QueryInterface(aIID, aResult);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
|
@ -528,7 +492,7 @@ protected:
|
|||
static PRBool IsAncestor(nsIDOMNode* aParentNode, nsIDOMNode* aChildNode);
|
||||
|
||||
// Helper routine that crawls a parent chain looking for a tree element.
|
||||
NS_IMETHOD GetParentTree(nsIDOMXULTreeElement** aTreeElement);
|
||||
NS_IMETHOD GetParentTree(nsIDOMXULMultiSelectControlElement** aTreeElement);
|
||||
|
||||
nsresult AddPopupListener(nsIAtom* aName);
|
||||
|
||||
|
@ -567,12 +531,6 @@ protected:
|
|||
* RDF; see nsIXULContent and nsRDFGenericBuilder.
|
||||
*/
|
||||
PRInt32 mLazyState;
|
||||
|
||||
/**
|
||||
* An unreferenced bare pointer to an aggregate that can
|
||||
* implement element-specific APIs.
|
||||
*/
|
||||
nsXULAggregateElement* mInnerXULElement;
|
||||
};
|
||||
|
||||
friend struct Slots;
|
||||
|
@ -630,7 +588,6 @@ protected:
|
|||
nsINodeInfo* NodeInfo() const { return mSlots ? mSlots->mNodeInfo : mPrototype->mNodeInfo; }
|
||||
nsIControllers* Controllers() const { return mSlots ? mSlots->mControllers.get() : nsnull; }
|
||||
nsXULAttributes* Attributes() const { return mSlots ? mSlots->mAttributes : nsnull; }
|
||||
nsXULAggregateElement* InnerXULElement() const { return mSlots ? mSlots->mInnerXULElement : nsnull; }
|
||||
|
||||
static nsIXBLService *gXBLService;
|
||||
};
|
||||
|
|
|
@ -733,7 +733,7 @@
|
|||
</FILE>
|
||||
<FILE>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsIDOMXULTreeElement.idl</PATH>
|
||||
<PATH>nsIDOMXULMultSelectCntrlEl.idl</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
<FILEKIND>Text</FILEKIND>
|
||||
<FILEFLAGS></FILEFLAGS>
|
||||
|
@ -834,7 +834,7 @@
|
|||
</FILEREF>
|
||||
<FILEREF>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsIDOMXULTreeElement.idl</PATH>
|
||||
<PATH>nsIDOMXULMultSelectCntrlEl.idl</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
</FILEREF>
|
||||
<FILEREF>
|
||||
|
@ -1574,7 +1574,7 @@
|
|||
</FILE>
|
||||
<FILE>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsIDOMXULTreeElement.idl</PATH>
|
||||
<PATH>nsIDOMXULMultSelectCntrlEl.idl</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
<FILEKIND>Text</FILEKIND>
|
||||
<FILEFLAGS></FILEFLAGS>
|
||||
|
@ -1675,7 +1675,7 @@
|
|||
</FILEREF>
|
||||
<FILEREF>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsIDOMXULTreeElement.idl</PATH>
|
||||
<PATH>nsIDOMXULMultSelectCntrlEl.idl</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
</FILEREF>
|
||||
<FILEREF>
|
||||
|
@ -1764,7 +1764,7 @@
|
|||
<FILEREF>
|
||||
<TARGETNAME>headers</TARGETNAME>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsIDOMXULTreeElement.idl</PATH>
|
||||
<PATH>nsIDOMXULMultSelectCntrlEl.idl</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
</FILEREF>
|
||||
<FILEREF>
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
nsIDOMXULCommandDispatcher.idl
|
||||
nsIDOMXULDocument.idl
|
||||
nsIDOMXULElement.idl
|
||||
nsIDOMXULTreeElement.idl
|
||||
|
|
|
@ -40,11 +40,11 @@ XPIDLSRCS = \
|
|||
nsIDOMXULImageElement.idl \
|
||||
nsIDOMXULLabelElement.idl \
|
||||
nsIDOMXULLabeledControlEl.idl \
|
||||
nsIDOMXULMenuListElement.idl \
|
||||
nsIDOMXULMenuListElement.idl \
|
||||
nsIDOMXULPopupElement.idl \
|
||||
nsIDOMXULSelectCntrlEl.idl \
|
||||
nsIDOMXULSelectCntrlItemEl.idl \
|
||||
nsIDOMXULTreeElement.idl \
|
||||
nsIDOMXULMultSelectCntrlEl.idl \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
|
|
@ -40,7 +40,7 @@ XPIDLSRCS = \
|
|||
.\nsIDOMXULPopupElement.idl \
|
||||
.\nsIDOMXULSelectCntrlEl.idl \
|
||||
.\nsIDOMXULSelectCntrlItemEl.idl \
|
||||
.\nsIDOMXULTreeElement.idl \
|
||||
.\nsIDOMXULMultSelectCntrlEl.idl \
|
||||
$(NULL)
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
|
|
|
@ -0,0 +1,67 @@
|
|||
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2000
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* David Hyatt <hyatt@netscape.com> (original author)
|
||||
* Joe Hewitt <hewitt@netscape.com>
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsIDOMXULSelectCntrlEl.idl"
|
||||
|
||||
[scriptable, uuid(7F435623-BA16-4c44-B4B0-0990946D3D7C)]
|
||||
interface nsIDOMXULMultiSelectControlElement : nsIDOMXULSelectControlElement
|
||||
{
|
||||
attribute DOMString selType;
|
||||
|
||||
attribute nsIDOMXULSelectControlItemElement currentItem;
|
||||
|
||||
readonly attribute nsIDOMNodeList selectedItems;
|
||||
|
||||
void addItemToSelection(in nsIDOMXULSelectControlItemElement item);
|
||||
void removeItemFromSelection(in nsIDOMXULSelectControlItemElement item);
|
||||
void toggleItemSelection(in nsIDOMXULSelectControlItemElement item);
|
||||
|
||||
void selectItem(in nsIDOMXULSelectControlItemElement item);
|
||||
void selectItemRange(in nsIDOMXULSelectControlItemElement startItem, in nsIDOMXULSelectControlItemElement item);
|
||||
|
||||
void selectAll();
|
||||
void invertSelection();
|
||||
void clearSelection();
|
||||
|
||||
// XXX - temporary, pending implementation of scriptable,
|
||||
// mutable nsIDOMNodeList for selectedItems
|
||||
readonly attribute long selectedCount;
|
||||
nsIDOMXULSelectControlItemElement getSelectedItem(in long index);
|
||||
};
|
|
@ -172,7 +172,6 @@ enum nsDOMClassInfoID {
|
|||
// XUL classes
|
||||
eDOMClassInfo_XULDocument_id,
|
||||
eDOMClassInfo_XULElement_id,
|
||||
eDOMClassInfo_XULTreeElement_id,
|
||||
eDOMClassInfo_XULCommandDispatcher_id,
|
||||
eDOMClassInfo_XULNodeList_id,
|
||||
eDOMClassInfo_XULNamedNodeMap_id,
|
||||
|
|
|
@ -253,7 +253,6 @@
|
|||
#include "nsIDOMTreeWalker.h"
|
||||
#include "nsIDOMXULDocument.h"
|
||||
#include "nsIDOMXULElement.h"
|
||||
#include "nsIDOMXULTreeElement.h"
|
||||
#include "nsIDOMXULCommandDispatcher.h"
|
||||
#include "nsIDOMCrypto.h"
|
||||
#include "nsIDOMCRMFObject.h"
|
||||
|
@ -659,8 +658,6 @@ static nsDOMClassInfoData sClassInfoData[] = {
|
|||
nsIXPCScriptable::WANT_ENUMERATE)
|
||||
NS_DEFINE_CLASSINFO_DATA(XULElement, nsElementSH,
|
||||
ELEMENT_SCRIPTABLE_FLAGS)
|
||||
NS_DEFINE_CLASSINFO_DATA(XULTreeElement, nsElementSH,
|
||||
ELEMENT_SCRIPTABLE_FLAGS)
|
||||
NS_DEFINE_CLASSINFO_DATA(XULCommandDispatcher, nsDOMGenericSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
NS_DEFINE_CLASSINFO_DATA_WITH_NAME(XULNodeList, NodeList, nsArraySH,
|
||||
|
@ -1709,12 +1706,6 @@ nsDOMClassInfo::Init()
|
|||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN(XULTreeElement, nsIDOMXULTreeElement)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMXULElement)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMXULTreeElement)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN(XULCommandDispatcher, nsIDOMXULCommandDispatcher)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMXULCommandDispatcher)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
function BookmarkProperties()
|
||||
{
|
||||
var tree = document.getElementById('bookmarksTree');
|
||||
var select_list = tree.getElementsByAttribute("selected", "true");
|
||||
var select_list = tree.selectedItems;
|
||||
|
||||
if (select_list.length >= 1) {
|
||||
|
||||
|
@ -172,17 +172,8 @@ function OpenEditNode()
|
|||
saveNode = gEditNode;
|
||||
|
||||
// unselect all nodes!
|
||||
var select_list = document.getElementsByAttribute("selected", "true");
|
||||
dump("# of Nodes selected: " + select_list.length + "\n\n");
|
||||
for (var nodeIndex=0; nodeIndex<select_list.length; nodeIndex++)
|
||||
{
|
||||
var node = select_list[nodeIndex];
|
||||
if (node)
|
||||
{
|
||||
dump("Unselecting node "+node.getAttribute("Name") + "\n");
|
||||
node.removeAttribute("selected");
|
||||
}
|
||||
}
|
||||
var tree = document.getElementById('bookmarksTree');
|
||||
tree.clearSelection();
|
||||
|
||||
// XXX for now, just remove the child from the parent
|
||||
// optimally, we'd like to not remove the child-parent relationship
|
||||
|
@ -379,7 +370,7 @@ function fillContextMenu(name)
|
|||
var rdf = isupports.QueryInterface(Components.interfaces.nsIRDFService);
|
||||
if (!rdf) return(false);
|
||||
|
||||
var select_list = treeNode.getElementsByAttribute("selected", "true");
|
||||
var select_list = treeNode.selectedItems;
|
||||
if (select_list.length < 1) return(false);
|
||||
|
||||
dump("# of Nodes selected: " + select_list.length + "\n\n");
|
||||
|
@ -491,7 +482,7 @@ function doContextCmd(cmdName)
|
|||
cmdResource = cmdResource.QueryInterface(Components.interfaces.nsIRDFResource);
|
||||
if (!cmdResource) return(false);
|
||||
|
||||
var select_list = treeNode.getElementsByAttribute("selected", "true");
|
||||
var select_list = treeNode.selectedItems;
|
||||
if (select_list.length < 1) return(false);
|
||||
|
||||
dump("# of Nodes selected: " + select_list.length + "\n\n");
|
||||
|
|
|
@ -1,544 +0,0 @@
|
|||
/*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator client code, released
|
||||
* March 31, 1998.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998-1999 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Ben Goodger
|
||||
*/
|
||||
|
||||
/*
|
||||
Script for the file properties window
|
||||
*/
|
||||
|
||||
function FileProperties()
|
||||
{
|
||||
var tree = document.getElementById('fileTree');
|
||||
|
||||
if (tree.selectedItems.length >= 1) {
|
||||
// don't bother showing properties on bookmark separators
|
||||
var type = tree.selectedItems[0].getAttribute('type');
|
||||
if (type != "http://home.netscape.com/NC-rdf#BookmarkSeparator") {
|
||||
var props = window.open("chrome://communicator/content/bookmarks/bm-props.xul",
|
||||
"BookmarkProperties", "chrome,menubar,resizable");
|
||||
props.BookmarkURL = tree.selectedItems[0].getAttribute("id");
|
||||
}
|
||||
} else {
|
||||
dump("nothing selected!\n");
|
||||
}
|
||||
}
|
||||
|
||||
function OpenSearch(tabName)
|
||||
{
|
||||
window.openDialog("resource:/res/samples/search.xul", "SearchWindow", "dialog=no,close,chrome,resizable", tabName);
|
||||
}
|
||||
|
||||
function OpenURL(event, node)
|
||||
{
|
||||
// clear any single-click/edit timeouts
|
||||
if (timerID != null)
|
||||
{
|
||||
gEditNode = null;
|
||||
clearTimeout(timerID);
|
||||
timerID = null;
|
||||
}
|
||||
|
||||
if (node.getAttribute('container') == "true")
|
||||
{
|
||||
return(false);
|
||||
}
|
||||
|
||||
var url = node.getAttribute('id');
|
||||
|
||||
// Ignore "NC:" urls.
|
||||
if (url.substring(0, 3) == "NC:")
|
||||
{
|
||||
return(false);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
// add support for IE favorites under Win32, and NetPositive URLs under BeOS
|
||||
if (url.indexOf("file://") == 0)
|
||||
{
|
||||
var rdf = Components.classes["@mozilla.org/rdf/rdf-service;1"].getService();
|
||||
if (rdf) rdf = rdf.QueryInterface(Components.interfaces.nsIRDFService);
|
||||
if (rdf)
|
||||
{
|
||||
var fileSys = rdf.GetDataSource("rdf:files");
|
||||
if (fileSys)
|
||||
{
|
||||
var src = rdf.GetResource(url, true);
|
||||
var prop = rdf.GetResource("http://home.netscape.com/NC-rdf#URL", true);
|
||||
var target = fileSys.GetTarget(src, prop, true);
|
||||
if (target) target = target.QueryInterface(Components.interfaces.nsIRDFLiteral);
|
||||
if (target) target = target.Value;
|
||||
if (target) url = target;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch(ex)
|
||||
{
|
||||
}
|
||||
|
||||
if(top.isEditor != undefined) {
|
||||
if(top.editorShell) {
|
||||
var ext = getFileExtension(url);
|
||||
// look at the extension of the file to see what should be done
|
||||
// with it. Note that this is a typically windowsey approach. will
|
||||
// rdf:files hold a reference to the actual file type? (Mac?)
|
||||
switch(ext) {
|
||||
// XXX Crude, but it will do for now.
|
||||
case "gif":
|
||||
case "jpeg":
|
||||
case "jpg":
|
||||
case "png":
|
||||
// just insert the image
|
||||
EditorAutoInsertImage(url);
|
||||
break;
|
||||
case "htm":
|
||||
case "html":
|
||||
case "xul":
|
||||
toEditor(url);
|
||||
break;
|
||||
case "js":
|
||||
EditorInsertJSFile(url);
|
||||
break;
|
||||
case "css":
|
||||
EditorInsertCSSFile(url);
|
||||
break;
|
||||
default:
|
||||
// load the file in the editor
|
||||
dump("Editor Message: Weirdo File Format\n");
|
||||
toEditor(url);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
window.open(url,'bookmarks');
|
||||
}
|
||||
|
||||
dump("OpenURL(" + url + ")\n");
|
||||
|
||||
return(true);
|
||||
}
|
||||
|
||||
// returns the extension of a specified file URL
|
||||
function getFileExtension(url)
|
||||
{
|
||||
return url.substring(url.lastIndexOf(".")+1,url.length).toLowerCase();
|
||||
}
|
||||
|
||||
var htmlInput = null;
|
||||
var saveNode = null;
|
||||
var newValue = "";
|
||||
var timerID = null;
|
||||
var gEditNode = null;
|
||||
|
||||
function DoSingleClick(event, node)
|
||||
{
|
||||
var type = node.parentNode.parentNode.getAttribute('type');
|
||||
var selected = node.parentNode.parentNode.getAttribute('selected');
|
||||
|
||||
if (gEditNode == node) {
|
||||
// Only start an inline edit if it is the second consecutive click
|
||||
// on the same node that is not already editing or a separator.
|
||||
if (!htmlInput &&
|
||||
type != "http://home.netscape.com/NC-rdf#BookmarkSeparator") {
|
||||
// Edit node if we don't get a double-click in less than 1/2 second
|
||||
timerID = setTimeout("OpenEditNode()", 500);
|
||||
}
|
||||
} else {
|
||||
if (htmlInput) {
|
||||
// Clicked during an edit
|
||||
// Save the changes and move on
|
||||
CloseEditNode(true);
|
||||
}
|
||||
gEditNode = node;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function OpenEditNode()
|
||||
{
|
||||
dump("OpenEditNode entered.\n");
|
||||
|
||||
// clear any single-click/edit timeouts
|
||||
if (timerID != null)
|
||||
{
|
||||
clearTimeout(timerID);
|
||||
timerID = null;
|
||||
}
|
||||
|
||||
// XXX uncomment the following line to replace the whole input row we do this
|
||||
// (and, therefore, only allow editing on the name column) until we can
|
||||
// arbitrarily change the content model (bugs prevent this at the moment)
|
||||
gEditNode = gEditNode.parentNode;
|
||||
|
||||
var name = gEditNode.parentNode.getAttribute("Name");
|
||||
dump("Single click on '" + name + "'\n");
|
||||
|
||||
var theParent = gEditNode.parentNode;
|
||||
dump("Parent node is a " + theParent.nodeName + "\n\n");
|
||||
|
||||
saveNode = gEditNode;
|
||||
|
||||
// unselect all nodes!
|
||||
var select_list = document.getElementsByAttribute("selected", "true");
|
||||
dump("# of Nodes selected: " + select_list.length + "\n\n");
|
||||
for (var nodeIndex=0; nodeIndex<select_list.length; nodeIndex++)
|
||||
{
|
||||
var node = select_list[nodeIndex];
|
||||
if (node)
|
||||
{
|
||||
dump("Unselecting node "+node.getAttribute("Name") + "\n");
|
||||
node.removeAttribute("selected");
|
||||
}
|
||||
}
|
||||
|
||||
// XXX for now, just remove the child from the parent
|
||||
// optimally, we'd like to not remove the child-parent relationship
|
||||
// and instead just set a "display: none;" attribute on the child node
|
||||
|
||||
// gEditNode.setAttribute("style", "display: none;");
|
||||
// dump("gEditNode hidden.\n");
|
||||
theParent.removeChild(gEditNode);
|
||||
gEditNode = null;
|
||||
dump("gEditNode removed.\n");
|
||||
|
||||
// create the html:input node
|
||||
htmlInput = document.createElementNS("http://www.w3.org/1999/xhtml", "html:input");
|
||||
htmlInput.setAttribute("value", name);
|
||||
htmlInput.setAttribute("onkeypress", "return EditNodeKeyPress(event)");
|
||||
|
||||
theParent.appendChild(htmlInput);
|
||||
dump("html:input node added.\n");
|
||||
|
||||
htmlInput.focus();
|
||||
|
||||
dump("OpenEditNode done.\n");
|
||||
return(true);
|
||||
}
|
||||
|
||||
function CloseEditNode(saveChangeFlag)
|
||||
{
|
||||
dump("CloseEditNode entered.\n");
|
||||
|
||||
if (htmlInput)
|
||||
{
|
||||
if (saveChangeFlag)
|
||||
{
|
||||
newValue = htmlInput.value;
|
||||
}
|
||||
dump(" Got html input: "+newValue+" \n");
|
||||
|
||||
var theParent = htmlInput.parentNode;
|
||||
theParent.removeChild(htmlInput);
|
||||
theParent.appendChild(saveNode);
|
||||
dump(" child node appended.\n");
|
||||
|
||||
if (saveNode && saveChangeFlag)
|
||||
{
|
||||
var RDF = Components.classes["@mozilla.org/rdf/rdf-service;1"].getService();
|
||||
RDF = RDF.QueryInterface(Components.interfaces.nsIRDFService);
|
||||
var Bookmarks = RDF.GetDataSource("rdf:bookmarks");
|
||||
dump("Got bookmarks datasource.\n");
|
||||
|
||||
// XXX once we support multi-column editing, get the property
|
||||
// from the column in the content model
|
||||
var propertyName = "http://home.netscape.com/NC-rdf#Name";
|
||||
var propertyNode = RDF.GetResource(propertyName, true);
|
||||
dump(" replacing value of property '" + propertyName + "'\n");
|
||||
|
||||
// get the URI
|
||||
var theNode = saveNode;
|
||||
var bookmarkURL = "";
|
||||
while(true)
|
||||
{
|
||||
var tag = theNode.nodeName;
|
||||
if (tag == "treeitem")
|
||||
{
|
||||
bookmarkURL = theNode.getAttribute("id");
|
||||
break;
|
||||
}
|
||||
theNode = theNode.parentNode;
|
||||
}
|
||||
dump(" uri is '" + bookmarkURL + "'\n");
|
||||
|
||||
if (bookmarkURL == "") return(false);
|
||||
var bookmarkNode = RDF.GetResource(bookmarkURL, true);
|
||||
|
||||
|
||||
dump(" newValue = '" + newValue + "'\n");
|
||||
newValue = (newValue != "") ? RDF.GetLiteral(newValue) : null;
|
||||
|
||||
var oldValue = Bookmarks.GetTarget(bookmarkNode, propertyNode, true);
|
||||
if (oldValue)
|
||||
{
|
||||
oldValue = oldValue.QueryInterface(Components.interfaces.nsIRDFLiteral);
|
||||
dump(" oldValue = '" + oldValue + "'\n");
|
||||
}
|
||||
|
||||
if (oldValue != newValue)
|
||||
{
|
||||
if (oldValue && !newValue)
|
||||
{
|
||||
Bookmarks.Unassert(bookmarkNode, propertyNode, oldValue);
|
||||
dump(" Unassert used.\n");
|
||||
}
|
||||
else if (!oldValue && newValue)
|
||||
{
|
||||
Bookmarks.Assert(bookmarkNode, propertyNode, newValue, true);
|
||||
dump(" Assert used.\n");
|
||||
}
|
||||
else if (oldValue && newValue)
|
||||
{
|
||||
Bookmarks.Change(bookmarkNode, propertyNode, oldValue, newValue);
|
||||
dump(" Change used.\n");
|
||||
}
|
||||
|
||||
dump("re-writing bookmarks.html\n");
|
||||
var remote = Bookmarks.QueryInterface(Components.interfaces.nsIRDFRemoteDataSource);
|
||||
remote.Flush();
|
||||
}
|
||||
|
||||
newValue = "";
|
||||
saveNode = null;
|
||||
}
|
||||
else dump("saveNode was null?\n");
|
||||
htmlInput = null;
|
||||
}
|
||||
else dump("htmlInput was null?\n");
|
||||
|
||||
dump("CloseEditNode done.\n");
|
||||
}
|
||||
|
||||
function EditNodeKeyPress(event)
|
||||
{
|
||||
if (event.keyCode == 27)
|
||||
{
|
||||
CloseEditNode(false);
|
||||
return(false);
|
||||
}
|
||||
else if (event.keyCode == 13 || event.keyCode == 10)
|
||||
{
|
||||
CloseEditNode(true);
|
||||
return(false);
|
||||
}
|
||||
return(true);
|
||||
}
|
||||
|
||||
function doSort(sortColName)
|
||||
{
|
||||
var node = document.getElementById(sortColName);
|
||||
// determine column resource to sort on
|
||||
var sortResource = node.getAttribute('resource');
|
||||
if (!node) return(false);
|
||||
|
||||
var sortDirection="ascending";
|
||||
var isSortActive = node.getAttribute('sortActive');
|
||||
if (isSortActive == "true") {
|
||||
var currentDirection = node.getAttribute('sortDirection');
|
||||
if (currentDirection == "ascending")
|
||||
sortDirection = "descending";
|
||||
else if (currentDirection == "descending")
|
||||
sortDirection = "natural";
|
||||
else
|
||||
sortDirection = "ascending";
|
||||
}
|
||||
|
||||
// get RDF Core service
|
||||
var rdfCore = XPAppCoresManager.Find("RDFCore");
|
||||
if (!rdfCore) {
|
||||
rdfCore = new RDFCore();
|
||||
if (!rdfCore) {
|
||||
return(false);
|
||||
}
|
||||
rdfCore.Init("RDFCore");
|
||||
// XPAppCoresManager.Add(rdfCore);
|
||||
}
|
||||
// sort!!!
|
||||
rdfCore.doSort(node, sortResource, sortDirection);
|
||||
return(false);
|
||||
}
|
||||
|
||||
|
||||
function fillContextMenu(name,node)
|
||||
{
|
||||
if (!name) return(false);
|
||||
var popupNode = document.getElementById(name);
|
||||
if (!popupNode) return(false);
|
||||
|
||||
var url = GetFileURL(node);
|
||||
var ext = getFileExtension(url);
|
||||
|
||||
// remove the menu node (which tosses all of its kids);
|
||||
// do this in case any old command nodes are hanging around
|
||||
var menuNode = popupNode.childNodes[0];
|
||||
popupNode.removeChild(menuNode);
|
||||
|
||||
// create a new menu node
|
||||
menuNode = document.createElementNS("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul", "menu");
|
||||
popupNode.appendChild(menuNode);
|
||||
|
||||
dump("mwa");
|
||||
if(ext == "gif")
|
||||
{
|
||||
// note: deleted all the doContextCmd stuff from bookmarks.
|
||||
menuItem = document.createElementNS("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul", "menuitem");
|
||||
menuItem.setAttribute("label","Insert Image");
|
||||
// menuItem.setAttribute("onaction","AutoInsertImage(\'" + url + "\')");
|
||||
parent.appendChild(menuItem);
|
||||
}
|
||||
|
||||
return(true);
|
||||
}
|
||||
|
||||
function isImageFile(parent,url)
|
||||
{
|
||||
}
|
||||
|
||||
function GetFileURL(node)
|
||||
{
|
||||
var url = node.getAttribute('id');
|
||||
|
||||
// Ignore "NC:" urls.
|
||||
if (url.substring(0, 3) == "NC:")
|
||||
{
|
||||
return(false);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
// add support for IE favorites under Win32, and NetPositive URLs under BeOS
|
||||
if (url.indexOf("file://") == 0)
|
||||
{
|
||||
var rdf = Components.classes["@mozilla.org/rdf/rdf-service;1"].getService();
|
||||
if (rdf) rdf = rdf.QueryInterface(Components.interfaces.nsIRDFService);
|
||||
if (rdf)
|
||||
{
|
||||
var fileSys = rdf.GetDataSource("rdf:files");
|
||||
if (fileSys)
|
||||
{
|
||||
var src = rdf.GetResource(url, true);
|
||||
var prop = rdf.GetResource("http://home.netscape.com/NC-rdf#URL", true);
|
||||
var target = fileSys.GetTarget(src, prop, true);
|
||||
if (target) target = target.QueryInterface(Components.interfaces.nsIRDFLiteral);
|
||||
if (target) target = target.Value;
|
||||
if (target) url = target;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch(ex)
|
||||
{
|
||||
}
|
||||
return url;
|
||||
}
|
||||
|
||||
|
||||
|
||||
function doContextCmd(cmdName)
|
||||
{
|
||||
dump("doContextCmd start: cmd='" + cmdName + "'\n");
|
||||
|
||||
var treeNode = document.getElementById("bookmarksTree");
|
||||
if (!treeNode) return(false);
|
||||
var db = treeNode.database;
|
||||
if (!db) return(false);
|
||||
|
||||
var compositeDB = db.QueryInterface(Components.interfaces.nsIRDFDataSource);
|
||||
if (!compositeDB) return(false);
|
||||
|
||||
var isupports = Components.classes["@mozilla.org/rdf/rdf-service;1"].getService();
|
||||
if (!isupports) return(false);
|
||||
var rdf = isupports.QueryInterface(Components.interfaces.nsIRDFService);
|
||||
if (!rdf) return(false);
|
||||
|
||||
// need a resource for the command
|
||||
var cmdResource = rdf.GetResource(cmdName);
|
||||
if (!cmdResource) return(false);
|
||||
cmdResource = cmdResource.QueryInterface(Components.interfaces.nsIRDFResource);
|
||||
if (!cmdResource) return(false);
|
||||
|
||||
var select_list = treeNode.getElementsByAttribute("selected", "true");
|
||||
if (select_list.length < 1) return(false);
|
||||
|
||||
dump("# of Nodes selected: " + select_list.length + "\n\n");
|
||||
|
||||
// set up selection nsISupportsArray
|
||||
var selectionInstance = Components.classes["@mozilla.org/supports-array;1"].createInstance();
|
||||
var selectionArray = selectionInstance.QueryInterface(Components.interfaces.nsISupportsArray);
|
||||
|
||||
// set up arguments nsISupportsArray
|
||||
var argumentsInstance = Components.classes["@mozilla.org/supports-array;1"].createInstance();
|
||||
var argumentsArray = argumentsInstance.QueryInterface(Components.interfaces.nsISupportsArray);
|
||||
|
||||
// get argument (parent)
|
||||
var parentArc = rdf.GetResource("http://home.netscape.com/NC-rdf#parent");
|
||||
if (!parentArc) return(false);
|
||||
|
||||
for (var nodeIndex=0; nodeIndex<select_list.length; nodeIndex++)
|
||||
{
|
||||
var node = select_list[nodeIndex];
|
||||
if (!node) break;
|
||||
var uri = node.getAttribute("ref");
|
||||
if ((uri) || (uri == ""))
|
||||
{
|
||||
uri = node.getAttribute("id");
|
||||
}
|
||||
if (!uri) return(false);
|
||||
|
||||
var rdfNode = rdf.GetResource(uri);
|
||||
if (!rdfNode) break;
|
||||
|
||||
// add node into selection array
|
||||
selectionArray.AppendElement(rdfNode);
|
||||
|
||||
// get the parent's URI
|
||||
var parentURI="";
|
||||
var theParent = node;
|
||||
while (theParent)
|
||||
{
|
||||
theParent = theParent.parentNode;
|
||||
|
||||
parentURI = theParent.getAttribute("ref");
|
||||
if ((!parentURI) || (parentURI == ""))
|
||||
{
|
||||
parentURI = theParent.getAttribute("id");
|
||||
}
|
||||
if (parentURI != "") break;
|
||||
}
|
||||
if (parentURI == "") return(false);
|
||||
|
||||
var parentNode = rdf.GetResource(parentURI, true);
|
||||
if (!parentNode) return(false);
|
||||
|
||||
// add parent arc and node into arguments array
|
||||
argumentsArray.AppendElement(parentArc);
|
||||
argumentsArray.AppendElement(parentNode);
|
||||
}
|
||||
|
||||
// do the command
|
||||
compositeDB.DoCommand( selectionArray, cmdResource, argumentsArray );
|
||||
|
||||
dump("doContextCmd ends.\n\n");
|
||||
return(true);
|
||||
}
|
|
@ -72,7 +72,7 @@ function onChangeCSSAttribute()
|
|||
|
||||
function ClearCSSInputWidgets()
|
||||
{
|
||||
gDialog.AddCSSAttributeTree.clearItemSelection();
|
||||
gDialog.AddCSSAttributeTree.clearSelection();
|
||||
gDialog.AddCSSAttributeNameInput.value ="";
|
||||
gDialog.AddCSSAttributeValueInput.value = "";
|
||||
gDialog.AddCSSAttributeNameInput.inputField.focus();
|
||||
|
|
|
@ -153,7 +153,7 @@ function onChangeHTMLAttribute()
|
|||
|
||||
function ClearHTMLInputWidgets()
|
||||
{
|
||||
gDialog.AddHTMLAttributeTree.clearItemSelection();
|
||||
gDialog.AddHTMLAttributeTree.clearSelection();
|
||||
gDialog.AddHTMLAttributeNameInput.value ="";
|
||||
gDialog.AddHTMLAttributeValueInput.value = "";
|
||||
gDialog.AddHTMLAttributeNameInput.inputField.focus();
|
||||
|
|
|
@ -244,7 +244,7 @@ function GetAndSelectExistingAttributeValue( attName, treeChildrenId )
|
|||
// Attribute doesn't exist in tree, so remove selection
|
||||
gDoOnSelectTree = false;
|
||||
try {
|
||||
treeChildren.parentNode.clearItemSelection();
|
||||
treeChildren.parentNode.clearSelection();
|
||||
} catch (e) {}
|
||||
gDoOnSelectTree = true;
|
||||
|
||||
|
|
|
@ -413,7 +413,7 @@ function ClearTreelist(tree)
|
|||
{
|
||||
if (tree)
|
||||
{
|
||||
tree.clearItemSelection();
|
||||
tree.clearSelection();
|
||||
// Skip over the first <treecolgroup> child
|
||||
if (tree.firstChild)
|
||||
{
|
||||
|
@ -462,7 +462,7 @@ function RemoveSelectedTreelistItem(tree)
|
|||
var treeItem = tree.selectedItems[0];
|
||||
if (treeItem)
|
||||
{
|
||||
tree.clearItemSelection();
|
||||
tree.cleaclearSelection
|
||||
var parent = treeItem.parentNode;
|
||||
if (parent)
|
||||
{
|
||||
|
|
|
@ -125,7 +125,7 @@
|
|||
sortResource="http://www.mozilla.org/rdf/chrome#name"
|
||||
preftype="localizedstring" prefstring="general.useragent.contentlocale"
|
||||
prefvalue="" prefattribute="prefvalue" wsm_attributes="prefvalue"
|
||||
multiple="false" onselect="SelectContentPack();"
|
||||
seltype="false" onselect="SelectContentPack();"
|
||||
sortDirection="ascending">
|
||||
<treecolgroup>
|
||||
<treecol flex="1"/>
|
||||
|
|
|
@ -1663,9 +1663,18 @@ function setCurrentObject (obj)
|
|||
|
||||
/* Unselect currently selected users. */
|
||||
userList = document.getElementById("user-list");
|
||||
<<<<<<< static.js
|
||||
if (userList)
|
||||
/* Remove curently selection items before this tree gets rerooted,
|
||||
* because it seems to remember the selections for eternity if not. */
|
||||
userList.clearSelection ();
|
||||
else
|
||||
dd ("setCurrentObject: could not find element with ID='user-list'");
|
||||
=======
|
||||
/* Remove curently selection items before this tree gets rerooted,
|
||||
* because it seems to remember the selections for eternity if not. */
|
||||
userList.clearItemSelection ();
|
||||
>>>>>>> 1.31
|
||||
|
||||
if (obj.TYPE == "IRCChannel")
|
||||
client.rdf.setTreeRoot ("user-list", obj.getGraphResource());
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
<spacer style="width: 7px;"/>
|
||||
<vbox>
|
||||
<label value="&treehead.schemaname.label;"/>
|
||||
<tree multiple="true" id="schematree"
|
||||
<tree seltype="multiple" id="schematree"
|
||||
style="height: 250px;" onclick="ViewEntries();">
|
||||
<treecolgroup>
|
||||
<treecol flex="1"/>
|
||||
|
@ -60,7 +60,7 @@
|
|||
<spacer style="width: 7px;"/>
|
||||
<vbox>
|
||||
<label id="entrytext" value2="&treehead.entries.label;" value3="&treehead.entries1.label;"/>
|
||||
<tree multiple="true" id="entrytree" class="inset"
|
||||
<tree seltype="multiple" id="entrytree" class="inset"
|
||||
style="height: 113px;" orient="vertical" onclick="ViewSynonyms();">
|
||||
<treecolgroup>
|
||||
<treecol flex="1"/>
|
||||
|
@ -69,7 +69,7 @@
|
|||
</tree>
|
||||
<spacer style="height: 7px;"/>
|
||||
<label id="synonymtext" value2="&treehead.synonyms.label;" value3="&treehead.synonymsoff.label;" value4="&treehead.synonyms1.label;"/>
|
||||
<tree multiple="true" id="synonymtree"
|
||||
<tree seltype="multiple" id="synonymtree"
|
||||
style="height: 113px;" orient="vertical" onclick="SynonymSelected();">
|
||||
<treecolgroup>
|
||||
<treecol flex="1"/>
|
||||
|
|
|
@ -93,7 +93,7 @@ Contributor(s):
|
|||
|
||||
<!-- Address bucket -->
|
||||
<vbox id="bucketBox">
|
||||
<tree id="addressBucket" flex="1" multiple="true"
|
||||
<tree id="addressBucket" flex="1" seltype="multiple"
|
||||
ondragover="DragOverBucketPane(event);"
|
||||
ondragdrop="DropOnBucketPane(event);"
|
||||
onselect="DialogBucketPaneSelectionChanged();">
|
||||
|
|
|
@ -132,7 +132,7 @@ function refreshServerList()
|
|||
{
|
||||
// save selection
|
||||
var oldSelectedIds = new Array;
|
||||
serverList.clearItemSelection();
|
||||
serverList.clearSelection();
|
||||
var selectedItems = serverList.selectedItems;
|
||||
for (var i=0; i< selectedItems.length; i++)
|
||||
oldSelectedIds[i] = selectedItems[0].id;
|
||||
|
|
|
@ -96,7 +96,7 @@ Rights Reserved.
|
|||
<tree flex="1"
|
||||
id="subscribetree"
|
||||
datasources="rdf:null"
|
||||
multiple="true"
|
||||
seltype="multiple"
|
||||
onclick="SubscribeOnClick(event);">
|
||||
<template>
|
||||
<rule>
|
||||
|
|
|
@ -234,7 +234,7 @@ function refreshFilterList() {
|
|||
if (selectedItems && selectedItems.length >0)
|
||||
selection = tree.selectedItems[0].id;
|
||||
|
||||
tree.clearItemSelection();
|
||||
tree.clearSelection();
|
||||
tree.setAttribute("ref", tree.getAttribute("ref"));
|
||||
|
||||
if (selection) {
|
||||
|
|
|
@ -55,7 +55,7 @@
|
|||
<description>&HTMLdomaintitle.label;</description>
|
||||
<hbox flex="1">
|
||||
<tree id="html_domains" flex="1"
|
||||
datasources="rdf:null" multiple="true"
|
||||
datasources="rdf:null" seltype="multiple"
|
||||
onkeypress="if (event.keyCode == 8 || event.keyCode == 46) RemoveDomains(htmlobj);">
|
||||
<treecolgroup>
|
||||
<treecol flex="1"/>
|
||||
|
@ -76,7 +76,7 @@
|
|||
<description>&PlainTexttitle.label;</description>
|
||||
<hbox flex="1">
|
||||
<tree id="plaintext_domains" flex="1"
|
||||
datasources="rdf:null" multiple="true"
|
||||
datasources="rdf:null" seltype="multiple"
|
||||
onkeypress="if (event.keyCode == 8 || event.keyCode == 46) RemoveDomains(plainobj);">
|
||||
<treecolgroup>
|
||||
<treecol flex="1"/>
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
<vbox id="CACerts">
|
||||
<description>&certmgr.cas;</description>
|
||||
<separator class="thin"/>
|
||||
<outliner id="ca-outliner" multiple="true" enableColumnDrag="true"
|
||||
<outliner id="ca-outliner" seltype="multiple" enableColumnDrag="true"
|
||||
onselect="ca_enableButtons()" flex="1">
|
||||
<outlinercols>
|
||||
<outlinercol id="certcol" label="&certmgr.certname;" primary="true"
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
<vbox id="myCerts">
|
||||
<description>&certmgr.mine;</description>
|
||||
<separator class="thin"/>
|
||||
<outliner id="user-outliner" multiple="true" enableColumnDrag="true"
|
||||
<outliner id="user-outliner" seltype="multiple" enableColumnDrag="true"
|
||||
onselect="mine_enableButtons()" flex="1">
|
||||
<outlinercols>
|
||||
<outlinercol id="certcol" label="&certmgr.certname;" primary="true"
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
<vbox id="othersCerts">
|
||||
<description>&certmgr.others;</description>
|
||||
<separator class="thin"/>
|
||||
<outliner id="email-outliner" multiple="true"
|
||||
<outliner id="email-outliner" seltype="multiple"
|
||||
onselect="email_enableButtons()" flex="1">
|
||||
<outlinercols>
|
||||
<outlinercol id="certcol" label="&certmgr.certname;" primary="true"
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
<vbox id="webCerts">
|
||||
<description>&certmgr.websites;</description>
|
||||
<separator class="thin"/>
|
||||
<outliner id="server-outliner" multiple="true" enableColumnDrag="true"
|
||||
<outliner id="server-outliner" seltype="multiple" enableColumnDrag="true"
|
||||
onselect="websites_enableButtons()" flex="1">
|
||||
<outlinercols>
|
||||
<outlinercol id="certcol" label="&certmgr.certname;" primary="true"
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
<description value="&validation.crlmanager.label;"/>
|
||||
<separator class="thin"/>
|
||||
<tree id="crltree" style="height: 10em;"
|
||||
multiple="false" onclick="EnableCrlActions()" flex="1">
|
||||
seltype="multiple" onclick="EnableCrlActions()" flex="1">
|
||||
<treecolgroup>
|
||||
<treecol flex="3" width="0"/>
|
||||
<splitter class="tree-splitter"/>
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
<rows>
|
||||
<row>
|
||||
<hbox flex="1"> <!-- List of devices -->
|
||||
<tree id="device_tree" rows="12" multiple="false"
|
||||
<tree id="device_tree" rows="12" seltype="false"
|
||||
onselect="enableButtons();"
|
||||
flex="1" style="min-width:15em">
|
||||
<treecolgroup>
|
||||
|
@ -67,7 +67,7 @@
|
|||
</tree>
|
||||
</hbox> <!-- / List of devices -->
|
||||
<hbox flex="1"> <!-- Device status -->
|
||||
<tree id="info_tree" rows="12" multiple="false"
|
||||
<tree id="info_tree" rows="12" seltype="false"
|
||||
class="list" flex="1" style="min-width:10em">
|
||||
<treecolgroup>
|
||||
<treecol flex="5"/>
|
||||
|
|
|
@ -124,7 +124,7 @@
|
|||
|
||||
<tree id="downloadView" ref="NC:DownloadsRoot"
|
||||
datasources="rdf:downloads"
|
||||
multiple="true" flags="dont-test-empty"
|
||||
seltype="multiple" flags="dont-test-empty"
|
||||
ondragover="nsDragAndDrop.dragOver(event, downloadView);"
|
||||
ondraggesture="nsDragAndDrop.startDrag(event, downloadView);"
|
||||
ondragdrop="nsDragAndDrop.drop(event, downloadView);"
|
||||
|
|
|
@ -139,7 +139,7 @@ function SelectAvailableCharset()
|
|||
var active_charsets = document.getElementById('active_charsets');
|
||||
|
||||
if (active_charsets.selectedItems.length > 0)
|
||||
active_charsets.clearItemSelection();
|
||||
active_charsets.clearSelection();
|
||||
|
||||
update_buttons();
|
||||
} //SelectAvailableCharset
|
||||
|
@ -152,7 +152,7 @@ function SelectActiveCharset()
|
|||
var available_charsets = document.getElementById('available_charsets');
|
||||
|
||||
if (available_charsets.selectedItems.length > 0)
|
||||
available_charsets.clearItemSelection();
|
||||
available_charsets.clearSelection();
|
||||
|
||||
update_buttons();
|
||||
} //SelectActiveCharset
|
||||
|
@ -227,7 +227,7 @@ function AddAvailableCharset()
|
|||
|
||||
}//for
|
||||
|
||||
available_charsets.clearItemSelection();
|
||||
available_charsets.clearSelection();
|
||||
enable_save();
|
||||
|
||||
} //AddAvailableCharset
|
||||
|
@ -262,7 +262,7 @@ function RemoveActiveCharset()
|
|||
if (nextNode) {
|
||||
tree.selectItem(nextNode)
|
||||
} else {
|
||||
//tree.clearItemSelection();
|
||||
//tree.clearSelection();
|
||||
}
|
||||
|
||||
enable_save();
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
<tree id="available_charsets" flex="1"
|
||||
onselect="SelectAvailableCharset();"
|
||||
ondblclick="AddAvailableCharset();"
|
||||
datasources="rdf:null" multiple="true">
|
||||
datasources="rdf:null" seltype="multiple">
|
||||
<treecolgroup>
|
||||
<treecol flex="1"/>
|
||||
</treecolgroup>
|
||||
|
@ -66,7 +66,7 @@
|
|||
onselect="SelectActiveCharset();"
|
||||
ondblclick="RemoveActiveCharset();"
|
||||
datasources="rdf:null"
|
||||
indent="false" multiple="true">
|
||||
indent="false" seltype="multiple">
|
||||
<treecolgroup>
|
||||
<treecol flex="1"/>
|
||||
</treecolgroup>
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
<description>&languages.customize.available.label;</description>
|
||||
|
||||
<tree id="available_languages" flex="1"
|
||||
datasources="rdf:null" multiple="true" ondblclick="HandleDoubleClick(event.target)">
|
||||
datasources="rdf:null" seltype="multiple" ondblclick="HandleDoubleClick(event.target)">
|
||||
<treecolgroup>
|
||||
<treecol flex="1"/>
|
||||
</treecolgroup>
|
||||
|
|
|
@ -386,7 +386,7 @@ function AddAvailableLanguage()
|
|||
}//if
|
||||
}
|
||||
|
||||
available_languages.clearItemSelection();
|
||||
available_languages.clearSelection();
|
||||
return true;
|
||||
} //AddAvailableLanguage
|
||||
|
||||
|
@ -433,7 +433,7 @@ function RemoveActiveLanguage()
|
|||
if (nextNode) {
|
||||
active_languages.selectItem(nextNode)
|
||||
} else {
|
||||
//active_languages.clearItemSelection();
|
||||
//active_languages.clearSelection();
|
||||
}
|
||||
|
||||
UpdateSavePrefString();
|
||||
|
|
|
@ -52,7 +52,7 @@
|
|||
<hbox flex="1">
|
||||
<tree id="active_languages" flex="1" style="width: 0px; height: 0px;"
|
||||
preftype="localizedstring" prefstring="intl.accept_languages" prefvalue="" prefattribute="prefvalue" wsm_attributes="prefvalue"
|
||||
datasources="rdf:null" multiple="true" onselect="SelectLanguage();">
|
||||
datasources="rdf:null" seltype="multiple" onselect="SelectLanguage();">
|
||||
<treecolgroup>
|
||||
<treecol flex="1"/>
|
||||
</treecolgroup>
|
||||
|
|
|
@ -76,7 +76,7 @@
|
|||
</row>
|
||||
<separator class="thin"/>
|
||||
<row flex="1">
|
||||
<tree id="disabledDomains" multiple="true" onkeyup="treeHandleEvent(event)" style="height: 0px; width: 0px;" flex="1">
|
||||
<tree id="disabledDomains" seltype="multiple" onkeyup="treeHandleEvent(event)" style="height: 0px; width: 0px;" flex="1">
|
||||
<treecolgroup>
|
||||
<treecol flex="1"/>
|
||||
</treecolgroup>
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
<hbox flex="1">
|
||||
|
||||
<vbox flex="1">
|
||||
<tree multiple="true" flex="1" id="allengines" ref="NC:SearchEngineRoot" datasources="rdf:internetsearch">
|
||||
<tree seltype="multiple" flex="1" id="allengines" ref="NC:SearchEngineRoot" datasources="rdf:internetsearch">
|
||||
<template>
|
||||
<treechildren>
|
||||
<treeitem uri="..." loading="rdf:http://home.netscape.com/NC-rdf#loading">
|
||||
|
@ -105,7 +105,7 @@
|
|||
<separator class="thin"/>
|
||||
|
||||
<hbox flex="1">
|
||||
<tree multiple="true" flex="1" id="engineList" style="height: 0px;"
|
||||
<tree seltype="multiple" flex="1" id="engineList" style="height: 0px;"
|
||||
datasources="rdf:internetsearch" onselect="doMoveDirectionEnabling()">
|
||||
<template>
|
||||
<treechildren>
|
||||
|
|
|
@ -222,7 +222,7 @@ function ClickOnOtherPanels(event)
|
|||
|
||||
// Remove the selection in the "current" panels list
|
||||
var current_panels = document.getElementById('current-panels');
|
||||
current_panels.clearItemSelection();
|
||||
current_panels.clearSelection();
|
||||
enable_buttons_for_current_panels();
|
||||
|
||||
if (treeitem.getAttribute('container') == 'true') {
|
||||
|
@ -275,7 +275,7 @@ function add_datasource_to_other_panels(link) {
|
|||
function SelectChangeForCurrentPanels() {
|
||||
// Remove the selection in the available panels list
|
||||
var all_panels = document.getElementById('other-panels');
|
||||
all_panels.clearItemSelection();
|
||||
all_panels.clearSelection();
|
||||
|
||||
enable_buttons_for_current_panels();
|
||||
enable_buttons_for_other_panels();
|
||||
|
@ -370,7 +370,7 @@ function AddPanel()
|
|||
// Remove the selection in the other list.
|
||||
// Selection will move to "current" list.
|
||||
var all_panels = document.getElementById('other-panels');
|
||||
all_panels.clearItemSelection();
|
||||
all_panels.clearSelection();
|
||||
|
||||
enable_buttons_for_current_panels();
|
||||
enable_buttons_for_other_panels();
|
||||
|
|
|
@ -52,7 +52,7 @@
|
|||
<tree id="other-panels" flex="1"
|
||||
datasources="rdf:null"
|
||||
containment="http://home.netscape.com/NC-rdf#panel-list"
|
||||
indent="true" multiple="true"
|
||||
indent="true" seltype="multiple"
|
||||
onselect="SelectChangeForOtherPanels(event, event.target.parentNode.parentNode)"
|
||||
onclick="if (event.detail == 2) { AddPanel(); }"
|
||||
>
|
||||
|
@ -116,7 +116,7 @@
|
|||
<label value="&sidebar.customize.current.label;"
|
||||
crop="right"/>
|
||||
<tree id="current-panels" onclick="SelectChangeForCurrentPanels();"
|
||||
datasources="rdf:null" flex="1" multiple="true">
|
||||
datasources="rdf:null" flex="1" seltype="multiple">
|
||||
<template>
|
||||
<rule>
|
||||
<conditions>
|
||||
|
|
|
@ -15,28 +15,387 @@
|
|||
extends="chrome://global/content/bindings/tree.xml#tree-base">
|
||||
<content>
|
||||
<children>
|
||||
<xul:treecolgroup>
|
||||
<xul:treecol flex="1"/>
|
||||
</xul:treecolgroup>
|
||||
</children>
|
||||
<xul:treecolgroup>
|
||||
<xul:treecol flex="1"/>
|
||||
</xul:treecolgroup>
|
||||
</children>
|
||||
<xul:treerows class="tree-container-treerows" inherits="dragover,dragdroptree">
|
||||
<children includes="treehead|treechildren"/>
|
||||
</xul:treerows>
|
||||
</content>
|
||||
<implementation>
|
||||
<property name="selectedIndex"
|
||||
onget="return (this.selectedItems.length > 0 ? this.getIndexOfItem(this.selectedItems[0]) : -1)"
|
||||
onset="if(val>=0){var item=this.getItemAtIndex(val); if(item) this.selectItem(item);} else this.clearItemSelection();"
|
||||
/>
|
||||
|
||||
<implementation implements="nsIDOMXULMultiSelectControlElement">
|
||||
<field name="_isUpSelection">0</field>
|
||||
<field name="_isDownSelection">0</field>
|
||||
<field name="_suppressOnSelect">false</field>
|
||||
<field name="_selectionStart">null</field>
|
||||
<field name="_currentItem">null</field>
|
||||
<field name="_selectTimeout">null</field>
|
||||
|
||||
<constructor>
|
||||
<![CDATA[
|
||||
var els = this.getElementsByAttribute("selected", "true");
|
||||
this.selectedItems = [];
|
||||
for (var i = 0; i < els.length; ++i)
|
||||
this.selectedItems.push(els[i]);
|
||||
]]>
|
||||
</constructor>
|
||||
|
||||
<!-- ///////////////// public tree members ///////////////// -->
|
||||
|
||||
<property name="treeBoxObject"
|
||||
onget="return this.boxObject.QueryInterface(Components.interfaces.nsITreeBoxObject);"
|
||||
readonly="true"/>
|
||||
<field name="isUpSelection">
|
||||
0
|
||||
</field>
|
||||
<field name="isDownSelection">
|
||||
0
|
||||
</field>
|
||||
|
||||
<method name="timedSelect">
|
||||
<parameter name="item"/>
|
||||
<parameter name="timeout"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
var suppress = this._suppressOnSelect;
|
||||
if (timeout != -1)
|
||||
this._suppressOnSelect = true;
|
||||
|
||||
this.selectItem(item);
|
||||
|
||||
this._suppressOnSelect = suppress;
|
||||
|
||||
if (timeout != -1) {
|
||||
if (this._selectTimeout)
|
||||
window.clearTimeout(this._selectTimeout);
|
||||
|
||||
this._selectTimeout = window.setTimeout(this._selectTimeoutHandler, timeout, this);
|
||||
}
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<!-- ///////////////// private tree members ///////////////// -->
|
||||
|
||||
<method name="_fireOnSelect">
|
||||
<body>
|
||||
<![CDATA[
|
||||
if (!this._suppressOnSelect && this.getAttribute("suppressonselect") != "true") {
|
||||
var event = document.createEvent("Events");
|
||||
event.initEvent("select", false, true);
|
||||
this.dispatchEvent(event);
|
||||
}
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="_selectTimeoutHandler">
|
||||
<parameter name="me"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
me._fireOnSelect();
|
||||
this._selectTimeout = null;
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<!-- ///////////////// nsIDOMXULSelectControlElement ///////////////// -->
|
||||
|
||||
<property name="selType"
|
||||
onget="return this.getAttribute('seltype')"
|
||||
onset="this.setAttribute('seltype', val); return val;"/>
|
||||
|
||||
<property name="selectedIndex">
|
||||
<getter><![CDATA[
|
||||
return this.selectedItems.length > 0 ? this.getIndexOfItem(this.selectedItems[0]) : -1;
|
||||
]]></getter>
|
||||
<setter><![CDATA[
|
||||
if (val >= 0)
|
||||
this.selectItem(this.getItemAtIndex(val));
|
||||
else
|
||||
this.clearSelection();
|
||||
]]></setter>
|
||||
</property>
|
||||
|
||||
<property name="selectedItem">
|
||||
<getter><![CDATA[
|
||||
return this.selectedItems.length > 0 ? this.selectedItems[0] : null;
|
||||
]]></getter>
|
||||
<setter><![CDATA[
|
||||
this.selectItem(item);
|
||||
]]></setter>
|
||||
</property>
|
||||
|
||||
<property name="value">
|
||||
<getter>
|
||||
<![CDATA[
|
||||
if (this.selectedItems.length > 0)
|
||||
return this.selectedItem.value;
|
||||
else
|
||||
return null;
|
||||
]]>
|
||||
</getter>
|
||||
<setter>
|
||||
<![CDATA[
|
||||
var kids = this.getElementsByAttribute("value", val);
|
||||
if (kids && kids.length)
|
||||
this.selectItem(kids[0]);
|
||||
return val;
|
||||
]]>
|
||||
</setter>
|
||||
</property>
|
||||
|
||||
<method name="appendItem">
|
||||
<parameter name="label"/>
|
||||
<parameter name="value"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
var kiddies = this.getElementsByTagName("treechildren")[0];
|
||||
var item = null;
|
||||
if (kiddies) {
|
||||
var XULNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
|
||||
item = document.createElementNS(XULNS, "treeitem");
|
||||
var row = document.createElementNS(XULNS, "treerow");
|
||||
var cell = document.createElementNS(XULNS, "treecell");
|
||||
item.setAttribute("label", label);
|
||||
item.setAttribute("value", value);
|
||||
kiddies.appendChild(item);
|
||||
}
|
||||
return item;
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="insertItemAt">
|
||||
<parameter name="index"/>
|
||||
<parameter name="label"/>
|
||||
<parameter name="value"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
var kiddies = this.getElementsByTagName("treechildren")[0];
|
||||
var item = null;
|
||||
if (kiddies) {
|
||||
var XULNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
|
||||
item = document.createElementNS(XULNS, "treeitem");
|
||||
item.setAttribute("label", label);
|
||||
item.setAttribute("value", value);
|
||||
var before = kiddies.childNodes[index];
|
||||
if (before)
|
||||
kiddies.insertBefore(item, before);
|
||||
else
|
||||
kiddies.appendChild(item);
|
||||
}
|
||||
return item;
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="removeItemAt">
|
||||
<parameter name="index"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
var kiddies = this.getElementsByTagName("treechildren")[0];
|
||||
var remove = null;
|
||||
if (kiddies) {
|
||||
remove = kiddies.childNodes[index];
|
||||
if (remove)
|
||||
kiddies.removeChild(remove);
|
||||
}
|
||||
return remove;
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
<!-- ///////////////// nsIDOMXULSelectMultipleControlElement ///////////////// -->
|
||||
|
||||
<property name="currentItem" onget="return this._currentItem;">
|
||||
<setter>
|
||||
<![CDATA[
|
||||
if (this._currentItem)
|
||||
this._currentItem.current = false;
|
||||
this._currentItem = val;
|
||||
if (val)
|
||||
val.current = true;
|
||||
return val;
|
||||
]]>
|
||||
</setter>
|
||||
</property>
|
||||
|
||||
<property name="selectedCount" onget="return this.selectedItems.length;"/>
|
||||
|
||||
<method name="getSelectedItem">
|
||||
<parameter name="index"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
return index < this.selectedItems.length ? this.selectedItems[index] : null;
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="addItemToSelection">
|
||||
<parameter name="item"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
if (item.selected)
|
||||
return;
|
||||
|
||||
this.selectedItems.push(item);
|
||||
item.selected = true;
|
||||
|
||||
this._fireOnSelect();
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="removeItemFromSelection">
|
||||
<parameter name="item"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
if (!item.selected)
|
||||
return;
|
||||
|
||||
for (var i = 0; i < this.selectedItems.length; ++i) {
|
||||
if (this.selectedItems[i] == item) {
|
||||
this.selectedItems.splice(i, 1);
|
||||
item.selected = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
this._fireOnSelect();
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="toggleItemSelection">
|
||||
<parameter name="item"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
if (item.selected)
|
||||
this.removeItemFromSelection(item);
|
||||
else
|
||||
this.addItemToSelection(item);
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="selectItem">
|
||||
<parameter name="item"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
if (!item)
|
||||
return;
|
||||
if (this.selectedItems.length == 1 && this.selectedItems[0] == item)
|
||||
return;
|
||||
|
||||
this._selectionStart = null;
|
||||
|
||||
var suppress = this._suppressOnSelect;
|
||||
this._suppressOnSelect = true;
|
||||
|
||||
this.clearSelection();
|
||||
this.addItemToSelection(item);
|
||||
this.currentItem = item;
|
||||
|
||||
this._suppressOnSelect = suppress;
|
||||
this._fireOnSelect();
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="selectItemRange">
|
||||
<parameter name="startItem"/>
|
||||
<parameter name="endItem"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
if (this.selType != "multiple")
|
||||
return;
|
||||
|
||||
if (!startItem)
|
||||
startItem = this._selectionStart ? this._selectionStart : this.currentItem;
|
||||
if (!startItem)
|
||||
startItem = endItem;
|
||||
|
||||
var suppressSelect = this._suppressOnSelect;
|
||||
this._suppressOnSelect = true;
|
||||
this.clearSelection();
|
||||
|
||||
this._selectionStart = startItem;
|
||||
|
||||
var currentItem;
|
||||
var startIndex = this.getIndexOfItem(startItem);
|
||||
var endIndex = this.getIndexOfItem(endItem);
|
||||
if (endIndex < startIndex) {
|
||||
currentItem = endItem;
|
||||
endItem = startItem;
|
||||
startItem = currentItem;
|
||||
} else {
|
||||
currentItem = startItem;
|
||||
}
|
||||
|
||||
while (currentItem) {
|
||||
if (currentItem.localName == "treeitem")
|
||||
this.addItemToSelection(currentItem);
|
||||
if (currentItem == endItem)
|
||||
break;
|
||||
currentItem = this.getNextItem(currentItem, 1);
|
||||
}
|
||||
|
||||
this._suppressOnSelect = suppressSelect;
|
||||
|
||||
this._fireOnSelect();
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="selectAll">
|
||||
<body>
|
||||
<![CDATA[
|
||||
var suppress = this._suppressOnSelect;
|
||||
this._suppressOnSelect = true;
|
||||
|
||||
var item = this.getItemAtIndex(0);
|
||||
while (item) {
|
||||
this.addItemToSelection(item);
|
||||
item = this.getNextItem(item, 1);
|
||||
}
|
||||
|
||||
this._suppressOnSelect = suppress;
|
||||
this._fireOnSelect();
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="invertSelection">
|
||||
<body>
|
||||
<![CDATA[
|
||||
var suppress = this._suppressOnSelect;
|
||||
this._suppressOnSelect = true;
|
||||
|
||||
var item = this.getItemAtIndex(0);
|
||||
while (item) {
|
||||
if (item.selected)
|
||||
this.removeItemFromSelection(item);
|
||||
else
|
||||
this.addItemToSelection(item);
|
||||
item = this.getNextItem(item, 1);
|
||||
}
|
||||
|
||||
this._suppressOnSelect = suppress;
|
||||
this._fireOnSelect();
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="clearSelection">
|
||||
<body>
|
||||
<![CDATA[
|
||||
for (var i = this.selectedItems.length-1; i >= 0; --i)
|
||||
this.selectedItems[i].selected = false;
|
||||
|
||||
this.selectedItems.splice(0, this.selectedItems.length);
|
||||
this._selectionStart = null;
|
||||
this._fireOnSelect();
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<!-- ///////////////// nsITreeBoxObject ///////////////// -->
|
||||
|
||||
<method name="getNextItem">
|
||||
<parameter name="startItem"/>
|
||||
<parameter name="delta"/>
|
||||
|
@ -97,17 +456,18 @@
|
|||
</body>
|
||||
</method>
|
||||
</implementation>
|
||||
|
||||
<handlers>
|
||||
<handler event="keypress" keycode="vk_enter">
|
||||
<![CDATA[
|
||||
if (event.target != this || selectedItems.length != 1)
|
||||
if (event.target != this || this.selectedItems.length != 1)
|
||||
return;
|
||||
this.selectedItems[0].toggleOpenState();
|
||||
]]>
|
||||
</handler>
|
||||
<handler event="keypress" keycode="vk_return">
|
||||
<![CDATA[
|
||||
if (event.target != this || selectedItems.length != 1)
|
||||
if (event.target != this || this.selectedItems.length != 1)
|
||||
return;
|
||||
this.selectedItems[0].toggleOpenState();
|
||||
]]>
|
||||
|
@ -137,8 +497,8 @@
|
|||
<![CDATA[
|
||||
if (event.target != this || this.selectedItems.length < 1)
|
||||
return;
|
||||
this.isUpSelection=0;
|
||||
this.isDownSelection=0;
|
||||
this._isUpSelection=0;
|
||||
this._isDownSelection=0;
|
||||
var n = this.getPreviousItem(this.selectedItems[this.selectedItems.length-1], 1);
|
||||
if (n) {
|
||||
this.ensureIndexIsVisible(this.getIndexOfItem(n));
|
||||
|
@ -156,8 +516,8 @@
|
|||
n = this.getItemAtIndex(0);
|
||||
}
|
||||
else {
|
||||
this.isUpSelection=0;
|
||||
this.isDownSelection=0;
|
||||
this._isUpSelection=0;
|
||||
this._isDownSelection=0;
|
||||
n = this.getNextItem(this.selectedItems[this.selectedItems.length-1], 1);
|
||||
}
|
||||
|
||||
|
@ -170,20 +530,20 @@
|
|||
<handler event="keypress" modifiers="shift" keycode="vk_up">
|
||||
<![CDATA[
|
||||
var l=this.selectedItems.length;
|
||||
if (event.target != this || l < 1 || this.getAttribute("multiple") != "true")
|
||||
if (event.target != this || l < 1 || this.selType != "multiple")
|
||||
return;
|
||||
var n = this.getPreviousItem(this.selectedItems[l-1], 1);
|
||||
if (n) {
|
||||
this.ensureElementIsVisible(n);
|
||||
if ( this.isDownSelection) {
|
||||
if ( this._isDownSelection) {
|
||||
if ( l > 1 )
|
||||
this.removeItemFromSelection(this.selectedItems[l-1]);
|
||||
if ( l <= 2 )
|
||||
this.isDownSelection=0;
|
||||
this._isDownSelection=0;
|
||||
}
|
||||
else {
|
||||
this.addItemToSelection(n);
|
||||
this.isUpSelection=1;
|
||||
this._isUpSelection=1;
|
||||
}
|
||||
}
|
||||
]]>
|
||||
|
@ -191,20 +551,20 @@
|
|||
<handler event="keypress" modifiers="shift" keycode="vk_down">
|
||||
<![CDATA[
|
||||
var l=this.selectedItems.length;
|
||||
if (event.target != this || l < 1 || this.getAttribute("multiple") != "true")
|
||||
if (event.target != this || l < 1 || this.selType != "multiple")
|
||||
return;
|
||||
var n = this.getNextItem(this.selectedItems[l-1], 1);
|
||||
if (n) {
|
||||
this.ensureElementIsVisible(n);
|
||||
if ( this.isUpSelection) {
|
||||
if ( this._isUpSelection) {
|
||||
if ( l > 1 )
|
||||
this.removeItemFromSelection(this.selectedItems[l-1]);
|
||||
if ( l <= 2 )
|
||||
this.isUpSelection=0;
|
||||
this._isUpSelection=0;
|
||||
}
|
||||
else {
|
||||
this.addItemToSelection(n);
|
||||
this.isDownSelection=1;
|
||||
this._isDownSelection=1;
|
||||
}
|
||||
}
|
||||
]]>
|
||||
|
@ -214,8 +574,8 @@
|
|||
var l = this.selectedItems.length;
|
||||
if (event.target != this || l < 1)
|
||||
return;
|
||||
this.isUpSelection=0;
|
||||
this.isDownSelection=0;
|
||||
this._isUpSelection=0;
|
||||
this._isDownSelection=0;
|
||||
var i = this.getIndexOfFirstVisibleRow();
|
||||
if ( i == 0 )
|
||||
var n=this.getItemAtIndex(0);
|
||||
|
@ -237,8 +597,8 @@
|
|||
var l = this.selectedItems.length;
|
||||
if (event.target != this || l < 1)
|
||||
return;
|
||||
this.isUpSelection=0;
|
||||
this.isDownSelection=0;
|
||||
this._isUpSelection=0;
|
||||
this._isDownSelection=0;
|
||||
var i = this.getIndexOfFirstVisibleRow();
|
||||
var v = this.getNumberOfVisibleRows();
|
||||
var count = this.getRowCount();
|
||||
|
@ -261,8 +621,8 @@
|
|||
<![CDATA[
|
||||
if (event.target != this || this.selectedItems.length < 1)
|
||||
return;
|
||||
this.isUpSelection=0;
|
||||
this.isDownSelection=0;
|
||||
this._isUpSelection=0;
|
||||
this._isDownSelection=0;
|
||||
this.scrollToIndex(0);
|
||||
this.selectItem(this.getItemAtIndex(0));
|
||||
]]>
|
||||
|
@ -271,8 +631,8 @@
|
|||
<![CDATA[
|
||||
if (event.target != this || this.selectedItems.length < 1)
|
||||
return;
|
||||
this.isUpSelection=0;
|
||||
this.isDownSelection=0;
|
||||
this._isUpSelection=0;
|
||||
this._isDownSelection=0;
|
||||
var count = this.getRowCount();
|
||||
this.ensureIndexIsVisible(count-1);
|
||||
this.selectItem(this.getItemAtIndex(count-1));
|
||||
|
@ -284,6 +644,7 @@
|
|||
<binding id="treerows"
|
||||
extends="chrome://global/content/bindings/tree.xml#tree-base">
|
||||
<content outer="true"/>
|
||||
|
||||
<implementation>
|
||||
<constructor>
|
||||
this.addEventListener("DOMMouseScroll", this._handleMouseScroll, true);
|
||||
|
@ -307,6 +668,21 @@
|
|||
})
|
||||
]]>
|
||||
</field>
|
||||
|
||||
<method name="_getMouseTargetItem">
|
||||
<parameter name="event"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
var p = event.originalTarget;
|
||||
while (p) {
|
||||
if (p.localName == "treeitem")
|
||||
return p;
|
||||
p = p.parentNode;
|
||||
}
|
||||
return null;
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
</implementation>
|
||||
|
||||
<handlers>
|
||||
|
@ -314,16 +690,13 @@
|
|||
click, so that drags work correctly. -->
|
||||
<handler event="mousedown">
|
||||
<![CDATA[
|
||||
var lt = event.originalTarget.localName;
|
||||
var target = (lt == 'treecell' || lt == 'treerow') ? lt : null;
|
||||
if (target && !event.ctrlKey && !event.shiftKey && !event.metaKey) {
|
||||
var parent = lt == 'treecell' ? event.target.parentNode.parentNode : event.target.parentNode;
|
||||
var isSelected = parent.getAttribute("selected");
|
||||
if (!isSelected) {
|
||||
parentNode.selectItem(parent);
|
||||
}
|
||||
parentNode.currentItem = parent;
|
||||
}
|
||||
var targetItem = this._getMouseTargetItem(event);
|
||||
if (targetItem && !event.ctrlKey && !event.shiftKey && !event.metaKey) {
|
||||
if (!targetItem.selected)
|
||||
parentNode.selectItem(targetItem);
|
||||
|
||||
parentNode.currentItem = targetItem;
|
||||
}
|
||||
]]>
|
||||
</handler>
|
||||
|
||||
|
@ -331,41 +704,41 @@
|
|||
except this item. -->
|
||||
<handler event="click">
|
||||
<![CDATA[
|
||||
if (event.button != 0) return;
|
||||
var t = event.originalTarget;
|
||||
if (t.localName == 'treecell') {
|
||||
if (event.ctrlKey || event.metaKey) {
|
||||
parentNode.toggleItemSelection(t.parentNode.parentNode);
|
||||
parentNode.currentItem = t.parentNode.parentNode;
|
||||
}
|
||||
else if (event.shiftKey) {
|
||||
parentNode.selectItemRange(null, t.parentNode.parentNode);
|
||||
parentNode.currentItem = t.parentNode.parentNode;
|
||||
}
|
||||
else {
|
||||
/* We want to deselect all the selected items except what was
|
||||
clicked, UNLESS it was a right-click. We have to do this
|
||||
in click rather than mousedown so that you can drag a
|
||||
selected group of items */
|
||||
if (event.button != 0) return;
|
||||
var targetItem = this._getMouseTargetItem(event);
|
||||
if (targetItem) {
|
||||
if (event.ctrlKey || event.metaKey) {
|
||||
parentNode.toggleItemSelection(targetItem);
|
||||
parentNode.currentItem = targetItem;
|
||||
}
|
||||
else if (event.shiftKey) {
|
||||
parentNode.selectItemRange(null, targetItem);
|
||||
parentNode.currentItem = targetItem;
|
||||
}
|
||||
else {
|
||||
/* We want to deselect all the selected items except what was
|
||||
clicked, UNLESS it was a right-click. We have to do this
|
||||
in click rather than mousedown so that you can drag a
|
||||
selected group of items */
|
||||
|
||||
var selectedItems = parentNode.selectedItems;
|
||||
var didSuppressSelect = false;
|
||||
var i = 0;
|
||||
while (i < selectedItems.length) {
|
||||
if (selectedItems[i] != t.parentNode.parentNode) {
|
||||
if (!didSuppressSelect) {
|
||||
parentNode.suppressOnSelect = true;
|
||||
didSuppressSelect = true;
|
||||
}
|
||||
parentNode.removeItemFromSelection(selectedItems[i]);
|
||||
}
|
||||
else
|
||||
i++;
|
||||
}
|
||||
if (didSuppressSelect)
|
||||
parentNode.suppressOnSelect = false;
|
||||
}
|
||||
}
|
||||
var selectedItems = parentNode.selectedItems;
|
||||
var didSuppressSelect = false;
|
||||
var i = 0;
|
||||
while (i < selectedItems.length) {
|
||||
if (selectedItems[i] != targetItem) {
|
||||
if (!didSuppressSelect) {
|
||||
parentNode._suppressOnSelect = true;
|
||||
didSuppressSelect = true;
|
||||
}
|
||||
parentNode.removeItemFromSelection(selectedItems[i]);
|
||||
}
|
||||
else
|
||||
i++;
|
||||
}
|
||||
if (didSuppressSelect)
|
||||
parentNode._suppressOnSelect = false;
|
||||
}
|
||||
}
|
||||
]]>
|
||||
</handler>
|
||||
|
||||
|
@ -395,8 +768,52 @@
|
|||
</binding>
|
||||
|
||||
<binding id="treeitem"
|
||||
extends="chrome://global/content/bindings/tree.xml#tree-base">
|
||||
<implementation>
|
||||
extends="chrome://global/content/bindings/general.xml#basetext">
|
||||
<resources>
|
||||
<stylesheet src="chrome://global/content/bindings/tree.css"/>
|
||||
<stylesheet src="chrome://global/skin/tree.css"/>
|
||||
</resources>
|
||||
|
||||
<implementation implements="nsIDOMXULSelectControlItemElement">
|
||||
<property name="current" onget="return this.getAttribute('current') == 'true';">
|
||||
<setter><![CDATA[
|
||||
if (val)
|
||||
this.setAttribute("current", "true");
|
||||
else
|
||||
this.removeAttribute("current");
|
||||
return val;
|
||||
]]></setter>
|
||||
</property>
|
||||
|
||||
<!-- ///////////////// nsIDOMXULSelectControlItemElement ///////////////// -->
|
||||
|
||||
<property name="value" onget="return this.getAttribute('value');"
|
||||
onset="this.setAttribute('value', val); return val;"/>
|
||||
|
||||
<property name="selected" onget="return this.getAttribute('selected') == 'true';">
|
||||
<setter><![CDATA[
|
||||
if (val)
|
||||
this.setAttribute("selected", "true");
|
||||
else
|
||||
this.removeAttribute("selected");
|
||||
return val;
|
||||
]]></setter>
|
||||
</property>
|
||||
|
||||
<property name="control">
|
||||
<getter><![CDATA[
|
||||
var parent = this.parentNode;
|
||||
while (parent) {
|
||||
if (parent.localName == "tree")
|
||||
return parent;
|
||||
parent = parent.parentNode;
|
||||
}
|
||||
return null;
|
||||
]]></getter>
|
||||
</property>
|
||||
|
||||
<!-- ///////////////// public treeitem members ///////////////// -->
|
||||
|
||||
<method name="toggleOpenState">
|
||||
<body>
|
||||
<![CDATA[
|
||||
|
@ -557,37 +974,5 @@
|
|||
</content>
|
||||
</binding>
|
||||
|
||||
<binding id="listbox" extends="xul:tree">
|
||||
<content>
|
||||
<xul:cols>
|
||||
<xul:col flex="1"/>
|
||||
</xul:cols>
|
||||
<xul:treerows>
|
||||
<xul:treerows>
|
||||
<children includes="listhead"/>
|
||||
<xul:treechildren>
|
||||
<children/>
|
||||
</xul:treechildren>
|
||||
</xul:treerows>
|
||||
</xul:treerows>
|
||||
</content>
|
||||
</binding>
|
||||
|
||||
<binding id="listhead" extends="xul:treehead">
|
||||
<content>
|
||||
<xul:treerow>
|
||||
<xul:treecell inherits="label" class="listcell-header"/>
|
||||
</xul:treerow>
|
||||
</content>
|
||||
</binding>
|
||||
|
||||
<binding id="listitem" extends="xul:treeitem">
|
||||
<content>
|
||||
<xul:treerow>
|
||||
<xul:treecell inherits="label" class="listcell-text"/>
|
||||
</xul:treerow>
|
||||
</content>
|
||||
</binding>
|
||||
|
||||
</bindings>
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче