Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(250)

Side by Side Diff: frontend/client/src/autotest/afe/HostSelector.java

Issue 3554003: Merge remote branch 'cros/upstream' into tempbranch3 (Closed) Base URL: http://git.chromium.org/git/autotest.git
Patch Set: Created 10 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 package autotest.afe; 1 package autotest.afe;
2 2
3 import autotest.common.Utils; 3 import autotest.common.Utils;
4 import autotest.common.table.ArrayDataSource; 4 import autotest.common.table.ArrayDataSource;
5 import autotest.common.table.SelectionManager;
6 import autotest.common.table.TableDecorator;
7 import autotest.common.table.DataSource.DefaultDataCallback; 5 import autotest.common.table.DataSource.DefaultDataCallback;
8 import autotest.common.table.DataSource.Query; 6 import autotest.common.table.DataSource.Query;
9 import autotest.common.table.DynamicTable.DynamicTableListener; 7 import autotest.common.table.DynamicTable.DynamicTableListener;
8 import autotest.common.table.SelectionManager;
10 import autotest.common.table.SelectionManager.SelectionListener; 9 import autotest.common.table.SelectionManager.SelectionListener;
10 import autotest.common.table.TableDecorator;
11 import autotest.common.ui.NotifyManager; 11 import autotest.common.ui.NotifyManager;
12 import autotest.common.ui.SimplifiedList; 12 import autotest.common.ui.SimplifiedList;
13 13
14 import com.google.gwt.event.dom.client.ClickEvent; 14 import com.google.gwt.event.dom.client.ClickEvent;
15 import com.google.gwt.event.dom.client.ClickHandler; 15 import com.google.gwt.event.dom.client.ClickHandler;
16 import com.google.gwt.event.dom.client.HasClickHandlers; 16 import com.google.gwt.event.dom.client.HasClickHandlers;
17 import com.google.gwt.json.client.JSONArray; 17 import com.google.gwt.json.client.JSONArray;
18 import com.google.gwt.json.client.JSONNumber; 18 import com.google.gwt.json.client.JSONNumber;
19 import com.google.gwt.json.client.JSONObject; 19 import com.google.gwt.json.client.JSONObject;
20 import com.google.gwt.json.client.JSONString; 20 import com.google.gwt.json.client.JSONString;
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 } 119 }
120 selectionRefresh(); 120 selectionRefresh();
121 } 121 }
122 }); 122 });
123 123
124 selectedTable.addListener(new DynamicTableListener() { 124 selectedTable.addListener(new DynamicTableListener() {
125 public void onRowClicked(int rowIndex, JSONObject row, boolean isRig htClick) { 125 public void onRowClicked(int rowIndex, JSONObject row, boolean isRig htClick) {
126 if (isMetaEntry(row) || isOneTimeHost(row)) { 126 if (isMetaEntry(row) || isOneTimeHost(row)) {
127 deselectRow(row); 127 deselectRow(row);
128 selectionRefresh(); 128 selectionRefresh();
129 } else {
130 availableSelection.deselectObject(row);
129 } 131 }
130 else
131 availableSelection.deselectObject(row);
132 } 132 }
133 133
134 public void onTableRefreshed() {} 134 public void onTableRefreshed() {}
135 }); 135 });
136 } 136 }
137 137
138 public void bindDisplay(Display display) { 138 public void bindDisplay(Display display) {
139 this.display = display; 139 this.display = display;
140 display.getAddByHostnameButton().addClickHandler(this); 140 display.getAddByHostnameButton().addClickHandler(this);
141 display.getAddByLabelButton().addClickHandler(this); 141 display.getAddByLabelButton().addClickHandler(this);
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 262
263 private void deselectAll() { 263 private void deselectAll() {
264 availableSelection.deselectAll(); 264 availableSelection.deselectAll();
265 // get rid of leftover meta-host entries 265 // get rid of leftover meta-host entries
266 selectedHostData.clear(); 266 selectedHostData.clear();
267 selectionRefresh(); 267 selectionRefresh();
268 } 268 }
269 269
270 private void populateLabels(SimplifiedList list) { 270 private void populateLabels(SimplifiedList list) {
271 String[] labelNames = AfeUtils.getLabelStrings(); 271 String[] labelNames = AfeUtils.getLabelStrings();
272 for(int i = 0; i < labelNames.length; i++) { 272 for (String labelName : labelNames) {
273 list.addItem(labelNames[i], ""); 273 list.addItem(labelName, "");
274 } 274 }
275 } 275 }
276 276
277 private String getHostname(JSONObject row) { 277 private String getHostname(JSONObject row) {
278 return row.get("hostname").isString().stringValue(); 278 return row.get("hostname").isString().stringValue();
279 } 279 }
280 280
281 private boolean isMetaEntry(JSONObject row) { 281 private boolean isMetaEntry(JSONObject row) {
282 return getHostname(row).startsWith(META_PREFIX); 282 return getHostname(row).startsWith(META_PREFIX);
283 } 283 }
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 public void refresh() { 356 public void refresh() {
357 availableTable.refresh(); 357 availableTable.refresh();
358 selectionRefresh(); 358 selectionRefresh();
359 } 359 }
360 360
361 public void setEnabled(boolean enabled) { 361 public void setEnabled(boolean enabled) {
362 this.enabled = enabled; 362 this.enabled = enabled;
363 display.setVisible(enabled); 363 display.setVisible(enabled);
364 } 364 }
365 } 365 }
OLDNEW
« no previous file with comments | « frontend/client/src/autotest/afe/HostListView.java ('k') | frontend/client/src/autotest/afe/IButton.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698