public List<Integer> getSelectedApplicationIds() {
   if (applications.getItemCount() == 0) {
     return group.getApplicationIds();
   }
   List<Integer> result = new ArrayList<Integer>(applications.getItemCount());
   for (int index = 0; index < applications.getItemCount(); index++) {
     if (applications.isItemSelected(index)) {
       int id = Integer.parseInt(applications.getValue(index));
       result.add(id);
     }
   }
   return result;
 }
 void resetApplications(List<Application> apps) {
   if (apps != null && !apps.isEmpty()) {
     applications.clear();
     for (Application a : apps) {
       applications.addItem(a.toDisplay(), a.getId() + "");
     }
     for (int index = 0; index < applications.getItemCount(); index++) {
       int id = Integer.parseInt(applications.getValue(index));
       applications.setItemSelected(index, group.getApplicationIds().contains(id));
     }
   }
   adjustListBox(box.getValue());
 }
 public List<Integer> getSelectedRegionIds() {
   GWT.log("get selected region ids");
   if (regions.getItemCount() == 0) {
     return group.getApplicationIds();
   }
   List<Integer> result = new ArrayList<Integer>(regions.getItemCount());
   for (int index = 0; index < regions.getItemCount(); index++) {
     if (regions.isItemSelected(index)) {
       int id = Integer.parseInt(regions.getValue(index));
       result.add(id);
     }
   }
   GWT.log("get selected region ids" + result);
   return result;
 }
 public void setGroup(Group g) {
   this.group = g;
   setApplicationIds(g.getApplicationIds());
   setRegionIds(g.getRegionIds());
 }