private void mapTowardsModel() {
   if (viewSizes == null) return;
   modelSizes = new SizeSequence(getInputSize(), defaultHeight);
   int[] selected = viewSizes.getSizes();
   for (int i = 0; i < selected.length; i++) {
     int modelIndex = convertToModel(i);
     modelSizes.setSize(modelIndex, selected[i]);
   }
 }
  public void restoreSelection() {
    if (viewSizes == null) return;
    int[] sizes = new int[getOutputSize()];
    Arrays.fill(sizes, defaultHeight);
    viewSizes.setSizes(sizes);
    //        viewSizes.setSizes(new int[0]);
    //        viewSizes.insertEntries(0, getOutputSize(), defaultHeight);

    int[] selected = modelSizes.getSizes();
    for (int i = 0; i < selected.length; i++) {
      int index = convertToView(i);
      // index might be -1, ignore.
      if (index >= 0) {
        viewSizes.setSize(index, selected[i]);
      }
    }
  }
 public void removeIndexInterval(int start, int length) {
   if (modelSizes == null) return;
   modelSizes.removeEntries(start, length);
 }
 public void insertIndexInterval(int start, int length, int value) {
   if (modelSizes == null) return;
   modelSizes.insertEntries(start, length, value);
 }