private void setVerticalScrollbar ( final CmsScrollBar scrollbar , int width ) { // Validate. if ( ( scrollbar == m_scrollbar ) || ( scrollbar == null ) ) { return ; } // Detach new child. scrollbar . asWidget ( ) . removeFromParent ( ) ; // Remove old child. if ( m_scrollbar != null ) { if ( m_verticalScrollbarHandlerRegistration != null ) { m_verticalScrollbarHandlerRegistration . removeHandler ( ) ; m_verticalScrollbarHandlerRegistration = null ; } remove ( m_scrollbar ) ; } m_scrollLayer . appendChild ( scrollbar . asWidget ( ) . getElement ( ) ) ; adopt ( scrollbar . asWidget ( ) ) ; // Logical attach. m_scrollbar = scrollbar ; m_verticalScrollbarWidth = width ; // Initialize the new scrollbar. m_verticalScrollbarHandlerRegistration = scrollbar . addValueChangeHandler ( new ValueChangeHandler < Integer > ( ) { public void onValueChange ( ValueChangeEvent < Integer > event ) { int vPos = scrollbar . getVerticalScrollPosition ( ) ; int v = getVerticalScrollPosition ( ) ; if ( v != vPos ) { setVerticalScrollPosition ( vPos ) ; } } } ) ; maybeUpdateScrollbars ( ) ; }
Set the scrollbar used for vertical scrolling .