PDA

View Full Version : ContentPanel isn't updating (source included)



mwmcmullen
25 Jun 2010, 4:27 AM
There is a ContentPanel in my application which is within a VerticalPanel and a Window.

This ContentPanel has a 'ToolBar' whose Content is updated everytime something happens elsewhere in the application... for instance if someone adds a new tab, it will be added to this toolbar in a list.

Here is the 'addListener' method for my ToolBar's SimpleComboBox:



type.addListener(Events.Change, new Listener<FieldEvent>()
{
@Override
public void handleEvent(FieldEvent be)
{

SimpleComboValue scv = (SimpleComboValue) be.getValue();

Grid<DatumModel> grid = portletGrids.get(scv.getValue());

com.google.gwt.user.client.Window.alert("I'm definitely handling the FieldEvent with " + scv.getValue() + "!");

contentCP.removeAll();
com.google.gwt.user.client.Window.alert("Size before: " + String.valueOf(contentCP.getItemCount()));
contentCP.add(grid);
contentCP.repaint();

com.google.gwt.user.client.Window.alert("Size after: " + String.valueOf(contentCP.getItemCount()));

contentTarget = new GridDropTarget(grid);
contentTarget.setAllowSelfAsSource(false);

});

sven
25 Jun 2010, 8:39 AM
instead of ontentCP.repaint(); you should call ontentCP.layout():

also this was dicussed severeal times, You should use the forumsearch how to modify containers