TextField and Select swap

I have an application that will create a form with fields, some fields I will tie a listener to to run a query. When one of these fields changes, the query is run and what I want to happen next is the Textfield to be changed into a Select.

I have gotten to the point where I believe I am replacing the Fields with Selects, but when I have requested a repaint on EVERYTHING, the new Select fields don’t show up.


Component comp = ComponentFactory.getCompForType(type);
if (type.getType().equals(LOOKUP)) {
      ((Field)comp).addListener(new Field.ValueChangeListener() {
            public void valueChange(ValueChangeEvent event) {
                    model.updateFields();
                    mainPanel.requestRepaintAll();
            }
      }
      model.addLookupField((Field)comp);
}

In my model I keep a list of the lookup fields. When updateFields is called I run a query, using all the lookup fields, I then parse through and make a list of results for each lookup field, as each one will be turned into a Select. I make a separate list for these new fields.


lookups = newFields;

This is where I have verified that I do have a new list of Select fields and I am trying to overwrite the previous fields. I believe my issue may be here, and that it doesn’t replace the original field just overwrites it but doesn’t go to the UI to update.

Help?

I discovered a workaround, if I use topPanel.replaceComponent I can pull it off.