| OLD | NEW |
| 1 package autotest.afe; | 1 package autotest.afe; |
| 2 | 2 |
| 3 import autotest.afe.create.CreateJobViewPresenter.JobCreateListener; | 3 import autotest.afe.CreateJobView.JobCreateListener; |
| 4 import autotest.common.JSONArrayList; | 4 import autotest.common.JSONArrayList; |
| 5 import autotest.common.JsonRpcCallback; | 5 import autotest.common.JsonRpcCallback; |
| 6 import autotest.common.JsonRpcProxy; | 6 import autotest.common.JsonRpcProxy; |
| 7 import autotest.common.SimpleCallback; | 7 import autotest.common.SimpleCallback; |
| 8 import autotest.common.StaticDataRepository; | 8 import autotest.common.StaticDataRepository; |
| 9 import autotest.common.Utils; | 9 import autotest.common.Utils; |
| 10 import autotest.common.table.JSONObjectSet; | 10 import autotest.common.table.JSONObjectSet; |
| 11 import autotest.common.ui.NotifyManager; | 11 import autotest.common.ui.NotifyManager; |
| 12 import autotest.common.ui.RadioChooser; | 12 import autotest.common.ui.RadioChooser; |
| 13 import autotest.common.ui.SimplifiedList; | |
| 14 | 13 |
| 15 import com.google.gwt.json.client.JSONArray; | 14 import com.google.gwt.json.client.JSONArray; |
| 16 import com.google.gwt.json.client.JSONBoolean; | 15 import com.google.gwt.json.client.JSONBoolean; |
| 17 import com.google.gwt.json.client.JSONObject; | 16 import com.google.gwt.json.client.JSONObject; |
| 18 import com.google.gwt.json.client.JSONString; | 17 import com.google.gwt.json.client.JSONString; |
| 19 import com.google.gwt.json.client.JSONValue; | 18 import com.google.gwt.json.client.JSONValue; |
| 20 import com.google.gwt.user.client.DOM; | 19 import com.google.gwt.user.client.DOM; |
| 21 import com.google.gwt.user.client.Element; | 20 import com.google.gwt.user.client.Element; |
| 22 import com.google.gwt.user.client.ui.ListBox; | 21 import com.google.gwt.user.client.ui.ListBox; |
| 23 | 22 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 54 } | 53 } |
| 55 return result.toString(); | 54 return result.toString(); |
| 56 } | 55 } |
| 57 | 56 |
| 58 public static String[] getLabelStrings() { | 57 public static String[] getLabelStrings() { |
| 59 return getFilteredLabelStrings(false, false); | 58 return getFilteredLabelStrings(false, false); |
| 60 } | 59 } |
| 61 | 60 |
| 62 protected static String[] getFilteredLabelStrings(boolean onlyPlatforms, | 61 protected static String[] getFilteredLabelStrings(boolean onlyPlatforms, |
| 63 boolean onlyNonPlatforms)
{ | 62 boolean onlyNonPlatforms)
{ |
| 64 assert !(onlyPlatforms && onlyNonPlatforms); | 63 assert( !(onlyPlatforms && onlyNonPlatforms)); |
| 65 JSONArray labels = staticData.getData("labels").isArray(); | 64 JSONArray labels = staticData.getData("labels").isArray(); |
| 66 List<String> result = new ArrayList<String>(); | 65 List<String> result = new ArrayList<String>(); |
| 67 for (int i = 0; i < labels.size(); i++) { | 66 for (int i = 0; i < labels.size(); i++) { |
| 68 JSONObject label = labels.get(i).isObject(); | 67 JSONObject label = labels.get(i).isObject(); |
| 69 String name = label.get("name").isString().stringValue(); | 68 String name = label.get("name").isString().stringValue(); |
| 70 boolean labelIsPlatform = label.get("platform").isBoolean().booleanV
alue(); | 69 boolean labelIsPlatform = label.get("platform").isBoolean().booleanV
alue(); |
| 71 JSONObject atomicGroup = label.get("atomic_group").isObject(); | 70 JSONObject atomicGroup = label.get("atomic_group").isObject(); |
| 72 if (atomicGroup != null) { | 71 if (atomicGroup != null) { |
| 73 name += ATOMIC_GROUP_SUFFIX; | 72 name += ATOMIC_GROUP_SUFFIX; |
| 74 } | 73 } |
| 75 if (onlyPlatforms && labelIsPlatform || | 74 if ((onlyPlatforms && labelIsPlatform) || |
| 76 onlyNonPlatforms && !labelIsPlatform) { | 75 (onlyNonPlatforms && !labelIsPlatform)) { |
| 77 result.add(name); | 76 result.add(name); |
| 78 } else if (!onlyPlatforms && !onlyNonPlatforms) { | 77 } else if (!onlyPlatforms && !onlyNonPlatforms) { |
| 79 if (labelIsPlatform) { | 78 if (labelIsPlatform) { |
| 80 name += PLATFORM_SUFFIX; | 79 name += PLATFORM_SUFFIX; |
| 81 } | 80 } |
| 82 result.add(name); | 81 result.add(name); |
| 83 } | 82 } |
| 84 } | 83 } |
| 85 return result.toArray(new String[result.size()]); | 84 return result.toArray(new String[result.size()]); |
| 86 } | 85 } |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 return Utils.jsonToString(job.get("id")) + "-" + Utils.jsonToString(job.
get("owner")); | 312 return Utils.jsonToString(job.get("id")) + "-" + Utils.jsonToString(job.
get("owner")); |
| 314 } | 313 } |
| 315 | 314 |
| 316 public static void populateRadioChooser(RadioChooser chooser, String name) { | 315 public static void populateRadioChooser(RadioChooser chooser, String name) { |
| 317 JSONArray options = staticData.getData(name + "_options").isArray(); | 316 JSONArray options = staticData.getData(name + "_options").isArray(); |
| 318 for (JSONString jsonOption : new JSONArrayList<JSONString>(options)) { | 317 for (JSONString jsonOption : new JSONArrayList<JSONString>(options)) { |
| 319 chooser.addChoice(Utils.jsonToString(jsonOption)); | 318 chooser.addChoice(Utils.jsonToString(jsonOption)); |
| 320 } | 319 } |
| 321 } | 320 } |
| 322 | 321 |
| 323 public static void populateListBox(ListBox box, String staticDataKey) { | 322 public static void popualateListBox(ListBox box, String staticDataKey) { |
| 324 JSONArray options = staticData.getData(staticDataKey).isArray(); | 323 JSONArray options = staticData.getData(staticDataKey).isArray(); |
| 325 for (JSONString jsonOption : new JSONArrayList<JSONString>(options)) { | 324 for (JSONString jsonOption : new JSONArrayList<JSONString>(options)) { |
| 326 box.addItem(Utils.jsonToString(jsonOption)); | 325 box.addItem(Utils.jsonToString(jsonOption)); |
| 327 } | 326 } |
| 328 } | 327 } |
| 329 | 328 |
| 330 public static void populateListBox(SimplifiedList box, String staticDataKey)
{ | |
| 331 JSONArray options = staticData.getData(staticDataKey).isArray(); | |
| 332 for (JSONString jsonOption : new JSONArrayList<JSONString>(options)) { | |
| 333 String option = Utils.jsonToString(jsonOption); | |
| 334 box.addItem(option, option); | |
| 335 } | |
| 336 } | |
| 337 | |
| 338 public static void setSelectedItem(ListBox box, String item) { | 329 public static void setSelectedItem(ListBox box, String item) { |
| 339 box.setSelectedIndex(0); | 330 box.setSelectedIndex(0); |
| 340 for (int i = 0; i < box.getItemCount(); i++) { | 331 for (int i = 0; i < box.getItemCount(); i++) { |
| 341 if (box.getItemText(i).equals(item)) { | 332 if (box.getItemText(i).equals(item)) { |
| 342 box.setSelectedIndex(i); | 333 box.setSelectedIndex(i); |
| 343 break; | 334 break; |
| 344 } | 335 } |
| 345 } | 336 } |
| 346 } | 337 } |
| 347 | 338 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 372 String targetFieldName) { | 363 String targetFieldName) { |
| 373 JSONValue dateValue = row.get(sourceFieldName); | 364 JSONValue dateValue = row.get(sourceFieldName); |
| 374 String date = ""; | 365 String date = ""; |
| 375 if (dateValue.isNull() == null) { | 366 if (dateValue.isNull() == null) { |
| 376 date = dateValue.isString().stringValue(); | 367 date = dateValue.isString().stringValue(); |
| 377 date = date.substring(0, date.length() - 3); | 368 date = date.substring(0, date.length() - 3); |
| 378 } | 369 } |
| 379 row.put(targetFieldName, new JSONString(date)); | 370 row.put(targetFieldName, new JSONString(date)); |
| 380 } | 371 } |
| 381 } | 372 } |
| OLD | NEW |