RFR: 8343535: IGV: Colorize nodes on demand [v2]
Roberto Castañeda Lozano
rcastanedalo at openjdk.org
Fri Nov 8 08:52:34 UTC 2024
On Wed, 6 Nov 2024 20:30:26 GMT, Tobias Holenstein <tholenstein at openjdk.org> wrote:
>> <img width="292" alt="color" src="https://github.com/user-attachments/assets/ea050a39-5f1e-456b-adaa-2102d78b0f60">
>>
>> <img width="697" alt="pick" src="https://github.com/user-attachments/assets/67569b5d-1d74-4a93-8a97-bb37c5bc9f93">
>>
>> <img width="428" alt="nodes" src="https://github.com/user-attachments/assets/c8a994e3-9946-42ae-8701-34223a000a0c">
>>
>> Adds new option to IGV to color selected nodes:
>> 1) select some nodes
>> 2) `Ctrl + C` or `View` -> `Color action`
>> 3) pick a color and apply
>
> Tobias Holenstein has updated the pull request incrementally with one additional commit since the last revision:
>
> Update src/utils/IdealGraphVisualizer/View/src/main/java/com/sun/hotspot/igv/view/DiagramScene.java
>
> Co-authored-by: Andrey Turbanov <turbanoff at gmail.com>
Nice improvement, thanks for working on this!
If the user selects a dark color, the node labels might become hard to read. Here's a simple change that addresses that by coloring the labels in white in that case. Please consider merging it into this PR:
diff --git a/src/utils/IdealGraphVisualizer/View/src/main/java/com/sun/hotspot/igv/view/widgets/FigureWidget.java b/src/utils/IdealGraphVisualizer/View/src/main/java/com/sun/hotspot/igv/view/widgets/FigureWidget.java
index a469d196a6b..495d844eb34 100644
--- a/src/utils/IdealGraphVisualizer/View/src/main/java/com/sun/hotspot/igv/view/widgets/FigureWidget.java
+++ b/src/utils/IdealGraphVisualizer/View/src/main/java/com/sun/hotspot/igv/view/widgets/FigureWidget.java
@@ -113,7 +113,6 @@ public FigureWidget(final Figure f, DiagramScene scene) {
LayoutFactory.SerialAlignment.LEFT_TOP :
LayoutFactory.SerialAlignment.CENTER;
middleWidget.setLayout(LayoutFactory.createVerticalFlowLayout(textAlign, 0));
- middleWidget.setBackground(f.getColor());
middleWidget.setOpaque(true);
middleWidget.getActions().addAction(new DoubleClickAction(this));
middleWidget.setCheckClipping(false);
@@ -143,7 +142,6 @@ public FigureWidget(final Figure f, DiagramScene scene) {
textWidget.addChild(lw);
lw.setLabel(displayString);
lw.setFont(Diagram.FONT);
- lw.setForeground(getTextColor());
lw.setAlignment(LabelWidget.Alignment.CENTER);
lw.setVerticalAlignment(LabelWidget.VerticalAlignment.CENTER);
lw.setBorder(BorderFactory.createEmptyBorder());
@@ -151,6 +149,8 @@ public FigureWidget(final Figure f, DiagramScene scene) {
}
formatExtraLabel(false);
+ refreshColor();
+
if (getFigure().getWarning() != null) {
ImageWidget warningWidget = new ImageWidget(scene, warningSign);
Point warningLocation = new Point(getFigure().getWidth() - Figure.WARNING_WIDTH - Figure.INSET / 2, 0);
@@ -186,6 +186,9 @@ protected Sheet createSheet() {
public void refreshColor() {
middleWidget.setBackground(figure.getColor());
+ for (LabelWidget lw : labelWidgets) {
+ lw.setForeground(getTextColor());
+ }
}
@Override
-------------
Changes requested by rcastanedalo (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/21925#pullrequestreview-2423097780
More information about the hotspot-compiler-dev
mailing list