Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Private Attributes
nsXFormsValueElement Class Reference

Implementation of the XForms <value> element. More...

Inheritance diagram for nsXFormsValueElement:
Inheritance graph
[legend]
Collaboration diagram for nsXFormsValueElement:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 nsXFormsValueElement ()
NS_DECL_ISUPPORTS_INHERITED
NS_IMETHOD 
OnCreated (nsIXTFGenericElementWrapper *aWrapper)
virtual nsRepeatState GetRepeatState ()
 Get/Set the repeat state for the xforms control or action.
virtual void SetRepeatState (nsRepeatState aState)
void onCreated (in nsIXTFGenericElementWrapper wrapper)
void onDestroyed ()
void getScriptingInterfaces (out unsigned long count,[array, size_is(count), retval] out nsIIDPtr array)
void willChangeDocument (in nsIDOMDocument newDoc)
void documentChanged (in nsIDOMDocument newDoc)
void willChangeParent (in nsIDOMElement newParent)
void parentChanged (in nsIDOMElement newParent)
void willInsertChild (in nsIDOMNode child, in unsigned long index)
void childInserted (in nsIDOMNode child, in unsigned long index)
void willAppendChild (in nsIDOMNode child)
void childAppended (in nsIDOMNode child)
void willRemoveChild (in unsigned long index)
void childRemoved (in unsigned long index)
void willSetAttribute (in nsIAtom name, in AString newValue)
void attributeSet (in nsIAtom name, in AString newValue)
void willRemoveAttribute (in nsIAtom name)
void attributeRemoved (in nsIAtom name)
void beginAddingChildren ()
void doneAddingChildren ()
boolean handleDefault (in nsIDOMEvent aEvent)
void cloneState (in nsIDOMElement aElement)

Public Attributes

const unsigned long ELEMENT_TYPE_GENERIC_ELEMENT = 0
const unsigned long ELEMENT_TYPE_SVG_VISUAL = 1
const unsigned long ELEMENT_TYPE_XML_VISUAL = 2
const unsigned long ELEMENT_TYPE_XUL_VISUAL = 3
const unsigned long ELEMENT_TYPE_BINDABLE = 4
readonly attribute unsigned long elementType
readonly attribute boolean isAttributeHandler
const unsigned long NOTIFY_WILL_CHANGE_DOCUMENT = 0x00000001
const unsigned long NOTIFY_DOCUMENT_CHANGED = 0x00000002
const unsigned long NOTIFY_WILL_CHANGE_PARENT = 0x00000004
const unsigned long NOTIFY_PARENT_CHANGED = 0x00000008
const unsigned long NOTIFY_WILL_INSERT_CHILD = 0x00000010
const unsigned long NOTIFY_CHILD_INSERTED = 0x00000020
const unsigned long NOTIFY_WILL_APPEND_CHILD = 0x00000040
const unsigned long NOTIFY_CHILD_APPENDED = 0x00000080
const unsigned long NOTIFY_WILL_REMOVE_CHILD = 0x00000100
const unsigned long NOTIFY_CHILD_REMOVED = 0x00000200
const unsigned long NOTIFY_WILL_SET_ATTRIBUTE = 0x00000400
const unsigned long NOTIFY_ATTRIBUTE_SET = 0x00000800
const unsigned long NOTIFY_WILL_REMOVE_ATTRIBUTE = 0x00001000
const unsigned long NOTIFY_ATTRIBUTE_REMOVED = 0x00002000
const unsigned long NOTIFY_BEGIN_ADDING_CHILDREN = 0x00004000
const unsigned long NOTIFY_DONE_ADDING_CHILDREN = 0x00008000
const unsigned long NOTIFY_HANDLE_DEFAULT = 0x00010000
readonly attribute AString value
 Returns the value for this element, which can come from inline text or from instance data.

Protected Member Functions

virtual nsRepeatState UpdateRepeatState (nsIDOMNode *aParent)
 This is processed when an XForms control or XForms action has been inserted under a parent node AND has been inserted into a document.

Protected Attributes

nsRepeatState mRepeatState
PRPackedBool mHasParent
 State that tells whether control has a parent or not.
PRPackedBool mHasDoc
 State that tells whether control has a document or not.

Private Attributes

nsIDOMElementmElement

Detailed Description

Implementation of the XForms <value> element.

Note:
The value element does not display any content, it simply provides a value from inline text or instance data.

Definition at line 54 of file nsXFormsValueElement.cpp.


Constructor & Destructor Documentation

Definition at line 58 of file nsXFormsValueElement.cpp.


Member Function Documentation

void nsIXTFElement::attributeSet ( in nsIAtom  name,
in AString  newValue 
) [inherited]
void nsIXTFElement::childInserted ( in nsIDOMNode  child,
in unsigned long  index 
) [inherited]
void nsIXTFElement::childRemoved ( in unsigned long  index) [inherited]
void nsIXTFElement::cloneState ( in nsIDOMElement  aElement) [inherited]

Get/Set the repeat state for the xforms control or action.

The repeat state indicates whether the control or action lives inside a context container, a repeat element, an itemset or none of the above.

Definition at line 205 of file nsXFormsStubElement.cpp.

{
  return mRepeatState;
}
void nsIXTFElement::getScriptingInterfaces ( out unsigned long  count,
[array, size_is(count), retval] out nsIIDPtr  array 
) [inherited]
void nsIXTFElement::parentChanged ( in nsIDOMElement  newParent) [inherited]
void nsXFormsStubElement::SetRepeatState ( nsRepeatState  aState) [virtual, inherited]

Definition at line 211 of file nsXFormsStubElement.cpp.

{
  mRepeatState = aState;
  return;
}

Here is the caller graph for this function:

nsRepeatState nsXFormsStubElement::UpdateRepeatState ( nsIDOMNode aParent) [protected, virtual, inherited]

This is processed when an XForms control or XForms action has been inserted under a parent node AND has been inserted into a document.

It checks the ancestors of the element and returns an nsRepeatState depending on the element's place in the document.

Parameters:
aParentThe new parent of the XForms control

Definition at line 218 of file nsXFormsStubElement.cpp.

{
  // Walk up the parent chain looking to see if the this control is contained
  // in an item.  If it is and that item is contained in a itemset, then we
  // know that this control was generated as a clone from the itemset's
  // template.  Similarly, we'll check to see if this control lives in a
  // contextcontainer (meaning it was cloned from a repeat's template).
  // Otherwise, if neither of these are the case but it lives under a repeat
  // or an itemset, then this control must be part of a template.  A template
  // is the content of a repeat or itemset that gets cloned once for every
  // node in the bound nodeset.
  //
  // If none of this applies, we'll return eType_NotApplicable to show that this
  // control isn't bound to a repeating nodeset.
  nsRepeatState repeatState = eType_NotApplicable;

  if (!mHasDoc || !mHasParent) {
    // If we don't have a document or a parent, none of these tests will work
    // correctly so no sense doing them now.  If either of these are false the
    // repeat state for the object should already be eType_Unknown so just
    // return that now.
    return eType_Unknown;
  }

  nsCOMPtr<nsIDOMNode> parent = aParent;
  PRBool childIsItem = PR_FALSE;
  while (parent) {
    if (nsXFormsUtils::IsXFormsElement(parent,
                                       NS_LITERAL_STRING("contextcontainer"))) {
      repeatState = eType_GeneratedContent;
      break;
    }
    if (nsXFormsUtils::IsXFormsElement(parent, NS_LITERAL_STRING("repeat"))) {
      repeatState = eType_Template;
      break;
    }
    if (nsXFormsUtils::IsXFormsElement(parent, NS_LITERAL_STRING("itemset"))) {
      if (childIsItem) {
        repeatState = eType_GeneratedContent;
        break;
      }
      repeatState = eType_Template;
      break;
    }

    if (nsXFormsUtils::IsXFormsElement(parent, NS_LITERAL_STRING("item"))) {
      childIsItem = PR_TRUE;
    } else {

      nsCOMPtr<nsIDOMElement> parentEle(do_QueryInterface(parent));
      if (!parentEle) {
        // I don't know how this can possibly happen, but if it does I guess
        // we should just ignore it and coninue on our way.
        break;
      }

      // if this control is contained underneath an element that contains
      // an xforms binding attribute that introduces an anonymous xf:repeat
      // then the control is part of a template
      PRBool repeatAttr = PR_FALSE;
      parentEle->HasAttributeNS(NS_LITERAL_STRING(NS_NAMESPACE_XFORMS),
                                NS_LITERAL_STRING("repeat-bind"),
                                &repeatAttr);
      if (repeatAttr) {
        repeatState = eType_Template;
        break;
      }

      parentEle->HasAttributeNS(NS_LITERAL_STRING(NS_NAMESPACE_XFORMS),
                                NS_LITERAL_STRING("repeat-nodeset"),
                                &repeatAttr);
      if (repeatAttr) {
        repeatState = eType_Template;
        break;
      }
    }
    nsCOMPtr<nsIDOMNode> tmp;
    parent->GetParentNode(getter_AddRefs(tmp));
    parent = tmp;
  }

  SetRepeatState(repeatState);
  return repeatState;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsIXTFElement::willInsertChild ( in nsIDOMNode  child,
in unsigned long  index 
) [inherited]
void nsIXTFElement::willRemoveChild ( in unsigned long  index) [inherited]
void nsIXTFElement::willSetAttribute ( in nsIAtom  name,
in AString  newValue 
) [inherited]

Member Data Documentation

Definition at line 72 of file nsIXTFElement.idl.

Definition at line 56 of file nsIXTFElement.idl.

Definition at line 60 of file nsIXTFElement.idl.

Definition at line 64 of file nsIXTFElement.idl.

Definition at line 68 of file nsIXTFElement.idl.

readonly attribute unsigned long nsIXTFElement::elementType [inherited]

Definition at line 78 of file nsIXTFElement.idl.

Definition at line 86 of file nsIXTFElement.idl.

Definition at line 69 of file nsXFormsValueElement.cpp.

State that tells whether control has a document or not.

This could be false even if the control has a document. Just means that the element doesn't need to track whether it has a document or not (i.e. xf:choices)

Definition at line 109 of file nsXFormsStubElement.h.

State that tells whether control has a parent or not.

This could be false even if the control has a parent. Just means that the element doesn't need to track whether it has a parent or not (i.e. xf:choices)

Definition at line 102 of file nsXFormsStubElement.h.

Definition at line 95 of file nsXFormsStubElement.h.

const unsigned long nsIXTFElement::NOTIFY_ATTRIBUTE_REMOVED = 0x00002000 [inherited]

Definition at line 118 of file nsIXTFElement.idl.

const unsigned long nsIXTFElement::NOTIFY_ATTRIBUTE_SET = 0x00000800 [inherited]

Definition at line 115 of file nsIXTFElement.idl.

const unsigned long nsIXTFElement::NOTIFY_BEGIN_ADDING_CHILDREN = 0x00004000 [inherited]

Definition at line 120 of file nsIXTFElement.idl.

const unsigned long nsIXTFElement::NOTIFY_CHILD_APPENDED = 0x00000080 [inherited]

Definition at line 109 of file nsIXTFElement.idl.

const unsigned long nsIXTFElement::NOTIFY_CHILD_INSERTED = 0x00000020 [inherited]

Definition at line 106 of file nsIXTFElement.idl.

const unsigned long nsIXTFElement::NOTIFY_CHILD_REMOVED = 0x00000200 [inherited]

Definition at line 112 of file nsIXTFElement.idl.

const unsigned long nsIXTFElement::NOTIFY_DOCUMENT_CHANGED = 0x00000002 [inherited]

Definition at line 100 of file nsIXTFElement.idl.

const unsigned long nsIXTFElement::NOTIFY_DONE_ADDING_CHILDREN = 0x00008000 [inherited]

Definition at line 121 of file nsIXTFElement.idl.

const unsigned long nsIXTFElement::NOTIFY_HANDLE_DEFAULT = 0x00010000 [inherited]

Definition at line 123 of file nsIXTFElement.idl.

const unsigned long nsIXTFElement::NOTIFY_PARENT_CHANGED = 0x00000008 [inherited]

Definition at line 103 of file nsIXTFElement.idl.

const unsigned long nsIXTFElement::NOTIFY_WILL_APPEND_CHILD = 0x00000040 [inherited]

Definition at line 108 of file nsIXTFElement.idl.

const unsigned long nsIXTFElement::NOTIFY_WILL_CHANGE_DOCUMENT = 0x00000001 [inherited]

Definition at line 99 of file nsIXTFElement.idl.

const unsigned long nsIXTFElement::NOTIFY_WILL_CHANGE_PARENT = 0x00000004 [inherited]

Definition at line 102 of file nsIXTFElement.idl.

const unsigned long nsIXTFElement::NOTIFY_WILL_INSERT_CHILD = 0x00000010 [inherited]

Definition at line 105 of file nsIXTFElement.idl.

const unsigned long nsIXTFElement::NOTIFY_WILL_REMOVE_ATTRIBUTE = 0x00001000 [inherited]

Definition at line 117 of file nsIXTFElement.idl.

const unsigned long nsIXTFElement::NOTIFY_WILL_REMOVE_CHILD = 0x00000100 [inherited]

Definition at line 111 of file nsIXTFElement.idl.

const unsigned long nsIXTFElement::NOTIFY_WILL_SET_ATTRIBUTE = 0x00000400 [inherited]

Definition at line 114 of file nsIXTFElement.idl.

readonly attribute AString nsIXFormsValueElement::value [inherited]

Returns the value for this element, which can come from inline text or from instance data.

Definition at line 52 of file nsIXFormsValueElement.idl.


The documentation for this class was generated from the following file: