bamaer commented on PR #8652:
URL: https://github.com/apache/hop/pull/8652#issuecomment-5885205454
No blockers. Built and ran the new tests locally (core + rcp uitests pass,
spotless/rat clean), and rendered the AI Provider editor to confirm the grid
sits in its own box.
**Should fix**
**1. A `comboValuesMethod` column's items are frozen at creation.**
`getTableControl` resolves the items once and bakes them into `ColumnInfo`.
`setComboValues(widgetId, ...)` — the existing way a dialog repopulates a combo
after a type change or a Get Fields — silently does nothing for a grid, because
`widgetsMap` holds the `TableView` and the method only handles `Combo` /
`ComboVar`. The enum case is fine, but the dev manual advertises the `String` +
`comboValuesMethod` form, and that is the one that will bite the next adopter.
Cheapest fix that matches the rest of the design: refresh the items in
`fillTable`, which already runs on every `setWidgetsContents` including the
post-BUTTON refresh:
```java
// in fillTable, before filling the rows
for (int i = 0; i < columns.size(); i++) {
GuiTableColumnElement column = columns.get(i);
if (column.getType() == GuiTableColumnType.COMBO
&& column.getFieldClass() != null
&& !column.getFieldClass().isEnum()
&& StringUtils.isNotEmpty(column.getComboValuesMethod())) {
tableView.getColumns()[i].setComboValues(getComboItems(sourceData,
column.getComboValuesMethod()));
}
}
```
**2. `findRowSetter` picks a setter by name and arity only.** It walks
`row.getClass().getMethods()` for any one-arg method with the right name.
`Method[]` ordering is unspecified, so a row class with two one-arg overloads
(`setRole(String)` and `setRole(AiModelRole)`) gets a nondeterministic pick,
and `writeCell` then coerces the cell text to whichever parameter type came
back. The column already knows the field type, so match on it:
```java
if (StringUtils.isNotEmpty(column.getSetterMethod()) &&
column.getFieldClass() != null) {
try {
return row.getClass().getMethod(column.getSetterMethod(),
column.getFieldClass());
} catch (NoSuchMethodException e) {
// fall through to the bean property
}
}
```
Same pattern in `writeList` for the `List` setter, though an overload there
is far less likely.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]