Package tripleplay.ui

Examples of tripleplay.ui.Group


        scroll.addStyles(Style.BACKGROUND.is(Background.solid(Colors.LIGHT_GRAY).inset(10)));

        updatePos.onEmit();
        updateSize.onEmit();

        return new Group(AxisLayout.vertical().offStretch()).add(
            new Group(AxisLayout.horizontal()).add(
                new Label("Size:"), new Shim(15, 1), width, new Label("x"), height, beh),
            new Group(AxisLayout.horizontal()).add(
                new Label("Pos:"), new Shim(15, 1), xpos, ypos),
            new Group(AxisLayout.horizontal()).add(
                new Label("Click:"), new Shim(15, 1), click),
            new Group(AxisLayout.horizontal().offStretch()).setConstraint(AxisLayout.stretched()).
                add(scroll.setConstraint(AxisLayout.stretched())));
    }
View Full Code Here


    @Override protected String title () {
        return "UI: FlowLayout";
    }

    @Override protected Group createIface () {
        Group root = new Group(
            AxisLayout.vertical().offStretch()).setConstraint(AxisLayout.stretched());

        final Group panel = new Group(new FlowLayout(), Styles.make(Style.BACKGROUND.is(
            Background.bordered(0xFFFFFFFF, 0xff000000, 2).inset(4))));

        Group buttons = new Group(AxisLayout.horizontal());
        for (final ElemType type : ElemType.values()) {
            buttons.add(new Button("Add " + type.toString()).onClick(new UnitSlot() {
                @Override public void onEmit () { panel.add(create(type)); }
            }));
        }
        root.add(buttons);

        buttons = new Group(AxisLayout.horizontal());
        buttons.add(new Label("HAlign:"));
        for (final Style.HAlign halign : Style.HAlign.values()) {
            buttons.add(new Button(halign.toString().substring(0, 1)).onClick(new UnitSlot() {
                @Override public void onEmit () { panel.addStyles(Style.HALIGN.is(halign)); }
            }));
        }

        buttons.add(new Label("VAlign:"));
        for (final Style.VAlign valign : Style.VAlign.values()) {
            buttons.add(new Button(valign.toString().substring(0, 1)).onClick(new UnitSlot() {
                @Override public void onEmit () { panel.addStyles(Style.VALIGN.is(valign)); }
            }));
        }
        root.add(buttons);
View Full Code Here

        super.paint(clock);
        _parts.paint(clock);
    }

    @Override protected Group createIface () {
        Group group = new Group(AxisLayout.vertical(),
                                Style.BACKGROUND.is(Background.solid(0xFF000000)));
        if (graphics().ctx() == null) {
            group.add(new Label("Particles are only supported with GL/WebGL.").
                      addStyles(Style.COLOR.is(0xFFFFFFFF)));
        }
        return group;
    }
View Full Code Here

    protected Group createIface () {
        final BoxPointWidget position = new BoxPointWidget("Position");
        final BoxPointWidget origin = new BoxPointWidget("Origin");
        final Slider width = new Slider(50, 10, 150);
        final Slider height = new Slider(50, 10, 150);
        Group sizeCtrl = new Group(AxisLayout.horizontal()).add(new Label("Size:"), width, height);
        final Group group = new Group(new AbsoluteLayout());
        group.layer.add(PlayN.graphics().createImmediateLayer(new ImmediateLayer.Renderer() {
            Point pt = new Point();
            @Override public void render (Surface surface) {
                IDimension size = group.size();
                position.point.get().resolve(size, pt);
                surface.save();
                surface.setFillColor(Colors.BLACK);
                surface.fillRect(pt.x - 2, pt.y - 2, 5, 5);
                surface.restore();
            }
        }).setDepth(1));
        group.addStyles(Style.BACKGROUND.is(Background.solid(Colors.WHITE)));
        final Group widget = new Group(AxisLayout.horizontal()).addStyles(
            Style.BACKGROUND.is(Background.solid(Colors.CYAN)));
        group.add(widget);
        UnitSlot updateConstraint = new UnitSlot() {
            @Override public void onEmit () {
                widget.setConstraint(new AbsoluteLayout.Constraint(
                    position.point.get(), origin.point.get(),
                    new Dimension(width.value.get(), height.value.get())));
            }
        };
        width.value.connect(updateConstraint);
        height.value.connect(updateConstraint);
        position.point.connect(updateConstraint);
        origin.point.connect(updateConstraint);
        updateConstraint.onEmit();
        return new Group(AxisLayout.vertical().offStretch()).add(
            new Label("Move the sliders to play with the constraint"),
            new Group(AxisLayout.horizontal()).add(position, origin),
            sizeCtrl, group.setConstraint(AxisLayout.stretched()));
    }
View Full Code Here

    @Override protected String title () {
        return "Util: Colors";
    }

    @Override protected Group createIface () {
        return new Group(AxisLayout.vertical(), Style.HALIGN.center).add(
            new Group(new TableLayout(TableLayout.COL.fixed().alignRight(),
                                      TableLayout.COL.fixed().alignLeft()).gaps(1, 5)).add(
                new Label("White"), createLabel(Colors.WHITE),
                new Label("Light Gray"), createLabel(Colors.LIGHT_GRAY),
                new Label("Gray"), createLabel(Colors.GRAY),
                new Label("Dark Gray"), createLabel(Colors.DARK_GRAY),
View Full Code Here

            ox = new Slider(0, 0, 100), oy = new Slider(0, 0, 100);

        public BoxPointWidget (String label) {
            setLayout(AxisLayout.vertical());
            initChildren(new Label(label),
                new Group(AxisLayout.horizontal()).add(new Label("N:"), nx, ny),
                new Group(AxisLayout.horizontal()).add(new Label("O:"), ox, oy));
            UnitSlot update = new UnitSlot() {
                @Override public void onEmit () {
                    point.update(new BoxPoint(
                        nx.value.get(), ny.value.get(), ox.value.get(), oy.value.get()));
                }
View Full Code Here

    @Override protected String title () {
        return "UI: Sliders";
    }

    @Override protected Group createIface () {
        Group iface = new Group(AxisLayout.vertical().gap(10)).add(
            new Shim(15, 15),
            new Label("Click and drag the slider to change the value:"),
            sliderAndLabel(new Slider(0, -100, 100), "-000"),
            new Shim(15, 15),
            new Label("This one counts by 2s:"),
View Full Code Here

    protected Group sliderAndLabel (Slider slider, String minText) {
        ValueLabel label = new ValueLabel(slider.value.map(FORMATTER)).
            setStyles(Style.HALIGN.right, Style.FONT.is(FIXED)).
            setConstraint(Constraints.minSize(minText));
        return new Group(AxisLayout.horizontal()).add(slider, label);
    }
View Full Code Here

        Button add100 = new Button("+100");
        HistoryGroup.Labels history = new HistoryGroup.Labels();
        final SizableGroup historyBox = new SizableGroup(new BorderLayout());
        historyBox.add(history.setConstraint(BorderLayout.CENTER));
        Slider width = new Slider(150, 25, 1024);
        Group top = new Group(AxisLayout.horizontal()).add(
            prefix.setConstraint(AxisLayout.stretched()), add10, add100, width);
        width.value.connectNotify(new Slot<Float>() {
            @Override public void onEmit (Float val) {
                historyBox.preferredSize.updateWidth(val);
            }
        });
        add10.clicked().connect(addSome(history, prefix, 10));
        add100.clicked().connect(addSome(history, prefix, 100));
        history.setStylesheet(Stylesheet.builder().add(Label.class,
            Style.BACKGROUND.is(Background.composite(
                Background.blank().inset(0, 2),
                Background.bordered(Colors.WHITE, Colors.BLACK, 1).inset(10))),
            Style.TEXT_WRAP.on, Style.HALIGN.left).create());
        history.addStyles(Style.BACKGROUND.is(Background.beveled(
            Colors.CYAN, Colors.brighter(Colors.CYAN), Colors.darker(Colors.CYAN)).inset(5)));
        _lastNum = 0;
        return new Group(AxisLayout.vertical()).add(
            top, historyBox.setConstraint(AxisLayout.stretched())).addStyles(
            Style.BACKGROUND.is(Background.blank().inset(5)));
    }
View Full Code Here

    @Override protected String title () {
        return "Screen Stack and Transitions";
    }

    @Override protected Group createIface () {
        Group root = new Group(AxisLayout.vertical());
        addUI(this, root, 0);
        return root;
    }
View Full Code Here

TOP

Related Classes of tripleplay.ui.Group

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.