Search code examples
gwtmvp4g

GWT target CheckBox widget within a flow panel


I have a CheckBox widget within a flowpanel, which is also within a flowpanel. Essentially, what I have is the following:

<div class="flowPanel1">
   <div class="flowPanel2">
      <checkBox>
   </div>
   <div class="flowPanel2">
      <checkBox>
   </div>
   <div class="flowPanel2">
      <checkBox>
   </div>
</div>

What i'd like to do is that when an anchor is clicked, I can uncheck the checkbox one I need unchecked. Keeping in mind that i'm generating the code above through a for loop using the checkbox value/id from an arrayList from a database. Hope that makes sense, thanks!


Solution

  • For those interested, here's what I did:

    for (int j = 0; j < checkBoxList.size(); j++){
        if(checkBoxList.get(j) == checkBoxId){
        FlowPanel subFlowPanel = (FlowPanel) mainFlowPanel.getWidget(j);
        CheckBox checkBox = (CheckBox) subFlowPanel.getWidget(0);
        checkBox.setValue(false);
        }
    }
    

    Thanks!

    PS. If you know a better way of achieving the same result, let me know. Thanks!