GCP-5515 (Fix error on ClassCastException) and GCP-5517 Refactor ViewTraitObservationDialog for VariateType