mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2025-12-08 06:50:56 +03:00
UIDefaultsDump: fixed order of removed values in diff dumps
This commit is contained in:
@@ -36,6 +36,8 @@ import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.TreeSet;
|
||||
import java.util.function.Predicate;
|
||||
import javax.swing.Icon;
|
||||
import javax.swing.ImageIcon;
|
||||
@@ -208,29 +210,33 @@ public class UIDefaultsDump
|
||||
}
|
||||
|
||||
private static String diff( Map<String, String> defaults1, Map<String, String> defaults2 ) {
|
||||
defaults1 = new LinkedHashMap<>( defaults1 );
|
||||
TreeSet<String> keys = new TreeSet<>();
|
||||
keys.addAll( defaults1.keySet() );
|
||||
keys.addAll( defaults2.keySet() );
|
||||
|
||||
StringBuilder buf = new StringBuilder( 10000 );
|
||||
for( Map.Entry<String, String> e : defaults2.entrySet() ) {
|
||||
String key = e.getKey();
|
||||
String value2 = e.getValue();
|
||||
String value1 = defaults1.remove( key );
|
||||
if( !value2.equals( value1 ) ) {
|
||||
|
||||
// diff header values
|
||||
for( String key : new String[] { "Class", "ID", "Name", "Java", "OS" } )
|
||||
diffValue( buf, key, defaults1.remove( key ), defaults2.remove( key ) );
|
||||
|
||||
// diff values
|
||||
for( String key : keys )
|
||||
diffValue( buf, key, defaults1.get( key ), defaults2.get( key ) );
|
||||
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
private static void diffValue( StringBuilder buf, String key, String value1, String value2 ) {
|
||||
if( !Objects.equals( value1, value2 ) ) {
|
||||
if( value1 != null )
|
||||
buf.append( "- " ).append( key ).append( value1 ).append( '\n' );
|
||||
if( value2 != null )
|
||||
buf.append( "+ " ).append( key ).append( value2 ).append( '\n' );
|
||||
buf.append( '\n' );
|
||||
}
|
||||
}
|
||||
|
||||
for( Map.Entry<String, String> e : defaults1.entrySet() ) {
|
||||
buf.append( "- " ).append( e.getKey() ).append( e.getValue() ).append( '\n' );
|
||||
buf.append( '\n' );
|
||||
}
|
||||
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
private static Map<String, String> parse( Reader in ) throws IOException {
|
||||
Map<String, String> defaults = new LinkedHashMap<>();
|
||||
try( BufferedReader reader = new BufferedReader( in ) ) {
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
- Button.default.borderWidth 2
|
||||
+ Button.default.borderWidth 1
|
||||
|
||||
- Button.default.focusedBackground #e3f1fa javax.swing.plaf.ColorUIResource [UI]
|
||||
|
||||
- Button.default.focusedBorderColor #87afda javax.swing.plaf.ColorUIResource [UI]
|
||||
+ Button.default.focusedBorderColor #a9c9f5 javax.swing.plaf.ColorUIResource [UI]
|
||||
|
||||
@@ -30,9 +32,13 @@
|
||||
- Button.default.hoverBorderColor #87afda javax.swing.plaf.ColorUIResource [UI]
|
||||
+ Button.default.hoverBorderColor #a9c9f5 javax.swing.plaf.ColorUIResource [UI]
|
||||
|
||||
- Button.focusedBackground #e3f1fa javax.swing.plaf.ColorUIResource [UI]
|
||||
|
||||
- CheckBox.icon.checkmarkColor #4f9ee3 javax.swing.plaf.ColorUIResource [UI]
|
||||
+ CheckBox.icon.checkmarkColor #ffffff javax.swing.plaf.ColorUIResource [UI]
|
||||
|
||||
- CheckBox.icon.focusedBackground #e3f1fa javax.swing.plaf.ColorUIResource [UI]
|
||||
|
||||
- CheckBox.icon.selectedBackground #ffffff javax.swing.plaf.ColorUIResource [UI]
|
||||
+ CheckBox.icon.selectedBackground #4f9ee3 javax.swing.plaf.ColorUIResource [UI]
|
||||
|
||||
@@ -63,6 +69,8 @@
|
||||
- FormattedTextField.border [lazy] 1,1,1,1 false com.formdev.flatlaf.ui.FlatTextBorder [UI]
|
||||
+ FormattedTextField.border [lazy] 3,3,3,3 false com.formdev.flatlaf.ui.FlatTextBorder [UI]
|
||||
|
||||
- HelpButton.focusedBackground #e3f1fa javax.swing.plaf.ColorUIResource [UI]
|
||||
|
||||
- HelpButton.icon [lazy] 22,22 com.formdev.flatlaf.icons.FlatHelpButtonIcon [UI]
|
||||
+ HelpButton.icon [lazy] 26,26 com.formdev.flatlaf.icons.FlatHelpButtonIcon [UI]
|
||||
|
||||
@@ -90,11 +98,3 @@
|
||||
- ToggleButton.border [lazy] 1,1,1,1 false com.formdev.flatlaf.ui.FlatButtonBorder [UI]
|
||||
+ ToggleButton.border [lazy] 3,3,3,3 false com.formdev.flatlaf.ui.FlatButtonBorder [UI]
|
||||
|
||||
- Button.default.focusedBackground #e3f1fa javax.swing.plaf.ColorUIResource [UI]
|
||||
|
||||
- Button.focusedBackground #e3f1fa javax.swing.plaf.ColorUIResource [UI]
|
||||
|
||||
- CheckBox.icon.focusedBackground #e3f1fa javax.swing.plaf.ColorUIResource [UI]
|
||||
|
||||
- HelpButton.focusedBackground #e3f1fa javax.swing.plaf.ColorUIResource [UI]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user