Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9208053
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T00:31:55+00:00 2026-06-18T00:31:55+00:00

Working in Google Web Toolkit (GWT) I am using a CellList to render the

  • 0

Working in Google Web Toolkit (GWT) I am using a CellList to render the details of a list of Tariffs (using a CompositeCell to show a CheckBoxCell next to a custom cell of my own).

I want to filter the list by tariff length (12, 18, 24, 36 months etc). I would like to render a checkbox for each tariff length at the top of the list, and update the dataProvider as necessary when users uncheck and recheck a box.

I do not know in advance the set of tariff lengths, they will be extracted from the result set when the page is rendered. There could just be two (requiring two checkboxes), but possibly there could be 10 (requiring 10 checkboxes) – I only want to render a checkbox for each as needed.

So somehow I need to associate an int value with each checkbox, and then pass that int to a function that updates the list by removing all tariffs that match. I’m just not sure how to add the handler for the checkboxes and how to get the value for that particular box.

This is what I’m thinking:

    // panel to hold boxes
    private Panel contractLengthPanel = new HorizontalPanel();      
    textPanel2.add(contractLengthPanel);

    // create a set of the terms, by looping the result set
    Set<String> contractTerms = new HashSet<String>();
    for(ElecTariff tariff : tariffs)
    {
        contractTerms.add(Integer.toString(tariff.getContractLength()));
    }

    // loop that set, creating a CheckBox for each value
    for(String term : contractTerms)
    {
        CheckBox box = new CheckBox(term + " Months");

        // set all boxes with the same name, and a unique id
        box.getElement().setAttribute("name", "termBoxes");
        box.getElement().setAttribute("id", "termBox" + term);

        contractLengthPanel.add(box);
    }

Now I’m not sure if I’m along the right lines here, but now I have each box as part of the same group (they have the same name) I would like to use that to add a handler that is called when a box is checked or unchecked, passing the box id (which contains the tariff length) to that function.

I hope this wasn’t too confusingly written. Help appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T00:31:57+00:00Added an answer on June 18, 2026 at 12:31 am

    There really is nothing like a “group of checkboxes” in HTML, and neither there is in GWT. There are kind of “groups of radiobuttons” though, but it’s only about having their checked state mutually exclusive, it doesn’t change anything to the way you work with them from code.

    You have to listen to changes on each and every checkbox.

    What you can do though is to use the same event handler for all your checkboxes; something like:

    ValueChangeHandler<Boolean> handler = new ValueChangeHandler<Boolean>() {
       @Override
       public void onValueChange(ValueChangeEvent<Boolean> event) {
          CheckBox box = (CheckBox) event.getSource();
          String id = box.getFormValue();
          boolean checked = box.getValue();
          …
       }
    };
    

    (note: I used getFormValue() rather than getElement().getId(); I believe it’s a better choice: it’s specifically made to associate a value with the checkbox)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Working a on a Google Web Toolkit project. I want to show a word
I am working on a web service servlet running on Google App Engine using
I am currently working on a simple web application through Google App engine using
Working with the Google Web Toolkit i have written an application which is based
I'm working on some Google Web Toolkit Code that places an AbsolutePanel on top
I'm working on a web app with google maps and using getCurrentPosition() to get
I am using Google Web Toolkit and Java Google App Engine to write an
I am using Google Web Toolkit for a project and would like the user
I'm working on a pretty complex web application in Ext with Google maps API
Currently I am working on project like web analytic using rails 3.2.3 I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.