Styling: fixes and added missing @since tags

This commit is contained in:
Karl Tauber
2021-12-11 00:50:05 +01:00
parent 09d8d09aad
commit 959b3e46fa
12 changed files with 43 additions and 31 deletions

View File

@@ -44,8 +44,8 @@ import com.formdev.flatlaf.util.LoggingFacade;
* <!-- BasicEditorPaneUI -->
*
* @uiDefault EditorPane.font Font
* @uiDefault EditorPane.background Color also used if not editable
* @uiDefault EditorPane.foreground Color
* @uiDefault EditorPane.background Color
* @uiDefault EditorPane.foreground Color also used if not editable
* @uiDefault EditorPane.caretForeground Color
* @uiDefault EditorPane.selectionBackground Color
* @uiDefault EditorPane.selectionForeground Color

View File

@@ -37,7 +37,7 @@ import javax.swing.plaf.ListUI;
public class FlatListCellBorder
extends FlatLineBorder
{
protected boolean showCellFocusIndicator = UIManager.getBoolean( "List.showCellFocusIndicator" );
/** @since 2 */ protected boolean showCellFocusIndicator = UIManager.getBoolean( "List.showCellFocusIndicator" );
private Component c;
@@ -113,7 +113,7 @@ public class FlatListCellBorder
/**
* Border for selected cell that uses margins and paints focus indicator border
* if enabled (List.showCellFocusIndicator=true) and exactly one item is selected.
* if enabled (List.showCellFocusIndicator=true) and multiple items are selected.
*/
public static class Selected
extends FlatListCellBorder
@@ -125,7 +125,7 @@ public class FlatListCellBorder
if( !showCellFocusIndicator )
return;
// paint focus indicator border only if exactly one item is selected
// paint focus indicator border only if multiple items are selected
JList<?> list = (JList<?>) SwingUtilities.getAncestorOfClass( JList.class, c );
if( list != null && list.getMinSelectionIndex() == list.getMaxSelectionIndex() )
return;

View File

@@ -78,9 +78,9 @@ public class FlatListUI
@Styleable protected Color selectionInactiveForeground;
// for FlatListCellBorder
@Styleable protected Insets cellMargins;
@Styleable protected Color cellFocusColor;
@Styleable protected boolean showCellFocusIndicator;
/** @since 2 */ @Styleable protected Insets cellMargins;
/** @since 2 */ @Styleable protected Color cellFocusColor;
/** @since 2 */ @Styleable protected Boolean showCellFocusIndicator;
private Map<String, Object> oldStyleValues;

View File

@@ -62,6 +62,8 @@ import com.formdev.flatlaf.util.SystemInfo;
* @uiDefault MenuItem.textNoAcceleratorGap int
* @uiDefault MenuItem.acceleratorArrowGap int
* @uiDefault MenuItem.checkBackground Color
* @uiDefault MenuItem.checkMargins Insets
* @uiDefault MenuItem.selectionType String null (default) or underline
* @uiDefault MenuItem.underlineSelectionBackground Color
* @uiDefault MenuItem.underlineSelectionCheckBackground Color
* @uiDefault MenuItem.underlineSelectionColor Color

View File

@@ -47,7 +47,7 @@ import com.formdev.flatlaf.util.UIScale;
* <!-- BasicScrollBarUI -->
*
* @uiDefault ScrollBar.background Color
* @uiDefault ScrollBar.foreground Color
* @uiDefault ScrollBar.foreground Color unused
* @uiDefault ScrollBar.track Color
* @uiDefault ScrollBar.thumb Color
* @uiDefault ScrollBar.width int

View File

@@ -37,7 +37,7 @@ import javax.swing.plaf.TableUI;
public class FlatTableCellBorder
extends FlatLineBorder
{
protected boolean showCellFocusIndicator = UIManager.getBoolean( "Table.showCellFocusIndicator" );
/** @since 2 */ protected boolean showCellFocusIndicator = UIManager.getBoolean( "Table.showCellFocusIndicator" );
private Component c;

View File

@@ -141,8 +141,8 @@ public class FlatTableHeaderBorder
protected boolean hideTrailingVerticalLine( JTableHeader header ) {
if( header.getUI() instanceof FlatTableHeaderUI ) {
FlatTableHeaderUI ui = (FlatTableHeaderUI) header.getUI();
if( ui.showTrailingVerticalLine )
return false;
if( ui.showTrailingVerticalLine != null )
return !ui.showTrailingVerticalLine;
}
if( showTrailingVerticalLine )

View File

@@ -84,14 +84,14 @@ public class FlatTableHeaderUI
@Styleable(type=String.class) protected int sortIconPosition;
// for FlatTableHeaderBorder
@Styleable protected Insets cellMargins;
@Styleable protected Color separatorColor;
/** @since 2 */ @Styleable protected boolean showTrailingVerticalLine;
/** @since 2 */ @Styleable protected Insets cellMargins;
/** @since 2 */ @Styleable protected Color separatorColor;
/** @since 2 */ @Styleable protected Boolean showTrailingVerticalLine;
// for FlatAscendingSortIcon and FlatDescendingSortIcon
// (needs to be public because icon classes are in another package)
@Styleable public String arrowType;
@Styleable public Color sortIconColor;
/** @since 2 */ @Styleable public String arrowType;
/** @since 2 */ @Styleable public Color sortIconColor;
private PropertyChangeListener propertyChangeListener;
private Map<String, Object> oldStyleValues;

View File

@@ -108,9 +108,9 @@ public class FlatTableUI
@Styleable protected Color selectionInactiveForeground;
// for FlatTableCellBorder
@Styleable protected Insets cellMargins;
@Styleable protected Color cellFocusColor;
@Styleable protected boolean showCellFocusIndicator;
/** @since 2 */ @Styleable protected Insets cellMargins;
/** @since 2 */ @Styleable protected Color cellFocusColor;
/** @since 2 */ @Styleable protected Boolean showCellFocusIndicator;
private boolean oldShowHorizontalLines;
private boolean oldShowVerticalLines;

View File

@@ -52,6 +52,7 @@ import com.formdev.flatlaf.util.UIScale;
*
* @uiDefault Tree.font Font
* @uiDefault Tree.background Color
* @uiDefault Tree.foreground Color unused
* @uiDefault Tree.hash Color
* @uiDefault Tree.dropLineColor Color
* @uiDefault Tree.expandedIcon Icon
@@ -136,12 +137,12 @@ public class FlatTreeUI
// for icons
// (needs to be public because icon classes are in another package)
@Styleable(dot=true) public String iconArrowType;
@Styleable(dot=true) public Color iconExpandedColor;
@Styleable(dot=true) public Color iconCollapsedColor;
@Styleable(dot=true) public Color iconLeafColor;
@Styleable(dot=true) public Color iconClosedColor;
@Styleable(dot=true) public Color iconOpenColor;
/** @since 2 */ @Styleable(dot=true) public String iconArrowType;
/** @since 2 */ @Styleable(dot=true) public Color iconExpandedColor;
/** @since 2 */ @Styleable(dot=true) public Color iconCollapsedColor;
/** @since 2 */ @Styleable(dot=true) public Color iconLeafColor;
/** @since 2 */ @Styleable(dot=true) public Color iconClosedColor;
/** @since 2 */ @Styleable(dot=true) public Color iconOpenColor;
// only used via styling (not in UI defaults, but has likewise client properties)
/** @since 2 */ @Styleable protected boolean paintSelection = true;

View File

@@ -257,7 +257,7 @@ public class TestFlatStyleableInfo
// FlatListCellBorder
"cellMargins", Insets.class,
"cellFocusColor", Color.class,
"showCellFocusIndicator", boolean.class
"showCellFocusIndicator", Boolean.class
);
assertMapEquals( expected, ui.getStyleableInfos( c ) );
@@ -760,7 +760,7 @@ public class TestFlatStyleableInfo
// FlatTableCellBorder
"cellMargins", Insets.class,
"cellFocusColor", Color.class,
"showCellFocusIndicator", boolean.class
"showCellFocusIndicator", Boolean.class
);
assertMapEquals( expected, ui.getStyleableInfos( c ) );
@@ -779,7 +779,7 @@ public class TestFlatStyleableInfo
// FlatTableHeaderBorder
"cellMargins", Insets.class,
"separatorColor", Color.class,
"showTrailingVerticalLine", boolean.class,
"showTrailingVerticalLine", Boolean.class,
// FlatAscendingSortIcon and FlatDescendingSortIcon
"arrowType", String.class,

View File

@@ -261,6 +261,7 @@ public class TestFlatStyling
// AbstractButton properties
ui.applyStyle( b, "margin: 2,2,2,2" );
ui.applyStyle( b, "iconTextGap: 4" );
}
@Test
@@ -312,6 +313,9 @@ public class TestFlatStyling
ui.applyStyle( "foreground: #fff" );
ui.applyStyle( "border: 2,2,2,2,#f00" );
ui.applyStyle( "font: italic 12 monospaced" );
// JComboBox properties
ui.applyStyle( "maximumRowCount: 20" );
}
@Test
@@ -335,6 +339,7 @@ public class TestFlatStyling
ui.applyStyle( "selectionColor: #fff" );
ui.applyStyle( "selectedTextColor: #fff" );
ui.applyStyle( "disabledTextColor: #fff" );
ui.applyStyle( "margin: 2,2,2,2" );
}
@Test
@@ -492,6 +497,7 @@ public class TestFlatStyling
// AbstractButton properties
applyStyle.accept( "margin: 2,2,2,2" );
applyStyle.accept( "iconTextGap: 4" );
}
private void menuItemRenderer( Consumer<String> applyStyle ) {
@@ -620,6 +626,7 @@ public class TestFlatStyling
// AbstractButton properties
ui.applyStyle( b, "margin: 2,2,2,2" );
ui.applyStyle( b, "iconTextGap: 4" );
//---- icon ----
@@ -716,6 +723,7 @@ public class TestFlatStyling
ui.applyStyle( "background: #fff" );
ui.applyStyle( "foreground: #fff" );
ui.applyStyle( "border: 2,2,2,2,#f00" );
ui.applyStyle( "viewportBorder: 2,2,2,2,#f00" );
}
@Test
@@ -933,7 +941,6 @@ public class TestFlatStyling
// JComponent properties
ui.applyStyle( "background: #fff" );
ui.applyStyle( "foreground: #fff" );
ui.applyStyle( "border: 2,2,2,2,#f00" );
ui.applyStyle( "font: italic 12 monospaced" );
// JTable properties
@@ -965,7 +972,6 @@ public class TestFlatStyling
// JComponent properties
ui.applyStyle( "background: #fff" );
ui.applyStyle( "foreground: #fff" );
ui.applyStyle( "border: 2,2,2,2,#f00" );
ui.applyStyle( "font: italic 12 monospaced" );
}
@@ -990,6 +996,7 @@ public class TestFlatStyling
ui.applyStyle( "selectionColor: #fff" );
ui.applyStyle( "selectedTextColor: #fff" );
ui.applyStyle( "disabledTextColor: #fff" );
ui.applyStyle( "margin: 2,2,2,2" );
}
@Test
@@ -1024,6 +1031,7 @@ public class TestFlatStyling
ui.applyStyle( "selectionColor: #fff" );
ui.applyStyle( "selectedTextColor: #fff" );
ui.applyStyle( "disabledTextColor: #fff" );
ui.applyStyle( "margin: 2,2,2,2" );
}
@Test
@@ -1047,6 +1055,7 @@ public class TestFlatStyling
ui.applyStyle( "selectionColor: #fff" );
ui.applyStyle( "selectedTextColor: #fff" );
ui.applyStyle( "disabledTextColor: #fff" );
ui.applyStyle( "margin: 2,2,2,2" );
}
@Test