Method for toggleTreeClass