Manage tree_state attribute

issue4028
review10391003