Examples of Baton


Examples of com.sun.midp.util.Baton

     * race condition between modifying a Form's contents (for example, with
     * append) while the Form is in the process of becoming current.
     */
    void testScreenChangeAppend() {
        StringItem items[] = new StringItem[10];
        final Baton baton = new Baton();

        for (int ii = 0; ii < items.length; ii++) {
            items[ii] = new StringItem(null, Integer.toString(ii % 10));
        }

        Form form = new Form("Test Form");

        // gets called from dpy.callScreenChange() after uCallShow()
        dpy.liveTracer.add(
            Display.LTR_SCREENCHANGE_AFTERSHOW,
            new LiveTraceListener() {
                public void call(String tag) {
                    baton.pass();
                }
            });

        dpy.setCurrent(form);

        for (int ii = 0; ii < items.length; ii++) {
            form.append(items[ii]);
            if (ii == 3) {
                baton.start();
            }
        }
        baton.finish();

        // wait for queued events to be processed
        new SerialCallback(dpy).invokeAndWait();

        assertTrue("layout must be valid", checkValidLayout(form));
View Full Code Here

Examples of com.sun.midp.util.Baton

     * This test simulates that case.
     */
    void testTraversalInconsistency() {
        Form form = new Form("Test Form 2");
        FormLFImpl formLF = (FormLFImpl)form.formLF;
        final Baton baton = new Baton();
        SerialCallback scb = new SerialCallback(dpy);

        // can be any interactive item
        Item item = new Gauge(null, true, 1, 0);

        // Set up a form with no focusable item.

        form.append("String 1");
        dpy.setCurrent(form);
        scb.invokeAndWait();

        // Block the event queue to prevent the invalidate from
        // being processed.

        dpy.callSerially(
            new Runnable() {
                public void run() {
                    baton.pass();
                }
            });
        baton.start();

        // Append a focusable item to the form, and then call
        // uTraverse() directly, as if a key had been pressed at
        // exactly the right moment.

        form.insert(0, item);
        formLF.uTraverse(Canvas.DOWN);
        baton.finish();

        // Wait for the invalidate to finish processing, then
        // check assertions.

        scb.invokeAndWait();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.