mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2025-12-06 14:00:55 +03:00
Styling: MenuItem: support styling acceleratorFont
Theme Editor: - support font keys in auto-completion - ignore Menu.acceleratorFont, CheckBoxMenuItem.acceleratorFont and RadioButtonMenuItem.acceleratorFont because they are never used (keep UI values for backward compatibility)
This commit is contained in:
@@ -78,7 +78,7 @@ public class FlatMenuItemRenderer
|
|||||||
protected final JMenuItem menuItem;
|
protected final JMenuItem menuItem;
|
||||||
protected Icon checkIcon;
|
protected Icon checkIcon;
|
||||||
protected Icon arrowIcon;
|
protected Icon arrowIcon;
|
||||||
protected final Font acceleratorFont;
|
@Styleable protected Font acceleratorFont;
|
||||||
protected final String acceleratorDelimiter;
|
protected final String acceleratorDelimiter;
|
||||||
|
|
||||||
/** @since 2 */ @Styleable protected boolean verticallyAlignText = FlatUIUtils.getUIBoolean( "MenuItem.verticallyAlignText", true );
|
/** @since 2 */ @Styleable protected boolean verticallyAlignText = FlatUIUtils.getUIBoolean( "MenuItem.verticallyAlignText", true );
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
|
|||||||
import static com.formdev.flatlaf.ui.TestUtils.assertMapEquals;
|
import static com.formdev.flatlaf.ui.TestUtils.assertMapEquals;
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import java.awt.Dimension;
|
import java.awt.Dimension;
|
||||||
|
import java.awt.Font;
|
||||||
import java.awt.Insets;
|
import java.awt.Insets;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -335,7 +336,8 @@ public class TestFlatStyleableInfo
|
|||||||
"selectionForeground", Color.class,
|
"selectionForeground", Color.class,
|
||||||
"disabledForeground", Color.class,
|
"disabledForeground", Color.class,
|
||||||
"acceleratorForeground", Color.class,
|
"acceleratorForeground", Color.class,
|
||||||
"acceleratorSelectionForeground", Color.class
|
"acceleratorSelectionForeground", Color.class,
|
||||||
|
"acceleratorFont", Font.class
|
||||||
);
|
);
|
||||||
|
|
||||||
menuItemRenderer( expected );
|
menuItemRenderer( expected );
|
||||||
|
|||||||
@@ -483,6 +483,7 @@ public class TestFlatStyling
|
|||||||
applyStyle.accept( "disabledForeground: #fff" );
|
applyStyle.accept( "disabledForeground: #fff" );
|
||||||
applyStyle.accept( "acceleratorForeground: #fff" );
|
applyStyle.accept( "acceleratorForeground: #fff" );
|
||||||
applyStyle.accept( "acceleratorSelectionForeground: #fff" );
|
applyStyle.accept( "acceleratorSelectionForeground: #fff" );
|
||||||
|
applyStyle.accept( "acceleratorFont: italic 12 monospaced" );
|
||||||
|
|
||||||
menuItemRenderer( applyStyle );
|
menuItemRenderer( applyStyle );
|
||||||
|
|
||||||
@@ -770,6 +771,8 @@ public class TestFlatStyling
|
|||||||
ui.applyStyle( "foreground: #fff" );
|
ui.applyStyle( "foreground: #fff" );
|
||||||
ui.applyStyle( "border: 2,2,2,2,#f00" );
|
ui.applyStyle( "border: 2,2,2,2,#f00" );
|
||||||
ui.applyStyle( "font: italic 12 monospaced" );
|
ui.applyStyle( "font: italic 12 monospaced" );
|
||||||
|
|
||||||
|
// JSlider properties
|
||||||
ui.applyStyle( "minimum: 0" );
|
ui.applyStyle( "minimum: 0" );
|
||||||
ui.applyStyle( "maximum: 50" );
|
ui.applyStyle( "maximum: 50" );
|
||||||
ui.applyStyle( "value: 20" );
|
ui.applyStyle( "value: 20" );
|
||||||
@@ -781,12 +784,6 @@ public class TestFlatStyling
|
|||||||
ui.applyStyle( "paintTicks: true" );
|
ui.applyStyle( "paintTicks: true" );
|
||||||
ui.applyStyle( "paintTrack: true" );
|
ui.applyStyle( "paintTrack: true" );
|
||||||
ui.applyStyle( "snapToTicks: true" );
|
ui.applyStyle( "snapToTicks: true" );
|
||||||
|
|
||||||
// JSlider properties
|
|
||||||
ui.applyStyle( "paintLabels: true" );
|
|
||||||
ui.applyStyle( "paintTicks: true" );
|
|
||||||
ui.applyStyle( "paintTrack: true" );
|
|
||||||
ui.applyStyle( "snapToTicks: true" );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
@@ -87,8 +87,15 @@ public class UIDefaultsKeysDump
|
|||||||
UIDefaults defaults = UIManager.getLookAndFeel().getDefaults();
|
UIDefaults defaults = UIManager.getLookAndFeel().getDefaults();
|
||||||
|
|
||||||
for( Object key : defaults.keySet() ) {
|
for( Object key : defaults.keySet() ) {
|
||||||
if( key instanceof String && !((String)key).startsWith( "FlatLaf.internal." ) )
|
if( key instanceof String && !ignoreKey( (String) key ) )
|
||||||
keys.add( (String) key );
|
keys.add( (String) key );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static boolean ignoreKey( String key ) {
|
||||||
|
return key.startsWith( "FlatLaf.internal." ) ||
|
||||||
|
key.equals( "Menu.acceleratorFont" ) ||
|
||||||
|
key.equals( "CheckBoxMenuItem.acceleratorFont" ) ||
|
||||||
|
key.equals( "RadioButtonMenuItem.acceleratorFont" );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -193,9 +193,7 @@ class FlatCompletionProvider
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean isIgnored( String key ) {
|
private boolean isIgnored( String key ) {
|
||||||
return key.endsWith( ".font" ) ||
|
return key.endsWith( "InputMap" );
|
||||||
key.endsWith( "Font" ) ||
|
|
||||||
key.endsWith( "InputMap" );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setCompletions( Set<String> keys ) {
|
private void setCompletions( Set<String> keys ) {
|
||||||
|
|||||||
@@ -139,7 +139,6 @@ CheckBox.margin
|
|||||||
CheckBox.rollover
|
CheckBox.rollover
|
||||||
CheckBox.textIconGap
|
CheckBox.textIconGap
|
||||||
CheckBox.textShiftOffset
|
CheckBox.textShiftOffset
|
||||||
CheckBoxMenuItem.acceleratorFont
|
|
||||||
CheckBoxMenuItem.acceleratorForeground
|
CheckBoxMenuItem.acceleratorForeground
|
||||||
CheckBoxMenuItem.acceleratorSelectionForeground
|
CheckBoxMenuItem.acceleratorSelectionForeground
|
||||||
CheckBoxMenuItem.arrowIcon
|
CheckBoxMenuItem.arrowIcon
|
||||||
@@ -430,7 +429,6 @@ List.selectionInactiveForeground
|
|||||||
List.showCellFocusIndicator
|
List.showCellFocusIndicator
|
||||||
List.timeFactor
|
List.timeFactor
|
||||||
ListUI
|
ListUI
|
||||||
Menu.acceleratorFont
|
|
||||||
Menu.acceleratorForeground
|
Menu.acceleratorForeground
|
||||||
Menu.acceleratorSelectionForeground
|
Menu.acceleratorSelectionForeground
|
||||||
Menu.arrowIcon
|
Menu.arrowIcon
|
||||||
@@ -614,7 +612,6 @@ RadioButton.rollover
|
|||||||
RadioButton.shadow
|
RadioButton.shadow
|
||||||
RadioButton.textIconGap
|
RadioButton.textIconGap
|
||||||
RadioButton.textShiftOffset
|
RadioButton.textShiftOffset
|
||||||
RadioButtonMenuItem.acceleratorFont
|
|
||||||
RadioButtonMenuItem.acceleratorForeground
|
RadioButtonMenuItem.acceleratorForeground
|
||||||
RadioButtonMenuItem.acceleratorSelectionForeground
|
RadioButtonMenuItem.acceleratorSelectionForeground
|
||||||
RadioButtonMenuItem.arrowIcon
|
RadioButtonMenuItem.arrowIcon
|
||||||
|
|||||||
Reference in New Issue
Block a user