Quintiq file version 2.0
#parent: #root
Method ShowHideComponents () id:Method_DialogSelectOptimizer_ShowHideComponents
{
  #keys: '[124808.0.1212040581]'
  Body:
  [*
    // Show / hide components
    inbound := guard( not SelectionStrategy.Data().IsBounded(), false );
    invalidkpiweight := guard( not SelectionStrategy.Data().IsValidKPIWeight(), false );
    isvisible := inbound or invalidkpiweight;
    
    text :="";
    if ( inbound )
    {
      text := Translations::MP_Designer_InboundStrategy_Warning();
    }
    else if( invalidkpiweight )
    {
      invalidkpiweightname := guard( select( SelectionStrategy.Data(), InvalidKPIWeight, kpiweight, true ).KPIName(), "" )
      text := Translations::Strategy_CanCopy_IsKPIWeightOK( invalidkpiweightname );
    }
    
    ImageOptimizerUnbounded.SetProperty( "Tooltip",text)
    ImageOptimizerUnbounded.Visible( isvisible );
    
    coversplanninghorizon := MacroPlan.GlobalParameters_MP().GetHasSelectedFullPlanningHorizon( SelectionPeriodFrom.Data(), SelectionPeriodTo.Data() );
    
    if( coversplanninghorizon )
    {
      ButtonPlanWholeHorizon.SetProperty( "Image", "CHECK" );                      
      ButtonPlanWholeHorizon.SetProperty( "Tooltip", Translations::MP_Optimizer_AllPlanningHorizonSelected_Tooltip() );
    }
    else
    {
      ButtonPlanWholeHorizon.SetProperty( "Image", "LM_HOR_FIX_PLUS" );
      ButtonPlanWholeHorizon.SetProperty( "Tooltip", Translations::MP_Optimizer_SelectAllPlanningHorizon_Tooltip() );
    }
  *]
}
