}
// Get the row data, represented as a Dictionary
Object tableRow = tableView.getTableData().get(rowIndex);
Dictionary<String, Object> rowData;
BeanDictionary beanDictionary = null;
if (tableRow instanceof Dictionary<?, ?>) {
rowData = (Dictionary<String, Object>)tableRow;
} else {
beanDictionary = new BeanDictionary(tableRow);
rowData = beanDictionary;
}
// Match the table pane's columns to the table view's
TableView.ColumnSequence tableViewColumns = tableView.getColumns();
TablePane.ColumnSequence tablePaneColumns = editorTablePane.getColumns();
TablePane.Row tablePaneRow = editorTablePane.getRows().get(0);
for (int i = 0, n = tableViewColumns.getLength(); i < n; i++) {
// Add a new column to the table pane to match the table view column
TablePane.Column tablePaneColumn = new TablePane.Column();
tablePaneColumns.add(tablePaneColumn);
// Size the table pane column to match that of the table view
// column. We get the real-time column width from the table view as
// opposed to the width property of the column, because the latter
// may represent a relative width, and we need the actual width
int columnWidth = tableView.getColumnBounds(i).width;
tablePaneColumn.setWidth(columnWidth, false);
// Determine which component to use as the editor for this column
String columnName = tableViewColumns.get(i).getName();
Component editorComponent = cellEditors.get(columnName);
// Default to a TextInput editor
if (editorComponent == null) {
TextInput editorTextInput = new TextInput();
editorTextInput.setTextKey(columnName);
editorComponent = editorTextInput;
}
// Disable the component for read-only properties
if (beanDictionary != null
&& beanDictionary.isReadOnly(columnName)) {
editorComponent.setEnabled(false);
}
// Add the editor component to the table pane
tablePaneRow.add(editorComponent);