Styling: support styling for recently merged changes

This commit is contained in:
Karl Tauber
2021-07-11 01:41:52 +02:00
parent be7114d3e6
commit 943dfe0619
3 changed files with 14 additions and 3 deletions

View File

@@ -70,14 +70,14 @@ public class FlatButtonBorder
@Styleable(dot=true) protected Color defaultFocusColor = UIManager.getColor( "Button.default.focusColor" );
@Styleable(dot=true) protected Color defaultHoverBorderColor = UIManager.getColor( "Button.default.hoverBorderColor" );
/** @since 1.4 */
protected final Color toolbarFocusColor = UIManager.getColor( "Button.toolbar.focusColor" );
@Styleable(dot=true) protected Color toolbarFocusColor = UIManager.getColor( "Button.toolbar.focusColor" );
@Styleable protected int borderWidth = UIManager.getInt( "Button.borderWidth" );
@Styleable(dot=true) protected int defaultBorderWidth = UIManager.getInt( "Button.default.borderWidth" );
@Styleable(dot=true) protected Insets toolbarMargin = UIManager.getInsets( "Button.toolbar.margin" );
@Styleable(dot=true) protected Insets toolbarSpacingInsets = UIManager.getInsets( "Button.toolbar.spacingInsets" );
/** @since 1.4 */
protected final float toolbarFocusWidth = FlatUIUtils.getUIFloat( "Button.toolbar.focusWidth", 1.5f );
@Styleable(dot=true) protected float toolbarFocusWidth = FlatUIUtils.getUIFloat( "Button.toolbar.focusWidth", 1.5f );
@Styleable protected int arc = UIManager.getInt( "Button.arc" );
public FlatButtonBorder() {

View File

@@ -61,7 +61,7 @@ public class FlatToolBarUI
extends BasicToolBarUI
{
/** @since 1.4 */
protected boolean focusableButtons;
@Styleable protected boolean focusableButtons;
// for FlatToolBarBorder
@Styleable protected Insets borderMargins;
@@ -138,7 +138,12 @@ public class FlatToolBarUI
* @since TODO
*/
protected void applyStyle( Object style ) {
boolean oldFocusableButtons = focusableButtons;
oldStyleValues = FlatStyleSupport.parseAndApply( oldStyleValues, style, this::applyStyleProperty );
if( focusableButtons != oldFocusableButtons )
setButtonsFocusable( focusableButtons );
}
/**

View File

@@ -664,6 +664,8 @@ public class TestFlatStyling
JToolBar c = new JToolBar();
FlatToolBarUI ui = (FlatToolBarUI) c.getUI();
ui.applyStyle( "focusableButtons: true" );
ui.applyStyle( "borderMargins: 1,2,3,4" );
ui.applyStyle( "gripColor: #fff" );
}
@@ -713,11 +715,13 @@ public class TestFlatStyling
applyStyle.accept( "default.focusedBorderColor: #fff" );
applyStyle.accept( "default.focusColor: #fff" );
applyStyle.accept( "default.hoverBorderColor: #fff" );
applyStyle.accept( "toolbar.focusColor: #fff" );
applyStyle.accept( "borderWidth: 1" );
applyStyle.accept( "default.borderWidth: 2" );
applyStyle.accept( "toolbar.margin: 1,2,3,4" );
applyStyle.accept( "toolbar.spacingInsets: 1,2,3,4" );
applyStyle.accept( "toolbar.focusWidth: {float}1.5" );
applyStyle.accept( "arc: 6" );
}
@@ -767,11 +771,13 @@ public class TestFlatStyling
border.applyStyleProperty( "default.focusedBorderColor", Color.WHITE );
border.applyStyleProperty( "default.focusColor", Color.WHITE );
border.applyStyleProperty( "default.hoverBorderColor", Color.WHITE );
border.applyStyleProperty( "toolbar.focusColor", Color.WHITE );
border.applyStyleProperty( "borderWidth", 1 );
border.applyStyleProperty( "default.borderWidth", 2 );
border.applyStyleProperty( "toolbar.margin", new Insets( 1, 2, 3, 4 ) );
border.applyStyleProperty( "toolbar.spacingInsets", new Insets( 1, 2, 3, 4 ) );
border.applyStyleProperty( "toolbar.focusWidth", 1.5f );
border.applyStyleProperty( "arc", 6 );
}