Example usage for com.google.gwt.user.client.ui FlexTable FlexTable

List of usage examples for com.google.gwt.user.client.ui FlexTable FlexTable

Introduction

In this page you can find the example usage for com.google.gwt.user.client.ui FlexTable FlexTable.

Prototype

public FlexTable() 

Source Link

Usage

From source file:com.google.gwt.demos.validation.client.ValidationDemo.java

License:Apache License

/**
 * Create the sample booking form./*from   w ww .ja v a 2s  .  c o  m*/
 */
private void createBookingForm() {

    // /////////////////////////////////////////////
    // World's most boring ui for a form.
    // ////////////////////////////////////////////
    booking = new FlexTable();
    booking.getColumnFormatter().setStyleName(0, "bookingLabel");
    RootPanel.get().add(booking);

    addTextField("Name");
    TextBox birth = addTextField("Birth");
    final TextBox crimeCode = addTextField("Crime Code");
    TextBox dateOfCrime = addTextField("Date of Crime");
    addTextField("Arresting Officer");
    TextBox phone = addTextField("Phone Number");

    // /////////////////////////////////////////////
    // Validation Support.
    // ////////////////////////////////////////////

    // Cannot book anyone younger than 18 or older than 100.
    Validator crimeValidator = new DateRangeValidator(offsetDate(100), offsetDate(18));
    ValidatorController crimeValidation = ValidatorController.addAsFocusListener(birth, crimeValidator);

    // Crime codes must be correctly formatted.
    ValidatorController.addAsFocusListener(crimeCode, crimeCodeFormatValidator);

    // Phone numbers can be pushed into shape if they are almost correctly
    // formatted.
    ValidatorController.addAsFocusListener(phone, new USPhoneValidator());

    // Creates a custom validator.
    Validator statuteValidator = createStatuteValidator(crimeCode);

    // Can add the same validator to multiple subjects to do multi-field
    // validation.
    crimeValidation.addValidator(statuteValidator);
    ValidatorController.addAsFocusListener(dateOfCrime, statuteValidator);

    // Cannot book someone for a crime more than 30 years old.
    ValidatorController.addAsFocusListener(dateOfCrime, new DateRangeValidator(offsetDate(30), new Date()));
}

From source file:com.google.gwt.examples.FlexTableExample.java

License:Apache License

public void onModuleLoad() {
    // Tables have no explicit size -- they resize automatically on demand.
    FlexTable t = new FlexTable();

    // Put some text at the table's extremes.  This forces the table to be
    // 3 by 3./*  www .ja va 2 s.co m*/
    t.setText(0, 0, "upper-left corner");
    t.setText(2, 2, "bottom-right corner");

    // Let's put a button in the middle...
    t.setWidget(1, 0, new Button("Wide Button"));

    // ...and set it's column span so that it takes up the whole row.
    t.getFlexCellFormatter().setColSpan(1, 0, 3);

    RootPanel.get().add(t);
}

From source file:com.google.gwt.gadgets.sample.mealpreferences.client.MealPreferencesGadget.java

License:Apache License

@Override
protected void init(MealPreferences preferences) {
    initDishes(preferences);//w w w . j  a  v  a  2s. c  o  m

    // Create a table with a checklist of all available dishes based on the
    // user's dietary preferences.
    Panel p = new DockLayoutPanel(Unit.PX);
    p.setWidth("100%");

    FlexTable ft = new FlexTable();

    int index = 0;
    for (String dish : dishes) {
        CheckBox cb = new CheckBox();
        final String dishCopy = dish;
        cb.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent event) {
                Window.alert("Your order of " + dishCopy + " will be right up.");
            }
        });
        ft.setWidget(index, 0, cb);
        ft.setHTML(index, 1, dish);
        index++;
    }
    p.add(ft);
    RootLayoutPanel.get().add(p);
}

From source file:com.google.gwt.gdata.sample.hellogdata.client.AccountsAuthSubAuthenticationDemo.java

License:Apache License

/**
 * Create the main content panel for this demo and call
 * showAuthSubStatus to display the authentication status
 * for each GData system./*from   w ww .j  av  a 2s.c  o m*/
 */
public AccountsAuthSubAuthenticationDemo() {
    mainPanel = new FlexTable();
    mainPanel.setCellPadding(4);
    mainPanel.setCellSpacing(0);
    initWidget(mainPanel);
    /* 
     * Here we load the default package to make AuthSub available.
     * For AuthSub any of the GData packages will do.
     * */
    if (!GData.isLoaded(HelloGData.defaultPackage)) {
        GData.loadGDataApi(GDATA_API_KEY, new Runnable() {
            public void run() {
                startDemo();
            }
        }, HelloGData.defaultPackage);
    } else {
        startDemo();
    }
}

From source file:com.google.gwt.gdata.sample.hellogdata.client.AnalyticsBounceRateDemo.java

License:Apache License

/**
 * Setup the Analytics service and create the main content panel.
 * If the user is not logged on to Analytics display a message,
 * otherwise start the demo by retrieving the Analytics accounts.
 *///from   ww  w . j av a  2s. c  om
public AnalyticsBounceRateDemo() {
    mainPanel = new FlexTable();
    initWidget(mainPanel);
    if (!GData.isLoaded(GDataSystemPackage.ANALYTICS)) {
        showStatus("Loading the GData Analytics package...", false);
        GData.loadGDataApi(GDATA_API_KEY, new Runnable() {
            public void run() {
                startDemo();
            }
        }, GDataSystemPackage.ANALYTICS);
    } else {
        startDemo();
    }
}

From source file:com.google.gwt.gdata.sample.hellogdata.client.AnalyticsLanguagesDemo.java

License:Apache License

/**
 * Setup the Analytics service and create the main content panel.
 * If the user is not logged on to Analytics display a message,
 * otherwise start the demo by retrieving the Analytics accounts.
 *//*ww w  .j a v a2  s  .  c o m*/
public AnalyticsLanguagesDemo() {
    mainPanel = new FlexTable();
    initWidget(mainPanel);
    if (!GData.isLoaded(GDataSystemPackage.ANALYTICS)) {
        showStatus("Loading the GData Analytics package...", false);
        GData.loadGDataApi(GDATA_API_KEY, new Runnable() {
            public void run() {
                startDemo();
            }
        }, GDataSystemPackage.ANALYTICS);
    } else {
        startDemo();
    }
}

From source file:com.google.gwt.gdata.sample.hellogdata.client.AnalyticsTopPagesDemo.java

License:Apache License

/**
 * Setup the Analytics service and create the main content panel.
 * If the user is not logged on to Analytics display a message,
 * otherwise start the demo by retrieving the Analytics accounts.
 *///from  w  w  w. j  a  va 2  s. c  o m
public AnalyticsTopPagesDemo() {
    mainPanel = new FlexTable();
    initWidget(mainPanel);
    if (!GData.isLoaded(GDataSystemPackage.ANALYTICS)) {
        showStatus("Loading the GData Analytics package...", false);
        GData.loadGDataApi(GDATA_API_KEY, new Runnable() {
            public void run() {
                startDemo();
            }
        }, GDataSystemPackage.ANALYTICS);
    } else {
        startDemo();
    }
}

From source file:com.google.gwt.gdata.sample.hellogdata.client.AnalyticsTopSearchesDemo.java

License:Apache License

/**
 * Setup the Analytics service and create the main content panel.
 * If the user is not logged on to Analytics display a message,
 * otherwise start the demo by retrieving the Analytics accounts.
 *//*from  w w w  .  j  a  v a 2s  .  c  o  m*/
public AnalyticsTopSearchesDemo() {
    mainPanel = new FlexTable();
    initWidget(mainPanel);
    if (!GData.isLoaded(GDataSystemPackage.ANALYTICS)) {
        showStatus("Loading the GData Analytics package...", false);
        GData.loadGDataApi(GDATA_API_KEY, new Runnable() {
            public void run() {
                startDemo();
            }
        }, GDataSystemPackage.ANALYTICS);
    } else {
        startDemo();
    }
}

From source file:com.google.gwt.gdata.sample.hellogdata.client.AnalyticsVisitsDemo.java

License:Apache License

/**
 * Setup the Analytics service and create the main content panel.
 * If the user is not logged on to Analytics display a message,
 * otherwise start the demo by retrieving the Analytics accounts.
 *//*from   w w w . ja  v a 2s . c o m*/
public AnalyticsVisitsDemo() {
    mainPanel = new FlexTable();
    initWidget(mainPanel);
    if (!GData.isLoaded(GDataSystemPackage.ANALYTICS)) {
        showStatus("Loading the GData Analytics package...", false);
        GData.loadGDataApi(GDATA_API_KEY, new Runnable() {
            public void run() {
                startDemo();
            }
        }, GDataSystemPackage.ANALYTICS);
    } else {
        startDemo();
    }
}

From source file:com.google.gwt.gdata.sample.hellogdata.client.AnalyticsYourAccountsDemo.java

License:Apache License

/**
 * Setup the Analytics service and create the main content panel.
 * If the user is not logged on to Analytics display a message,
 * otherwise start the demo by retrieving the Analytics accounts.
 */// w  w w .  j av  a2s .c  o  m
public AnalyticsYourAccountsDemo() {
    mainPanel = new FlexTable();
    initWidget(mainPanel);
    if (!GData.isLoaded(GDataSystemPackage.ANALYTICS)) {
        showStatus("Loading the GData Analytics package...", false);
        GData.loadGDataApi(GDATA_API_KEY, new Runnable() {
            public void run() {
                startDemo();
            }
        }, GDataSystemPackage.ANALYTICS);
    } else {
        startDemo();
    }
}