public class FxMultiComponentLine implements MultiComponentLine {
  private final MigPane fieldPanel = new MigPane(LayoutUtils.withoutInsets().gridGap("2", "0"));

  @Override
  public ITextView addFieldsView(String labelText) {
    FxTextView view = FxTextView.SingleLine(labelText);
    fieldPanel.add(view.getNode());
    return view;
  }

  @Override
  public IntegerView addIntegerView(String labelText, IntegerModel description) {
    IntegerSpinner spinner = new IntegerSpinner();
    spinner.setValue(description.getValue());
    addLabeledComponent(labelText, spinner.getNode());
    return spinner;
  }

  private void addLabeledComponent(String text, final Node component) {
    Label label = new Label(text);
    fieldPanel.add(label);
    fieldPanel.add(component);
  }

  public Node getNode() {
    return fieldPanel;
  }
}
public class FxEquipmentDetails implements EquipmentDetails {

  private final FxToolListView<IEquipmentStats> listView = new FxToolListView<>();
  private final FxEquipmentDescriptionPanel descriptionPanel;
  private MigPane outerPane =
      new MigPane(LayoutUtils.fillWithoutInsets().wrapAfter(1), new AC().grow().fill());
  private final DialogFactory dialogFactory;

  public FxEquipmentDetails(SelectionViewFactory selectionFactory, DialogFactory dialogFactory) {
    this.dialogFactory = dialogFactory;
    this.descriptionPanel = new FxEquipmentDescriptionPanel(selectionFactory);
  }

  public Node getNode() {
    return outerPane;
  }

  @Override
  public ToolListView<IEquipmentStats> initStatsListView(
      final String title, AgnosticUIConfiguration<IEquipmentStats> configuration) {
    listView.setUiConfiguration(configuration);
    Node node = listView.getNode();
    Node titledPane = StyledTitledPane.Create(title, node);
    outerPane.add(titledPane, new CC().push().grow());
    return listView;
  }

  @Override
  public EquipmentDescriptionPanel addDescriptionPanel(final String title) {
    Node titledPane = StyledTitledPane.Create(title, descriptionPanel.getNode());
    outerPane.add(titledPane, new CC().grow().push());
    return descriptionPanel;
  }

  @Override
  public EquipmentStatsDialog createEquipmentStatsDialog() {
    return new FxEditStatsDialog(dialogFactory);
  }
}