Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Static Public Member Functions
nsPostRefresh Class Reference

nsPostRefresh is needed by the UI Controls, which are implemented in XBL and used inside <repeat>. More...

#include <nsXFormsModelElement.h>

List of all members.

Public Member Functions

 nsPostRefresh ()
 ~nsPostRefresh ()

Static Public Member Functions

static const nsVoidArrayPostRefreshList ()

Detailed Description

nsPostRefresh is needed by the UI Controls, which are implemented in XBL and used inside <repeat>.

It is needed to refresh the controls, because XBL bindings are attached to XForms controls after refreshing the <repeat>.

Definition at line 580 of file nsXFormsModelElement.h.


Constructor & Destructor Documentation

Definition at line 523 of file nsXFormsModelElement.cpp.

{
#ifdef DEBUG_smaug
  printf("nsPostRefresh\n");
#endif
  ++sRefreshing;
}

Definition at line 531 of file nsXFormsModelElement.cpp.

{
#ifdef DEBUG_smaug
  printf("~nsPostRefresh\n");
#endif

  if (sRefreshing != 1) {
    --sRefreshing;
    return;
  }

  if (sPostRefreshList) {
    while (sPostRefreshList->Count()) {
      // Iterating this way because refresh can lead to
      // additions/deletions in sPostRefreshList.
      // Iterating from last to first saves possibly few memcopies,
      // see nsVoidArray::RemoveElementsAt().
      PRInt32 last = sPostRefreshList->Count() - 1;
      nsIXFormsControl* control =
        NS_STATIC_CAST(nsIXFormsControl*, sPostRefreshList->ElementAt(last));
      sPostRefreshList->RemoveElementAt(last);
      if (control)
        control->Refresh();
    }
    if (sRefreshing == 1) {
      delete sPostRefreshList;
      sPostRefreshList = nsnull;
    }
  }

  --sRefreshing;

  // process sContainerPostRefreshList after we've decremented sRefreshing.
  // container->refresh below could ask for ContainerNeedsPostRefresh which
  // will add an item to the sContainerPostRefreshList if sRefreshing > 0.
  // So keeping this under sRefreshing-- will avoid an infinite loop.
  while (sContainerPostRefreshList && sContainerPostRefreshList->Count()) {
    PRInt32 last = sContainerPostRefreshList->Count() - 1;
    nsIXFormsControl* container =
      NS_STATIC_CAST(nsIXFormsControl*, sContainerPostRefreshList->ElementAt(last));
    sContainerPostRefreshList->RemoveElementAt(last);
    if (container) {
      container->Refresh();
    }
  }
  delete sContainerPostRefreshList;
  sContainerPostRefreshList = nsnull;
}

Member Function Documentation

Definition at line 581 of file nsXFormsModelElement.cpp.

{
  return sPostRefreshList;
}

Here is the caller graph for this function:


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