1 | StringBuffer buf = new StringBuffer();↵ | | |
|
| | | 1 | if (selRows.length != 0 && selCols.length != 0)↵
|
| | | 2 | {↵
|
| | | 3 | StringBuffer buf = new StringBuffer();↵
|
| | | 4 | for (int rowIdx = 0; rowIdx < nbrSelRows; ++rowIdx)↵
|
| | | 5 | {↵
|
|
| | | 6 | buf.append("UPDATE PressCtrlH SET ");↵
|
|
| | | 7 | boolean firstCol = true;↵
|
2 | for (int colIdx = 0; colIdx < nbrSelCols; ++colIdx)↵ | | 8 | for (int colIdx = 0; colIdx < nbrSelCols; ++colIdx)↵
|
3 | {↵ | | 9 | ↵
|
| | | 10 | {↵
|
|
4 | TableColumn col = _table.getColumnModel().getColumn(selCols[colIdx]);↵ | | 11 | TableColumn col = _table.getColumnModel().getColumn(selCols[colIdx]);↵
|
|
5 | ColumnDisplayDefinition colDef = null;↵ | | 12 | ColumnDisplayDefinition colDef = null;↵
|
6 | if(col instanceof ExtTableColumn)↵ | | 13 | if(col instanceof ExtTableColumn)↵
|
7 | {↵ | | 14 | {↵
|
8 | colDef = ((ExtTableColumn) col).getColumnDisplayDefinition();↵ | | 15 | colDef = ((ExtTableColumn) col).getColumnDisplayDefinition();↵
|
9 | }↵ | | 16 | }↵
|
|
10 | int lastLength = buf.length();↵ | | 17 | ↵
|
11 | buf.append("(");↵ | | |
|
12 | for (int rowIdx = 0; rowIdx < nbrSelRows; ++rowIdx)↵ | | |
|
| | | 18 | else↵
|
| | | 19 | {↵
|
| | | 20 | continue;↵
|
13 | {↵ | | 21 | }↵
|
|
|
|
14 | if(0 < rowIdx)↵ | | 22 | if (firstCol)↵
|
15 | {↵ | | 23 | {↵
|
16 | buf.append(",");↵ | | 24 | ↵
|
17 | if(100 < buf.length() - lastLength)↵ | | 25 | firstCol = false;↵
|
18 | {↵ | | 26 | }↵
|
19 | ↵ | | 27 | else↵
|
20 | lastLength = buf.length(); ↵ | | 28 | ↵
|
21 | ↵ | | 29 | {↵
|
22 | buf.append("\n");↵ | | 30 | buf.append(",");↵
|
23 | }↵ | | |
|
24 | }↵ | | 31 | }↵
|
|
25 | final Object cellObj = _table.getValueAt(selRows[rowIdx], selCols[colIdx]);↵ | | 32 | final Object cellObj = _table.getValueAt(selRows[rowIdx], selCols[colIdx]);↵
|
26 | buf.append(getData(colDef, cellObj, StatType.IN));↵ | | 33 | buf.append(colDef.getColumnName()).append(getData(colDef, cellObj, StatType.UPDATE));↵
|
27 | }↵ | | 34 | }↵
|
|
28 | buf.append(")\n");↵ | | 35 | buf.append(" WHERE\n");↵
|
29 | }↵ | | 36 | }↵
|
30 | final StringSelection ss = new StringSelection(buf.toString());↵ | | 37 | final StringSelection ss = new StringSelection(buf.toString());↵
|
31 | Toolkit.getDefaultToolkit().getSystemClipboard().setContents(ss, ss); | | 38 | Toolkit.getDefaultToolkit().getSystemClipboard().setContents(ss, ss);↵
|
| | | 39 | }
|