Styling: support styling for recently merged changes

This commit is contained in:
Karl Tauber
2021-09-14 22:43:44 +02:00
parent c5c0a3768a
commit ccd0597b35
5 changed files with 12 additions and 1 deletions

View File

@@ -139,6 +139,12 @@ public class FlatTableHeaderBorder
} }
protected boolean hideTrailingVerticalLine( JTableHeader header ) { protected boolean hideTrailingVerticalLine( JTableHeader header ) {
if( header.getUI() instanceof FlatTableHeaderUI ) {
FlatTableHeaderUI ui = (FlatTableHeaderUI) header.getUI();
if( ui.showTrailingVerticalLine )
return false;
}
if( showTrailingVerticalLine ) if( showTrailingVerticalLine )
return false; return false;

View File

@@ -86,6 +86,7 @@ public class FlatTableHeaderUI
// for FlatTableHeaderBorder // for FlatTableHeaderBorder
@Styleable protected Insets cellMargins; @Styleable protected Insets cellMargins;
@Styleable protected Color separatorColor; @Styleable protected Color separatorColor;
/** @since 2 */ @Styleable protected boolean showTrailingVerticalLine;
// for FlatAscendingSortIcon and FlatDescendingSortIcon // for FlatAscendingSortIcon and FlatDescendingSortIcon
// (needs to be public because icon classes are in another package) // (needs to be public because icon classes are in another package)

View File

@@ -98,7 +98,7 @@ public class FlatTableUI
{ {
protected boolean showHorizontalLines; protected boolean showHorizontalLines;
protected boolean showVerticalLines; protected boolean showVerticalLines;
/** @since 1.6 */ protected boolean showTrailingVerticalLine; /** @since 1.6 */ @Styleable protected boolean showTrailingVerticalLine;
protected Dimension intercellSpacing; protected Dimension intercellSpacing;
@Styleable protected Color selectionBackground; @Styleable protected Color selectionBackground;

View File

@@ -708,6 +708,7 @@ public class TestFlatStyleableInfo
FlatTableUI ui = (FlatTableUI) c.getUI(); FlatTableUI ui = (FlatTableUI) c.getUI();
Map<String, Class<?>> expected = expectedMap( Map<String, Class<?>> expected = expectedMap(
"showTrailingVerticalLine", boolean.class,
"selectionBackground", Color.class, "selectionBackground", Color.class,
"selectionForeground", Color.class, "selectionForeground", Color.class,
"selectionInactiveBackground", Color.class, "selectionInactiveBackground", Color.class,
@@ -735,6 +736,7 @@ public class TestFlatStyleableInfo
// FlatTableHeaderBorder // FlatTableHeaderBorder
"cellMargins", Insets.class, "cellMargins", Insets.class,
"separatorColor", Color.class, "separatorColor", Color.class,
"showTrailingVerticalLine", boolean.class,
// FlatAscendingSortIcon and FlatDescendingSortIcon // FlatAscendingSortIcon and FlatDescendingSortIcon
"arrowType", String.class, "arrowType", String.class,

View File

@@ -806,6 +806,7 @@ public class TestFlatStyling
JTable c = new JTable(); JTable c = new JTable();
FlatTableUI ui = (FlatTableUI) c.getUI(); FlatTableUI ui = (FlatTableUI) c.getUI();
ui.applyStyle( "showTrailingVerticalLine: true" );
ui.applyStyle( "selectionBackground: #fff" ); ui.applyStyle( "selectionBackground: #fff" );
ui.applyStyle( "selectionForeground: #fff" ); ui.applyStyle( "selectionForeground: #fff" );
ui.applyStyle( "selectionInactiveBackground: #fff" ); ui.applyStyle( "selectionInactiveBackground: #fff" );
@@ -841,6 +842,7 @@ public class TestFlatStyling
// FlatTableHeaderBorder // FlatTableHeaderBorder
ui.applyStyle( "cellMargins: 1,2,3,4" ); ui.applyStyle( "cellMargins: 1,2,3,4" );
ui.applyStyle( "separatorColor: #fff" ); ui.applyStyle( "separatorColor: #fff" );
ui.applyStyle( "showTrailingVerticalLine: true" );
// FlatAscendingSortIcon and FlatDescendingSortIcon // FlatAscendingSortIcon and FlatDescendingSortIcon
ui.applyStyle( "arrowType: chevron" ); ui.applyStyle( "arrowType: chevron" );