OLD | NEW |
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; |
5 import autotest.common.table.DataSource.DefaultDataCallback; | 7 import autotest.common.table.DataSource.DefaultDataCallback; |
6 import autotest.common.table.DataSource.Query; | 8 import autotest.common.table.DataSource.Query; |
7 import autotest.common.table.DynamicTable.DynamicTableListener; | 9 import autotest.common.table.DynamicTable.DynamicTableListener; |
8 import autotest.common.table.SelectionManager; | |
9 import autotest.common.table.SelectionManager.SelectionListener; | 10 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 Loading... |
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 { | 129 } |
| 130 else |
130 availableSelection.deselectObject(row); | 131 availableSelection.deselectObject(row); |
131 } | |
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 Loading... |
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 (String labelName : labelNames) { | 272 for(int i = 0; i < labelNames.length; i++) { |
273 list.addItem(labelName, ""); | 273 list.addItem(labelNames[i], ""); |
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 Loading... |
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 } |
OLD | NEW |