Example #1
0
 public void refresh(boolean refreshModel) {
   if (model == null) {
     colWidth = null;
     cellShift = 0;
     hotPointX = 0;
     hotPointY = 0;
     environment.onAreaNewContent(this);
     environment.onAreaNewHotPoint(this);
     return;
   }
   if (refreshModel) model.refresh();
   final int colCount = model.getColCount();
   final int rowCount = model.getRowCount();
   if (colCount <= 0 || rowCount <= 0) {
     colWidth = null;
     cellShift = 0;
     hotPointX = 0;
     hotPointY = 0;
     environment.onAreaNewContent(this);
     environment.onAreaNewHotPoint(this);
     return;
   }
   initialHotPointX = appearance.getInitialHotPointX(model);
   colWidth = new int[colCount];
   int totalWidth = initialHotPointX;
   for (int i = 0; i < colCount; ++i) {
     final int width = appearance.getColWidth(model, i);
     colWidth[i] = width >= 1 ? width : 1;
     totalWidth += (colWidth[i] + 1);
   }
   if (hotPointY > rowCount) hotPointY = rowCount;
   if (hotPointY < rowCount && hotPointX >= totalWidth)
     hotPointX =
         totalWidth - 1; // totalWidth may not be zero as always we have at least one column here;
   if (hotPointY == rowCount) hotPointX = 0;
   environment.onAreaNewContent(this);
   environment.onAreaNewHotPoint(this);
 }