Skip to content

Commit 190222d

Browse files
committed
InputPanel: move default method impls to iface
1 parent 403e422 commit 190222d

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

src/main/java/org/scijava/widget/AbstractInputPanel.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,6 @@ public abstract class AbstractInputPanel<P, W> implements InputPanel<P, W> {
4949

5050
// -- InputPanel methods --
5151

52-
@Override
53-
public boolean supports(final InputWidget<?, ?> widget) {
54-
// verify this panel's widget type matches that of the given widget
55-
final Class<?> thisType = getWidgetComponentType();
56-
final Class<?> thatType = widget.getComponentType();
57-
return thisType.isAssignableFrom(thatType);
58-
}
59-
6052
@Override
6153
public void addWidget(final InputWidget<?, W> widget) {
6254
widgets.put(widget.get().getItem().getName(), widget);

src/main/java/org/scijava/widget/InputPanel.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,12 @@ public interface InputPanel<P, W> extends UIComponent<P> {
4444
// TODO - groups of fields
4545

4646
/** Gets whether the given widget would be appropriate for the given panel. */
47-
boolean supports(InputWidget<?, ?> widget);
47+
default boolean supports(final InputWidget<?, ?> widget) {
48+
// verify this panel's widget type matches that of the given widget
49+
final Class<?> thisType = getWidgetComponentType();
50+
final Class<?> thatType = widget.getComponentType();
51+
return thisType.isAssignableFrom(thatType);
52+
}
4853

4954
/** Adds a widget to the panel. */
5055
void addWidget(InputWidget<?, W> widget);

0 commit comments

Comments
 (0)