mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2025-12-06 14:00:55 +03:00
Styling: replaced all occurrences of
`return new UnknownStyleException( key )` with `throw new UnknownStyleException( key )`
This commit is contained in:
@@ -370,7 +370,7 @@ public class FlatButtonUI
|
|||||||
protected Object applyStyleProperty( AbstractButton b, String key, Object value ) {
|
protected Object applyStyleProperty( AbstractButton b, String key, Object value ) {
|
||||||
if( key.startsWith( "help." ) ) {
|
if( key.startsWith( "help." ) ) {
|
||||||
if( !(helpButtonIcon instanceof FlatHelpButtonIcon) )
|
if( !(helpButtonIcon instanceof FlatHelpButtonIcon) )
|
||||||
return new UnknownStyleException( key );
|
throw new UnknownStyleException( key );
|
||||||
|
|
||||||
if( helpButtonIconShared ) {
|
if( helpButtonIconShared ) {
|
||||||
helpButtonIcon = FlatStylingSupport.cloneIcon( helpButtonIcon );
|
helpButtonIcon = FlatStylingSupport.cloneIcon( helpButtonIcon );
|
||||||
|
|||||||
@@ -205,7 +205,7 @@ public class FlatRadioButtonUI
|
|||||||
if( key.startsWith( "icon." ) ) {
|
if( key.startsWith( "icon." ) ) {
|
||||||
Icon icon = getRealIcon( b );
|
Icon icon = getRealIcon( b );
|
||||||
if( !(icon instanceof FlatCheckBoxIcon) )
|
if( !(icon instanceof FlatCheckBoxIcon) )
|
||||||
return new UnknownStyleException( key );
|
throw new UnknownStyleException( key );
|
||||||
|
|
||||||
if( icon == this.icon && iconShared ) {
|
if( icon == this.icon && iconShared ) {
|
||||||
this.icon = icon = FlatStylingSupport.cloneIcon( icon );
|
this.icon = icon = FlatStylingSupport.cloneIcon( icon );
|
||||||
|
|||||||
@@ -671,7 +671,7 @@ public class FlatTabbedPaneUI
|
|||||||
// close icon
|
// close icon
|
||||||
if( key.startsWith( "close" ) ) {
|
if( key.startsWith( "close" ) ) {
|
||||||
if( !(closeIcon instanceof FlatTabbedPaneCloseIcon) )
|
if( !(closeIcon instanceof FlatTabbedPaneCloseIcon) )
|
||||||
return new UnknownStyleException( key );
|
throw new UnknownStyleException( key );
|
||||||
|
|
||||||
if( closeIconShared ) {
|
if( closeIconShared ) {
|
||||||
closeIcon = FlatStylingSupport.cloneIcon( closeIcon );
|
closeIcon = FlatStylingSupport.cloneIcon( closeIcon );
|
||||||
|
|||||||
@@ -77,6 +77,7 @@ import com.formdev.flatlaf.icons.FlatRadioButtonMenuItemIcon;
|
|||||||
import com.formdev.flatlaf.icons.FlatSearchIcon;
|
import com.formdev.flatlaf.icons.FlatSearchIcon;
|
||||||
import com.formdev.flatlaf.icons.FlatSearchWithHistoryIcon;
|
import com.formdev.flatlaf.icons.FlatSearchWithHistoryIcon;
|
||||||
import com.formdev.flatlaf.ui.FlatStylingSupport.StyleableUI;
|
import com.formdev.flatlaf.ui.FlatStylingSupport.StyleableUI;
|
||||||
|
import com.formdev.flatlaf.ui.FlatStylingSupport.UnknownStyleException;
|
||||||
import com.formdev.flatlaf.ui.TestFlatStyling.CustomCheckBoxIcon;
|
import com.formdev.flatlaf.ui.TestFlatStyling.CustomCheckBoxIcon;
|
||||||
import com.formdev.flatlaf.ui.TestFlatStyling.CustomIcon;
|
import com.formdev.flatlaf.ui.TestFlatStyling.CustomIcon;
|
||||||
import com.formdev.flatlaf.ui.TestFlatStyling.CustomRadioButtonIcon;
|
import com.formdev.flatlaf.ui.TestFlatStyling.CustomRadioButtonIcon;
|
||||||
@@ -574,6 +575,12 @@ public class TestFlatStyleableValue
|
|||||||
//---- icon ----
|
//---- icon ----
|
||||||
|
|
||||||
if( b.getIcon() instanceof CustomIcon ) {
|
if( b.getIcon() instanceof CustomIcon ) {
|
||||||
|
try {
|
||||||
|
ui.applyStyle( b, "icon.focusWidth: 1.23" );
|
||||||
|
assertTrue( false );
|
||||||
|
} catch( UnknownStyleException ex ) {
|
||||||
|
assertEquals( new UnknownStyleException( "icon.focusWidth" ).getMessage(), ex.getMessage() );
|
||||||
|
}
|
||||||
assertEquals( null, ui.getStyleableValue( b, "icon.focusWidth" ) );
|
assertEquals( null, ui.getStyleableValue( b, "icon.focusWidth" ) );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ import org.junit.jupiter.api.BeforeAll;
|
|||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import com.formdev.flatlaf.FlatLaf;
|
import com.formdev.flatlaf.FlatLaf;
|
||||||
import com.formdev.flatlaf.icons.*;
|
import com.formdev.flatlaf.icons.*;
|
||||||
|
import com.formdev.flatlaf.ui.FlatStylingSupport.UnknownStyleException;
|
||||||
import com.formdev.flatlaf.util.ColorFunctions;
|
import com.formdev.flatlaf.util.ColorFunctions;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -697,8 +698,15 @@ public class TestFlatStyling
|
|||||||
|
|
||||||
//---- icon ----
|
//---- icon ----
|
||||||
|
|
||||||
if( b.getIcon() instanceof CustomIcon )
|
if( b.getIcon() instanceof CustomIcon ) {
|
||||||
|
try {
|
||||||
|
ui.applyStyle( b, "icon.focusWidth: 1.5" );
|
||||||
|
assertTrue( false );
|
||||||
|
} catch( UnknownStyleException ex ) {
|
||||||
|
assertEquals( new UnknownStyleException( "icon.focusWidth" ).getMessage(), ex.getMessage() );
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
ui.applyStyle( b, "icon.focusWidth: 1.5" );
|
ui.applyStyle( b, "icon.focusWidth: 1.5" );
|
||||||
ui.applyStyle( b, "icon.focusColor: #fff" );
|
ui.applyStyle( b, "icon.focusColor: #fff" );
|
||||||
|
|||||||
Reference in New Issue
Block a user