ETable columns recreated incorrectly
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
ETableTest で提供されている再現テストから始め、それらを実行して順序とソートの失敗を確認します。次に、非表示列の処理を含め、ETable.createDefaultColumnsFromModel と関連する ETableColumnModel の処理を調査します。移動またはモデルの変更後も、再作成された列が順序、ソート状態、非表示列、幅を保持すれば完了です。
索引モデルが issue の本文から書いたものです。
説明
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
- 主要言語
- Java
- スター
- 3.1k
- フォーク
- 939
- 平均マージ
- 4日 20時間
- マージ済み PR(30日)
- 25
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
apache/netbeans のほかの issue
-
Contribution welcome kind:feature Platform
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
apache/netbeans#9614 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
kind:bug LSP needs:triage
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
apache/netbeans#9548 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Editor Java kind:feature needs:triage
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
メンテナーはふだん 1 日以内に返信
-
The main Options dialog window has buttons with OK on the left instead of on the right on Linuxオープンkind:bug needs:triage os:linux os:macos Platform UI
難易度 1/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信
-
kind:bug needs:triage
難易度 1/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信
apache/netbeans の issue をすべて見る
似ている issue
-
BoxAttachmentMulti parsing leaks IOException / ArrayIndexOutOfBoundsException on malformed content instead of IllegalArgumentException対応中かも @Kshot3000 が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
ergoplatform/ergo-appkit#272 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 64/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 64/100
utopia-rise/godot-jvm#1004 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
spring-projects/spring-grpc#442 ·