add correct handling of invisible widgets
add javadoc