ETable columns recreated incorrectly
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 78/100
Direzione di ricerca
Inizia in ETableTest con i test di riproduzione forniti ed eseguili per confermare i problemi relativi all'ordine e all'ordinamento. Poi esamina ETable.createDefaultColumnsFromModel e la gestione correlata di ETableColumnModel, incluse le colonne nascoste. Il lavoro è completato quando le colonne ricreate mantengono l'ordine, lo stato di ordinamento, le colonne nascoste e la larghezza dopo lo spostamento o la modifica del modello.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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
- Lingua principale
- Java
- Stelle
- 3.1k
- Fork
- 939
- Merge medio
- 4g 14h
- PR unite (30g)
- 26
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di apache/netbeans
-
Contribution welcome kind:feature Platform
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
apache/netbeans#9614 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
kind:bug LSP needs:triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
apache/netbeans#9548 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Editor Java kind:feature needs:triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
I maintainer di solito rispondono entro 1 giorno
-
The main Options dialog window has buttons with OK on the left instead of on the right on LinuxApertakind:bug needs:triage os:linux os:macos Platform UI
Difficoltà 1/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno
-
kind:bug needs:triage
Difficoltà 1/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di apache/netbeans
Issue simili
-
enhancement good first issue
Difficoltà 2/5 Mezza giornata Idoneità per principianti 66/100
apache/fineract-consumer-facing#175 ·
I maintainer di solito rispondono entro 1 giorno
-
[BUG] 订单:会员凭订单号即可取消其他会员的待付款订单(取消接口不校验订单归属)Forse già presa @dadiyang l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
macrozheng/mall#1016 ·
-
[Bug] The producer summary counts an unreported client version as a second version and warns about a version mixForse già presa Una pull request collegata a questa issue è aperta o già unita. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
apache/rocketmq-dashboard#6110 ·
I maintainer di solito rispondono entro 4 giorni
-
Feature:Resolution
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
intellij-elixir/intellij-elixir#4396 ·
I maintainer di solito rispondono entro 1 giorno
-
Python 3.15 supportForse già presa @amnesiaof l’ha presa oggi. ApertaL: python L: python:uv
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
dependabot/dependabot-core#16524 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno