mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2026-02-13 15:27:16 -06: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 ValueType[] tempResultValueType = new ValueType[1];
|
||||||
private static Map<Class<?>, ValueType> javaValueTypes;
|
private static Map<Class<?>, ValueType> javaValueTypes;
|
||||||
|
private static Map<String, ValueType> knownValueTypes;
|
||||||
|
|
||||||
static Object parseValue( String key, String value, Class<?> valueType ) {
|
static Object parseValue( String key, String value, Class<?> valueType ) {
|
||||||
return parseValue( key, value, valueType, null, v -> v, Collections.emptyList() );
|
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
|
// determine value type from key
|
||||||
if( valueType == ValueType.UNKNOWN ) {
|
if( valueType == ValueType.UNKNOWN ) {
|
||||||
if( key.endsWith( "UI" ) )
|
if( key.endsWith( "UI" ) )
|
||||||
|
|||||||
@@ -563,7 +563,7 @@ Spinner.buttonStyle = button
|
|||||||
|
|
||||||
#---- SplitPane ----
|
#---- SplitPane ----
|
||||||
|
|
||||||
SplitPane.dividerSize = {integer}5
|
SplitPane.dividerSize = 5
|
||||||
SplitPane.continuousLayout = true
|
SplitPane.continuousLayout = true
|
||||||
SplitPane.border = null
|
SplitPane.border = null
|
||||||
SplitPane.centerOneTouchButtons = true
|
SplitPane.centerOneTouchButtons = true
|
||||||
@@ -578,7 +578,7 @@ SplitPaneDivider.oneTouchPressedArrowColor = @buttonPressedArrowColor
|
|||||||
SplitPaneDivider.style = grip
|
SplitPaneDivider.style = grip
|
||||||
SplitPaneDivider.gripColor = @icon
|
SplitPaneDivider.gripColor = @icon
|
||||||
SplitPaneDivider.gripDotCount = 3
|
SplitPaneDivider.gripDotCount = 3
|
||||||
SplitPaneDivider.gripDotSize = {integer}3
|
SplitPaneDivider.gripDotSize = 3
|
||||||
SplitPaneDivider.gripGap = 2
|
SplitPaneDivider.gripGap = 2
|
||||||
|
|
||||||
|
|
||||||
@@ -624,7 +624,7 @@ TabbedPane.scrollButtonsPlacement = both
|
|||||||
TabbedPane.closeIcon = com.formdev.flatlaf.icons.FlatTabbedPaneCloseIcon
|
TabbedPane.closeIcon = com.formdev.flatlaf.icons.FlatTabbedPaneCloseIcon
|
||||||
TabbedPane.closeSize = 16,16
|
TabbedPane.closeSize = 16,16
|
||||||
TabbedPane.closeArc = 4
|
TabbedPane.closeArc = 4
|
||||||
TabbedPane.closeCrossPlainSize = {float}7.5
|
TabbedPane.closeCrossPlainSize = 7.5
|
||||||
TabbedPane.closeCrossFilledSize = $TabbedPane.closeCrossPlainSize
|
TabbedPane.closeCrossFilledSize = $TabbedPane.closeCrossPlainSize
|
||||||
TabbedPane.closeCrossLineWidth = 1
|
TabbedPane.closeCrossLineWidth = 1
|
||||||
|
|
||||||
@@ -636,7 +636,7 @@ Table.showHorizontalLines = false
|
|||||||
Table.showVerticalLines = false
|
Table.showVerticalLines = false
|
||||||
Table.showTrailingVerticalLine = false
|
Table.showTrailingVerticalLine = false
|
||||||
Table.consistentHomeEndKeyBehavior = true
|
Table.consistentHomeEndKeyBehavior = true
|
||||||
Table.intercellSpacing = {dimension}0,0
|
Table.intercellSpacing = 0,0
|
||||||
Table.scrollPaneBorder = com.formdev.flatlaf.ui.FlatBorder
|
Table.scrollPaneBorder = com.formdev.flatlaf.ui.FlatBorder
|
||||||
Table.ascendingSortIcon = com.formdev.flatlaf.icons.FlatAscendingSortIcon
|
Table.ascendingSortIcon = com.formdev.flatlaf.icons.FlatAscendingSortIcon
|
||||||
Table.descendingSortIcon = com.formdev.flatlaf.icons.FlatDescendingSortIcon
|
Table.descendingSortIcon = com.formdev.flatlaf.icons.FlatDescendingSortIcon
|
||||||
|
|||||||
@@ -800,7 +800,7 @@ public class TestFlatStyling
|
|||||||
ui.applyStyle( "style: grip" );
|
ui.applyStyle( "style: grip" );
|
||||||
ui.applyStyle( "gripColor: #fff" );
|
ui.applyStyle( "gripColor: #fff" );
|
||||||
ui.applyStyle( "gripDotCount: 3" );
|
ui.applyStyle( "gripDotCount: 3" );
|
||||||
ui.applyStyle( "gripDotSize: {integer}3" );
|
ui.applyStyle( "gripDotSize: 3" );
|
||||||
ui.applyStyle( "gripGap: 2" );
|
ui.applyStyle( "gripGap: 2" );
|
||||||
|
|
||||||
// JComponent properties
|
// JComponent properties
|
||||||
@@ -809,7 +809,7 @@ public class TestFlatStyling
|
|||||||
ui.applyStyle( "border: 2,2,2,2,#f00" );
|
ui.applyStyle( "border: 2,2,2,2,#f00" );
|
||||||
|
|
||||||
// JSplitPane properties
|
// JSplitPane properties
|
||||||
ui.applyStyle( "dividerSize: {integer}20" );
|
ui.applyStyle( "dividerSize: 20" );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -867,8 +867,8 @@ public class TestFlatStyling
|
|||||||
// FlatTabbedPaneCloseIcon
|
// FlatTabbedPaneCloseIcon
|
||||||
ui.applyStyle( "closeSize: 16,16" );
|
ui.applyStyle( "closeSize: 16,16" );
|
||||||
ui.applyStyle( "closeArc: 4" );
|
ui.applyStyle( "closeArc: 4" );
|
||||||
ui.applyStyle( "closeCrossPlainSize: {float}7.5" );
|
ui.applyStyle( "closeCrossPlainSize: 7.5" );
|
||||||
ui.applyStyle( "closeCrossFilledSize: {float}7.5" );
|
ui.applyStyle( "closeCrossFilledSize: 7.5" );
|
||||||
ui.applyStyle( "closeCrossLineWidth: 1" );
|
ui.applyStyle( "closeCrossLineWidth: 1" );
|
||||||
ui.applyStyle( "closeBackground: #fff" );
|
ui.applyStyle( "closeBackground: #fff" );
|
||||||
ui.applyStyle( "closeForeground: #fff" );
|
ui.applyStyle( "closeForeground: #fff" );
|
||||||
@@ -911,7 +911,7 @@ public class TestFlatStyling
|
|||||||
ui.applyStyle( "rowHeight: 30" );
|
ui.applyStyle( "rowHeight: 30" );
|
||||||
ui.applyStyle( "showHorizontalLines: true" );
|
ui.applyStyle( "showHorizontalLines: true" );
|
||||||
ui.applyStyle( "showVerticalLines: true" );
|
ui.applyStyle( "showVerticalLines: true" );
|
||||||
ui.applyStyle( "intercellSpacing: {dimension}1,1" );
|
ui.applyStyle( "intercellSpacing: 1,1" );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
@@ -342,8 +342,8 @@ TabbedPane.buttonPressedBackground = #FFC800
|
|||||||
|
|
||||||
TabbedPane.closeSize = 16,16
|
TabbedPane.closeSize = 16,16
|
||||||
TabbedPane.closeArc = 999
|
TabbedPane.closeArc = 999
|
||||||
TabbedPane.closeCrossPlainSize = {float}12
|
TabbedPane.closeCrossPlainSize = 12
|
||||||
TabbedPane.closeCrossFilledSize = {float}6.5
|
TabbedPane.closeCrossFilledSize = 6.5
|
||||||
TabbedPane.closeCrossLineWidth = 2
|
TabbedPane.closeCrossLineWidth = 2
|
||||||
#TabbedPane.closeBackground = #faa
|
#TabbedPane.closeBackground = #faa
|
||||||
TabbedPane.closeForeground = #f00
|
TabbedPane.closeForeground = #f00
|
||||||
|
|||||||
Reference in New Issue
Block a user