/** * The following theme parameters are required by the scroll pane: * * <table> * <tr> * <th>Parameter name</th> * <th>Type</th> * <th>Description</th> * </tr> * <tr> * <td>autoScrollArea</td> * <td>integer</td> * <td>The size of the auto scroll area</td> * </tr> * <tr> * <td>autoScrollSpeed</td> * <td>integer</td> * <td>The speed in pixels to scroll every 50 ms</td> * </tr> * <tr> * <td>hasDragButton</td> * <td>boolean</td> * <td>If the dragButton should be shown or not</td> * </tr> * <tr> * <td>scrollbarsAlwaysVisible</td> * <td>boolean</td> * <td>Show scrollbars always (true) or only when needed (false)</td> * </tr> * </table> * * <br> * The following optional parameters can be used to change the appearance of the scroll pane: * * <table> * <tr> * <th>Parameter name</th> * <th>Type</th> * <th>Description</th> * </tr> * <tr> * <td>hscrollbarOffset</td> * <td>Dimension</td> * <td>Moves the horizontal scrollbar but does not change the available area * for the scroll content.</td> * </tr> * <tr> * <td>vscrollbarOffset</td> * <td>Dimension</td> * <td>Moves the vertical scrollbar but does not change the available area * for the scroll content.</td> * </tr> * <tr> * <td>contentScrollbarSpacing</td> * <td>Dimension</td> * <td>An optional spacing between the scrollbar and the content area. This * is only applied when the corresponding scrollbar is visible. It should be * >= 0.</td> * </tr> * </table> * * @param themeInfo the theme info */ protected void applyThemeScrollPane(ThemeInfo themeInfo) { autoScrollArea = themeInfo.getParameter("autoScrollArea", 5); autoScrollSpeed = themeInfo.getParameter("autoScrollSpeed", autoScrollArea * 2); hscrollbarOffset = themeInfo.getParameterValue("hscrollbarOffset", false, Dimension.class, Dimension.ZERO); vscrollbarOffset = themeInfo.getParameterValue("vscrollbarOffset", false, Dimension.class, Dimension.ZERO); contentScrollbarSpacing = themeInfo.getParameterValue( "contentScrollbarSpacing", false, Dimension.class, Dimension.ZERO); scrollbarsAlwaysVisible = themeInfo.getParameter("scrollbarsAlwaysVisible", false); boolean hasDragButton = themeInfo.getParameter("hasDragButton", false); if (hasDragButton && dragButton == null) { dragButton = new DraggableButton(); dragButton.setTheme("dragButton"); dragButton.setListener( new DraggableButton.DragListener() { public void dragStarted() { scrollbarH.externalDragStart(); scrollbarV.externalDragStart(); } public void dragged(int deltaX, int deltaY) { scrollbarH.externalDragged(deltaX, deltaY); scrollbarV.externalDragged(deltaX, deltaY); } public void dragStopped() { scrollbarH.externalDragStopped(); scrollbarV.externalDragStopped(); } }); super.insertChild(dragButton, 3); } else if (!hasDragButton && dragButton != null) { assert super.getChild(3) == dragButton; super.removeChild(3); dragButton = null; } }