Package react

Examples of react.UnitSlot


                return checked ? tileIcon(squares, 0) : null;
            }
        }).connect(label2.icon.slot());

        final Field source = editable, target = disabled;
        setField.clicked().connect(new UnitSlot() {
            @Override public void onEmit () {
                PlayN.log().info("Setting text to " + source.text.get());
                target.text.update(source.text.get());
            }
        });
View Full Code Here


        final Box box = new Box();
        return new Group(AxisLayout.vertical().offEqualize()).add(
            new Group(AxisLayout.horizontal().gap(15), GREENBG).add(
                toggle3, AxisLayout.stretch(disabled)),
            new Group(AxisLayout.horizontal().gap(15), GREENBG).add(
                new LongPressButton("Long Pressable").onLongPress(new UnitSlot() {
                    @Override public void onEmit () { pressResult.text.update("Long pressed"); }
                }).onClick(new UnitSlot() {
                    @Override public void onEmit () { pressResult.text.update("Clicked"); }
                }), AxisLayout.stretch(pressResult)),
            new Group(AxisLayout.horizontal().gap(15), GREENBG).add(
                new Label("Image button"),
                new ImageButton(tile(squares, 0), tile(squares, 1)).onClick(new UnitSlot() {
                    @Override public void onEmit () { clickCount.increment(1); }
                }),
                new ValueLabel(clickCount)),
            new Group(AxisLayout.horizontal().gap(15), GREENBG).add(
                new Button("Fill Box").onClick(new UnitSlot() {
                    @Override public void onEmit () {
                        box.set(new Label(box.contents() == null ? "Filled" : "Refilled"));
                    }
                }),
                box),
            new Group(AxisLayout.horizontal().gap(15), GREENBG).add(
                throbber.onClick(new UnitSlot() {
                    @Override public void onEmit () {
                        throbber.throb();
                    }
                }))
            );
View Full Code Here

                    Style.BACKGROUND.is(Background.beveled(0xFF8F8F8F, 0xFF4F4F4F, 0xFFCFCFCF).
                        inset(4))).setConstraint(new TableLayout.Colspan(2)));
                final Button prev = new Button("<< Previous").onClick(menu.incrementPage(-1));
                final Button next = new Button("Next >>").onClick(menu.incrementPage(1));
                menu.add(prev, next);
                UnitSlot updateEnabling = new UnitSlot() {
                    @Override public void onEmit () {
                        prev.setEnabled(menu.page().get() > 0);
                        next.setEnabled(menu.page().get() < menu.numPages().get() - 1);
                    }
                };

                menu.page().connect(updateEnabling);
                menu.numPages().connect(updateEnabling);

                int sel = -1;
                for (int ii = 0; ii < 256; ii++) {
                    String hex = new StringBuilder("0x").
                        append(HEX.charAt((ii>>4)&0xf)).
                        append(HEX.charAt(ii&0xf)).toString();
                    if (text.get().startsWith(hex)) sel = ii;
                    menu.add(new MenuItem(hex));
                }
                if (sel != -1) menu.setPage(sel / menu.itemsPerPage);
                updateEnabling.onEmit();
                return menu;
            }
        };

        TrackingLabel colors = new TrackingLabel(menuHost, "Colors \u25BC") {
View Full Code Here

            class CellAdder extends Button {
                final int count;
                CellAdder (int count) {
                    super("+" + count);
                    this.count = count;
                    onClick(new UnitSlot() {
                        @Override public void onEmit () { addCells(CellAdder.this.count); }
                    });
                }
            }
            Button add = new Button("Add").onClick(new UnitSlot() {
                @Override public void onEmit () { addColumn(); }
            });
            Button reset = new Button("Reset").onClick(new UnitSlot() {
                @Override public void onEmit () { reset(); }
            });
            add(column,
                new Group(AxisLayout.horizontal()).add(
                    new Label("Columns:"), add, reset, new Shim(5, 1),
View Full Code Here

            class CellAdder extends Button {
                final int count;
                CellAdder (int count) {
                    super("+" + count);
                    this.count = count;
                    onClick(new UnitSlot() {
                        @Override public void onEmit () { addCells(CellAdder.this.count); }
                    });
                }
View Full Code Here

    /**
     * Gets a slot that will increment the page by the given delta when emitted.
     */
    public UnitSlot incrementPage (final int delta) {
        return new UnitSlot() {
            @Override public void onEmit () {
                setPage(_page.get() + delta);
            }
        };
    }
View Full Code Here

    /**
     * Gets a new slot which will invoke {@link #invalidate()}.
     * @param styles if set, the slot will also call {@link #clearLayoutData()} when emitted
     */
    protected UnitSlot invalidateSlot (final boolean styles) {
        return new UnitSlot() {
            @Override public void onEmit () {
                invalidate();
                if (styles) clearLayoutData();
            }
        };
View Full Code Here

    public Slider (float value, float min, float max) {
        this.value = Value.create(value);
        range = Value.create(new Range(min, max));
        // update our display if the slider value is changed externally
        UnitSlot updateThumb = new UnitSlot () { @Override public void onEmit () { updateThumb(); }};
        this.value.connect(updateThumb);
        range.connect(updateThumb);
    }
View Full Code Here

            if (ii%3 == 0) grid.add(new Label(_rlabels[ii/3]));
            final DemoScreen screen = _screens[ii];
            if (screen == null) {
                grid.add(new Shim(1, 1));
            } else {
                grid.add(new Button(screen.name()).onClick(new UnitSlot() { public void onEmit () {
                    _stack.push(screen);
                    screen.back.clicked().connect(new UnitSlot() { public void onEmit () {
                        _stack.remove(screen);
                    }});
                }}));
                // push this screen immediately if it was specified on the command line
                if (shown++ == toShow) _stack.push(screen, ScreenStack.NOOP);
View Full Code Here

        super.wasHidden();
        iface.destroyRoot(_root);
    }

    protected Button screen (String title, final ScreenFactory factory) {
        return new Button(title).onClick(new UnitSlot() { public void onEmit () {
            final DemoScreen screen = factory.apply();
            _stack.push(screen);
            screen.back.clicked().connect(new UnitSlot() { public void onEmit () {
                _stack.remove(screen);
            }});
        }});
    }
View Full Code Here

TOP

Related Classes of react.UnitSlot

Copyright © 2018 www.massapicom. 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.