Skip to content

Commit

Permalink
Merge branch 'JFormDesigner:main' into classx
Browse files Browse the repository at this point in the history
  • Loading branch information
MikOfClassX authored Mar 29, 2024
2 parents 503eb54 + bde25f6 commit 2807321
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 7 deletions.
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FlatLaf Change Log
==================

## 3.4.1-SNAPSHOT
## 3.4.1

#### Fixed bugs

Expand All @@ -24,6 +24,13 @@ FlatLaf Change Log
invocation).
- macOS: Fixed crash when running in WebSwing. (issue #826; regression in 3.4)

#### Incompatibilities

- File names of custom properties files for nested Laf classes now must include
name of enclosing class name. E.g. nested Laf class `IntelliJTheme.ThemeLaf`
used `ThemeLaf.properties` in previous versions, but now needs to be named
`IntelliJTheme$ThemeLaf.properties`.


## 3.4

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public abstract class FlatDefaultsAddon
public InputStream getDefaults( Class<?> lafClass ) {
Class<?> addonClass = this.getClass();
String propertiesName = '/' + addonClass.getPackage().getName().replace( '.', '/' )
+ '/' + lafClass.getSimpleName() + ".properties";
+ '/' + UIDefaultsLoader.simpleClassName( lafClass ) + ".properties";
return addonClass.getResourceAsStream( propertiesName );
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ static void loadDefaultsFromProperties( List<Class<?>> lafClasses, List<FlatDefa
classLoader = FlatLaf.class.getClassLoader();

for( Class<?> lafClass : lafClasses ) {
String propertiesName = packageName + '/' + lafClass.getSimpleName() + ".properties";
String propertiesName = packageName + '/' + simpleClassName( lafClass ) + ".properties";
try( InputStream in = classLoader.getResourceAsStream( propertiesName ) ) {
if( in != null )
properties.load( in );
Expand All @@ -171,7 +171,7 @@ static void loadDefaultsFromProperties( List<Class<?>> lafClasses, List<FlatDefa
// load from package URL
URL packageUrl = (URL) source;
for( Class<?> lafClass : lafClasses ) {
URL propertiesUrl = new URL( packageUrl + lafClass.getSimpleName() + ".properties" );
URL propertiesUrl = new URL( packageUrl + simpleClassName( lafClass ) + ".properties" );

try( InputStream in = propertiesUrl.openStream() ) {
properties.load( in );
Expand All @@ -183,7 +183,7 @@ static void loadDefaultsFromProperties( List<Class<?>> lafClasses, List<FlatDefa
// load from folder
File folder = (File) source;
for( Class<?> lafClass : lafClasses ) {
File propertiesFile = new File( folder, lafClass.getSimpleName() + ".properties" );
File propertiesFile = new File( folder, simpleClassName( lafClass ) + ".properties" );
if( !propertiesFile.isFile() )
continue;

Expand Down Expand Up @@ -294,6 +294,14 @@ static void loadDefaultsFromProperties( List<Class<?>> lafClasses, List<FlatDefa
}
}

/**
* Similar to Class.getSimpleName(), but includes enclosing class for nested classes.
*/
static String simpleClassName( Class<?> cls ) {
String className = cls.getName();
return className.substring( className.lastIndexOf( '.' ) + 1 );
}

static void logParseError( String key, String value, RuntimeException ex, boolean severe ) {
String message = "FlatLaf: Failed to parse: '" + key + '=' + value + '\'';
if( severe )
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
# limitations under the License.
#

flatlaf.releaseVersion = 3.4
flatlaf.developmentVersion = 3.4.1-SNAPSHOT
flatlaf.releaseVersion = 3.4.1
flatlaf.developmentVersion = 3.5-SNAPSHOT

org.gradle.parallel = true
# org.gradle.warning.mode = all

0 comments on commit 2807321

Please sign in to comment.