public static void pollGamepads() { JsArray<Gamepad> currentGamepads = nativePollGamepads(); if (currentGamepads != null) { gamepadsTemp.clear(); gamepadsTemp.putAll(gamepads); for (int i = 0, j = currentGamepads.length(); i < j; i++) { Gamepad gamepad = currentGamepads.get(i); if (gamepad != null) { if (!gamepadsTemp.containsKey(gamepad.getIndex())) { onGamepadConnect(gamepad); } gamepadsTemp.remove(gamepad.getIndex()); } } for (Gamepad gamepad : gamepadsTemp.values()) { onGamepadDisconnect(gamepad); } } }
/** * @deprecated Call and override {@link #getDOMRowCount(Element)} instead. */ @Deprecated protected int getDOMRowCount(com.google.gwt.user.client.Element tbody) { return impl.getRows(tbody).length(); }
this.justTouched = true; JsArray<Touch> touches = e.getChangedTouches(); for (int i = 0, j = touches.length(); i < j; i++) { Touch touch = touches.get(i); int real = touch.getIdentifier(); for (int i = 0, j = touches.length(); i < j; i++) { Touch touch = touches.get(i); int real = touch.getIdentifier(); for (int i = 0, j = touches.length(); i < j; i++) { Touch touch = touches.get(i); int real = touch.getIdentifier(); for (int i = 0, j = touches.length(); i < j; i++) { Touch touch = touches.get(i); int real = touch.getIdentifier();
this.justTouched = true; JsArray<Touch> touches = e.getChangedTouches(); for (int i = 0, j = touches.length(); i < j; i++) { Touch touch = touches.get(i); int real = touch.getIdentifier(); for (int i = 0, j = touches.length(); i < j; i++) { Touch touch = touches.get(i); int real = touch.getIdentifier(); for (int i = 0, j = touches.length(); i < j; i++) { Touch touch = touches.get(i); int real = touch.getIdentifier(); for (int i = 0, j = touches.length(); i < j; i++) { Touch touch = touches.get(i); int real = touch.getIdentifier();
public void add(Class<?> clazz, JsArray<JavaScriptObject> constructors) { assert constructors.length() == 2 : "Expecting two constructor references"; set(clazz.getName(), constructors); }
for (int i = 0, j = buttons.length(); i < j; i++) { float newButton = (float)buttons.get(i).getValue(); if (controller.isStandardMapping() && i >= STANDARD_CONTROLLER_DPAD_UP && i <= STANDARD_CONTROLLER_DPAD_RIGHT) {
private void check(String typeSignature, int length) throws SerializationException { /* * Probably trying to serialize a type that isn't supposed to be * serializable. */ if (methodMapNative.get(typeSignature) == null) { throw new SerializationException(typeSignature); } assert methodMapNative.get(typeSignature).length() >= length : "Not enough methods, expecting " + length + " saw " + methodMapNative.get(typeSignature).length(); }
/** * Get touch from event. * * @param event the event * @return the touch object */ protected Touch getTouchFromEvent(TouchEvent<?> event) { JsArray<Touch> touches = event.getTouches(); return (touches.length() > 0) ? touches.get(0) : null; }
/** * @deprecated Call and override {@link #getDOMCellCount(Element, int)} instead. */ @Deprecated protected int getDOMCellCount(com.google.gwt.user.client.Element tableBody, int row) { Element rowElement = impl.getRows(tableBody).get(row); return impl.getCells(rowElement).length(); }
@Override public StackTraceElement[] getStackTrace(Object t) { JsArray<JsArrayString> stack = getFnStack(t).cast(); StackTraceElement[] stackTrace = new StackTraceElement[stack.length()]; for (int i = 0; i < stackTrace.length; i++) { JsArrayString frame = stack.get(i); String name = frame.get(0); String location = frame.get(1); String fileName = null; int lineNumber = LINE_NUMBER_UNKNOWN; if (location != null) { int idx = location.indexOf(':'); if (idx != -1) { fileName = location.substring(0, idx); lineNumber = parseInt(location.substring(idx + 1)); } else { lineNumber = parseInt(location); } } stackTrace[i] = new StackTraceElement(UNKNOWN, name, fileName, lineNumber); } return stackTrace; } }
assert tasks != null : "tasks"; int length = tasks.length(); if (length == 0) { return null; boolean executedSomeTask = false; for (int i = 0; i < length; i++) { assert tasks.length() == length : "Working array length changed " + tasks.length() + " != " + length; Task t = tasks.get(i); assert newTasks.length() < length; return newTasks.length() == 0 ? null : newTasks; } else { return tasks;
public final List<JSNodeMarker> getAllChildMarkers() { final List<JSNodeMarker> markers = new ArrayList<>(); final JsArray<JSObject> markerObjects = getMarkerObjects(); if (markerObjects == null) return markers; for (int i = 0; i < markerObjects.length(); i++) { final JSObject markerObject = markerObjects.get(i); final JSNodeMarker marker = new JSNodeMarker(markerObject); markers.add(marker); } return markers; }
private void check(String typeSignature, int length) throws SerializationException { /* * Probably trying to serialize a type that isn't supposed to be * serializable. */ if (methodMapNative.get(typeSignature) == null) { throw new SerializationException(typeSignature); } assert methodMapNative.get(typeSignature).length() >= length : "Not enough methods, expecting " + length + " saw " + methodMapNative.get(typeSignature).length(); }
public GWTVertex findVertexById(String id) { for(int i = 0; i < getVertices().length(); i++) { GWTVertex v = getVertices().get(i); if(v.getId().equals(id)) { return v; } } return null; }
protected int createObject(WebGLObject object, WebGLObjectType type) { // TODO (haustein) keep track of empty positions. // for (int i = 0; i < webGLObjects.size(); i++) { // if (webGLObjects.get(i) == null) { // webGLObjects.set(i, container); // return i; // } // } webGLObjects.push(object); webGLObjectTypes.push(type.ordinal()); return webGLObjects.length() - 1; }
private Integer[] findEdgeIndices(GWTVertex vertex) { List<Integer> indexArray = new ArrayList<>(); for(int i = 0; i < getEdges().length(); i++) { GWTEdge edge = getEdges().get(i); if(edge.getSource().getId().equals(vertex.getId()) || edge.getTarget().getId().equals(vertex.getId())) { indexArray.add(i); } } return indexArray.toArray(new Integer[0]); }
private int findIndex(GWTVertex vertex) { for(int i = 0; i < getVertices().length(); i++) { GWTVertex v = getVertices().get(i); if(v.getId().equals(vertex.getId())) { return i; } } return -1; }
/** * @param event * touch event * @return first changed / added touch */ public static Touch getRelevantTouch(TouchEvent<?> event) { JsArray<?> touches = event.getTouches().length() == 0 ? event.getChangedTouches() : event.getTouches(); return (Touch) touches.get(0); }
private BoundingRect createBoundingRect(JsArray<GWTVertex> vertices, boolean fitToView) { final BoundingRect rect = new BoundingRect(); for(int i = 0; i < vertices.length(); i++) { GWTVertex vertex = vertices.get(i); if(fitToView || vertex.isSelected()) { double vertexX = vertex.getX(); double vertexY = vertex.getY(); rect.addPoint(new Point(vertexX, vertexY)); } } return rect; }