Package tripleplay.ui

Examples of tripleplay.ui.Tabs


        return "UI: Tabs";
    }

    @Override protected Group createIface () {
        final int [] lastTab = {0};
        final Tabs tabs = new Tabs().addStyles(Style.BACKGROUND.is(
            Background.bordered(Colors.WHITE, Colors.BLACK, 1).inset(1)));
        final Button moveRight = new Button("Move Right").onClick(new UnitSlot() {
            @Override public void onEmit () {
                Tabs.Tab tab = tabs.selected.get();
                if (movable(tab)) {
                    tabs.repositionTab(tab, tab.index() + 1);
                }
            }
        }).setEnabled(false);
        final Button hide = new Button("Hide").onClick(new UnitSlot() {
            @Override public void onEmit () {
                Tabs.Tab tab = tabs.selected.get();
                if (tab != null) {
                    tab.setVisible(false);
                }
            }
        }).setEnabled(false);
        tabs.selected.connect(new Slot<Tabs.Tab>() {
            @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));
                    }
                }),
                new Button("Remove...").onClick(new TabSelector(tabs) {
                    @Override public void handle (Tabs.Tab tab) {
                        tabs.destroyTab(tab);
                    }
                }),
                new Button("Highlight...").onClick(new TabSelector(tabs) {
                    @Override public void handle (Tabs.Tab tab) {
                        tabs.highlighter().highlight(tab, true);
                    }
                }), moveRight, hide, new Button("Show All").onClick(new UnitSlot() {
                    @Override public void onEmit () {
                        for (int ii = 0; ii < tabs.tabCount(); ii++) {
                            tabs.tabAt(ii).setVisible(true);
                        }
                    }
                })),
            tabs.setConstraint(AxisLayout.stretched()));
    }
View Full Code Here

TOP

Related Classes of tripleplay.ui.Tabs

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.