Refactor dockpanel