ETable columns recreated incorrectly
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 78/100
Línea de trabajo
Comienza en ETableTest con las pruebas de reproducción proporcionadas y ejecútalas para confirmar los fallos de orden y ordenación. Después, inspecciona ETable.createDefaultColumnsFromModel y el manejo relacionado de ETableColumnModel, incluidas las columnas ocultas. La tarea estará terminada cuando las columnas recreadas conserven el orden, el estado de ordenación, las columnas ocultas y el ancho después de moverlas o cambiar el modelo.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Apache NetBeans version
Apache NetBeans 32 latest daily build
What happened
When recreating columns from the model in ETable, column ordering, sort order, and (sometimes) width revert to their defaults. Add these unit tests to ETableTest and you'll see they both fail.
public void testRecreatingColumnsShouldMaintainOrder() {
ETable t = createTestingTable(false);
t.moveColumn(1, 0);
t.createDefaultColumnsFromModel();
assertEquals("BB", t.getColumnModel().getColumn(0).getIdentifier());
assertEquals("AA", t.getColumnModel().getColumn(1).getIdentifier());
}
public void testRecreatingColumnsShouldMaintainSortAfterMoving() {
ETable t = createTestingTable(false);
t.setColumnSorted(0, true, 1);
t.moveColumn(1, 0);
t.createDefaultColumnsFromModel();
var etc = (ETableColumn) t.getColumnModel().getColumn(1);
assertTrue(etc.isAscending());
assertEquals(1, etc.getSortRank());
}
There seems to be some mixup between model index and view index. I tried some simple changes to store the values in sortedColumnIndexes using the view index and setting the new columns' model index from the previous table column, but this messed up the hidden columns. The following unit test passes with the existing code, but failed with my updates so it may be worth adding as well to ensure no regression.
public void testHiddenColumnsCorrectAfterRecreatingColumns() {
ETable t = createTestingTable(false);
var etcm = (ETableColumnModel) t.getColumnModel();
etcm.setColumnHidden(etcm.getColumn(0), true);
t.createDefaultColumnsFromModel();
assertEquals("BB", etcm.getColumn(0).getIdentifier());
}
Finally, although I haven't been able to reproduce a failure of the width, I have seen it periodically in the UI when using the OutlineView. As such, a test similar to the following may be worth adding as well.
public void testRecreatingColumnsShouldMaintainSizeAfterMoving() {
ETable t = createTestingTable(false);
final int width = 500;
t.getColumnModel().getColumn(0).setWidth(width);
t.moveColumn(1, 0);
t.createDefaultColumnsFromModel();
assertEquals(width, t.getColumnModel().getColumn(1).getWidth());
}
Language / Project Type / NetBeans Component
No response
How to reproduce
- Create an
OutlineViewinstance - Sort, reorder, and resize columns in the UI
- Trigger column recreation, typically by triggering a "tableChanged" as the result of adding or removing a node to/from the view
Did this work correctly in an earlier version?
No / Don't know
Operating System
All
JDK
Eclipse Adoptium 25.0.2
Apache NetBeans packaging
Apache NetBeans platform
Anything else
No response
Are you willing to submit a pull request?
No
- Lenguaje dominante
- Java
- Estrellas
- 3.1k
- Forks
- 939
- Merge medio
- 4 d 20 h
- PR fusionados (30 d)
- 25
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de apache/netbeans
-
Contribution welcome kind:feature Platform
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
apache/netbeans#9614 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
kind:bug LSP needs:triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
apache/netbeans#9548 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Editor Java kind:feature needs:triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
Los mantenedores suelen responder en 1 día
-
The main Options dialog window has buttons with OK on the left instead of on the right on LinuxAbiertokind:bug needs:triage os:linux os:macos Platform UI
Dificultad 1/5 1-3 horas Aptitud para principiantes 68/100
Los mantenedores suelen responder en 1 día
-
Incorrect DTD for wstcref-FilesAbiertokind:bug needs:triage
Dificultad 1/5 1-3 horas Aptitud para principiantes 68/100
Los mantenedores suelen responder en 1 día
Todos los issues de apache/netbeans
Issues similares
-
Use GHA setup gradle actionPosiblemente ocupada @bric3 la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 67/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
openhab/openhab-addons#21921 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
jellyfin/jellyfin-androidtv#5885 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 1 día
-
priority:P2 product:orazaka type:bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día