BasicDomElementComponent (final CommittablePanel committablePanel, final CaptionComponent captionComponent, final @Nullable DomElement element) { final JPanel panel = new JPanel(new BorderLayout()); panel.add(captionComponent, BorderLayout.NORTH); panel.add(element != null && element.isValid() ? committablePanel.getComponent() : new JPanel(), BorderLayout.CENTER); BasicDomElementComponent component = new BasicDomElementComponent(element) { @Override public JComponent getComponent() { return panel; } }; component.addComponent(committablePanel); component.addComponent(captionComponent); return component; }