-
Notifications
You must be signed in to change notification settings - Fork 484
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
8277000: Tree-/TableRowSkin: replace listener to fixedCellSize by live lookup #1645
Open
Maran23
wants to merge
3
commits into
openjdk:master
Choose a base branch
from
Maran23:8277000-tree-table-row-skin-live-lookup
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -97,10 +97,6 @@ public TreeTableRowSkin(TreeTableRow<T> control) { | |
|
||
ListenerHelper lh = ListenerHelper.get(this); | ||
|
||
lh.addChangeListener(control.indexProperty(), (ev) -> { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since #1635 got merged, this is not needed as |
||
updateCells = true; | ||
}); | ||
|
||
lh.addChangeListener(control.treeItemProperty(), (ev) -> { | ||
updateTreeItem(); | ||
// There used to be an isDirty = true statement here, but this was | ||
|
@@ -111,7 +107,6 @@ public TreeTableRowSkin(TreeTableRow<T> control) { | |
setupTreeTableViewListeners(); | ||
} | ||
|
||
// FIXME: replace listener to fixedCellSize with direct lookup - JDK-8277000 | ||
private void setupTreeTableViewListeners() { | ||
TreeTableView<T> treeTableView = getSkinnable().getTreeTableView(); | ||
if (treeTableView == null) { | ||
|
@@ -130,40 +125,19 @@ private void setupTreeTableViewListeners() { | |
} | ||
}); | ||
|
||
DoubleProperty fixedCellSizeProperty = getTreeTableView().fixedCellSizeProperty(); | ||
if (fixedCellSizeProperty != null) { | ||
registerChangeListener(fixedCellSizeProperty, (x) -> { | ||
updateCachedFixedSize(); | ||
}); | ||
updateCachedFixedSize(); | ||
|
||
if (getFixedCellSize() > 0) { | ||
// JDK-8144500: | ||
// When in fixed cell size mode, we must listen to the width of the virtual flow, so | ||
// that when it changes, we can appropriately add / remove cells that may or may not | ||
// be required (because we remove all cells that are not visible). | ||
VirtualFlow<TreeTableRow<T>> virtualFlow = getVirtualFlow(); | ||
if (virtualFlow != null) { | ||
registerChangeListener(getVirtualFlow().widthProperty(), (x) -> { | ||
if (getSkinnable() != null) { | ||
TreeTableView<T> t = getSkinnable().getTreeTableView(); | ||
t.requestLayout(); | ||
} | ||
}); | ||
registerChangeListener(getVirtualFlow().widthProperty(), e -> getTreeTableView().requestLayout()); | ||
} | ||
} | ||
} | ||
} | ||
|
||
private void updateCachedFixedSize() { | ||
if (getSkinnable() != null) { | ||
TreeTableView<T> t = getSkinnable().getTreeTableView(); | ||
if (t != null) { | ||
fixedCellSize = t.getFixedCellSize(); | ||
fixedCellSizeEnabled = fixedCellSize > 0.0; | ||
} | ||
} | ||
} | ||
|
||
/* ************************************************************************* | ||
* * | ||
* Listeners * | ||
|
@@ -351,6 +325,12 @@ private TreeTableView<T> getTreeTableView() { | |
return getSkinnable().getTreeTableView(); | ||
} | ||
|
||
@Override | ||
double getFixedCellSize() { | ||
TreeTableView<T> treeTableView = getTreeTableView(); | ||
return treeTableView != null ? treeTableView.getFixedCellSize() : super.getFixedCellSize(); | ||
} | ||
|
||
private void updateDisclosureNodeAndGraphic() { | ||
if (getSkinnable().isEmpty()) { | ||
getChildren().remove(graphic); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are you sure this is correct?
the tableCell is added in L343 only if
fixedCellSize > 0
the removal in L424 misses that logic
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, IntelliJ actually gave me the hint.
isVisible
can only befalse
, when afixedCellSize
is set. So the else branch can only ever be executed whenfixedCellSize > 0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's hard to tell (for me): there are just too many conditions: isColumnParticallyOrFullVisible(), if parent == null...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It will be much better after #1644 :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you apply the same treatment as in #1644? there at least it makes sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would say, lets merge #1644 first and then it is automatically there when the conflict is solved