Compare commits

..

1 Commits

Author SHA1 Message Date
Dmitry Batrak
44f519d8c4 optimize tree implementation 2025-09-16 17:58:55 +03:00
3 changed files with 32 additions and 29 deletions

View File

@@ -4319,38 +4319,43 @@ public class BasicTreeUI extends TreeUI
updateSize();
}
else if (treeState.isExpanded(parentPath)) {
// Changed nodes are visible
// Find the minimum index, we only need paint from there
// down.
int minIndex = indices[0];
for (int i = indices.length - 1; i > 0; i--) {
minIndex = Math.min(indices[i], minIndex);
boolean isShowing = tree.isShowing();
TreePath minPath = null;
Rectangle minBounds = null;
if (isShowing) {
// Changed nodes are visible
// Find the minimum index, we only need paint from there
// down.
int minIndex = indices[0];
for (int i = indices.length - 1; i > 0; i--) {
minIndex = Math.min(indices[i], minIndex);
}
Object minChild = treeModel.getChild(
parentPath.getLastPathComponent(), minIndex);
minPath = parentPath.pathByAddingChild(minChild);
minBounds = getPathBounds(tree, minPath);
}
Object minChild = treeModel.getChild(
parentPath.getLastPathComponent(), minIndex);
TreePath minPath = parentPath.pathByAddingChild(minChild);
Rectangle minBounds = getPathBounds(tree, minPath);
// Forward to the treestate
treeState.treeNodesChanged(e);
// Mark preferred size as bogus.
updateSize0();
// And repaint
Rectangle newMinBounds = getPathBounds(tree, minPath);
if (minBounds == null || newMinBounds == null) {
return;
}
if (isShowing) {
// And repaint
Rectangle newMinBounds = getPathBounds(tree, minPath);
if (minBounds == null || newMinBounds == null) {
return;
}
if (indices.length == 1 &&
newMinBounds.height == minBounds.height) {
tree.repaint(0, minBounds.y, tree.getWidth(),
minBounds.height);
}
else {
tree.repaint(0, minBounds.y, tree.getWidth(),
tree.getHeight() - minBounds.y);
if (indices.length == 1 &&
newMinBounds.height == minBounds.height) {
tree.repaint(0, minBounds.y, tree.getWidth(),
minBounds.height);
} else {
tree.repaint(0, minBounds.y, tree.getWidth(),
tree.getHeight() - minBounds.y);
}
}
}
else {

View File

@@ -116,7 +116,7 @@
java/awt/AlphaComposite/WindowAlphaCompositeTest.java JBR-6553 macosx-all
java/awt/Button/DisabledButtonPress.java JBR-5799 windows-aarch64
java/awt/Desktop/8064934/bug8064934.java JBR-5764,JBR-5799 windows-all
java/awt/Debug/DumpOnKey/DumpOnKey.java JBR-5225 windows-all
java/awt/Debug/DumpOnKey/DumpOnKey.java JBR-5225,JBR-9350 windows-all,macosx-all
java/awt/event/HierarchyEvent/SpecTest.java JBR-7589 windows-all
java/awt/event/KeyEvent/CorrectTime/CorrectTime.java JBR-6665 linux-all,windows-all
java/awt/event/KeyEvent/SwallowKeyEvents/SwallowKeyEvents.java 8224055,JBR-5906 macosx-all,linux-all
@@ -391,7 +391,6 @@ sun/java2d/SunGraphics2D/DrawImageBilinear.java 8297175 linux-all
java/awt/Graphics/NativeWin32Clear.java JBR-8689 linux-aarch64
java/awt/Graphics/XORPaint.java#id1 JBR-8642 macosx-aarch64
java/awt/Graphics/XORPaint.java#id2 JBR-9348 linux-6.15.8-100.fc41.x86_64
java/awt/Graphics2D/CopyAreaOOB.java JBR-5354,JBR-9206 macosx-all,windows-all,linux-6.15.8-100.fc41.x86_64
java/awt/Graphics2D/DrawString/DisposerTest.java JBR-5010 linux-aarch64
java/awt/Graphics2D/DrawString/DrawRotatedStringUsingRotatedFont.java 8266283 generic-all
@@ -765,7 +764,7 @@ java/awt/MenuBar/TestNoScreenMenuBar.java 8265987 macosx-all
java/awt/Dialog/DialogAboveFrame/DialogAboveFrameTest.java JBR-5210 windows-all
java/awt/Dialog/MakeWindowAlwaysOnTop/MakeWindowAlwaysOnTop.java 8266243,JBR-6632 macosx-all,linux-all
java/awt/Dialog/ModalDialogPermission/ModalDialogPermission.java JBR-5225 windows-all
java/awt/Dialog/ModalDialogPermission/ModalDialogPermission.java JBR-5225,JBR-9350 windows-all,macosx-all
java/awt/Dialog/SiblingChildOrder/SiblingChildOrderTest.java JBR-5082 linux-all
java/awt/Window/GetScreenLocation/GetScreenLocationTest.java 8225787,8253184 linux-all,windows-all
java/awt/dnd/DragSourceMotionListenerTest.java 8225131 windows-all
@@ -1065,7 +1064,7 @@ javax/swing/JMenuItem/8158566/CloseOnMouseClickPropertyTest.java JBR-5545,JBR-65
javax/swing/JMenuItem/bug4839464.java JBR-5911 windows-all
javax/swing/JMenuItem/6249972/bug6249972.java 8197552 windows-all
javax/swing/JOptionPane/7138665/bug7138665.java JBR-5799 windows-all
javax/swing/JOptionPane/8081019/bug8081019.java JBR-5767 windows-all
javax/swing/JOptionPane/8081019/bug8081019.java JBR-5767,JBR-9350 windows-all,macosx-all
javax/swing/JPasswordField/TestSelectedTextBackgroundColor.java JBR-8665 linux-6.8.0-1017-raspi
javax/swing/JProgressBar/8015748/JProgressBarOrientationRobotTest.java JBR-8571 linux-all
javax/swing/JProgressBar/8161664/ProgressBarMemoryLeakTest.java JBR-8926 macosx-x64

View File

@@ -165,7 +165,6 @@ javax/swing/JComboBox/DisabledComboBoxFontTestAuto.java nobug generic-all
javax/swing/JFrame/8175301/ScaledFrameBackgroundTest.java nobug generic-all
javax/swing/JInternalFrame/8069348/bug8069348.java nobug generic-all
javax/swing/JInternalFrame/8160248/JInternalFrameDraggingTest.java nobug generic-all
javax/swing/JInternalFrame/Ctrli.java JBR-9362 windows-all
javax/swing/JLabel/GetSpanHiDpiBug.java nobug generic-all
javax/swing/JTabbedPane/TestBackgroundScrollPolicy.java nobug generic-all
javax/swing/JTextArea/8149849/DNDTextToScaledArea.java nobug generic-all