Browse Source

Demo: Make content pane wrapping opt-in

For now we should only delegate the creation of the content pane to the BaseComponentDemo for demos which explicitly support the Spec declarations.
modulesv2
weisj 3 years ago
parent
commit
a9baba753b
No known key found for this signature in database
GPG Key ID: 31124CB75461DA2A
  1. 5
      core/src/test/java/com/github/weisj/darklaf/ui/button/AbstractButtonDemo.java
  2. 6
      core/src/test/java/com/github/weisj/darklaf/ui/demo/BaseComponentDemo.java

5
core/src/test/java/com/github/weisj/darklaf/ui/button/AbstractButtonDemo.java

@ -82,6 +82,11 @@ public abstract class AbstractButtonDemo<T extends AbstractButton> extends BaseC
enumSpecWithNone(DarkButtonUI.KEY_CORNER, AlignmentExt.class);
}
@Override
protected boolean supportsSpec() {
return true;
}
protected void initBaseControls() {}
protected abstract T createButton();

6
core/src/test/java/com/github/weisj/darklaf/ui/demo/BaseComponentDemo.java

@ -43,7 +43,7 @@ public abstract class BaseComponentDemo implements ComponentDemo, DemoExecutionS
@Override
public JComponent getContentPane() {
JComponent component = getComponent();
if (component instanceof DemoPanel) return component;
if (!supportsSpec()) return component;
init();
DemoPanel demoPanel = new DemoPanel(component);
@ -156,6 +156,10 @@ public abstract class BaseComponentDemo implements ComponentDemo, DemoExecutionS
addSpec(new SpacerSpec());
}
protected boolean supportsSpec() {
return false;
}
@Override
public List<DemoSpec<?>> getSpecs() {
return demoSpecList.stream()

Loading…
Cancel
Save