Table and TableHeader: added UI defaults to show last vertical line (issue #332)

This commit is contained in:
Karl Tauber
2021-09-05 11:51:28 +02:00
parent c2c79c4676
commit 824db2e3bd
8 changed files with 21 additions and 1 deletions

View File

@@ -44,6 +44,7 @@ public class FlatTableHeaderBorder
{ {
protected Color separatorColor = UIManager.getColor( "TableHeader.separatorColor" ); protected Color separatorColor = UIManager.getColor( "TableHeader.separatorColor" );
protected Color bottomSeparatorColor = UIManager.getColor( "TableHeader.bottomSeparatorColor" ); protected Color bottomSeparatorColor = UIManager.getColor( "TableHeader.bottomSeparatorColor" );
protected boolean showLastVerticalLine = UIManager.getBoolean( "TableHeader.showLastVerticalLine" );
public FlatTableHeaderBorder() { public FlatTableHeaderBorder() {
super( UIManager.getInsets( "TableHeader.cellMargins" ) ); super( UIManager.getInsets( "TableHeader.cellMargins" ) );
@@ -108,6 +109,9 @@ public class FlatTableHeaderBorder
} }
protected boolean hideTrailingVerticalLine( JTableHeader header ) { protected boolean hideTrailingVerticalLine( JTableHeader header ) {
if( showLastVerticalLine )
return false;
Container viewport = header.getParent(); Container viewport = header.getParent();
Container viewportParent = (viewport != null) ? viewport.getParent() : null; Container viewportParent = (viewport != null) ? viewport.getParent() : null;
if( !(viewportParent instanceof JScrollPane) ) if( !(viewportParent instanceof JScrollPane) )

View File

@@ -62,6 +62,7 @@ import com.formdev.flatlaf.util.UIScale;
* @uiDefault TableHeader.cellMargins Insets * @uiDefault TableHeader.cellMargins Insets
* @uiDefault TableHeader.separatorColor Color * @uiDefault TableHeader.separatorColor Color
* @uiDefault TableHeader.bottomSeparatorColor Color * @uiDefault TableHeader.bottomSeparatorColor Color
* @uiDefault TableHeader.showLastVerticalLine boolean
* *
* @author Karl Tauber * @author Karl Tauber
*/ */

View File

@@ -69,6 +69,7 @@ import com.formdev.flatlaf.util.UIScale;
* @uiDefault Table.rowHeight int * @uiDefault Table.rowHeight int
* @uiDefault Table.showHorizontalLines boolean * @uiDefault Table.showHorizontalLines boolean
* @uiDefault Table.showVerticalLines boolean * @uiDefault Table.showVerticalLines boolean
* @uiDefault Table.showLastVerticalLine boolean
* @uiDefault Table.intercellSpacing Dimension * @uiDefault Table.intercellSpacing Dimension
* @uiDefault Table.selectionInactiveBackground Color * @uiDefault Table.selectionInactiveBackground Color
* @uiDefault Table.selectionInactiveForeground Color * @uiDefault Table.selectionInactiveForeground Color
@@ -90,6 +91,7 @@ public class FlatTableUI
{ {
protected boolean showHorizontalLines; protected boolean showHorizontalLines;
protected boolean showVerticalLines; protected boolean showVerticalLines;
protected boolean showLastVerticalLine;
protected Dimension intercellSpacing; protected Dimension intercellSpacing;
protected Color selectionBackground; protected Color selectionBackground;
@@ -111,6 +113,7 @@ public class FlatTableUI
showHorizontalLines = UIManager.getBoolean( "Table.showHorizontalLines" ); showHorizontalLines = UIManager.getBoolean( "Table.showHorizontalLines" );
showVerticalLines = UIManager.getBoolean( "Table.showVerticalLines" ); showVerticalLines = UIManager.getBoolean( "Table.showVerticalLines" );
showLastVerticalLine = UIManager.getBoolean( "Table.showLastVerticalLine" );
intercellSpacing = UIManager.getDimension( "Table.intercellSpacing" ); intercellSpacing = UIManager.getDimension( "Table.intercellSpacing" );
selectionBackground = UIManager.getColor( "Table.selectionBackground" ); selectionBackground = UIManager.getColor( "Table.selectionBackground" );
@@ -292,6 +295,9 @@ public class FlatTableUI
} }
protected boolean hideLastVerticalLine() { protected boolean hideLastVerticalLine() {
if( showLastVerticalLine )
return false;
Container viewport = SwingUtilities.getUnwrappedParent( table ); Container viewport = SwingUtilities.getUnwrappedParent( table );
Container viewportParent = (viewport != null) ? viewport.getParent() : null; Container viewportParent = (viewport != null) ? viewport.getParent() : null;
if( !(viewportParent instanceof JScrollPane) ) if( !(viewportParent instanceof JScrollPane) )

View File

@@ -628,6 +628,7 @@ TabbedPane.closeCrossLineWidth = {float}1
Table.rowHeight = 20 Table.rowHeight = 20
Table.showHorizontalLines = false Table.showHorizontalLines = false
Table.showVerticalLines = false Table.showVerticalLines = false
Table.showLastVerticalLine = false
Table.consistentHomeEndKeyBehavior = true Table.consistentHomeEndKeyBehavior = true
Table.intercellSpacing = {dimension}0,0 Table.intercellSpacing = {dimension}0,0
Table.scrollPaneBorder = com.formdev.flatlaf.ui.FlatBorder Table.scrollPaneBorder = com.formdev.flatlaf.ui.FlatBorder
@@ -657,7 +658,7 @@ TableHeader.cellBorder = com.formdev.flatlaf.ui.FlatTableHeaderBorder
TableHeader.cellMargins = 2,3,2,3 TableHeader.cellMargins = 2,3,2,3
TableHeader.focusCellBackground = $TableHeader.background TableHeader.focusCellBackground = $TableHeader.background
TableHeader.background = @textComponentBackground TableHeader.background = @textComponentBackground
TableHeader.showLastVerticalLine = false
#---- TextArea ---- #---- TextArea ----

View File

@@ -1078,6 +1078,7 @@ Table.selectionForeground #bbbbbb HSL 0 0 73 javax.swing.plaf.Colo
Table.selectionInactiveBackground #0d293e HSL 206 65 15 javax.swing.plaf.ColorUIResource [UI] Table.selectionInactiveBackground #0d293e HSL 206 65 15 javax.swing.plaf.ColorUIResource [UI]
Table.selectionInactiveForeground #bbbbbb HSL 0 0 73 javax.swing.plaf.ColorUIResource [UI] Table.selectionInactiveForeground #bbbbbb HSL 0 0 73 javax.swing.plaf.ColorUIResource [UI]
Table.showHorizontalLines false Table.showHorizontalLines false
Table.showLastVerticalLine false
Table.showVerticalLines false Table.showVerticalLines false
Table.sortIconColor #adadad HSL 0 0 68 javax.swing.plaf.ColorUIResource [UI] Table.sortIconColor #adadad HSL 0 0 68 javax.swing.plaf.ColorUIResource [UI]
@@ -1093,6 +1094,7 @@ TableHeader.font [active] $defaultFont [UI]
TableHeader.foreground #bbbbbb HSL 0 0 73 javax.swing.plaf.ColorUIResource [UI] TableHeader.foreground #bbbbbb HSL 0 0 73 javax.swing.plaf.ColorUIResource [UI]
TableHeader.height 25 TableHeader.height 25
TableHeader.separatorColor #5e6364 HSL 190 3 38 javax.swing.plaf.ColorUIResource [UI] TableHeader.separatorColor #5e6364 HSL 190 3 38 javax.swing.plaf.ColorUIResource [UI]
TableHeader.showLastVerticalLine false
TableHeaderUI com.formdev.flatlaf.ui.FlatTableHeaderUI TableHeaderUI com.formdev.flatlaf.ui.FlatTableHeaderUI

View File

@@ -1083,6 +1083,7 @@ Table.selectionForeground #ffffff HSL 0 0 100 javax.swing.plaf.Colo
Table.selectionInactiveBackground #d4d4d4 HSL 0 0 83 javax.swing.plaf.ColorUIResource [UI] Table.selectionInactiveBackground #d4d4d4 HSL 0 0 83 javax.swing.plaf.ColorUIResource [UI]
Table.selectionInactiveForeground #000000 HSL 0 0 0 javax.swing.plaf.ColorUIResource [UI] Table.selectionInactiveForeground #000000 HSL 0 0 0 javax.swing.plaf.ColorUIResource [UI]
Table.showHorizontalLines false Table.showHorizontalLines false
Table.showLastVerticalLine false
Table.showVerticalLines false Table.showVerticalLines false
Table.sortIconColor #afafaf HSL 0 0 69 javax.swing.plaf.ColorUIResource [UI] Table.sortIconColor #afafaf HSL 0 0 69 javax.swing.plaf.ColorUIResource [UI]
@@ -1098,6 +1099,7 @@ TableHeader.font [active] $defaultFont [UI]
TableHeader.foreground #000000 HSL 0 0 0 javax.swing.plaf.ColorUIResource [UI] TableHeader.foreground #000000 HSL 0 0 0 javax.swing.plaf.ColorUIResource [UI]
TableHeader.height 25 TableHeader.height 25
TableHeader.separatorColor #e6e6e6 HSL 0 0 90 javax.swing.plaf.ColorUIResource [UI] TableHeader.separatorColor #e6e6e6 HSL 0 0 90 javax.swing.plaf.ColorUIResource [UI]
TableHeader.showLastVerticalLine false
TableHeaderUI com.formdev.flatlaf.ui.FlatTableHeaderUI TableHeaderUI com.formdev.flatlaf.ui.FlatTableHeaderUI

View File

@@ -1088,6 +1088,7 @@ Table.selectionForeground #ffff00 HSL 60 100 50 javax.swing.plaf.Colo
Table.selectionInactiveBackground #888888 HSL 0 0 53 javax.swing.plaf.ColorUIResource [UI] Table.selectionInactiveBackground #888888 HSL 0 0 53 javax.swing.plaf.ColorUIResource [UI]
Table.selectionInactiveForeground #ffffff HSL 0 0 100 javax.swing.plaf.ColorUIResource [UI] Table.selectionInactiveForeground #ffffff HSL 0 0 100 javax.swing.plaf.ColorUIResource [UI]
Table.showHorizontalLines false Table.showHorizontalLines false
Table.showLastVerticalLine false
Table.showVerticalLines false Table.showVerticalLines false
Table.sortIconColor #ffff00 HSL 60 100 50 javax.swing.plaf.ColorUIResource [UI] Table.sortIconColor #ffff00 HSL 60 100 50 javax.swing.plaf.ColorUIResource [UI]
@@ -1103,6 +1104,7 @@ TableHeader.font [active] $defaultFont [UI]
TableHeader.foreground #ffffff HSL 0 0 100 javax.swing.plaf.ColorUIResource [UI] TableHeader.foreground #ffffff HSL 0 0 100 javax.swing.plaf.ColorUIResource [UI]
TableHeader.height 25 TableHeader.height 25
TableHeader.separatorColor #00ff00 HSL 120 100 50 javax.swing.plaf.ColorUIResource [UI] TableHeader.separatorColor #00ff00 HSL 120 100 50 javax.swing.plaf.ColorUIResource [UI]
TableHeader.showLastVerticalLine false
TableHeaderUI com.formdev.flatlaf.ui.FlatTableHeaderUI TableHeaderUI com.formdev.flatlaf.ui.FlatTableHeaderUI

View File

@@ -830,6 +830,7 @@ Table.selectionForeground
Table.selectionInactiveBackground Table.selectionInactiveBackground
Table.selectionInactiveForeground Table.selectionInactiveForeground
Table.showHorizontalLines Table.showHorizontalLines
Table.showLastVerticalLine
Table.showVerticalLines Table.showVerticalLines
Table.sortIconColor Table.sortIconColor
TableHeader.ancestorInputMap TableHeader.ancestorInputMap
@@ -842,6 +843,7 @@ TableHeader.font
TableHeader.foreground TableHeader.foreground
TableHeader.height TableHeader.height
TableHeader.separatorColor TableHeader.separatorColor
TableHeader.showLastVerticalLine
TableHeaderUI TableHeaderUI
TableUI TableUI
TaskPane.background TaskPane.background