java - Is it Possible to Loop Through a Map of Grids in GWT? -


problem

i've checked contents of map, response keys , tried grabbing maps manually. reason though, lets me create 1 map, no matter 1 select.

my attempt

occupancycheckview class

so create object in turn creates map:

private map<string, grid> resultgrids = new hashmap<string, grid>(); //where string title of grid

after created, allow user grab it:

public map<string, grid> getresultgrids() {         return resultgrids;     } 

datarun class

i make rpc call in class , wait response:

public void onsuccess(method method, response response)              {                    occupancycheckview = new occupancycheckview(response.getresult()); //this passes list of 2 strings creates titles , grids , puts them in map<string, grid>                  map<string, grid> resultgrids = occupancycheckview.getresultgrids(); //i've checked contents dumping widgetname.tostring() screen , both grids there yet can't seem call both of them @ same time          //so try accessing both grids                  for( string name : response.getresult() ) {                      label gridtitle = new label(string.valueof(resultgrids.containskey(name))); //both return true                     gridtitle.setstylename("gridtitle");                     mainpanel_.add(gridtitle);                     mainpanel_.add(resultgrids.get(name)); //accesses map<string, grid>                     testmap.add(resultgrids.get(name));                     echo.settext("no data");                 }                  //mainpanel_.add(resultgrids.get("firstresponse"));                  //mainpanel_.add(resultgrids.get("secondresponse"));              } 

i'm having no compilation errors. works when print various parts screen (ask me if want me check anything). on last part commented out 2 manual adding of grids, if leave 1 or both in, still ever displays 1 grid, no matter 1 select.

edit

how create grids:

private grid occupancygrid;  <snip>  private void createresultgrid(list<string> gridname){      occupancygrid = new grid(17,17);      (string name_ : gridname){     label title = new label();     title.settext(name_);      title.setstylename("gridtitle"); //todo style      (int index=1;  index < occupancygrid.getcolumncount(); index++){         occupancygrid.setwidget(0, index, new html("cx"+integer.tohexstring(index-1)));     }      (int index=1;  index < occupancygrid.getrowcount(); index++){         occupancygrid.setwidget(index, 0, new html("cx"+integer.tohexstring(index-1)));     }      resultlabels.put(name_, title);     resultgrids.put(name_, occupancygrid); } } 

it possible add both grids, second 1 displayed on top of first one. may happen if mainpanel_ layoutpanel, example.

try adding both grids flowpanel , add flowpanel mainpanel_, or, if mainpanel_ layoutpanel, set position of each grid when add it.


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -