mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Property Table: row separators, correct icons indentation
This commit is contained in:
@@ -78,7 +78,10 @@ public abstract class PropertyTable extends JBTable {
|
||||
setModel(myModel);
|
||||
setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
|
||||
showColumns(false);
|
||||
setShowGrid(false);
|
||||
|
||||
setShowVerticalLines(false);
|
||||
setIntercellSpacing(new Dimension(0, 1));
|
||||
setGridColor(UIUtil.getSlightlyDarkerColor(getBackground()));
|
||||
|
||||
setRowSelectionAllowed(true);
|
||||
setColumnSelectionAllowed(false);
|
||||
@@ -1051,7 +1054,10 @@ public abstract class PropertyTable extends JBTable {
|
||||
boolean hasChildren = !getChildren(property).isEmpty();
|
||||
|
||||
myRenderer.setIcon(hasChildren ? icon : null);
|
||||
int indent = (icon.getIconWidth() + myRenderer.getIconTextGap()) * (getDepth(property) + (hasChildren ? 0 : 1));
|
||||
|
||||
int indent = (UIUtil.getTreeLeftChildIndent() + myRenderer.getIconTextGap()) * getDepth(property);
|
||||
if (!hasChildren) indent += icon.getIconWidth() + myRenderer.getIconTextGap();
|
||||
|
||||
myRenderer.setIpad(new Insets(0, indent, 0, 0));
|
||||
|
||||
return myRenderer;
|
||||
|
||||
@@ -45,19 +45,19 @@ public class CenteredIcon implements Icon {
|
||||
public void paintIcon(Component c, Graphics g, int x, int y) {
|
||||
final Dimension size = c.getSize();
|
||||
|
||||
int actualX;
|
||||
int actualY;
|
||||
int offsetX;
|
||||
int offsetY;
|
||||
|
||||
if (myCenteredInComponent) {
|
||||
actualX = size.width / 2 - myIcon.getIconWidth() / 2;
|
||||
actualY = size.height / 2 - myIcon.getIconHeight() / 2;
|
||||
offsetX = size.width / 2 - myIcon.getIconWidth() / 2;
|
||||
offsetY = size.height / 2 - myIcon.getIconHeight() / 2;
|
||||
}
|
||||
else {
|
||||
actualX = (myWidth - myIcon.getIconWidth()) / 2;
|
||||
actualY = (myHight - myIcon.getIconHeight()) / 2;
|
||||
offsetX = (myWidth - myIcon.getIconWidth()) / 2;
|
||||
offsetY = (myHight - myIcon.getIconHeight()) / 2;
|
||||
}
|
||||
|
||||
myIcon.paintIcon(c, g, x + actualX, y + actualY);
|
||||
myIcon.paintIcon(c, g, x + offsetX, y + offsetY);
|
||||
}
|
||||
|
||||
public int getIconWidth() {
|
||||
|
||||
@@ -821,12 +821,12 @@ public class UIUtil {
|
||||
Icon selectedIcon = getTreeSelectedExpandedIcon();
|
||||
Icon notSelectedIcon = getTreeExpandedIcon();
|
||||
|
||||
int widht = Math.max(selectedIcon.getIconWidth(), notSelectedIcon.getIconWidth());
|
||||
int width = Math.max(selectedIcon.getIconWidth(), notSelectedIcon.getIconWidth());
|
||||
int height = Math.max(selectedIcon.getIconWidth(), notSelectedIcon.getIconWidth());
|
||||
|
||||
return new CenteredIcon(expanded ? (white ? getTreeSelectedExpandedIcon() : getTreeExpandedIcon())
|
||||
: (white ? getTreeSelectedCollapsedIcon() : getTreeCollapsedIcon()),
|
||||
widht, height, false);
|
||||
width, height, false);
|
||||
}
|
||||
|
||||
public static Icon getTreeCollapsedIcon() {
|
||||
|
||||
Reference in New Issue
Block a user