import com.google.gwt.event.shared.HandlerManager;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.user.client.DOM;
+import com.google.gwt.user.client.Event;
+import com.google.gwt.user.client.EventListener;
+import com.google.gwt.user.client.Timer;
/**
* An element-like bundle representing a configurable and visual scrollbar in
*/
abstract class ScrollbarBundle {
+ private class TemporaryResizer extends Object {
+ private static final int TEMPORARY_RESIZE_DELAY = 1000;
+
+ private final Timer timer = new Timer() {
+ @Override
+ public void run() {
+ internalSetScrollbarThickness(1);
+ }
+ };
+
+ public void show() {
+ internalSetScrollbarThickness(OSX_INVISIBLE_SCROLLBAR_FAKE_SIZE_PX);
+ timer.schedule(TEMPORARY_RESIZE_DELAY);
+ }
+ }
+
/**
* A means to listen to when the scrollbar handle in a
* {@link ScrollbarBundle} either appears or is removed.
@Deprecated
private HandlerManager handlerManager;
+ private TemporaryResizer invisibleScrollbarTemporaryResizer = new TemporaryResizer();
+
private ScrollbarBundle() {
root.appendChild(scrollSizeElement);
+ Event.sinkEvents(root, Event.ONSCROLL);
+ Event.setEventListener(root, new EventListener() {
+ @Override
+ public void onBrowserEvent(Event event) {
+ invisibleScrollbarTemporaryResizer.show();
+ }
+ });
}
protected abstract int internalGetScrollSize();
scrollPos = Math.max(0, Math.min(maxScrollPos, truncate(px)));
if (!pixelValuesEqual(oldScrollPos, scrollPos)) {
+ if (isInvisibleScrollbar) {
+ invisibleScrollbarTemporaryResizer.show();
+ }
+
/*
* This is where the value needs to be converted into an integer no
* matter how we flip it, since GWT expects an integer value.
*/
public final void setScrollbarThickness(int px) {
isInvisibleScrollbar = (px == 0);
- internalSetScrollbarThickness(px != 0 ? Math.max(0, px)
- : OSX_INVISIBLE_SCROLLBAR_FAKE_SIZE_PX);
+ internalSetScrollbarThickness(Math.max(1, px));
}
/**