ソースを参照

Scheduler.ScheduledCommand and RepeatingCommand to be lambda (#10203)

* Scheduler.ScheduledCommand and RepeatingCommand to be lambda

* Restore <table> in javadoc

* Fix docs
tags/8.2.0.alpha3
Ahmed Ashour 6年前
コミット
03570cb874
29個のファイルの変更415行の追加763行の削除
  1. 9
    16
      client/src/main/java/com/vaadin/client/ApplicationConfiguration.java
  2. 2
    9
      client/src/main/java/com/vaadin/client/VSchedulerImpl.java
  3. 2
    7
      client/src/main/java/com/vaadin/client/VUIDLBrowser.java
  4. 15
    21
      client/src/main/java/com/vaadin/client/WidgetUtil.java
  5. 4
    10
      client/src/main/java/com/vaadin/client/communication/DefaultReconnectDialog.java
  6. 3
    7
      client/src/main/java/com/vaadin/client/communication/MessageHandler.java
  7. 6
    9
      client/src/main/java/com/vaadin/client/communication/ServerRpcQueue.java
  8. 11
    16
      client/src/main/java/com/vaadin/client/connectors/grid/DetailsManagerConnector.java
  9. 3
    6
      client/src/main/java/com/vaadin/client/data/AbstractRemoteDataSource.java
  10. 16
    20
      client/src/main/java/com/vaadin/client/debug/internal/VDebugWindow.java
  11. 5
    10
      client/src/main/java/com/vaadin/client/ui/FocusableScrollPanel.java
  12. 2
    7
      client/src/main/java/com/vaadin/client/ui/ImageIcon.java
  13. 11
    17
      client/src/main/java/com/vaadin/client/ui/VComboBox.java
  14. 1
    7
      client/src/main/java/com/vaadin/client/ui/VContextMenu.java
  15. 1
    8
      client/src/main/java/com/vaadin/client/ui/VMenuBar.java
  16. 6
    10
      client/src/main/java/com/vaadin/client/ui/VPopupView.java
  17. 4
    10
      client/src/main/java/com/vaadin/client/ui/VSlider.java
  18. 2
    7
      client/src/main/java/com/vaadin/client/ui/VTabsheet.java
  19. 1
    9
      client/src/main/java/com/vaadin/client/ui/VUI.java
  20. 31
    35
      client/src/main/java/com/vaadin/client/ui/VUpload.java
  21. 1
    8
      client/src/main/java/com/vaadin/client/ui/VWindow.java
  22. 10
    16
      client/src/main/java/com/vaadin/client/ui/dd/VDragAndDropManager.java
  23. 2
    7
      client/src/main/java/com/vaadin/client/ui/orderedlayout/AbstractOrderedLayoutConnector.java
  24. 12
    20
      client/src/main/java/com/vaadin/client/ui/ui/UIConnector.java
  25. 1
    8
      client/src/main/java/com/vaadin/client/ui/window/WindowConnector.java
  26. 27
    32
      client/src/main/java/com/vaadin/client/widget/escalator/ScrollbarBundle.java
  27. 74
    93
      client/src/main/java/com/vaadin/client/widgets/Escalator.java
  28. 23
    51
      client/src/main/java/com/vaadin/client/widgets/Grid.java
  29. 130
    287
      uitest/src/main/java/com/vaadin/tests/widgetset/client/grid/EscalatorBasicClientFeaturesWidget.java

+ 9
- 16
client/src/main/java/com/vaadin/client/ApplicationConfiguration.java ファイルの表示

import com.google.gwt.core.client.JsArrayString; import com.google.gwt.core.client.JsArrayString;
import com.google.gwt.core.client.RunAsyncCallback; import com.google.gwt.core.client.RunAsyncCallback;
import com.google.gwt.core.client.Scheduler; import com.google.gwt.core.client.Scheduler;
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
import com.google.gwt.core.client.ScriptInjector; import com.google.gwt.core.client.ScriptInjector;
import com.google.gwt.dom.client.Element; import com.google.gwt.dom.client.Element;
import com.google.gwt.logging.client.LogConfiguration; import com.google.gwt.logging.client.LogConfiguration;
* element into which the application should be rendered. * element into which the application should be rendered.
*/ */
public static void startApplication(final String applicationId) { public static void startApplication(final String applicationId) {
Scheduler.get().scheduleDeferred(new ScheduledCommand() {

@Override
public void execute() {
Profiler.enter("ApplicationConfiguration.startApplication");
ApplicationConfiguration appConf = getConfigFromDOM(
applicationId);
ApplicationConnection a = GWT
.create(ApplicationConnection.class);
a.init(widgetSet, appConf);
runningApplications.add(a);
Profiler.leave("ApplicationConfiguration.startApplication");

a.start();
}
Scheduler.get().scheduleDeferred(() -> {
Profiler.enter("ApplicationConfiguration.startApplication");
ApplicationConfiguration appConf = getConfigFromDOM(applicationId);
ApplicationConnection a = GWT.create(ApplicationConnection.class);
a.init(widgetSet, appConf);
runningApplications.add(a);
Profiler.leave("ApplicationConfiguration.startApplication");

a.start();
}); });
} }



+ 2
- 9
client/src/main/java/com/vaadin/client/VSchedulerImpl.java ファイルの表示

public void scheduleDeferred(ScheduledCommand cmd) { public void scheduleDeferred(ScheduledCommand cmd) {
deferredCommandTrackers++; deferredCommandTrackers++;
super.scheduleDeferred(cmd); super.scheduleDeferred(cmd);
super.scheduleDeferred(new ScheduledCommand() {

@Override
public void execute() {
deferredCommandTrackers--;
}
});
super.scheduleDeferred(() -> deferredCommandTrackers--);
} }


public boolean hasWorkQueued() { public boolean hasWorkQueued() {
boolean hasWorkQueued = (deferredCommandTrackers != 0);
return hasWorkQueued;
return deferredCommandTrackers != 0;
} }
} }

+ 2
- 7
client/src/main/java/com/vaadin/client/VUIDLBrowser.java ファイルの表示

import com.google.gwt.core.client.JsArray; import com.google.gwt.core.client.JsArray;
import com.google.gwt.core.client.JsArrayString; import com.google.gwt.core.client.JsArrayString;
import com.google.gwt.core.client.Scheduler; import com.google.gwt.core.client.Scheduler;
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
import com.google.gwt.dom.client.Document; import com.google.gwt.dom.client.Document;
import com.google.gwt.dom.client.Element; import com.google.gwt.dom.client.Element;
import com.google.gwt.dom.client.Style; import com.google.gwt.dom.client.Style;
} }
if (highlightedPid != null && highlightedPid.equals(uidl.getId())) { if (highlightedPid != null && highlightedPid.equals(uidl.getId())) {
getElement().getStyle().setBackgroundColor("#fdd"); getElement().getStyle().setBackgroundColor("#fdd");
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
@Override
public void execute() {
getElement().scrollIntoView();
}
});
Scheduler.get()
.scheduleDeferred(() -> getElement().scrollIntoView());
} }
} }
} }

+ 15
- 21
client/src/main/java/com/vaadin/client/WidgetUtil.java ファイルの表示



import com.google.gwt.core.client.JavaScriptObject; import com.google.gwt.core.client.JavaScriptObject;
import com.google.gwt.core.client.Scheduler; import com.google.gwt.core.client.Scheduler;
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
import com.google.gwt.dom.client.AnchorElement; import com.google.gwt.dom.client.AnchorElement;
import com.google.gwt.dom.client.DivElement; import com.google.gwt.dom.client.DivElement;
import com.google.gwt.dom.client.Document; import com.google.gwt.dom.client.Document;
com.google.gwt.dom.client.Element el, String p) com.google.gwt.dom.client.Element el, String p)
/*-{ /*-{
try { try {
if (el.currentStyle) { if (el.currentStyle) {
// IE // IE
return el.currentStyle[p]; return el.currentStyle[p];
} catch (e) { } catch (e) {
return ""; return "";
} }
}-*/; }-*/;


/** /**
try { try {
el.focus(); el.focus();
} catch (e) { } catch (e) {
} }
}-*/; }-*/;


((Focusable) targetWidget).focus(); ((Focusable) targetWidget).focus();
} }


Scheduler.get().scheduleDeferred(new ScheduledCommand() {
@Override
public void execute() {
try {
target.dispatchEvent(createMouseDownEvent);
target.dispatchEvent(createMouseUpEvent);
target.dispatchEvent(createMouseClickEvent);
} catch (Exception e) {
}

Scheduler.get().scheduleDeferred(() -> {
try {
target.dispatchEvent(createMouseDownEvent);
target.dispatchEvent(createMouseUpEvent);
target.dispatchEvent(createMouseClickEvent);
} catch (Exception e) {
} }
}); });

} }


/** /**
if ($wnd.document.activeElement) { if ($wnd.document.activeElement) {
return $wnd.document.activeElement; return $wnd.document.activeElement;
} }
return null; return null;
}-*/; }-*/;


/*-{ /*-{
var top = elem.offsetTop; var top = elem.offsetTop;
var height = elem.offsetHeight; var height = elem.offsetHeight;
if (elem.parentNode != elem.offsetParent) { if (elem.parentNode != elem.offsetParent) {
top -= elem.parentNode.offsetTop; top -= elem.parentNode.offsetTop;
} }
var cur = elem.parentNode; var cur = elem.parentNode;
while (cur && (cur.nodeType == 1)) { while (cur && (cur.nodeType == 1)) {
if (top < cur.scrollTop) { if (top < cur.scrollTop) {
if (top + height > cur.scrollTop + cur.clientHeight) { if (top + height > cur.scrollTop + cur.clientHeight) {
cur.scrollTop = (top + height) - cur.clientHeight; cur.scrollTop = (top + height) - cur.clientHeight;
} }
var offsetTop = cur.offsetTop; var offsetTop = cur.offsetTop;
if (cur.parentNode != cur.offsetParent) { if (cur.parentNode != cur.offsetParent) {
offsetTop -= cur.parentNode.offsetTop; offsetTop -= cur.parentNode.offsetTop;
} }
top += offsetTop - cur.scrollTop; top += offsetTop - cur.scrollTop;
cur = cur.parentNode; cur = cur.parentNode;
} }
} }
var heightWithoutBorder = cloneElement.offsetHeight; var heightWithoutBorder = cloneElement.offsetHeight;
parentElement.removeChild(cloneElement); parentElement.removeChild(cloneElement);
return heightWithBorder - heightWithoutBorder; return heightWithBorder - heightWithoutBorder;
} }
}-*/; }-*/;

+ 4
- 10
client/src/main/java/com/vaadin/client/communication/DefaultReconnectDialog.java ファイルの表示

package com.vaadin.client.communication; package com.vaadin.client.communication;


import com.google.gwt.core.client.Scheduler; import com.google.gwt.core.client.Scheduler;
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
import com.google.gwt.core.shared.GWT; import com.google.gwt.core.shared.GWT;
import com.google.gwt.dom.client.BodyElement; import com.google.gwt.dom.client.BodyElement;
import com.google.gwt.dom.client.Document; import com.google.gwt.dom.client.Document;
getElement().getStyle().setVisibility(Visibility.HIDDEN); getElement().getStyle().setVisibility(Visibility.HIDDEN);
setStyleName(STYLE_RECONNECTING, true); setStyleName(STYLE_RECONNECTING, true);


Scheduler.get().scheduleDeferred(new ScheduledCommand() {

@Override
public void execute() {
getElement().getStyle().setVisibility(Visibility.VISIBLE);
setStyleName(STYLE_RECONNECTING, false);
hide();

}
Scheduler.get().scheduleDeferred(() -> {
getElement().getStyle().setVisibility(Visibility.VISIBLE);
setStyleName(STYLE_RECONNECTING, false);
hide();
}); });
} }
} }

+ 3
- 7
client/src/main/java/com/vaadin/client/communication/MessageHandler.java ファイルの表示

import com.google.gwt.core.client.JsArray; import com.google.gwt.core.client.JsArray;
import com.google.gwt.core.client.JsArrayString; import com.google.gwt.core.client.JsArrayString;
import com.google.gwt.core.client.Scheduler; import com.google.gwt.core.client.Scheduler;
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
import com.google.gwt.user.client.Command; import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.Timer; import com.google.gwt.user.client.Timer;
import com.google.gwt.user.client.ui.Widget; import com.google.gwt.user.client.ui.Widget;
ConnectorBundleLoader.get().ensureDeferredBundleLoaded(); ConnectorBundleLoader.get().ensureDeferredBundleLoaded();


if (Profiler.isEnabled()) { if (Profiler.isEnabled()) {
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
@Override
public void execute() {
Profiler.logTimings();
Profiler.reset();
}
Scheduler.get().scheduleDeferred(() -> {
Profiler.logTimings();
Profiler.reset();
}); });
} }
} }

+ 6
- 9
client/src/main/java/com/vaadin/client/communication/ServerRpcQueue.java ファイルの表示

Scheduler.get().scheduleFinally(scheduledFlushCommand); Scheduler.get().scheduleFinally(scheduledFlushCommand);
} }


private final ScheduledCommand scheduledFlushCommand = new ScheduledCommand() {
@Override
public void execute() {
flushScheduled = false;
if (!isFlushPending()) {
// Somebody else cleared the queue before we had the chance
return;
}
connection.getMessageSender().sendInvocationsToServer();
private final ScheduledCommand scheduledFlushCommand = () -> {
flushScheduled = false;
if (!isFlushPending()) {
// Somebody else cleared the queue before we had the chance
return;
} }
connection.getMessageSender().sendInvocationsToServer();
}; };


/** /**

+ 11
- 16
client/src/main/java/com/vaadin/client/connectors/grid/DetailsManagerConnector.java ファイルの表示



private ScheduledCommand createResizeCommand(final int rowIndex, private ScheduledCommand createResizeCommand(final int rowIndex,
final Element element) { final Element element) {
return new ScheduledCommand() {

@Override
public void execute() {
// It should not be possible to get here without calculating
// the spacerCellBorderHeights or without having the details
// row open, nor for this command to be triggered while
// layout is running, but it's safer to check anyway.
if (spacerCellBorderHeights != null
&& !getLayoutManager().isLayoutRunning()
&& getDetailsComponentConnectorId(
rowIndex) != null) {
double height = getLayoutManager().getOuterHeightDouble(
element) + spacerCellBorderHeights;
getWidget().setDetailsHeight(rowIndex, height);
}
return () -> {
// It should not be possible to get here without calculating
// the spacerCellBorderHeights or without having the details
// row open, nor for this command to be triggered while
// layout is running, but it's safer to check anyway.
if (spacerCellBorderHeights != null
&& !getLayoutManager().isLayoutRunning()
&& getDetailsComponentConnectorId(rowIndex) != null) {
double height = getLayoutManager().getOuterHeightDouble(
element) + spacerCellBorderHeights;
getWidget().setDetailsHeight(rowIndex, height);
} }
}; };
} }

+ 3
- 6
client/src/main/java/com/vaadin/client/data/AbstractRemoteDataSource.java ファイルの表示



private CacheStrategy cacheStrategy = new CacheStrategy.DefaultCacheStrategy(); private CacheStrategy cacheStrategy = new CacheStrategy.DefaultCacheStrategy();


private final ScheduledCommand coverageChecker = new ScheduledCommand() {
@Override
public void execute() {
coverageCheckPending = false;
checkCacheCoverage();
}
private final ScheduledCommand coverageChecker = () -> {
coverageCheckPending = false;
checkCacheCoverage();
}; };


private Map<Object, Integer> pinnedCounts = new HashMap<>(); private Map<Object, Integer> pinnedCounts = new HashMap<>();

+ 16
- 20
client/src/main/java/com/vaadin/client/debug/internal/VDebugWindow.java ファイルの表示



import com.google.gwt.core.client.Duration; import com.google.gwt.core.client.Duration;
import com.google.gwt.core.client.Scheduler; import com.google.gwt.core.client.Scheduler;
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
import com.google.gwt.core.shared.GWT; import com.google.gwt.core.shared.GWT;
import com.google.gwt.dom.client.Element; import com.google.gwt.dom.client.Element;
import com.google.gwt.dom.client.NativeEvent; import com.google.gwt.dom.client.NativeEvent;
* Finalize initialization when all entry points have had the chance to * Finalize initialization when all entry points have had the chance to
* e.g. register new sections. * e.g. register new sections.
*/ */
Scheduler.get().scheduleFinally(new ScheduledCommand() {
@Override
public void execute() {
readStoredState();

Window.addResizeHandler(
new com.google.gwt.event.logical.shared.ResizeHandler() {
Scheduler.get().scheduleFinally(() -> {
readStoredState();


Timer t = new Timer() {
@Override
public void run() {
applyPositionAndSize();
}
};
Window.addResizeHandler(
new com.google.gwt.event.logical.shared.ResizeHandler() {


Timer t = new Timer() {
@Override @Override
public void onResize(ResizeEvent event) {
t.cancel();
// TODO less
t.schedule(1000);
public void run() {
applyPositionAndSize();
} }
});
}
};

@Override
public void onResize(ResizeEvent event) {
t.cancel();
// TODO less
t.schedule(1000);
}
});
}); });
} }



+ 5
- 10
client/src/main/java/com/vaadin/client/ui/FocusableScrollPanel.java ファイルの表示

import java.util.List; import java.util.List;


import com.google.gwt.core.client.Scheduler; import com.google.gwt.core.client.Scheduler;
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
import com.google.gwt.dom.client.DivElement; import com.google.gwt.dom.client.DivElement;
import com.google.gwt.dom.client.Document; import com.google.gwt.dom.client.Document;
import com.google.gwt.dom.client.Style; import com.google.gwt.dom.client.Style;


@Override @Override
public void onScroll(ScrollEvent event) { public void onScroll(ScrollEvent event) {
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
@Override
public void execute() {
focusElement.getStyle().setTop(getScrollPosition(), Unit.PX);
focusElement.getStyle().setLeft(getHorizontalScrollPosition(),
Unit.PX);
}
Scheduler.get().scheduleDeferred(() -> {
focusElement.getStyle().setTop(getScrollPosition(), Unit.PX);
focusElement.getStyle().setLeft(getHorizontalScrollPosition(),
Unit.PX);
}); });
} }


public com.google.gwt.user.client.Element getFocusElement() { public com.google.gwt.user.client.Element getFocusElement() {
if (useFakeFocusElement()) { if (useFakeFocusElement()) {
return focusElement.cast(); return focusElement.cast();
} else {
return getElement();
} }
return getElement();
} }


} }

+ 2
- 7
client/src/main/java/com/vaadin/client/ui/ImageIcon.java ファイルの表示

package com.vaadin.client.ui; package com.vaadin.client.ui;


import com.google.gwt.core.client.Scheduler; import com.google.gwt.core.client.Scheduler;
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
import com.google.gwt.user.client.DOM; import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.Event; import com.google.gwt.user.client.Event;
import com.vaadin.client.BrowserInfo; import com.vaadin.client.BrowserInfo;


if (BrowserInfo.get().isIE()) { if (BrowserInfo.get().isIE()) {
// apply src later for IE, to ensure onload is fired // apply src later for IE, to ensure onload is fired
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
@Override
public void execute() {
DOM.setElementProperty(getElement(), "src", imageUrl);
}
});
Scheduler.get().scheduleDeferred(() -> DOM
.setElementProperty(getElement(), "src", imageUrl));
} }


DOM.setElementProperty(getElement(), "src", imageUrl); DOM.setElementProperty(getElement(), "src", imageUrl);

+ 11
- 17
client/src/main/java/com/vaadin/client/ui/VComboBox.java ファイルの表示

import com.google.gwt.animation.client.AnimationScheduler; import com.google.gwt.animation.client.AnimationScheduler;
import com.google.gwt.aria.client.Roles; import com.google.gwt.aria.client.Roles;
import com.google.gwt.core.client.JavaScriptObject; import com.google.gwt.core.client.JavaScriptObject;
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
import com.google.gwt.dom.client.Document; import com.google.gwt.dom.client.Document;
import com.google.gwt.dom.client.Element; import com.google.gwt.dom.client.Element;
import com.google.gwt.dom.client.NativeEvent; import com.google.gwt.dom.client.NativeEvent;
return $entry(function(e) { return $entry(function(e) {
var deltaX = e.deltaX ? e.deltaX : -0.5*e.wheelDeltaX; var deltaX = e.deltaX ? e.deltaX : -0.5*e.wheelDeltaX;
var deltaY = e.deltaY ? e.deltaY : -0.5*e.wheelDeltaY; var deltaY = e.deltaY ? e.deltaY : -0.5*e.wheelDeltaY;
// IE8 has only delta y // IE8 has only delta y
if (isNaN(deltaY)) { if (isNaN(deltaY)) {
deltaY = -0.5*e.wheelDelta; deltaY = -0.5*e.wheelDelta;
} }
@com.vaadin.client.ui.VComboBox.JsniUtil::moveScrollFromEvent(*)(widget, deltaX, deltaY, e, e.deltaMode); @com.vaadin.client.ui.VComboBox.JsniUtil::moveScrollFromEvent(*)(widget, deltaX, deltaY, e, e.deltaMode);
}); });
}-*/; }-*/;
implements SubPartAware, LoadHandler { implements SubPartAware, LoadHandler {


private VLazyExecutor delayedImageLoadExecutioner = new VLazyExecutor( private VLazyExecutor delayedImageLoadExecutioner = new VLazyExecutor(
100, new ScheduledCommand() {

@Override
public void execute() {
debug("VComboBox.SM: delayedImageLoadExecutioner()");
if (suggestionPopup.isVisible()
&& suggestionPopup.isAttached()) {
setWidth("");
getElement().getFirstChildElement().getStyle()
.clearWidth();
suggestionPopup
.setPopupPositionAndShow(suggestionPopup);
}

100, () -> {
debug("VComboBox.SM: delayedImageLoadExecutioner()");
if (suggestionPopup.isVisible()
&& suggestionPopup.isAttached()) {
setWidth("");
getElement().getFirstChildElement().getStyle()
.clearWidth();
suggestionPopup
.setPopupPositionAndShow(suggestionPopup);
} }
}); });



+ 1
- 7
client/src/main/java/com/vaadin/client/ui/VContextMenu.java ファイルの表示

package com.vaadin.client.ui; package com.vaadin.client.ui;


import com.google.gwt.core.client.Scheduler; import com.google.gwt.core.client.Scheduler;
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
import com.google.gwt.dom.client.Element; import com.google.gwt.dom.client.Element;
import com.google.gwt.dom.client.NodeList; import com.google.gwt.dom.client.NodeList;
import com.google.gwt.dom.client.TableRowElement; import com.google.gwt.dom.client.TableRowElement;
private Element focusedElement; private Element focusedElement;


private VLazyExecutor delayedImageLoadExecutioner = new VLazyExecutor(100, private VLazyExecutor delayedImageLoadExecutioner = new VLazyExecutor(100,
new ScheduledCommand() {
@Override
public void execute() {
imagesLoaded();
}
});
() -> imagesLoaded());


/** /**
* This method should be used only by Client object as only one per client * This method should be used only by Client object as only one per client

+ 1
- 8
client/src/main/java/com/vaadin/client/ui/VMenuBar.java ファイルの表示

import java.util.Queue; import java.util.Queue;


import com.google.gwt.core.client.GWT; import com.google.gwt.core.client.GWT;
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
import com.google.gwt.dom.client.Element; import com.google.gwt.dom.client.Element;
import com.google.gwt.dom.client.Style; import com.google.gwt.dom.client.Style;
import com.google.gwt.dom.client.Style.Overflow; import com.google.gwt.dom.client.Style.Overflow;
public boolean enabled = true; public boolean enabled = true;


private VLazyExecutor iconLoadedExecutioner = new VLazyExecutor(100, private VLazyExecutor iconLoadedExecutioner = new VLazyExecutor(100,
new ScheduledCommand() {

@Override
public void execute() {
iLayout(true);
}
});
() -> iLayout(true));


/** For internal use only. May be removed or replaced in the future. */ /** For internal use only. May be removed or replaced in the future. */
public boolean openRootOnHover; public boolean openRootOnHover;

+ 6
- 10
client/src/main/java/com/vaadin/client/ui/VPopupView.java ファイルの表示

import java.util.Set; import java.util.Set;


import com.google.gwt.core.client.Scheduler; import com.google.gwt.core.client.Scheduler;
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
import com.google.gwt.dom.client.Element; import com.google.gwt.dom.client.Element;
import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler; import com.google.gwt.event.dom.client.ClickHandler;
* could be no shortcutActionHandler set yet. So let's postpone * could be no shortcutActionHandler set yet. So let's postpone
* search of shortcutActionHandler. * search of shortcutActionHandler.
*/ */
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
@Override
public void execute() {
try {
if (shortcutActionHandler == null) {
shortcutActionHandler = findShortcutActionHandler();
}
} finally {
popupShowInProgress = false;
Scheduler.get().scheduleDeferred(() -> {
try {
if (shortcutActionHandler == null) {
shortcutActionHandler = findShortcutActionHandler();
} }
} finally {
popupShowInProgress = false;
} }
}); });
} }

+ 4
- 10
client/src/main/java/com/vaadin/client/ui/VSlider.java ファイルの表示

package com.vaadin.client.ui; package com.vaadin.client.ui;


import com.google.gwt.core.client.Scheduler; import com.google.gwt.core.client.Scheduler;
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
import com.google.gwt.dom.client.Element; import com.google.gwt.dom.client.Element;
import com.google.gwt.dom.client.Style.Display; import com.google.gwt.dom.client.Style.Display;
import com.google.gwt.dom.client.Style.Overflow; import com.google.gwt.dom.client.Style.Overflow;
/* Temporary dragging/animation variables */ /* Temporary dragging/animation variables */
private boolean dragging = false; private boolean dragging = false;


private VLazyExecutor delayedValueUpdater = new VLazyExecutor(100,
new ScheduledCommand() {

@Override
public void execute() {
fireValueChanged();
acceleration = 1;
}
});
private VLazyExecutor delayedValueUpdater = new VLazyExecutor(100, () -> {
fireValueChanged();
acceleration = 1;
});


public VSlider() { public VSlider() {
super(); super();

+ 2
- 7
client/src/main/java/com/vaadin/client/ui/VTabsheet.java ファイルの表示

getTab(tabsheet.activeTabIndex).recalculateCaptionWidth(); getTab(tabsheet.activeTabIndex).recalculateCaptionWidth();


// Scroll the tab into view if it is not already, after layout // Scroll the tab into view if it is not already, after layout
Scheduler.get().scheduleFinally(new Scheduler.ScheduledCommand() {
@Override
public void execute() {
getTabsheet()
.scrollIntoView(getTab(tabsheet.activeTabIndex));
}
});
Scheduler.get().scheduleFinally(() -> getTabsheet()
.scrollIntoView(getTab(tabsheet.activeTabIndex)));
} }


public Tab navigateTab(int fromIndex, int toIndex) { public Tab navigateTab(int fromIndex, int toIndex) {

+ 1
- 9
client/src/main/java/com/vaadin/client/ui/VUI.java ファイルの表示



import java.util.List; import java.util.List;


import com.google.gwt.core.client.Scheduler.ScheduledCommand;
import com.google.gwt.dom.client.Element; import com.google.gwt.dom.client.Element;
import com.google.gwt.event.dom.client.HasScrollHandlers; import com.google.gwt.event.dom.client.HasScrollHandlers;
import com.google.gwt.event.dom.client.ScrollEvent; import com.google.gwt.event.dom.client.ScrollEvent;
private TouchScrollHandler touchScrollHandler; private TouchScrollHandler touchScrollHandler;


private VLazyExecutor delayedResizeExecutor = new VLazyExecutor(200, private VLazyExecutor delayedResizeExecutor = new VLazyExecutor(200,
new ScheduledCommand() {

@Override
public void execute() {
performSizeCheck();
}

});
() -> performSizeCheck());


private Element storedFocus; private Element storedFocus;



+ 31
- 35
client/src/main/java/com/vaadin/client/ui/VUpload.java ファイルの表示

if (isAttached()) { if (isAttached()) {
// no need to call poll() if component is already // no need to call poll() if component is already
// detached #8728 // detached #8728
((UploadConnector) ConnectorMap.get(client).getConnector(VUpload.this))
.getRpcProxy(UploadServerRpc.class).poll();
((UploadConnector) ConnectorMap.get(client)
.getConnector(VUpload.this))
.getRpcProxy(UploadServerRpc.class)
.poll();
} }
} }


}); });
} }


ScheduledCommand startUploadCmd = new ScheduledCommand() {

@Override
public void execute() {
element.submit();
submitted = true;

disableUpload();

/*
* Visit server a moment after upload has started to see possible
* changes from UploadStarted event. Will be cleared on complete.
*
* Must get the id here as the upload can finish before the timer
* expires and in that case nextUploadId has been updated and is
* wrong.
*/
final int thisUploadId = nextUploadId;
t = new Timer() {
@Override
public void run() {
// Only visit the server if the upload has not already
// finished
if (thisUploadId == nextUploadId) {
VConsole.log(
"Visiting server to see if upload started event changed UI.");
client.updateVariable(paintableId, "pollForStart",
thisUploadId, true);
}
ScheduledCommand startUploadCmd = () -> {
element.submit();
submitted = true;

disableUpload();

/*
* Visit server a moment after upload has started to see possible
* changes from UploadStarted event. Will be cleared on complete.
*
* Must get the id here as the upload can finish before the timer
* expires and in that case nextUploadId has been updated and is wrong.
*/
final int thisUploadId = nextUploadId;
t = new Timer() {
@Override
public void run() {
// Only visit the server if the upload has not already
// finished
if (thisUploadId == nextUploadId) {
VConsole.log(
"Visiting server to see if upload started event changed UI.");
client.updateVariable(paintableId, "pollForStart",
thisUploadId, true);
} }
};
t.schedule(800);
}

}
};
t.schedule(800);
}; };


/** For internal use only. May be removed or replaced in the future. */ /** For internal use only. May be removed or replaced in the future. */

+ 1
- 8
client/src/main/java/com/vaadin/client/ui/VWindow.java ファイルの表示

import com.google.gwt.aria.client.RelevantValue; import com.google.gwt.aria.client.RelevantValue;
import com.google.gwt.aria.client.Roles; import com.google.gwt.aria.client.Roles;
import com.google.gwt.core.client.Scheduler; import com.google.gwt.core.client.Scheduler;
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
import com.google.gwt.dom.client.Document; import com.google.gwt.dom.client.Document;
import com.google.gwt.dom.client.Element; import com.google.gwt.dom.client.Element;
import com.google.gwt.dom.client.NativeEvent; import com.google.gwt.dom.client.NativeEvent;
public int bringToFrontSequence = -1; public int bringToFrontSequence = -1;


private VLazyExecutor delayedContentsSizeUpdater = new VLazyExecutor(200, private VLazyExecutor delayedContentsSizeUpdater = new VLazyExecutor(200,
new ScheduledCommand() {

@Override
public void execute() {
updateContentsSize();
}
});
() -> updateContentsSize());


public VWindow() { public VWindow() {
super(false, false); // no autohide, not modal super(false, false); // no autohide, not modal

+ 10
- 16
client/src/main/java/com/vaadin/client/ui/dd/VDragAndDropManager.java ファイルの表示



import com.google.gwt.core.client.GWT; import com.google.gwt.core.client.GWT;
import com.google.gwt.core.client.Scheduler; import com.google.gwt.core.client.Scheduler;
import com.google.gwt.core.client.Scheduler.RepeatingCommand;
import com.google.gwt.dom.client.Element; import com.google.gwt.dom.client.Element;
import com.google.gwt.dom.client.EventTarget; import com.google.gwt.dom.client.EventTarget;
import com.google.gwt.dom.client.NativeEvent; import com.google.gwt.dom.client.NativeEvent;
int currentY = WidgetUtil int currentY = WidgetUtil
.getTouchOrMouseClientY( .getTouchOrMouseClientY(
event.getNativeEvent()); event.getNativeEvent());
if (Math.abs(
startX - currentX) > MINIMUM_DISTANCE_TO_START_DRAG
if (Math.abs(startX
- currentX) > MINIMUM_DISTANCE_TO_START_DRAG
|| Math.abs(startY || Math.abs(startY
- currentY) > MINIMUM_DISTANCE_TO_START_DRAG) { - currentY) > MINIMUM_DISTANCE_TO_START_DRAG) {
ensureDeferredRegistrationCleanup(); ensureDeferredRegistrationCleanup();
.getTransferable().getDragSource(); .getTransferable().getDragSource();
final ApplicationConnection client = currentDropHandler final ApplicationConnection client = currentDropHandler
.getApplicationConnection(); .getApplicationConnection();
Scheduler.get().scheduleFixedDelay(new RepeatingCommand() {
@Override
public boolean execute() {
if (!client.getMessageSender().hasActiveRequest()) {
removeActiveDragSourceStyleName(dragSource);
return false;
}
return true;
Scheduler.get().scheduleFixedDelay(() -> {
if (!client.getMessageSender().hasActiveRequest()) {
removeActiveDragSourceStyleName(dragSource);
return false;
} }
return true;
}, 30); }, 30);

} }
} else { } else {
currentDropHandler.dragLeave(currentDrag); currentDropHandler.dragLeave(currentDrag);
} }


/* /*
* Remove class name indicating drag source when server visit is done
* if server visit was not initiated. Otherwise it will be removed once
* the server visit is done.
* Remove class name indicating drag source when server visit is done if
* server visit was not initiated. Otherwise it will be removed once the
* server visit is done.
*/ */
if (!sendTransferableToServer && currentDrag != null) { if (!sendTransferableToServer && currentDrag != null) {
removeActiveDragSourceStyleName( removeActiveDragSourceStyleName(

+ 2
- 7
client/src/main/java/com/vaadin/client/ui/orderedlayout/AbstractOrderedLayoutConnector.java ファイルの表示

import java.util.List; import java.util.List;


import com.google.gwt.core.client.Scheduler; import com.google.gwt.core.client.Scheduler;
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
import com.google.gwt.dom.client.Element; import com.google.gwt.dom.client.Element;
import com.google.gwt.dom.client.Style.Unit; import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.user.client.ui.Widget; import com.google.gwt.user.client.ui.Widget;
// updateExpandedSizes causes fixed size components to temporarily // updateExpandedSizes causes fixed size components to temporarily
// lose their size. updateExpandCompensation must be delayed until // lose their size. updateExpandCompensation must be delayed until
// the browser has a chance to measure them. // the browser has a chance to measure them.
Scheduler.get().scheduleFinally(new ScheduledCommand() {
@Override
public void execute() {
getWidget().updateExpandCompensation();
}
});
Scheduler.get().scheduleFinally(
() -> getWidget().updateExpandCompensation());
} else { } else {
getWidget().clearExpand(); getWidget().clearExpand();
} }

+ 12
- 20
client/src/main/java/com/vaadin/client/ui/ui/UIConnector.java ファイルの表示

import java.util.logging.Logger; import java.util.logging.Logger;


import com.google.gwt.core.client.Scheduler; import com.google.gwt.core.client.Scheduler;
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
import com.google.gwt.dom.client.Document; import com.google.gwt.dom.client.Document;
import com.google.gwt.dom.client.Element; import com.google.gwt.dom.client.Element;
import com.google.gwt.dom.client.HeadElement; import com.google.gwt.dom.client.HeadElement;
registerRpc(UIClientRpc.class, new UIClientRpc() { registerRpc(UIClientRpc.class, new UIClientRpc() {
@Override @Override
public void uiClosed(final boolean sessionExpired) { public void uiClosed(final boolean sessionExpired) {
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
@Override
public void execute() {
// Only notify user if we're still running and not eg.
// navigating away (#12298)
if (getConnection().isApplicationRunning()) {
if (sessionExpired) {
getConnection().showSessionExpiredError(null);
} else {
getState().enabled = false;
updateEnabledState(getState().enabled);
}
getConnection().setApplicationRunning(false);
Scheduler.get().scheduleDeferred(() -> {
// Only notify user if we're still running and not eg.
// navigating away (#12298)
if (getConnection().isApplicationRunning()) {
if (sessionExpired) {
getConnection().showSessionExpiredError(null);
} else {
getState().enabled = false;
updateEnabledState(getState().enabled);
} }
getConnection().setApplicationRunning(false);
} }
}); });
} }
if (firstPaint) { if (firstPaint) {
// Queue the initial window size to be sent with the following // Queue the initial window size to be sent with the following
// request. // request.
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
@Override
public void execute() {
getWidget().sendClientResized();
}
});
Scheduler.get()
.scheduleDeferred(() -> getWidget().sendClientResized());
} }
} }



+ 1
- 8
client/src/main/java/com/vaadin/client/ui/window/WindowConnector.java ファイルの表示

import java.util.logging.Logger; import java.util.logging.Logger;


import com.google.gwt.core.client.Scheduler; import com.google.gwt.core.client.Scheduler;
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
import com.google.gwt.dom.client.Element; import com.google.gwt.dom.client.Element;
import com.google.gwt.dom.client.NativeEvent; import com.google.gwt.dom.client.NativeEvent;
import com.google.gwt.dom.client.Node; import com.google.gwt.dom.client.Node;
window.centered = state.centered; window.centered = state.centered;
// Ensure centering before setting visible (#16486) // Ensure centering before setting visible (#16486)
if (window.centered && getState().windowMode != WindowMode.MAXIMIZED) { if (window.centered && getState().windowMode != WindowMode.MAXIMIZED) {
Scheduler.get().scheduleFinally(new ScheduledCommand() {

@Override
public void execute() {
getWidget().center();
}
});
Scheduler.get().scheduleFinally(() -> getWidget().center());
} }
window.setVisible(true); window.setVisible(true);
} }

+ 27
- 32
client/src/main/java/com/vaadin/client/widget/escalator/ScrollbarBundle.java ファイルの表示

.isNativelySupported(); .isNativelySupported();


private class ScrollEventFirer { private class ScrollEventFirer {
private final ScheduledCommand fireEventCommand = new ScheduledCommand() {
@Override
public void execute() {

/*
* Some kind of native-scroll-event related asynchronous problem
* occurs here (at least on desktops) where the internal
* bookkeeping isn't up to date with the real scroll position.
* The weird thing is, that happens only once, and if you drag
* scrollbar fast enough. After it has failed once, it never
* fails again.
*
* Theory: the user drags the scrollbar, and this command is
* executed before the browser has a chance to fire a scroll
* event (which normally would correct this situation). This
* would explain why slow scrolling doesn't trigger the problem,
* while fast scrolling does.
*
* To make absolutely sure that we have the latest scroll
* position, let's update the internal value.
*
* This might lead to a slight performance hit (on my computer
* it was never more than 3ms on either of Chrome 38 or Firefox
* 31). It also _slightly_ counteracts the purpose of the
* internal bookkeeping. But since getScrollPos is called 3
* times (on one direction) per scroll loop, it's still better
* to have take this small penalty than removing it altogether.
*/
updateScrollPosFromDom();
private final ScheduledCommand fireEventCommand = () -> {
/*
* Some kind of native-scroll-event related asynchronous problem
* occurs here (at least on desktops) where the internal bookkeeping
* isn't up to date with the real scroll position. The weird thing
* is, that happens only once, and if you drag scrollbar fast
* enough. After it has failed once, it never fails again.
*
* Theory: the user drags the scrollbar, and this command is
* executed before the browser has a chance to fire a scroll event
* (which normally would correct this situation). This would explain
* why slow scrolling doesn't trigger the problem, while fast
* scrolling does.
*
* To make absolutely sure that we have the latest scroll position,
* let's update the internal value.
*
* This might lead to a slight performance hit (on my computer it
* was never more than 3ms on either of Chrome 38 or Firefox 31). It
* also _slightly_ counteracts the purpose of the internal
* bookkeeping. But since getScrollPos is called 3 times (on one
* direction) per scroll loop, it's still better to have take this
* small penalty than removing it altogether.
*/
updateScrollPosFromDom();


getHandlerManager().fireEvent(new ScrollEvent());
isBeingFired = false;
}
getHandlerManager().fireEvent(new ScrollEvent());
isBeingFired = false;
}; };


private boolean isBeingFired; private boolean isBeingFired;

+ 74
- 93
client/src/main/java/com/vaadin/client/widgets/Escalator.java ファイルの表示

} }


/** /**
* Helper class that helps to implement the WAI-ARIA functionality
* for the Grid and TreeGrid component.
* Helper class that helps to implement the WAI-ARIA functionality for the
* Grid and TreeGrid component.
* <p> * <p>
* The following WAI-ARIA attributes are added through this class: * The following WAI-ARIA attributes are added through this class:
* *
* <ul> * <ul>
* <li>aria-rowcount (since 8.2)</li>
* <li>aria-rowcount (since 8.2)</li>
* </ul> * </ul>
* *
* @since 8.2 * @since 8.2
public class AriaGridHelper { public class AriaGridHelper {


/** /**
* This field contains the total number of rows from the grid
* including rows from thead, tbody and tfoot.
* This field contains the total number of rows from the grid including
* rows from thead, tbody and tfoot.
* *
* @since 8.2 * @since 8.2
*/ */
* Adds the given numberOfRows to allRows and calls * Adds the given numberOfRows to allRows and calls
* {@link #updateAriaRowCount()}. * {@link #updateAriaRowCount()}.
* *
* @param numberOfRows number of rows that were added to the
* grid
* @param numberOfRows
* number of rows that were added to the grid
* *
* @since 8.2 * @since 8.2
*/ */
* Removes the given numberOfRows from allRows and calls * Removes the given numberOfRows from allRows and calls
* {@link #updateAriaRowCount()}. * {@link #updateAriaRowCount()}.
* *
* @param numberOfRows number of rows that were removed from
* the grid
* @param numberOfRows
* number of rows that were removed from the grid
* *
* @since 8.2 * @since 8.2
*/ */
} }


/** /**
* Sets the aria-rowcount attribute with the current value
* of {@link AriaGridHelper#allRows} if the grid is attached
* and {@link AriaGridHelper#allRows} > 0.
* Sets the aria-rowcount attribute with the current value of
* {@link AriaGridHelper#allRows} if the grid is attached and
* {@link AriaGridHelper#allRows} > 0.
* *
* @since 8.2 * @since 8.2
*/ */


private boolean initialColumnSizesCalculated = false; private boolean initialColumnSizesCalculated = false;


public AbstractRowContainer(final TableSectionElement rowContainerElement) {
public AbstractRowContainer(
final TableSectionElement rowContainerElement) {
root = rowContainerElement; root = rowContainerElement;
} }


} }


public void autodetectRowHeightLater() { public void autodetectRowHeightLater() {
Scheduler.get().scheduleFinally(new Scheduler.ScheduledCommand() {
@Override
public void execute() {
if (defaultRowHeightShouldBeAutodetected && isAttached()) {
autodetectRowHeightNow();
defaultRowHeightShouldBeAutodetected = false;
}
Scheduler.get().scheduleFinally(() -> {
if (defaultRowHeightShouldBeAutodetected && isAttached()) {
autodetectRowHeightNow();
defaultRowHeightShouldBeAutodetected = false;
} }
}); });
} }
private void fireRowHeightChangedEventFinally() { private void fireRowHeightChangedEventFinally() {
if (!rowHeightChangedEventFired) { if (!rowHeightChangedEventFired) {
rowHeightChangedEventFired = true; rowHeightChangedEventFired = true;
Scheduler.get().scheduleFinally(new ScheduledCommand() {
@Override
public void execute() {
fireEvent(new RowHeightChangedEvent());
rowHeightChangedEventFired = false;
}
Scheduler.get().scheduleFinally(() -> {
fireEvent(new RowHeightChangedEvent());
rowHeightChangedEventFired = false;
}); });
} }
} }
/** The height of the combined rows in the DOM. Never negative. */ /** The height of the combined rows in the DOM. Never negative. */
private double heightOfSection = 0; private double heightOfSection = 0;


public AbstractStaticRowContainer(final TableSectionElement headElement) {
public AbstractStaticRowContainer(
final TableSectionElement headElement) {
super(headElement); super(headElement);
} }


private final AriaGridHelper ariaGridHelper = new AriaGridHelper(); private final AriaGridHelper ariaGridHelper = new AriaGridHelper();


private final HeaderRowContainer header = new HeaderRowContainer(headElem); private final HeaderRowContainer header = new HeaderRowContainer(headElem);
private final BodyRowContainerImpl body = new BodyRowContainerImpl(bodyElem);
private final BodyRowContainerImpl body = new BodyRowContainerImpl(
bodyElem);
private final FooterRowContainer footer = new FooterRowContainer(footElem); private final FooterRowContainer footer = new FooterRowContainer(footElem);


/** /**
private double delayToCancelTouchScroll = -1; private double delayToCancelTouchScroll = -1;


private boolean layoutIsScheduled = false; private boolean layoutIsScheduled = false;
private ScheduledCommand layoutCommand = new ScheduledCommand() {
@Override
public void execute() {
recalculateElementSizes();
layoutIsScheduled = false;
}
private ScheduledCommand layoutCommand = () -> {
recalculateElementSizes();
layoutIsScheduled = false;
}; };


private final ElementPositionBookkeeper positions = new ElementPositionBookkeeper(); private final ElementPositionBookkeeper positions = new ElementPositionBookkeeper();
* We either lost or gained a scrollbar. In any case, we * We either lost or gained a scrollbar. In any case, we
* need to change the height, if it's defined by rows. * need to change the height, if it's defined by rows.
*/ */
Scheduler.get().scheduleFinally(new ScheduledCommand() {

@Override
public void execute() {
applyHeightByRows();
queued = false;
}
Scheduler.get().scheduleFinally(() -> {
applyHeightByRows();
queued = false;
}); });
} }
}); });
public void scrollToRow(final int rowIndex, public void scrollToRow(final int rowIndex,
final ScrollDestination destination, final int padding) final ScrollDestination destination, final int padding)
throws IndexOutOfBoundsException, IllegalArgumentException { throws IndexOutOfBoundsException, IllegalArgumentException {
Scheduler.get().scheduleFinally(new ScheduledCommand() {
@Override
public void execute() {
validateScrollDestination(destination, padding);
verifyValidRowIndex(rowIndex);
scroller.scrollToRow(rowIndex, destination, padding);
}
Scheduler.get().scheduleFinally(() -> {
validateScrollDestination(destination, padding);
verifyValidRowIndex(rowIndex);
scroller.scrollToRow(rowIndex, destination, padding);
}); });
} }


public void scrollToRowAndSpacer(final int rowIndex, public void scrollToRowAndSpacer(final int rowIndex,
final ScrollDestination destination, final int padding) final ScrollDestination destination, final int padding)
throws IllegalArgumentException { throws IllegalArgumentException {
Scheduler.get().scheduleFinally(new ScheduledCommand() {
@Override
public void execute() {
validateScrollDestination(destination, padding);
if (rowIndex != -1) {
verifyValidRowIndex(rowIndex);
}
Scheduler.get().scheduleFinally(() -> {
validateScrollDestination(destination, padding);
if (rowIndex != -1) {
verifyValidRowIndex(rowIndex);
}


// row range
final Range rowRange;
if (rowIndex != -1) {
int rowTop = (int) Math.floor(body.getRowTop(rowIndex));
int rowHeight = (int) Math.ceil(body.getDefaultRowHeight());
rowRange = Range.withLength(rowTop, rowHeight);
} else {
rowRange = Range.withLength(0, 0);
}
// row range
final Range rowRange;
if (rowIndex != -1) {
int rowTop = (int) Math.floor(body.getRowTop(rowIndex));
int rowHeight = (int) Math.ceil(body.getDefaultRowHeight());
rowRange = Range.withLength(rowTop, rowHeight);
} else {
rowRange = Range.withLength(0, 0);
}


// get spacer
final SpacerContainer.SpacerImpl spacer = body.spacerContainer
.getSpacer(rowIndex);
// get spacer
final SpacerContainer.SpacerImpl spacer = body.spacerContainer
.getSpacer(rowIndex);


if (rowIndex == -1 && spacer == null) {
throw new IllegalArgumentException(
"Cannot scroll to row index "
+ "-1, as there is no spacer open at that index.");
}
if (rowIndex == -1 && spacer == null) {
throw new IllegalArgumentException("Cannot scroll to row index "
+ "-1, as there is no spacer open at that index.");
}


// make into target range
final Range targetRange;
if (spacer != null) {
final int spacerTop = (int) Math.floor(spacer.getTop());
final int spacerHeight = (int) Math
.ceil(spacer.getHeight());
Range spacerRange = Range.withLength(spacerTop,
spacerHeight);
// make into target range
final Range targetRange;
if (spacer != null) {
final int spacerTop = (int) Math.floor(spacer.getTop());
final int spacerHeight = (int) Math.ceil(spacer.getHeight());
Range spacerRange = Range.withLength(spacerTop, spacerHeight);


targetRange = rowRange.combineWith(spacerRange);
} else {
targetRange = rowRange;
}
targetRange = rowRange.combineWith(spacerRange);
} else {
targetRange = rowRange;
}


// get params
int targetStart = targetRange.getStart();
int targetEnd = targetRange.getEnd();
double viewportStart = getScrollTop();
double viewportEnd = viewportStart + body.getHeightOfSection();
// get params
int targetStart = targetRange.getStart();
int targetEnd = targetRange.getEnd();
double viewportStart = getScrollTop();
double viewportEnd = viewportStart + body.getHeightOfSection();


double scrollPos = getScrollPos(destination, targetStart,
targetEnd, viewportStart, viewportEnd, padding);
double scrollPos = getScrollPos(destination, targetStart, targetEnd,
viewportStart, viewportEnd, padding);


setScrollTop(scrollPos);
}
setScrollTop(scrollPos);
}); });
} }



+ 23
- 51
client/src/main/java/com/vaadin/client/widgets/Grid.java ファイルの表示

* (for example when updating cell values) we only get one actual * (for example when updating cell values) we only get one actual
* refresh in the end. * refresh in the end.
*/ */
Scheduler.get().scheduleFinally(new Scheduler.ScheduledCommand() {

@Override
public void execute() {
if (markAsDirty) {
markAsDirty = false;
getGrid().refreshHeader();
}
Scheduler.get().scheduleFinally(() -> {
if (markAsDirty) {
markAsDirty = false;
getGrid().refreshHeader();
} }
}); });
} }
* (for example when updating cell values) we only get one actual * (for example when updating cell values) we only get one actual
* refresh in the end. * refresh in the end.
*/ */
Scheduler.get().scheduleFinally(new Scheduler.ScheduledCommand() {

@Override
public void execute() {
Scheduler.get().scheduleFinally(() -> {
if (markAsDirty) { if (markAsDirty) {
markAsDirty = false; markAsDirty = false;
getGrid().refreshFooter(); getGrid().refreshFooter();
}
} }
}); });
} }
if (grid.selectionColumn != null && grid.selectionColumn if (grid.selectionColumn != null && grid.selectionColumn
.getRenderer() instanceof MultiSelectionRenderer) { .getRenderer() instanceof MultiSelectionRenderer) {
grid.refreshBody(); grid.refreshBody();
HeaderCell cell = grid.getDefaultHeaderRow().getCell(grid.selectionColumn);
HeaderCell cell = grid.getDefaultHeaderRow()
.getCell(grid.selectionColumn);
if (cell.getType() == GridStaticCellType.WIDGET) { // if lazy provider, then no checkbox if (cell.getType() == GridStaticCellType.WIDGET) { // if lazy provider, then no checkbox
CheckBox checkBox = (CheckBox) grid.getDefaultHeaderRow() CheckBox checkBox = (CheckBox) grid.getDefaultHeaderRow()
.getCell(grid.selectionColumn).getWidget();
.getCell(grid.selectionColumn).getWidget();
checkBox.setEnabled(isEnabled); checkBox.setEnabled(isEnabled);
} }
} }
final MenuItem item = getSelectedItem(); final MenuItem item = getSelectedItem();
super.onBrowserEvent(event); super.onBrowserEvent(event);
Scheduler.get() Scheduler.get()
.scheduleDeferred(new ScheduledCommand() {

@Override
public void execute() {
selectItem(item);
focus();
}
.scheduleDeferred(() -> {
selectItem(item);
focus();
}); });


} else { } else {
super.onBrowserEvent(event); super.onBrowserEvent(event);
} }
} }

}; };
KeyDownHandler keyDownHandler = new KeyDownHandler() { KeyDownHandler keyDownHandler = new KeyDownHandler() {


super.onAttach(); super.onAttach();
// make sure the button will get correct height if the button should // make sure the button will get correct height if the button should
// be visible when the grid is rendered the first time. // be visible when the grid is rendered the first time.
Scheduler.get().scheduleDeferred(new ScheduledCommand() {

@Override
public void execute() {
setHeightToHeaderCellHeight();
}
});
Scheduler.get()
.scheduleDeferred(() -> setHeightToHeaderCellHeight());
} }


@Override @Override


private MenuItem createToggle(final Column<?, T> column) { private MenuItem createToggle(final Column<?, T> column) {
MenuItem toggle = new MenuItem(createHTML(column), true, MenuItem toggle = new MenuItem(createHTML(column), true,
new ScheduledCommand() {

@Override
public void execute() {
hidingColumn = true;
column.setHidden(!column.isHidden(), true);
hidingColumn = false;
}
() -> {
hidingColumn = true;
column.setHidden(!column.isHidden(), true);
hidingColumn = false;
}); });
toggle.addStyleName("column-hiding-toggle"); toggle.addStyleName("column-hiding-toggle");
columnToHidingToggleMap.put(column, toggle); columnToHidingToggleMap.put(column, toggle);


/** /**
* Request delayed refresh of all body rows. * Request delayed refresh of all body rows.
*
*
* @since 8.1 * @since 8.1
*/ */
public void requestRefreshBody() { public void requestRefreshBody() {
public HandlerRegistration addDataAvailableHandler( public HandlerRegistration addDataAvailableHandler(
final DataAvailableHandler handler) { final DataAvailableHandler handler) {
// Deferred call to handler with current row range // Deferred call to handler with current row range
Scheduler.get().scheduleFinally(new ScheduledCommand() {
@Override
public void execute() {
if (!dataSource.isWaitingForData()) {
handler.onDataAvailable(
new DataAvailableEvent(currentDataAvailable));
}
Scheduler.get().scheduleFinally(() -> {
if (!dataSource.isWaitingForData()) {
handler.onDataAvailable(
new DataAvailableEvent(currentDataAvailable));
} }
}); });
return addHandler(handler, DataAvailableEvent.TYPE); return addHandler(handler, DataAvailableEvent.TYPE);
/* /*
* Delay calculation to be deferred so Escalator can do it's magic. * Delay calculation to be deferred so Escalator can do it's magic.
*/ */
Scheduler.get().scheduleFinally(new ScheduledCommand() {

@Override
public void execute() {
Scheduler.get().scheduleFinally(() -> {
if (escalator if (escalator
.getInnerWidth() != autoColumnWidthsRecalculator.lastCalculatedInnerWidth) { .getInnerWidth() != autoColumnWidthsRecalculator.lastCalculatedInnerWidth) {
recalculateColumnWidths(); recalculateColumnWidths();
// off-by-one error which occurs when the user scrolls all the // off-by-one error which occurs when the user scrolls all the
// way to the bottom. // way to the bottom.
refreshBody(); refreshBody();
}
}); });
} }



+ 130
- 287
uitest/src/main/java/com/vaadin/tests/widgetset/client/grid/EscalatorBasicClientFeaturesWidget.java ファイルの表示



private void createFrozenMenu() { private void createFrozenMenu() {
String[] menupath = { FEATURES_MENU, "Frozen columns" }; String[] menupath = { FEATURES_MENU, "Frozen columns" };
addMenuCommand("Freeze 1 column", new ScheduledCommand() {
@Override
public void execute() {
escalator.getColumnConfiguration().setFrozenColumnCount(1);
}
}, menupath);
addMenuCommand("Freeze 0 columns", new ScheduledCommand() {
@Override
public void execute() {
escalator.getColumnConfiguration().setFrozenColumnCount(0);
}
}, menupath);
addMenuCommand("Freeze 1 column", () -> escalator
.getColumnConfiguration().setFrozenColumnCount(1), menupath);
addMenuCommand("Freeze 0 columns", () -> escalator
.getColumnConfiguration().setFrozenColumnCount(0), menupath);
} }


private void createColspanMenu() { private void createColspanMenu() {
String[] menupath = { FEATURES_MENU, "Column spanning" }; String[] menupath = { FEATURES_MENU, "Column spanning" };
addMenuCommand("Apply normal colspan", new ScheduledCommand() {
@Override
public void execute() {
colspan = Colspan.NORMAL;
refreshEscalator();
}
addMenuCommand("Apply normal colspan", () -> {
colspan = Colspan.NORMAL;
refreshEscalator();
}, menupath); }, menupath);
addMenuCommand("Apply crazy colspan", new ScheduledCommand() {
@Override
public void execute() {
colspan = Colspan.CRAZY;
refreshEscalator();
}
addMenuCommand("Apply crazy colspan", () -> {
colspan = Colspan.CRAZY;
refreshEscalator();
}, menupath); }, menupath);
addMenuCommand("Apply no colspan", new ScheduledCommand() {
@Override
public void execute() {
colspan = Colspan.NONE;
refreshEscalator();
}
addMenuCommand("Apply no colspan", () -> {
colspan = Colspan.NONE;
refreshEscalator();
}, menupath); }, menupath);
} }


private void createColumnsAndRowsMenu() { private void createColumnsAndRowsMenu() {
String[] menupath = { COLUMNS_AND_ROWS_MENU }; String[] menupath = { COLUMNS_AND_ROWS_MENU };
addMenuCommand("Add one of each row", new ScheduledCommand() {
@Override
public void execute() {
insertRows(escalator.getHeader(), 0, 1);
insertRows(escalator.getBody(), 0, 1);
insertRows(escalator.getFooter(), 0, 1);
}
addMenuCommand("Add one of each row", () -> {
insertRows(escalator.getHeader(), 0, 1);
insertRows(escalator.getBody(), 0, 1);
insertRows(escalator.getFooter(), 0, 1);
}, menupath); }, menupath);
addMenuCommand("Remove one of each row", new ScheduledCommand() {
@Override
public void execute() {
removeRows(escalator.getHeader(), 0, 1);
removeRows(escalator.getBody(), 0, 1);
removeRows(escalator.getFooter(), 0, 1);
}
addMenuCommand("Remove one of each row", () -> {
removeRows(escalator.getHeader(), 0, 1);
removeRows(escalator.getBody(), 0, 1);
removeRows(escalator.getFooter(), 0, 1);
}, menupath); }, menupath);
} }


private void createGeneralMenu() { private void createGeneralMenu() {
String[] menupath = { GENERAL_MENU }; String[] menupath = { GENERAL_MENU };


addMenuCommand("Detach Escalator", new ScheduledCommand() {
@Override
public void execute() {
escalator.removeFromParent();
}
}, menupath);
addMenuCommand("Detach Escalator", () -> escalator.removeFromParent(),
menupath);


addMenuCommand("Attach Escalator", new ScheduledCommand() {
@Override
public void execute() {
if (!escalator.isAttached()) {
addNorth(escalator, 500);
}
addMenuCommand("Attach Escalator", () -> {
if (!escalator.isAttached()) {
addNorth(escalator, 500);
} }
}, menupath); }, menupath);


addMenuCommand("Clear (columns, then rows)", new ScheduledCommand() {
@Override
public void execute() {
resetColRow();
}
addMenuCommand("Clear (columns, then rows)", () -> resetColRow(),
menupath);
addMenuCommand("Clear (rows, then columns)", () -> resetRowCol()

, menupath);
addMenuCommand("Populate Escalator (columns, then rows)", () -> {
resetColRow();
insertColumns(0, 10);
insertRows(escalator.getHeader(), 0, 1);
insertRows(escalator.getBody(), 0, 100);
insertRows(escalator.getFooter(), 0, 1);
}, menupath); }, menupath);
addMenuCommand("Clear (rows, then columns)", new ScheduledCommand() {
@Override
public void execute() {
resetRowCol();
}
addMenuCommand("Populate Escalator (rows, then columns)", () -> {
resetColRow();
insertRows(escalator.getHeader(), 0, 1);
insertRows(escalator.getBody(), 0, 100);
insertRows(escalator.getFooter(), 0, 1);
insertColumns(0, 10);
}, menupath); }, menupath);
addMenuCommand("Populate Escalator (columns, then rows)",
new ScheduledCommand() {
@Override
public void execute() {
resetColRow();
insertColumns(0, 10);
insertRows(escalator.getHeader(), 0, 1);
insertRows(escalator.getBody(), 0, 100);
insertRows(escalator.getFooter(), 0, 1);
}
}, menupath);
addMenuCommand("Populate Escalator (rows, then columns)",
new ScheduledCommand() {
@Override
public void execute() {
resetColRow();
insertRows(escalator.getHeader(), 0, 1);
insertRows(escalator.getBody(), 0, 100);
insertRows(escalator.getFooter(), 0, 1);
insertColumns(0, 10);
}
}, menupath);


createSizeMenu(); createSizeMenu();
} }
private void addSizeMenuItem(final String size, final String direction, private void addSizeMenuItem(final String size, final String direction,
String[] menupath) { String[] menupath) {
final String title = (size != null ? size : "undefined"); final String title = (size != null ? size : "undefined");
addMenuCommand(title + " " + direction, new ScheduledCommand() {
@Override
public void execute() {
if (direction.equals("height")) {
escalator.setHeight(size);
} else {
escalator.setWidth(size);
}
addMenuCommand(title + " " + direction, () -> {
if (direction.equals("height")) {
escalator.setHeight(size);
} else {
escalator.setWidth(size);
} }
}, menupath); }, menupath);
} }


private void createColumnMenu() { private void createColumnMenu() {
String[] menupath = { COLUMNS_AND_ROWS_MENU, "Columns" }; String[] menupath = { COLUMNS_AND_ROWS_MENU, "Columns" };
addMenuCommand("Add one column to beginning", new ScheduledCommand() {
@Override
public void execute() {
insertColumns(0, 1);
}
}, menupath);
addMenuCommand("Add one column to end", new ScheduledCommand() {
@Override
public void execute() {
insertColumns(
escalator.getColumnConfiguration().getColumnCount(), 1);
}
}, menupath);
addMenuCommand("Add ten columns", new ScheduledCommand() {
@Override
public void execute() {
insertColumns(0, 10);
}
}, menupath);
addMenuCommand("Add one column to beginning", () -> insertColumns(0, 1),
menupath);
addMenuCommand("Add one column to end",
() -> insertColumns(
escalator.getColumnConfiguration().getColumnCount(), 1),
menupath);
addMenuCommand("Add ten columns", () -> insertColumns(0, 10), menupath);
addMenuCommand("Remove one column from beginning", addMenuCommand("Remove one column from beginning",
new ScheduledCommand() {
@Override
public void execute() {
removeColumns(0, 1);
}
}, menupath);
addMenuCommand("Remove one column from end", new ScheduledCommand() {
@Override
public void execute() {
removeColumns(
() -> removeColumns(0, 1), menupath);
addMenuCommand("Remove one column from end",
() -> removeColumns(
escalator.getColumnConfiguration().getColumnCount() - 1, escalator.getColumnConfiguration().getColumnCount() - 1,
1);
}
}, menupath);
1),
menupath);


addMenuCommand("Refresh first column", new ScheduledCommand() {
@Override
public void execute() {
escalator.getColumnConfiguration().refreshColumns(0, 1);
}
}, menupath);
addMenuCommand("Refresh first column",
() -> escalator.getColumnConfiguration().refreshColumns(0, 1),
menupath);


addMenuCommand("Resize first column to max width", addMenuCommand("Resize first column to max width",
new ScheduledCommand() {
@Override
public void execute() {
escalator.getColumnConfiguration().setColumnWidth(0,
-1);
}
}, menupath);
() -> escalator.getColumnConfiguration().setColumnWidth(0, -1),
menupath);


addMenuCommand("Resize first column to 100 px", new ScheduledCommand() {
@Override
public void execute() {
escalator.getColumnConfiguration().setColumnWidth(0, 100);
}
}, menupath);
addMenuCommand("Resize first column to 100 px",
() -> escalator.getColumnConfiguration().setColumnWidth(0, 100),
menupath);
} }


private void createHeaderRowsMenu() { private void createHeaderRowsMenu() {
String[] menupath = { COLUMNS_AND_ROWS_MENU, "Body Rows" }; String[] menupath = { COLUMNS_AND_ROWS_MENU, "Body Rows" };
createRowsMenu(escalator.getBody(), menupath); createRowsMenu(escalator.getBody(), menupath);


addMenuCommand("Add 5 rows to top", new ScheduledCommand() {
@Override
public void execute() {
insertRows(escalator.getBody(), 0, 5);
}
}, menupath);
addMenuCommand("Add 22 rows to top", new ScheduledCommand() {
@Override
public void execute() {
insertRows(escalator.getBody(), 0, 22);
}
}, menupath);
addMenuCommand("Add 50 rows to top", new ScheduledCommand() {
@Override
public void execute() {
insertRows(escalator.getBody(), 0, 50);
}
}, menupath);
addMenuCommand("Remove 5 rows from bottom", new ScheduledCommand() {
@Override
public void execute() {
removeRows(escalator.getBody(),
escalator.getBody().getRowCount() - 5, 5);
}
}, menupath);
addMenuCommand("Remove 50 rows from bottom", new ScheduledCommand() {
@Override
public void execute() {
removeRows(escalator.getBody(),
escalator.getBody().getRowCount() - 50, 50);
}
}, menupath);
addMenuCommand("Remove 15 rows from middle", new ScheduledCommand() {
@Override
public void execute() {
removeRows(escalator.getBody(), 3, 15);
}
}, menupath);
addMenuCommand("Add 5 rows to top",
() -> insertRows(escalator.getBody(), 0, 5), menupath);
addMenuCommand("Add 22 rows to top",
() -> insertRows(escalator.getBody(), 0, 22), menupath);
addMenuCommand("Add 50 rows to top",
() -> insertRows(escalator.getBody(), 0, 50), menupath);
addMenuCommand("Remove 5 rows from bottom",
() -> removeRows(escalator.getBody(),
escalator.getBody().getRowCount() - 5, 5),
menupath);
addMenuCommand("Remove 50 rows from bottom",
() -> removeRows(escalator.getBody(),
escalator.getBody().getRowCount() - 50, 50),
menupath);
addMenuCommand("Remove 15 rows from middle",
() -> removeRows(escalator.getBody(), 3, 15), menupath);
addMenuCommand("Remove 50 rows from almost bottom", addMenuCommand("Remove 50 rows from almost bottom",
new ScheduledCommand() {
@Override
public void execute() {
removeRows(escalator.getBody(),
escalator.getBody().getRowCount() - 60, 50);
}
}, menupath);
addMenuCommand("Remove all, insert 30 and scroll 40px",
new ScheduledCommand() {
@Override
public void execute() {
removeRows(escalator.getBody(), 0,
escalator.getBody().getRowCount());
insertRows(escalator.getBody(), 0, 30);
escalator.setScrollTop(40);
}
}, menupath);
() -> removeRows(escalator.getBody(),
escalator.getBody().getRowCount() - 60, 50),
menupath);
addMenuCommand("Remove all, insert 30 and scroll 40px", () -> {
removeRows(escalator.getBody(), 0,
escalator.getBody().getRowCount());
insertRows(escalator.getBody(), 0, 30);
escalator.setScrollTop(40);
}, menupath);


String[] scrollToRowMenuPath = new String[menupath.length + 1]; String[] scrollToRowMenuPath = new String[menupath.length + 1];
System.arraycopy(menupath, 0, scrollToRowMenuPath, 0, menupath.length); System.arraycopy(menupath, 0, scrollToRowMenuPath, 0, menupath.length);
scrollToRowMenuPath[scrollToRowMenuPath.length - 1] = "Scroll to..."; scrollToRowMenuPath[scrollToRowMenuPath.length - 1] = "Scroll to...";
for (int i = 0; i < 100; i += 25) { for (int i = 0; i < 100; i += 25) {
final int rowIndex = i; final int rowIndex = i;
addMenuCommand("Row " + i, new ScheduledCommand() {
@Override
public void execute() {
escalator.scrollToRow(rowIndex, ScrollDestination.ANY, 0);
}
}, scrollToRowMenuPath);
addMenuCommand("Row " + i, () -> escalator.scrollToRow(rowIndex,
ScrollDestination.ANY, 0), scrollToRowMenuPath);
} }


addMenuCommand("Set 20px default height", new ScheduledCommand() {
@Override
public void execute() {
escalator.getBody().setDefaultRowHeight(20);
}
}, menupath);
addMenuCommand("Set 20px default height",
() -> escalator.getBody().setDefaultRowHeight(20), menupath);
} }


private void createRowsMenu(final RowContainer container, private void createRowsMenu(final RowContainer container,
String[] menupath) { String[] menupath) {
addMenuCommand("Add one row to beginning", new ScheduledCommand() {
@Override
public void execute() {
int offset = 0;
int number = 1;
insertRows(container, offset, number);
}
addMenuCommand("Add one row to beginning", () -> {
int offset = 0;
int number = 1;
insertRows(container, offset, number);
}, menupath); }, menupath);
addMenuCommand("Add one row to end", new ScheduledCommand() {
@Override
public void execute() {
int offset = container.getRowCount();
int number = 1;
insertRows(container, offset, number);
}
addMenuCommand("Add one row to end", () -> {
int offset = container.getRowCount();
int number = 1;
insertRows(container, offset, number);
}, menupath); }, menupath);
addMenuCommand("Remove one row from beginning", new ScheduledCommand() {
@Override
public void execute() {
int offset = 0;
int number = 1;
removeRows(container, offset, number);
}
addMenuCommand("Remove one row from beginning", () -> {
int offset = 0;
int number = 1;
removeRows(container, offset, number);
}, menupath); }, menupath);
addMenuCommand("Remove one row from end", new ScheduledCommand() {
@Override
public void execute() {
int offset = container.getRowCount() - 1;
int number = 1;
removeRows(container, offset, number);
}
addMenuCommand("Remove one row from end", () -> {
int offset = container.getRowCount() - 1;
int number = 1;
removeRows(container, offset, number);
}, menupath); }, menupath);
addMenuCommand("Remove all rows", new ScheduledCommand() {
@Override
public void execute() {
if (container.getRowCount() > 0) {
removeRows(container, 0, container.getRowCount());
}
addMenuCommand("Remove all rows", () -> {
if (container.getRowCount() > 0) {
removeRows(container, 0, container.getRowCount());
} }
}, menupath); }, menupath);
} }
} }
}, menupath); }, menupath);


addMenuCommand("Focusable Updater", new ScheduledCommand() {
@Override
public void execute() {
escalator.getBody().setSpacerUpdater(new SpacerUpdater() {
addMenuCommand("Focusable Updater",
() -> escalator.getBody().setSpacerUpdater(new SpacerUpdater() {
@Override @Override
public void init(Spacer spacer) { public void init(Spacer spacer) {
spacer.getElement().appendChild(DOM.createInputText()); spacer.getElement().appendChild(DOM.createInputText());
public void destroy(Spacer spacer) { public void destroy(Spacer spacer) {
spacer.getElement().removeAllChildren(); spacer.getElement().removeAllChildren();
} }
});
}
}, menupath);
}), menupath);


createSpacersMenuForRow(-1, menupath); createSpacersMenuForRow(-1, menupath);
createSpacersMenuForRow(1, menupath); createSpacersMenuForRow(1, menupath);
private void createSpacersMenuForRow(final int rowIndex, private void createSpacersMenuForRow(final int rowIndex,
String[] menupath) { String[] menupath) {
menupath = new String[] { menupath[0], menupath[1], "Row " + rowIndex }; menupath = new String[] { menupath[0], menupath[1], "Row " + rowIndex };
addMenuCommand("Set 100px", new ScheduledCommand() {
@Override
public void execute() {
escalator.getBody().setSpacer(rowIndex, 100);
}
}, menupath);
addMenuCommand("Set 50px", new ScheduledCommand() {
@Override
public void execute() {
escalator.getBody().setSpacer(rowIndex, 50);
}
}, menupath);
addMenuCommand("Remove", new ScheduledCommand() {
@Override
public void execute() {
escalator.getBody().setSpacer(rowIndex, -1);
}
}, menupath);
addMenuCommand("Scroll here (ANY, 0)", new ScheduledCommand() {
@Override
public void execute() {
escalator.scrollToSpacer(rowIndex, ScrollDestination.ANY, 0);
}
}, menupath);
addMenuCommand("Scroll here row+spacer below (ANY, 0)",
new ScheduledCommand() {
@Override
public void execute() {
escalator.scrollToRowAndSpacer(rowIndex,
ScrollDestination.ANY, 0);
}
}, menupath);
addMenuCommand("Set 100px",
() -> escalator.getBody().setSpacer(rowIndex, 100), menupath);
addMenuCommand("Set 50px",
() -> escalator.getBody().setSpacer(rowIndex, 50), menupath);
addMenuCommand("Remove",
() -> escalator.getBody().setSpacer(rowIndex, -1), menupath);
addMenuCommand("Scroll here (ANY, 0)", () -> escalator
.scrollToSpacer(rowIndex, ScrollDestination.ANY, 0), menupath);
addMenuCommand("Scroll here row+spacer below (ANY, 0)", () -> escalator
.scrollToRowAndSpacer(rowIndex, ScrollDestination.ANY, 0),
menupath);
} }


private void insertRows(final RowContainer container, int offset, private void insertRows(final RowContainer container, int offset,

読み込み中…
キャンセル
保存