Table: replaced Table.showGrid with Table.showHorizontalLines and Table.showVerticalLines (issue #38)

This commit is contained in:
Karl Tauber
2020-01-09 20:55:55 +01:00
parent 41e2888bf1
commit 43ab095e0f
3 changed files with 23 additions and 18 deletions

View File

@@ -18,6 +18,8 @@ FlatLaf Change Log
- ScrollPane with Table: The border of buttons that are added to one of the four
scroll pane corners are now removed if the center component is a table. Also,
these corner buttons are made not focusable.
- Table: Replaced `Table.showGrid` with `Table.showHorizontalLines` and
`Table.showVerticalLines`. (issue #38)
## 0.23.1

View File

@@ -56,7 +56,8 @@ import com.formdev.flatlaf.util.UIScale;
* <!-- FlatTableUI -->
*
* @uiDefault Table.rowHeight int
* @uiDefault Table.showGrid boolean
* @uiDefault Table.showHorizontalLines boolean
* @uiDefault Table.showVerticalLines boolean
* @uiDefault Table.intercellSpacing Dimension
* @uiDefault Table.selectionInactiveBackground Color
* @uiDefault Table.selectionInactiveForeground Color
@@ -72,7 +73,8 @@ import com.formdev.flatlaf.util.UIScale;
public class FlatTableUI
extends BasicTableUI
{
protected boolean showGrid;
protected boolean showHorizontalLines;
protected boolean showVerticalLines;
protected Dimension intercellSpacing;
protected Color selectionBackground;
@@ -102,7 +104,8 @@ public class FlatTableUI
protected void installDefaults() {
super.installDefaults();
showGrid = UIManager.getBoolean( "Table.showGrid" );
showHorizontalLines = UIManager.getBoolean( "Table.showHorizontalLines" );
showVerticalLines = UIManager.getBoolean( "Table.showVerticalLines" );
intercellSpacing = UIManager.getDimension( "Table.intercellSpacing" );
selectionBackground = UIManager.getColor( "Table.selectionBackground" );
@@ -116,10 +119,13 @@ public class FlatTableUI
if( rowHeight > 0 )
LookAndFeel.installProperty( table, "rowHeight", UIScale.scale( rowHeight ) );
if( !showGrid ) {
if( !showHorizontalLines ) {
oldShowHorizontalLines = table.getShowHorizontalLines();
table.setShowHorizontalLines( false );
}
if( !showVerticalLines ) {
oldShowVerticalLines = table.getShowVerticalLines();
table.setShowGrid( false );
table.setShowVerticalLines( false );
}
if( intercellSpacing != null ) {
@@ -137,19 +143,15 @@ public class FlatTableUI
selectionInactiveBackground = null;
selectionInactiveForeground = null;
// restore old show grid
if( !showGrid ) {
if( !table.getShowHorizontalLines() )
table.setShowHorizontalLines( oldShowHorizontalLines );
if( !table.getShowVerticalLines() )
table.setShowVerticalLines( oldShowVerticalLines );
}
// restore old show horizontal/vertical lines (if not modified)
if( !showHorizontalLines && oldShowHorizontalLines && !table.getShowHorizontalLines() )
table.setShowHorizontalLines( true );
if( !showVerticalLines && oldShowVerticalLines && !table.getShowVerticalLines() )
table.setShowVerticalLines( true );
// restore old intercell spacing
if( intercellSpacing != null ) {
if( table.getIntercellSpacing().equals( intercellSpacing ) )
table.setIntercellSpacing( oldIntercellSpacing );
}
// restore old intercell spacing (if not modified)
if( intercellSpacing != null && table.getIntercellSpacing().equals( intercellSpacing ) )
table.setIntercellSpacing( oldIntercellSpacing );
}
@Override

View File

@@ -369,7 +369,8 @@ TabbedPane.shadow=$ComboBox.buttonArrowColor
#---- Table ----
Table.rowHeight=20
Table.showGrid=false
Table.showHorizontalLines=false
Table.showVerticalLines=false
Table.intercellSpacing={dimension}0,0
Table.scrollPaneBorder=com.formdev.flatlaf.ui.FlatBorder
Table.ascendingSortIcon=com.formdev.flatlaf.icons.FlatAscendingSortIcon