示例#1
0
bool ModelServicesImp::setElementName(DataElement* pElement, const string& name)
{
    DataDescriptorImp* pDescriptor = dynamic_cast<DataDescriptorImp*>(pElement->getDataDescriptor());
    VERIFY(pDescriptor != NULL);

    if (getElement(name, pDescriptor->getType(), pDescriptor->getParent()) != NULL)
    {
        return false;
    }

    VERIFY(removeElement(pElement));
    dynamic_cast<DataElementImp*>(pElement)->setName(name);
    VERIFY(addElement(pElement));

    return true;
}
示例#2
0
bool ModelServicesImp::setElementParent(DataElement* pElement, DataElement *pParent)
{
    DataDescriptorImp* pDescriptor = dynamic_cast<DataDescriptorImp*>(pElement->getDataDescriptor());
    VERIFY(pDescriptor != NULL);

    if (getElement(pDescriptor->getName(), pDescriptor->getType(), pParent) != NULL)
    {
        return false;
    }

    VERIFY(removeElement(pElement));
    pDescriptor->setParent(pParent);
    VERIFY(addElement(pElement));

    notify(SIGNAL_NAME(ModelServices, ElementReparented), boost::any(pElement));
    return true;
}
示例#3
0
DataElementImp::DataElementImp(const DataDescriptorImp& descriptor, const string& id) :
   SessionItemImp(id, descriptor.getName()),
   mpDataDescriptor(dynamic_cast<DataDescriptorImp*>(descriptor.copy()))
{
   if (mpDataDescriptor != NULL)
   {
      addPropertiesPage("Data Descriptor Properties");

      if (mpDataDescriptor->getFileDescriptor() != NULL)
      {
         addPropertiesPage("File Descriptor Properties");
      }

      addPropertiesPage("Classification Properties");
      addPropertiesPage("Metadata Properties");
   }

   // Attach to the data descriptor to notify when the descriptor changes
   if (mpDataDescriptor != NULL)
   {
      mpDataDescriptor->attach(SIGNAL_NAME(DataDescriptor, Renamed), Slot(this, &DataElementImp::descriptorRenamed));
      mpDataDescriptor->attach(SIGNAL_NAME(Subject, Modified), Slot(this, &DataElementImp::descriptorModified));
   }
}