The indentation is feasible, and the logic, you'll have to craft it on your own.
You could set a FieldChangeListener on every checkbox field so that you can detect when a checkbox have been checked/unchecked. If the parent is checked or unchecked, manually call setChecked
over each children field to check/uncheck them. For the children, when one is unchecked, uncheck the parent.
This is the basic logic for a single nesting level (parent and children) Make sure to check in the listeners that the event firing the update of the binded checkbox fields is user generated (not programmatic), because the change listener is also called back when you programmatically call setChecked
. If not taken into consideration, you'll run into undesired propagation and infinite loops. Of course, if you had more than one level of nesting, then you'll need to care about programmatically fired events.