widgetmodel/alfwidgetmodel/src/alfvisualtemplate.cpp
changeset 3 4526337fb576
parent 0 e83bab7cf002
equal deleted inserted replaced
2:b1a1f09f9110 3:4526337fb576
    29 #include <utf.h>
    29 #include <utf.h>
    30 #include <alf/alfimagevisual.h>
    30 #include <alf/alfimagevisual.h>
    31 #include <alf/alftexture.h>
    31 #include <alf/alftexture.h>
    32 #include <alf/alfenv.h>
    32 #include <alf/alfenv.h>
    33 #include <alf/alfexceptions.h>
    33 #include <alf/alfexceptions.h>
    34 #include "alf/alfperf.h"
    34 //#include "alf/alfperf.h"
    35 #include <osn/osnnew.h>
    35 #include <osn/osnnew.h>
    36 #include <alf/ialfelement.h>
    36 #include <alf/ialfelement.h>
    37 #include "alf/alfvisualtemplate.h"
    37 #include "alf/alfvisualtemplate.h"
    38 #include "alf/alfvarianttype.h"
    38 #include "alf/alfvarianttype.h"
    39 #include "alf/ialfattributesetter.h"
    39 #include "alf/ialfattributesetter.h"
   370     // Update the attributes.
   370     // Update the attributes.
   371     for (int i = 0; i < mAttributeArray.count(); ++i)
   371     for (int i = 0; i < mAttributeArray.count(); ++i)
   372         {
   372         {
   373         try
   373         try
   374             {
   374             {
   375             ALF_PERF_START( perfdata, "AlfVisualTemplate-updateVisualTree-SetAttributeValue")
   375             //ALF_PERF_START( perfdata, "AlfVisualTemplate-updateVisualTree-SetAttributeValue")
   376             mAttributeArray[i]->setAttributeValue(aVisual, mContainerArray[i], aData);
   376             mAttributeArray[i]->setAttributeValue(aVisual, mContainerArray[i], aData);
   377             ALF_PERF_STOP( perfdata, "AlfVisualTemplate-updateVisualTree-setAttributeValue")
   377             //ALF_PERF_STOP( perfdata, "AlfVisualTemplate-updateVisualTree-setAttributeValue")
   378             }
   378             }
   379         catch (...)
   379         catch (...)
   380             {
   380             {
   381             ALF_THROW(AlfAttributeException,EInvalidAttributeValue,"AlfVisualTemplate")
   381             ALF_THROW(AlfAttributeException,EInvalidAttributeValue,"AlfVisualTemplate")
   382             }
   382             }
   431     CAlfLayout *layout = NULL;
   431     CAlfLayout *layout = NULL;
   432     if (!mSelectOneChild)
   432     if (!mSelectOneChild)
   433         {
   433         {
   434         if (mVisualType < 0)
   434         if (mVisualType < 0)
   435             {
   435             {
   436             ALF_PERF_START( perfdata, "AlfVisualTemplate-createVisualTree-NewLayout")
   436             //ALF_PERF_START( perfdata, "AlfVisualTemplate-createVisualTree-NewLayout")
   437             // create layout
   437             // create layout
   438             result = layout = AlfVisualFactory::NewLayoutL(
   438             result = layout = AlfVisualFactory::NewLayoutL(
   439                                   (TAlfLayoutType)(-1 - mVisualType), aParentLayout, aControl, aControl.Env());
   439                                   (TAlfLayoutType)(-1 - mVisualType), aParentLayout, aControl, aControl.Env());
   440             ALF_PERF_STOP( perfdata, "AlfVisualTemplate-createVisualTree-NewLayout")
   440             //ALF_PERF_STOP( perfdata, "AlfVisualTemplate-createVisualTree-NewLayout")
   441             if (!result)
   441             if (!result)
   442                 {
   442                 {
   443                 ALF_THROW(AlfVisualException,ECanNotCreateVisual,"AlfVisualTemplate")
   443                 ALF_THROW(AlfVisualException,ECanNotCreateVisual,"AlfVisualTemplate")
   444                 }
   444                 }
   445             }
   445             }
   446         else
   446         else
   447             {
   447             {
   448             // create visual
   448             // create visual
   449             ALF_PERF_START( perfdata, "AlfVisualTemplate-createVisualTree-NewVisual")
   449             //ALF_PERF_START( perfdata, "AlfVisualTemplate-createVisualTree-NewVisual")
   450             result = AlfVisualFactory::NewVisualL(
   450             result = AlfVisualFactory::NewVisualL(
   451                          (TAlfVisualType)mVisualType, aParentLayout, aControl, aControl.Env());
   451                          (TAlfVisualType)mVisualType, aParentLayout, aControl, aControl.Env());
   452             ALF_PERF_STOP( perfdata, "AlfVisualTemplate-createVisualTree-NewVisual")
   452             //ALF_PERF_STOP( perfdata, "AlfVisualTemplate-createVisualTree-NewVisual")
   453             if (!result)
   453             if (!result)
   454                 {
   454                 {
   455                 ALF_THROW(AlfVisualException,ECanNotCreateVisual,"AlfVisualTemplate")
   455                 ALF_THROW(AlfVisualException,ECanNotCreateVisual,"AlfVisualTemplate")
   456                 }
   456                 }
   457 
   457 
   484         // Set the attributes
   484         // Set the attributes
   485         for (int i = 0; i < mAttributeArray.count(); ++i)
   485         for (int i = 0; i < mAttributeArray.count(); ++i)
   486             {
   486             {
   487             try
   487             try
   488                 {
   488                 {
   489                 ALF_PERF_START( perfdata, "AlfVisualTemplate-createVisualTree-setAttributeValue")
   489                 //ALF_PERF_START( perfdata, "AlfVisualTemplate-createVisualTree-setAttributeValue")
   490                 // set dirtines of all attribute in createvisualtree
   490                 // set dirtines of all attribute in createvisualtree
   491                 for(int j = 0; j < mContainerArray[i]->attributeCount() ;j++ )
   491                 for(int j = 0; j < mContainerArray[i]->attributeCount() ;j++ )
   492                     {
   492                     {
   493                     mContainerArray[i]->getAttribute(j).setDirty(true);
   493                     mContainerArray[i]->getAttribute(j).setDirty(true);
   494                     }
   494                     }
   495                 mAttributeArray[i]->setAttributeValue(*result, mContainerArray[i], aData);
   495                 mAttributeArray[i]->setAttributeValue(*result, mContainerArray[i], aData);
   496                 ALF_PERF_STOP( perfdata, "AlfVisualTemplate-createVisualTree-setAttributeValue")
   496                 //ALF_PERF_STOP( perfdata, "AlfVisualTemplate-createVisualTree-setAttributeValue")
   497                 }
   497                 }
   498             catch (...)
   498             catch (...)
   499                 {
   499                 {
   500                 ALF_THROW(AlfAttributeException,EInvalidAttributeValue,"AlfVisualTemplate")
   500                 ALF_THROW(AlfAttributeException,EInvalidAttributeValue,"AlfVisualTemplate")
   501                 }
   501                 }