IDEA-275394 Fix collapsible group headers

GitOrigin-RevId: 9015b3bf1bda2661e4f1b91bb20753bade28ccc1
This commit is contained in:
Pavel Porvatov
2021-09-14 18:38:12 +03:00
committed by intellij-monorepo-bot
parent 26e502804a
commit 37e1a05dac
2 changed files with 10 additions and 10 deletions

View File

@@ -10,10 +10,8 @@ public class IndentedIcon implements Icon {
private final Icon baseIcon;
private final Insets insets;
public IndentedIcon(Icon baseIcon, int leftIndent) {
this.baseIcon = baseIcon;
//noinspection UseDPIAwareInsets
insets = new Insets(0, leftIndent, 0, 0);
public IndentedIcon(Icon baseIcon, int leftInset) {
this(baseIcon, new JBInsets(0, leftInset, 0, 0));
}
public IndentedIcon(Icon baseIcon, Insets insets) {

View File

@@ -70,6 +70,8 @@ import java.util.*;
public final class PropertyInspectorTable extends JBTable implements DataProvider {
private static final Logger LOG = Logger.getInstance(PropertyInspectorTable.class);
private static final int PROPERTY_INDENT = 11;
public static final DataKey<PropertyInspectorTable> DATA_KEY = DataKey.create(PropertyInspectorTable.class.getName());
private static final Color SYNTETIC_PROPERTY_BACKGROUND = new JBColor(Gray._230, UIUtil.getPanelBackground().brighter());
@@ -148,7 +150,7 @@ public final class PropertyInspectorTable extends JBTable implements DataProvide
return;
}
final Property property = myProperties.get(row);
int indent = getPropertyIndentDepth(property) * getPropertyIndentWidth();
int indent = getPropertyIndentDepth(property) * getScaledPropertyIndent();
final Rectangle rect = getCellRect(row, convertColumnIndexToView(0), false);
Component rendererComponent = myCellRenderer.getTableCellRendererComponent(PropertyInspectorTable.this,
@@ -611,8 +613,8 @@ public final class PropertyInspectorTable extends JBTable implements DataProvide
return 0;
}
private static int getPropertyIndentWidth() {
return JBUIScale.scale(11);
private static int getScaledPropertyIndent() {
return JBUIScale.scale(PROPERTY_INDENT);
}
private Property[] getPropChildren(final Property property) {
@@ -1034,10 +1036,10 @@ public final class PropertyInspectorTable extends JBTable implements DataProvide
myExpandIcon = UIDesignerIcons.ExpandNode;
myCollapseIcon = UIDesignerIcons.CollapseNode;
for (int i = 0; i < myIndentIcons.length; i++) {
myIndentIcons[i] = EmptyIcon.create(myExpandIcon.getIconWidth() + getPropertyIndentWidth() * i, myExpandIcon.getIconHeight());
myIndentIcons[i] = EmptyIcon.create(myExpandIcon.getIconWidth() + getScaledPropertyIndent() * i, myExpandIcon.getIconHeight());
}
myIndentedExpandIcon = new IndentedIcon(myExpandIcon, getPropertyIndentWidth());
myIndentedCollapseIcon = new IndentedIcon(myCollapseIcon, getPropertyIndentWidth());
myIndentedExpandIcon = new IndentedIcon(myExpandIcon, PROPERTY_INDENT);
myIndentedCollapseIcon = new IndentedIcon(myCollapseIcon, PROPERTY_INDENT);
}
@Override