add methods exectued before a panel shows and hides.