| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
|
|
| 14 |
|
|
| 15 |
|
|
| 16 |
|
package org.kuali.student.common.ui.client.widgets.pagetable; |
| 17 |
|
|
| 18 |
|
import java.util.Set; |
| 19 |
|
|
| 20 |
|
import org.kuali.student.common.ui.client.widgets.KSLabel; |
| 21 |
|
|
| 22 |
|
import com.google.gwt.gen2.table.client.FixedWidthGrid; |
| 23 |
|
import com.google.gwt.gen2.table.event.client.RowSelectionEvent; |
| 24 |
|
import com.google.gwt.gen2.table.event.client.RowSelectionHandler; |
| 25 |
|
|
| 26 |
|
|
| 27 |
|
|
| 28 |
|
@see |
| 29 |
|
|
| 30 |
|
|
| 31 |
|
@author |
| 32 |
|
|
| 33 |
|
|
|
|
|
| 0% |
Uncovered Elements: 17 (17) |
Complexity: 3 |
Complexity Density: 0.23 |
|
| 34 |
|
public class TableSelectionToLabelHandler implements RowSelectionHandler { |
| 35 |
|
private FixedWidthGrid dataTable; |
| 36 |
|
private KSLabel selection; |
| 37 |
|
private String labelPrefix; |
| 38 |
|
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
| 39 |
0
|
public TableSelectionToLabelHandler(FixedWidthGrid dataTable, KSLabel selection) {... |
| 40 |
0
|
this.dataTable = dataTable; |
| 41 |
0
|
this.selection = selection; |
| 42 |
0
|
this.labelPrefix = selection.getText(); |
| 43 |
|
} |
| 44 |
|
|
| 45 |
|
|
| 46 |
|
|
| 47 |
|
@see |
| 48 |
|
|
|
|
|
| 0% |
Uncovered Elements: 12 (12) |
Complexity: 2 |
Complexity Density: 0.2 |
|
| 49 |
0
|
@Override... |
| 50 |
|
public void onRowSelection(RowSelectionEvent event) { |
| 51 |
0
|
Set<Integer>selectedRows = dataTable.getSelectedRows(); |
| 52 |
|
|
| 53 |
0
|
int colCount = dataTable.getColumnCount(); |
| 54 |
0
|
StringBuilder sb = new StringBuilder(labelPrefix); |
| 55 |
0
|
sb.append('\n'); |
| 56 |
0
|
for(Integer row:selectedRows){ |
| 57 |
0
|
selection.setText(labelPrefix); |
| 58 |
0
|
for(int column = 0; column < colCount; column++) { |
| 59 |
0
|
sb.append(dataTable.getText(row, column)).append(' '); |
| 60 |
|
} |
| 61 |
0
|
sb.append('\n'); |
| 62 |
|
} |
| 63 |
0
|
selection.setText(sb.toString()); |
| 64 |
|
} |
| 65 |
|
} |