* Update the style of the button.
*
* @param b the button.
*/
public void updateStyle(AbstractButton b) {
SeaGlassContext context = getContext(b, SynthConstants.ENABLED);
SynthStyle oldStyle = style;
style = SeaGlassLookAndFeel.updateStyle(context, this);
if (style != oldStyle) {
if (b.getMargin() == null || (b.getMargin() instanceof UIResource)) {
Insets margin = (Insets) style.get(context, getPropertyPrefix() + "margin");
if (margin == null) {
// Some places assume margins are non-null.
margin = SeaGlassLookAndFeel.EMPTY_UIRESOURCE_INSETS;
}
b.setMargin(margin);
}
Object value = style.get(context, getPropertyPrefix() + "iconTextGap");
if (value != null) {
LookAndFeel.installProperty(b, "iconTextGap", value);
}
value = style.get(context, getPropertyPrefix() + "contentAreaFilled");
LookAndFeel.installProperty(b, "contentAreaFilled", value != null ? value : Boolean.TRUE);
value = b.getClientProperty(APPLE_PREFIX + "buttonType");
if (value != null) {
if ("segmented".equals(value)) {
b.setMargin(SeaGlassLookAndFeel.EMPTY_UIRESOURCE_INSETS);
}
}
if (oldStyle != null) {
uninstallKeyboardActions(b);
installKeyboardActions(b);
}
}
context.dispose();
}