Quintiq file version 2.0
#parent: #root
Method CheckUncheckCheckBox (
  shadow[UserImportProfile] userprofile,
  shadow[DefaultImportProfile] defaultprofile,
  internal[WebCheckbox] scenariospeccheckbox,
  internal[WebCheckbox] globalcheckbox
) id:Method_ApplicationMacroPlanner_CheckUncheckCheckBox
{
  #keys: '[136682.0.2038927049]'
  Body:
  [*
    // Check checkbox if all import group is included
    // Need two subclass due to shadow scope (base class relation not established yet)
    if( not isnull( scenariospeccheckbox ) )
    {
      checkAllScenario := scenariospeccheckbox.Checked();
      
      if( not isnull( defaultprofile ) )
      { 
        checkAllScenario := forall( defaultprofile, ImportObjectGroupInDefaultProfile, e,
                                    not e.ImportObjectGroup().IsGlobal(),
                                    e.IsIncludeInImportExport() );                                     
      }   
      else
      {
        checkAllScenario := forall( userprofile, ImportObjectGroupInUserProfile, e,
                                    not e.ImportObjectGroup().IsGlobal(),
                                    e.IsIncludeInImportExport() );
      }
                         
      scenariospeccheckbox.Checked( checkAllScenario );
    }  
    
    // There is no global for user profile
    if( not isnull( globalcheckbox )
        and not isnull( defaultprofile ) )
    {
      checkAllGlob := forall( defaultprofile, ImportObjectGroupInDefaultProfile, e,
                              e.ImportObjectGroup().IsGlobal(),
                              e.IsIncludeInImportExport() );                            
                                
      globalcheckbox.Checked( checkAllGlob );
    }
  *]
}
