/**
  * Refresh this MetaControl with Data from the local AttributeValue object.
  * @param boolean $blnReload reload AttributeValue from the database
  * @return void
  */
 public function Refresh($blnReload = false)
 {
     if ($blnReload) {
         $this->objAttributeValue->Reload();
     }
     if ($this->lblId) {
         if ($this->blnEditMode) {
             $this->lblId->Text = $this->objAttributeValue->Id;
         }
     }
     if ($this->lstAttribute) {
         $this->lstAttribute->RemoveAllItems();
         if (!$this->blnEditMode) {
             $this->lstAttribute->AddItem(QApplication::Translate('- Select One -'), null);
         }
         $objAttributeArray = Attribute::LoadAll();
         if ($objAttributeArray) {
             foreach ($objAttributeArray as $objAttribute) {
                 $objListItem = new QListItem($objAttribute->__toString(), $objAttribute->Id);
                 if ($this->objAttributeValue->Attribute && $this->objAttributeValue->Attribute->Id == $objAttribute->Id) {
                     $objListItem->Selected = true;
                 }
                 $this->lstAttribute->AddItem($objListItem);
             }
         }
     }
     if ($this->lblAttributeId) {
         $this->lblAttributeId->Text = $this->objAttributeValue->Attribute ? $this->objAttributeValue->Attribute->__toString() : null;
     }
     if ($this->lstPerson) {
         $this->lstPerson->RemoveAllItems();
         if (!$this->blnEditMode) {
             $this->lstPerson->AddItem(QApplication::Translate('- Select One -'), null);
         }
         $objPersonArray = Person::LoadAll();
         if ($objPersonArray) {
             foreach ($objPersonArray as $objPerson) {
                 $objListItem = new QListItem($objPerson->__toString(), $objPerson->Id);
                 if ($this->objAttributeValue->Person && $this->objAttributeValue->Person->Id == $objPerson->Id) {
                     $objListItem->Selected = true;
                 }
                 $this->lstPerson->AddItem($objListItem);
             }
         }
     }
     if ($this->lblPersonId) {
         $this->lblPersonId->Text = $this->objAttributeValue->Person ? $this->objAttributeValue->Person->__toString() : null;
     }
     if ($this->calDateValue) {
         $this->calDateValue->DateTime = $this->objAttributeValue->DateValue;
     }
     if ($this->lblDateValue) {
         $this->lblDateValue->Text = sprintf($this->objAttributeValue->DateValue) ? $this->objAttributeValue->__toString($this->strDateValueDateTimeFormat) : null;
     }
     if ($this->calDatetimeValue) {
         $this->calDatetimeValue->DateTime = $this->objAttributeValue->DatetimeValue;
     }
     if ($this->lblDatetimeValue) {
         $this->lblDatetimeValue->Text = sprintf($this->objAttributeValue->DatetimeValue) ? $this->objAttributeValue->__toString($this->strDatetimeValueDateTimeFormat) : null;
     }
     if ($this->txtTextValue) {
         $this->txtTextValue->Text = $this->objAttributeValue->TextValue;
     }
     if ($this->lblTextValue) {
         $this->lblTextValue->Text = $this->objAttributeValue->TextValue;
     }
     if ($this->chkBooleanValue) {
         $this->chkBooleanValue->Checked = $this->objAttributeValue->BooleanValue;
     }
     if ($this->lblBooleanValue) {
         $this->lblBooleanValue->Text = $this->objAttributeValue->BooleanValue ? QApplication::Translate('Yes') : QApplication::Translate('No');
     }
     if ($this->lstSingleAttributeOption) {
         $this->lstSingleAttributeOption->RemoveAllItems();
         $this->lstSingleAttributeOption->AddItem(QApplication::Translate('- Select One -'), null);
         $objSingleAttributeOptionArray = AttributeOption::LoadAll();
         if ($objSingleAttributeOptionArray) {
             foreach ($objSingleAttributeOptionArray as $objSingleAttributeOption) {
                 $objListItem = new QListItem($objSingleAttributeOption->__toString(), $objSingleAttributeOption->Id);
                 if ($this->objAttributeValue->SingleAttributeOption && $this->objAttributeValue->SingleAttributeOption->Id == $objSingleAttributeOption->Id) {
                     $objListItem->Selected = true;
                 }
                 $this->lstSingleAttributeOption->AddItem($objListItem);
             }
         }
     }
     if ($this->lblSingleAttributeOptionId) {
         $this->lblSingleAttributeOptionId->Text = $this->objAttributeValue->SingleAttributeOption ? $this->objAttributeValue->SingleAttributeOption->__toString() : null;
     }
     if ($this->lstAttributeOptionsAsMultiple) {
         $this->lstAttributeOptionsAsMultiple->RemoveAllItems();
         $objAssociatedArray = $this->objAttributeValue->GetAttributeOptionAsMultipleArray();
         $objAttributeOptionArray = AttributeOption::LoadAll();
         if ($objAttributeOptionArray) {
             foreach ($objAttributeOptionArray as $objAttributeOption) {
                 $objListItem = new QListItem($objAttributeOption->__toString(), $objAttributeOption->Id);
                 foreach ($objAssociatedArray as $objAssociated) {
                     if ($objAssociated->Id == $objAttributeOption->Id) {
                         $objListItem->Selected = true;
                     }
                 }
                 $this->lstAttributeOptionsAsMultiple->AddItem($objListItem);
             }
         }
     }
     if ($this->lblAttributeOptionsAsMultiple) {
         $objAssociatedArray = $this->objAttributeValue->GetAttributeOptionAsMultipleArray();
         $strItems = array();
         foreach ($objAssociatedArray as $objAssociated) {
             $strItems[] = $objAssociated->__toString();
         }
         $this->lblAttributeOptionsAsMultiple->Text = implode($strGlue, $strItems);
     }
 }