mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2025-12-09 16:25:10 +03:00
UIDefaultsLoader: further reduced need for value type prefixes in properties files and in CSS styles
This commit is contained in:
@@ -340,6 +340,7 @@ class UIDefaultsLoader
|
||||
|
||||
private static ValueType[] tempResultValueType = new ValueType[1];
|
||||
private static Map<Class<?>, ValueType> javaValueTypes;
|
||||
private static Map<String, ValueType> knownValueTypes;
|
||||
|
||||
static Object parseValue( String key, String value, Class<?> valueType ) {
|
||||
return parseValue( key, value, valueType, null, v -> v, Collections.emptyList() );
|
||||
@@ -446,6 +447,28 @@ class UIDefaultsLoader
|
||||
}
|
||||
}
|
||||
|
||||
if( valueType == ValueType.UNKNOWN ) {
|
||||
if( knownValueTypes == null ) {
|
||||
// create lazy
|
||||
knownValueTypes = new HashMap<>();
|
||||
// SplitPane
|
||||
knownValueTypes.put( "SplitPane.dividerSize", ValueType.INTEGER );
|
||||
knownValueTypes.put( "SplitPaneDivider.gripDotSize", ValueType.INTEGER );
|
||||
knownValueTypes.put( "dividerSize", ValueType.INTEGER );
|
||||
knownValueTypes.put( "gripDotSize", ValueType.INTEGER );
|
||||
// TabbedPane
|
||||
knownValueTypes.put( "TabbedPane.closeCrossPlainSize", ValueType.FLOAT );
|
||||
knownValueTypes.put( "TabbedPane.closeCrossFilledSize", ValueType.FLOAT );
|
||||
knownValueTypes.put( "closeCrossPlainSize", ValueType.FLOAT );
|
||||
knownValueTypes.put( "closeCrossFilledSize", ValueType.FLOAT );
|
||||
// Table
|
||||
knownValueTypes.put( "Table.intercellSpacing", ValueType.DIMENSION );
|
||||
knownValueTypes.put( "intercellSpacing", ValueType.DIMENSION );
|
||||
}
|
||||
|
||||
valueType = knownValueTypes.getOrDefault( key, ValueType.UNKNOWN );
|
||||
}
|
||||
|
||||
// determine value type from key
|
||||
if( valueType == ValueType.UNKNOWN ) {
|
||||
if( key.endsWith( "UI" ) )
|
||||
|
||||
@@ -563,7 +563,7 @@ Spinner.buttonStyle = button
|
||||
|
||||
#---- SplitPane ----
|
||||
|
||||
SplitPane.dividerSize = {integer}5
|
||||
SplitPane.dividerSize = 5
|
||||
SplitPane.continuousLayout = true
|
||||
SplitPane.border = null
|
||||
SplitPane.centerOneTouchButtons = true
|
||||
@@ -578,7 +578,7 @@ SplitPaneDivider.oneTouchPressedArrowColor = @buttonPressedArrowColor
|
||||
SplitPaneDivider.style = grip
|
||||
SplitPaneDivider.gripColor = @icon
|
||||
SplitPaneDivider.gripDotCount = 3
|
||||
SplitPaneDivider.gripDotSize = {integer}3
|
||||
SplitPaneDivider.gripDotSize = 3
|
||||
SplitPaneDivider.gripGap = 2
|
||||
|
||||
|
||||
@@ -624,7 +624,7 @@ TabbedPane.scrollButtonsPlacement = both
|
||||
TabbedPane.closeIcon = com.formdev.flatlaf.icons.FlatTabbedPaneCloseIcon
|
||||
TabbedPane.closeSize = 16,16
|
||||
TabbedPane.closeArc = 4
|
||||
TabbedPane.closeCrossPlainSize = {float}7.5
|
||||
TabbedPane.closeCrossPlainSize = 7.5
|
||||
TabbedPane.closeCrossFilledSize = $TabbedPane.closeCrossPlainSize
|
||||
TabbedPane.closeCrossLineWidth = 1
|
||||
|
||||
@@ -636,7 +636,7 @@ Table.showHorizontalLines = false
|
||||
Table.showVerticalLines = false
|
||||
Table.showTrailingVerticalLine = false
|
||||
Table.consistentHomeEndKeyBehavior = true
|
||||
Table.intercellSpacing = {dimension}0,0
|
||||
Table.intercellSpacing = 0,0
|
||||
Table.scrollPaneBorder = com.formdev.flatlaf.ui.FlatBorder
|
||||
Table.ascendingSortIcon = com.formdev.flatlaf.icons.FlatAscendingSortIcon
|
||||
Table.descendingSortIcon = com.formdev.flatlaf.icons.FlatDescendingSortIcon
|
||||
|
||||
@@ -800,7 +800,7 @@ public class TestFlatStyling
|
||||
ui.applyStyle( "style: grip" );
|
||||
ui.applyStyle( "gripColor: #fff" );
|
||||
ui.applyStyle( "gripDotCount: 3" );
|
||||
ui.applyStyle( "gripDotSize: {integer}3" );
|
||||
ui.applyStyle( "gripDotSize: 3" );
|
||||
ui.applyStyle( "gripGap: 2" );
|
||||
|
||||
// JComponent properties
|
||||
@@ -809,7 +809,7 @@ public class TestFlatStyling
|
||||
ui.applyStyle( "border: 2,2,2,2,#f00" );
|
||||
|
||||
// JSplitPane properties
|
||||
ui.applyStyle( "dividerSize: {integer}20" );
|
||||
ui.applyStyle( "dividerSize: 20" );
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -867,8 +867,8 @@ public class TestFlatStyling
|
||||
// FlatTabbedPaneCloseIcon
|
||||
ui.applyStyle( "closeSize: 16,16" );
|
||||
ui.applyStyle( "closeArc: 4" );
|
||||
ui.applyStyle( "closeCrossPlainSize: {float}7.5" );
|
||||
ui.applyStyle( "closeCrossFilledSize: {float}7.5" );
|
||||
ui.applyStyle( "closeCrossPlainSize: 7.5" );
|
||||
ui.applyStyle( "closeCrossFilledSize: 7.5" );
|
||||
ui.applyStyle( "closeCrossLineWidth: 1" );
|
||||
ui.applyStyle( "closeBackground: #fff" );
|
||||
ui.applyStyle( "closeForeground: #fff" );
|
||||
@@ -911,7 +911,7 @@ public class TestFlatStyling
|
||||
ui.applyStyle( "rowHeight: 30" );
|
||||
ui.applyStyle( "showHorizontalLines: true" );
|
||||
ui.applyStyle( "showVerticalLines: true" );
|
||||
ui.applyStyle( "intercellSpacing: {dimension}1,1" );
|
||||
ui.applyStyle( "intercellSpacing: 1,1" );
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user