Package tripleplay.ui

Examples of tripleplay.ui.Group


    @Override public String title () {
        return "UI: BorderLayout";
    }

    @Override protected Group createIface () {
        Group buttons = new Group(
            AxisLayout.horizontal(),
            Styles.make(Style.BACKGROUND.is(Background.solid(0xFFFFFFFF).inset(5))));

        for (final String edge : Panel.EDGES) {
            buttons.add(new Button(edge).onClick(new UnitSlot() {
                @Override public void onEmit () {
                    _panel.toggleEdge(edge);
                }
            }));
        }

        buttons.add(new Shim(10, 1)).add(new Button("Toggle Gaps").onClick(new UnitSlot() {
            @Override public void onEmit () {
                setPanel(_panel.useGroups, _panel.gaps == 0 ? 5 : 0);
            }
        }));

        buttons.add(new Shim(10, 1)).add(new Button("Toggle Sizing").onClick(new UnitSlot() {
            @Override public void onEmit () {
                setPanel(!_panel.useGroups, _panel.gaps);
            }
        }));

        _root = new Group(AxisLayout.vertical().offStretch()).setConstraint(AxisLayout.stretched());
        _root.add(buttons);
        setPanel(false, 0);
        return _root;
    }
View Full Code Here


            }

            public void onFailure (Throwable cause) { }
        });

        return new Group(new TableLayout(3).gaps(5, 5)).add(
            label("Beveled", Background.beveled(0xFFCCFF99, 0xFFEEFFBB, 0xFFAADD77).inset(10)),
            label("Beveled (no inset)", Background.beveled(0xFFCCFF99, 0xFFEEFFBB, 0xFFAADD77)),
            label("Composite", Background.composite(
                Background.solid(Colors.BLUE).inset(5),
                Background.bordered(Colors.WHITE, Colors.BLACK, 2).inset(12),
View Full Code Here

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

    @Override protected Group createIface () {
        Group main = new Group(AxisLayout.vertical()), buttons;
        Selector sel;

        String font = Style.FONT.getDefault(main).name();
        Style.Binding<Font> hdr = Style.FONT.is(graphics().createFont(font, Font.Style.BOLD, 14));
        main.setStylesheet(Stylesheet.builder().add(Label.class,
            Style.FONT.is(graphics().createFont(font, Font.Style.PLAIN, 12))).create());

        main.add(new Label("Simple").addStyles(hdr));
        main.add(new Label("A single parent with buttons - at most one is selected."));
        main.add(buttons = new Group(AxisLayout.horizontal()).add(
            mkButt("A"), mkButt("B"), mkButt("C")));
        sel = new Selector(buttons, buttons.childAt(0));
        main.add(hookup("Selection:", sel));
        main.add(new Shim(10, 10));

        main.add(new Label("Mixed").addStyles(hdr));
        main.add(new Label("A single parent with two groups - one from each may be selected."));
        main.add(buttons = new Group(AxisLayout.horizontal()).add(
            mkButt("Alvin"), mkButt("Simon"), mkButt("Theodore"),
            mkButt("Alpha"), mkButt("Sigma"), mkButt("Theta")));
        sel = new Selector().add(buttons.childAt(0), buttons.childAt(1), buttons.childAt(2));
        main.add(hookup("Chipmunk:", sel));
        sel = new Selector().add(buttons.childAt(3), buttons.childAt(4), buttons.childAt(5));
        main.add(hookup("Greek Letter:", sel));
        main.add(new Shim(10, 10));

        Style.Binding<Background> box = Style.BACKGROUND.is(
            Background.bordered(0xffffffff, 0xff000000, 1).inset(5));
        main.add(new Label("Multiple parents").addStyles(hdr));
        main.add(new Label("At most one button may be selected."));
        main.add(buttons = new Group(AxisLayout.horizontal()).add(
            new Group(AxisLayout.vertical(), box).add(mkButt("R1C1"), mkButt("R2C1")),
            new Group(AxisLayout.vertical(), box).add(mkButt("R1C2"), mkButt("R2C2"))));
        sel = new Selector().add((Group)buttons.childAt(0)).add((Group)buttons.childAt(1));
        main.add(hookup("Selection:", sel));

        return main;
    }
View Full Code Here

            @Override public void onEmit (Element<?> event) {
                update(label, (ToggleButton)event);
            }
        });
        update(label, (ToggleButton)sel.selected.get());
        return new Group(AxisLayout.horizontal()).add(new Label(name), label);
    }
View Full Code Here

            Style.FONT.is(PlayN.graphics().createFont("Times New Roman", Font.Style.PLAIN, 20)),
            Style.HALIGN.center, Style.UNDERLINE.is(true));
        Styles bigLabel = Styles.make(
            Style.FONT.is(PlayN.graphics().createFont("Times New Roman", Font.Style.PLAIN, 32)),
            Style.HALIGN.center);
        return new Group(AxisLayout.vertical()).add(
            new Shim(15, 15),
            new Label("Wrapped text").addStyles(Style.HALIGN.center),
            new Group(AxisLayout.horizontal(), greenBg.add(Style.VALIGN.top)).add(
                AxisLayout.stretch(new Label(TEXT1, smiley).addStyles(
                                       Style.TEXT_WRAP.is(true), Style.HALIGN.left,
                                       Style.ICON_GAP.is(5))),
                AxisLayout.stretch(new Label(TEXT2).addStyles(
                                       Style.TEXT_WRAP.is(true), Style.HALIGN.center)),
                AxisLayout.stretch(new Label(TEXT3).addStyles(
                                       Style.TEXT_WRAP.is(true), Style.HALIGN.right))),
            new Shim(15, 15),
            new Label("Styled text").addStyles(Style.HALIGN.center),
            new Group(AxisLayout.horizontal().gap(10)).add(
                new Label("Plain").addStyles(bigLabel),
                new Label("Pixel Outline").addStyles(
                                       bigLabel.add(Style.TEXT_EFFECT.pixelOutline).
                                       add(Style.COLOR.is(Colors.WHITE)).
                                       add(Style.HIGHLIGHT.is(Colors.GRAY))),
                new Label("Vector Outline").addStyles(
                                       bigLabel.add(Style.TEXT_EFFECT.vectorOutline,
                                                    Style.OUTLINE_WIDTH.is(2f))),
                new Label("Shadow").addStyles(
                                       bigLabel.add(Style.TEXT_EFFECT.shadow))),
            new Label("Underlining").addStyles(Style.HALIGN.center),
            new Group(AxisLayout.horizontal().gap(10)).add(
                new Label("Plain").addStyles(smallUnderlined),
                new Label("gjpqy").addStyles(smallUnderlined),
                new Label("Pixel Outline").addStyles(
                                       smallUnderlined.add(Style.TEXT_EFFECT.pixelOutline)),
                new Label("gjpqy").addStyles(
                                       smallUnderlined.add(Style.TEXT_EFFECT.pixelOutline))),
            new Group(AxisLayout.horizontal().gap(10)).add(
                new Label("Vector Outline").addStyles(
                                       smallUnderlined.add(Style.TEXT_EFFECT.vectorOutline,
                                                           Style.OUTLINE_WIDTH.is(2f))),
                new Label("gjpqy").addStyles(
                                       smallUnderlined.add(Style.TEXT_EFFECT.vectorOutline,
View Full Code Here

            @Override public void onEmit (Tabs.Tab tab) {
                moveRight.setEnabled(movable(tab));
                hide.setEnabled(tab != null);
            }
        });
        return new Group(AxisLayout.vertical().offStretch()).add(
            new Group(AxisLayout.horizontal()).add(
                new Button("Add").onClick(new UnitSlot() {
                    @Override public void onEmit () {
                        String label = _prefix + ++lastTab[0];
                        tabs.add(label, tabContent(label));
                    }
View Full Code Here

    protected int randColor () {
        return Color.rgb(128 + _rnd.nextInt(127), 128 + _rnd.nextInt(127), 128 + _rnd.nextInt(127));
    }

    protected Group tabContent (String label) {
        return new Group(AxisLayout.vertical().offStretch().stretchByDefault()).add(
            new Label(label).addStyles(Style.BACKGROUND.is(Background.solid(randColor()))));
    }
View Full Code Here

            COL.minWidth(100), COL.minWidth(100).stretch(), COL).gaps(5, 5);

        Styles greyBg = Styles.make(Style.BACKGROUND.is(Background.solid(0xFFCCCCCC).inset(5)));
        Styles greenBg = Styles.make(Style.BACKGROUND.is(Background.solid(0xFFCCFF99).inset(5)));

        Group iface = new Group(AxisLayout.vertical().offStretch()).add(
            new Shim(15, 15),
            new Label("Table Layout"),
            new Group(main, greyBg).add(
                new Label("This column is stretched"),
                new Label("This column is not"),

                new Group(new TableLayout(COL, COL).gaps(5, 5), greenBg).add(
                    new Label("Upper left"), new Label("Upper right"),
                    new Label("Lower left"), new Label("Lower right")),

                new Group(alignDemo, greenBg).add(
                    new Button("Foo"),
                    new Button("Bar"),
                    new Button("Baz"),
                    new Button("Foozle"),
                    new Button("Barzle"),
                    new Button("Bazzle")),

                new Group(fixedDemo, greenBg).add(
                    new Button("Fixed"),
                    new Button("Free"),
                    new Button("Stretch+free"),
                    new Button("Fixed"),
                    new Button("Free"),
                    new Button("Stretch+free")),

                new Group(minWidthDemo, greenBg).add(
                    new Button("Min"),
                    new Button("M+stretch"),
                    new Button("Free"),
                    new Button("Min"),
                    new Button("M+stretch"),
                    new Button("Free"))),

            new Shim(15, 15),
            new Label("Absolute Layout"),
            new Group(new AbsoluteLayout(), greyBg).add(
                AbsoluteLayout.at(new Label("+50+20"), 50, 20),
                AbsoluteLayout.at(new Button("150x35+150+50"), 150, 50, 150, 35)));

        return iface;
    }
View Full Code Here

        super.wasAdded();
        _root = iface.createRoot(AxisLayout.vertical().gap(0).offStretch(), stylesheet(), layer);
        _root.addStyles(Style.BACKGROUND.is(background()), Style.VALIGN.top);
        _root.setSize(width(), height());
        Background bg = Background.solid(0xFFCC99FF).inset(0, 0, 5, 0);
        _root.add(new Group(AxisLayout.horizontal(), Style.HALIGN.left, Style.BACKGROUND.is(bg)).add(
                      this.back = new Button("Back"),
                      new Label(title()).addStyles(Style.FONT.is(TITLE_FONT), Style.HALIGN.center).
                      setConstraint(AxisLayout.stretched())));
        if (subtitle() != null) _root.add(new Label(subtitle()));
        Group iface = createIface();
        if (iface != null) _root.add(iface.setConstraint(AxisLayout.stretched()));
    }
View Full Code Here

    @Override protected String title () {
        return "Flump animation";
    }

    @Override protected Group createIface () {
        final Group root = new Group(new AbsoluteLayout());

        JsonLoader.loadLibrary("flump", new Callback<Library>() {
            public void onSuccess (Library lib) {
                _movie = lib.createMovie("walk");
                _movie.layer().setTranslation(graphics().width()/2, 300);
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.