public void setRules(@Nullable List<? extends ArrangementGroupingRule> rules) {
    for (ArrangementGroupingComponent component : myComponents.values()) {
      component.setSelected(false);
    }

    if (rules == null) {
      return;
    }

    DefaultTableModel model = getModel();
    while (model.getRowCount() > 0) {
      model.removeRow(model.getRowCount() - 1);
    }

    final Set<ArrangementSettingsToken> groupingTokens =
      new HashSet<>(myComponents.keySet());
    for (ArrangementGroupingRule rule : rules) {
      final ArrangementSettingsToken groupingType = rule.getGroupingType();
      ArrangementGroupingComponent component = myComponents.get(groupingType);
      component.setSelected(true);
      component.setOrderType(rule.getOrderType());
      model.addRow(new Object[]{component});
      groupingTokens.remove(groupingType);
    }

    List<ArrangementSettingsToken> types =
      new ArrayList<>(groupingTokens);
    types = mySettingsManager.sort(types);
    for (ArrangementSettingsToken type : types) {
      model.addRow(new Object[]{myComponents.get(type)});
    }
  }
public void setRules(@Nullable List<? extends ArrangementGroupingRule> rules)