use of com.codename1.io.Log in project CodenameOne by codenameone.
the class TestUtils method pointerDrag.
/**
* A component drag on a given named component at x/y where x and y are <b>NOT pixels</b>
* but rather a number between 0 to 1 representing the percentage within the component where the
* event took place. E.g. For a 100x100 component a press within 10,5 would be 0.1f, 0.05f.
* @param x the offset within the component as a number between 0 and 1
* @param y the offset within the component as a number between 0 and 1
* @param path the path to the component
*/
public static void pointerDrag(float x, float y, int[] path) {
if (verbose) {
log("pointerDrag(" + x + ", " + y + ", " + toString(path) + ")");
}
Component c = getComponentByPath(path);
int actualX = c.getAbsoluteX() + (int) (x * c.getWidth());
int actualY = c.getAbsoluteY() + (int) (y * c.getHeight());
Display.getInstance().getCurrent().pointerDragged(actualX, actualY);
}
use of com.codename1.io.Log in project CodenameOne by codenameone.
the class TestComponent method getComponentAt_int_int_button.
private void getComponentAt_int_int_button() {
log("Testing getComponentAt(x, y) with button");
int w = Display.getInstance().getDisplayWidth();
int h = Display.getInstance().getDisplayHeight();
Form f = new Form("My Form", new BorderLayout());
Label l = new Button("Hello");
f.add(BorderLayout.CENTER, l);
f.show();
TestUtils.waitForFormTitle("My Form");
Component middleComponent = f.getComponentAt(w / 2, h / 2);
assertEqual(l, middleComponent, "Found wrong component");
}
use of com.codename1.io.Log in project CodenameOne by codenameone.
the class TestComponent method getComponentAt_int_int_label.
private void getComponentAt_int_int_label() {
log("Testing getComponentAt(x, y) with label");
int w = Display.getInstance().getDisplayWidth();
int h = Display.getInstance().getDisplayHeight();
Form f = new Form("My Form", new BorderLayout());
Label l = new Label("Hello");
f.add(BorderLayout.CENTER, l);
f.show();
TestUtils.waitForFormTitle("My Form", 2000);
Component middleComponent = f.getComponentAt(w / 2, h / 2);
assertEqual(l, middleComponent, "Found wrong component");
}
use of com.codename1.io.Log in project CodenameOne by codenameone.
the class FaceBookAccess method logOut.
/**
* log out the current user
*/
public static void logOut() {
ConnectionRequest req = new ConnectionRequest();
req.setPost(false);
req.setUrl("https://www.facebook.com/logout.php?access_token=" + token + "&confirm=1&next=" + redirectURI);
NetworkManager.getInstance().addToQueueAndWait(req);
token = null;
}
use of com.codename1.io.Log in project CodenameOne by codenameone.
the class StubLocationManager method bindListener.
@Override
protected void bindListener() {
checkLocationRegistration();
setStatus(AVAILABLE);
final LocationListener l = getLocationListener();
task = new TimerTask() {
@Override
public void run() {
Display.getInstance().callSerially(new Runnable() {
public void run() {
Location loc;
try {
loc = getCurrentLocation();
if (JavaSEPort.locSimulation == null) {
loc.setLongitude(loc.getLongitude() + 0.001);
loc.setLatitude(loc.getLatitude() + +0.001);
} else {
int s = JavaSEPort.locSimulation.getState();
if (s != StubLocationManager.super.getStatus()) {
l.providerStateChanged(s);
setStatus(s);
}
}
l.locationUpdated(loc);
} catch (IOException ex) {
Logger.getLogger(StubLocationManager.class.getName()).log(Level.SEVERE, null, ex);
}
}
});
}
};
timer = new Timer();
timer.schedule(task, 3000, 3000);
}
Aggregations