use of com.google.gwt.core.client.JsArrayNumber in project rstudio by rstudio.
the class History method onHistoryRemoveEntries.
@Handler
void onHistoryRemoveEntries() {
// get selected indexes (bail if there is no selection)
final ArrayList<Integer> selectedRowIndexes = view_.getRecentCommandsSelectedRowIndexes();
if (selectedRowIndexes.size() < 1) {
globalDisplay_.showErrorMessage("Error", "No history entries currently selected.");
return;
}
// bring view to front
view_.bringToFront();
globalDisplay_.showYesNoMessage(GlobalDisplay.MSG_QUESTION, "Confirm Remove Entries", "Are you sure you want to remove the selected entries from " + "the history?", new ProgressOperation() {
public void execute(final ProgressIndicator indicator) {
indicator.onProgress("Removing items...");
// for each selected row index we need to calculate
// the offset from the bottom
int rowCount = view_.getRecentCommandsRowsDisplayed();
JsArrayNumber bottomIndexes = (JsArrayNumber) JsArrayNumber.createArray();
for (int i = 0; i < selectedRowIndexes.size(); i++) bottomIndexes.push(rowCount - selectedRowIndexes.get(i) - 1);
server_.removeHistoryItems(bottomIndexes, new VoidServerRequestCallback(indicator));
}
}, true);
}
use of com.google.gwt.core.client.JsArrayNumber in project playn by threerings.
the class ArrayUtils method toJsArray.
public static JsArrayNumber toJsArray(float[] data) {
JsArrayNumber jsan = (JsArrayNumber) JsArrayNumber.createArray();
int len = data.length;
for (int i = len - 1; i >= 0; i--) {
jsan.set(i, data[i]);
}
return jsan;
}
use of com.google.gwt.core.client.JsArrayNumber in project libgdx by libgdx.
the class GwtControllers method onGamepadUpdated.
@Override
public void onGamepadUpdated(int index) {
Gamepad gamepad = Gamepad.getGamepad(index);
GwtController controller = controllerMap.get(index);
if (gamepad != null && controller != null) {
// Determine what changed
JsArrayNumber axes = gamepad.getAxes();
JsArrayNumber buttons = gamepad.getButtons();
synchronized (eventQueue) {
for (int i = 0, j = axes.length(); i < j; i++) {
float oldAxis = controller.getAxis(i);
float newAxis = (float) axes.get(i);
if (oldAxis != newAxis) {
GwtControllerEvent event = eventPool.obtain();
event.type = GwtControllerEvent.AXIS;
event.controller = controller;
event.code = i;
event.amount = newAxis;
eventQueue.add(event);
}
}
for (int i = 0, j = buttons.length(); i < j; i++) {
float oldButton = controller.getButtonAmount(i);
float newButton = (float) buttons.get(i);
if (oldButton != newButton) {
if ((oldButton < 0.5f && newButton < 0.5f) || (oldButton >= 0.5f && newButton >= 0.5f)) {
controller.buttons.put(i, newButton);
continue;
}
GwtControllerEvent event = eventPool.obtain();
event.type = newButton >= 0.5f ? GwtControllerEvent.BUTTON_DOWN : GwtControllerEvent.BUTTON_UP;
event.controller = controller;
event.code = i;
event.amount = newButton;
eventQueue.add(event);
}
}
}
}
}
use of com.google.gwt.core.client.JsArrayNumber in project playn by threerings.
the class ArrayUtils method toJsArray.
public static JsArrayNumber toJsArray(double[] data) {
JsArrayNumber jsan = (JsArrayNumber) JsArrayNumber.createArray();
int len = data.length;
for (int i = len - 1; i >= 0; i--) {
jsan.set(i, data[i]);
}
return jsan;
}
Aggregations