// Updating all parent node states
E parent = ( E ) node.getParent ();
while ( parent != null )
{
// Calculating parent state
CheckState state = CheckState.unchecked;
boolean hasChecked = false;
boolean hasUnchecked = false;
for ( int i = 0; i < parent.getChildCount (); i++ )
{
final CheckState checkState = getCheckState ( ( E ) parent.getChildAt ( i ) );
if ( checkState == CheckState.mixed )
{
state = CheckState.mixed;
break;
}
else if ( checkState == CheckState.checked )
{
hasChecked = true;
if ( hasUnchecked )
{
state = CheckState.mixed;
break;
}
else
{
state = CheckState.checked;
}
}
else if ( checkState == CheckState.unchecked )
{
hasUnchecked = true;
if ( hasChecked )
{
state = CheckState.mixed;
break;
}
else
{
state = CheckState.unchecked;
}
}
}
final CheckState oldState = getCheckState ( parent );
if ( oldState != state )
{
// Saving changes
if ( changes != null )
{