//
// Triple Play - utilities for use in PlayN-based games
// Copyright (c) 2011, Three Rings Design, Inc. - All rights reserved.
// http://github.com/threerings/tripleplay/blob/master/LICENSE

package tripleplay.ui;

import tripleplay.ui.TableLayout.Column;

/**
 * Displays tables and their configuration options.
 */
public class TablePage implements WidgetDemo.Page
{
    public String name () {
        return "Tables";
    }

    public Group createInterface () {
        TableLayout main = new TableLayout(new Column().stretch(), new Column()).gaps(15, 15);

        TableLayout aligndemo = new TableLayout(
            new Column().alignLeft(), new Column().alignRight(), new Column().stretch()).gaps(5, 5);

        TableLayout fixeddemo = new TableLayout(3).gaps(5, 5);
        fixeddemo.column(0).fixed();
        fixeddemo.column(2).stretch();

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

        Group iface = new Group(main, greyBg).add(
            new Label("This column is stretched"),
            new Label("This column is not"),

            new Group(new TableLayout(2).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")));

        return iface;
    }
}

@@ -554,25 +554,24 @@
 ps(15, 15);%0A
-%0A
         Tabl
@@ -708,17 +708,16 @@
 (5, 5);%0A
-%0A
         
@@ -760,49 +760,32 @@
 out(
-3).gaps(5, 5);%0A        fixeddemo.c
+%0A            new C
 olumn(
-0
 ).fi
@@ -793,36 +793,35 @@
 ed()
-;%0A        fixeddemo.c
+, new Column(), new C
 olumn(
-2
 ).st
@@ -827,16 +827,28 @@
 tretch()
+).gaps(5, 5)
 ;%0A%0A     

Use columns in the third constructor as well.