Program: 145402
Project: 145402
Buggy source:
public Grid(ProvidesKey<T> aKeyProvider){
  super();
  getElement().getStyle().setPosition(Style.Position.RELATIVE);
  getElement().appendChild(tdsStyleElement);
  getElement().appendChild(cellsStyleElement);
  getElement().appendChild(oddRowsStyleElement);
  getElement().appendChild(evenRowsStyleElement);
  setRowsHeight(25);
  hive=new FlexTable();
  setWidget(hive);
  hive.setCellPadding(0);
  hive.setCellSpacing(0);
  hive.setBorderWidth(0);
  headerLeft=new GridSection<T>(aKeyProvider);
  headerLeftContainer=new ScrollPanel(headerLeft);
  headerRight=new GridSection<T>(aKeyProvider);
  headerRightContainer=new ScrollPanel(headerRight);
  frozenLeft=new GridSection<T>(aKeyProvider){
    @Override protected void replaceAllChildren(    List<T> values,    SafeHtml html){
      super.replaceAllChildren(values,html);
      footerLeft.redrawFooters();
    }
    @Override protected void replaceChildren(    List<T> values,    int start,    SafeHtml html){
      super.replaceChildren(values,start,html);
      footerLeft.redrawFooters();
    }
  }
;
  frozenLeftContainer=new ScrollPanel(frozenLeft);
  frozenRight=new GridSection<T>(aKeyProvider){
    @Override protected void replaceAllChildren(    List<T> values,    SafeHtml html){
      super.replaceAllChildren(values,html);
      footerRight.redrawFooters();
    }
    @Override protected void replaceChildren(    List<T> values,    int start,    SafeHtml html){
      super.replaceChildren(values,start,html);
      footerRight.redrawFooters();
    }
  }
;
  frozenRightContainer=new ScrollPanel(frozenRight);
  scrollableLeft=new GridSection<T>(aKeyProvider){
    @Override protected void replaceAllChildren(    List<T> values,    SafeHtml html){
      super.replaceAllChildren(values,html);
      footerLeft.redrawFooters();
    }
    @Override protected void replaceChildren(    List<T> values,    int start,    SafeHtml html){
      super.replaceChildren(values,start,html);
      footerLeft.redrawFooters();
    }
  }
;
  scrollableLeftContainer=new ScrollPanel(scrollableLeft);
  scrollableRight=new GridSection<T>(aKeyProvider){
    @Override protected void replaceAllChildren(    List<T> values,    SafeHtml html){
      super.replaceAllChildren(values,html);
      footerRight.redrawFooters();
    }
    @Override protected void replaceChildren(    List<T> values,    int start,    SafeHtml html){
      super.replaceChildren(values,start,html);
      footerRight.redrawFooters();
    }
  }
;
  scrollableRightContainer=new ScrollPanel(scrollableRight);
  footerLeft=new GridSection<>(aKeyProvider);
  footerLeftContainer=new ScrollPanel(footerLeft);
  footerRight=new GridSection<>(aKeyProvider);
  footerRightContainer=new ScrollPanel(footerRight);
  for (  Widget w : new Widget[]{headerLeftContainer,headerRightContainer,frozenLeftContainer,frozenRightContainer,scrollableLeftContainer,footerLeftContainer,footerRightContainer}) {
    w.getElement().getStyle().setOverflow(Style.Overflow.HIDDEN);
  }
  for (  Widget w : new Widget[]{headerLeftContainer,headerRightContainer,frozenLeftContainer,frozenRightContainer,scrollableLeftContainer,scrollableRightContainer,footerLeftContainer,footerRightContainer}) {
    w.getElement().getFirstChildElement().getStyle().setPosition(Style.Position.ABSOLUTE);
  }
  headerLeft.setWidthPropagator(new GridWidthPropagator<T>(headerLeft){
    @Override public void changed(){
      super.changed();
      propagateHeaderWidth();
    }
  }
);
  for (  GridSection<T> section : (GridSection<T>[])new GridSection<?>[]{headerRight,frozenLeft,frozenRight,scrollableLeft,scrollableRight,footerLeft,footerRight}) {
    section.setWidthPropagator(new GridWidthPropagator<>(section));
  }
  headerLeft.setColumnsPartners(new AbstractCellTable[]{frozenLeft,scrollableLeft,footerLeft});
  headerRight.setColumnsPartners(new AbstractCellTable[]{frozenRight,scrollableRight,footerRight});
  ColumnsRemover leftColumnsRemover=new ColumnsRemoverAdapter<T>(headerLeft,frozenLeft,scrollableLeft,footerLeft);
  ColumnsRemover rightColumnsRemover=new ColumnsRemoverAdapter<T>(headerRight,frozenRight,scrollableRight,footerRight);
  for (  GridSection<T> section : (GridSection<T>[])new GridSection<?>[]{headerLeft,frozenLeft,scrollableLeft,footerLeft}) {
    section.setColumnsRemover(leftColumnsRemover);
  }
  for (  GridSection<T> section : (GridSection<T>[])new GridSection<?>[]{headerRight,frozenRight,scrollableRight,footerRight}) {
    section.setColumnsRemover(rightColumnsRemover);
  }
  for (  GridSection<T> section : (GridSection<T>[])new GridSection<?>[]{frozenLeft,scrollableLeft,footerLeft}) {
    section.setHeaderSource(headerLeft);
  }
  for (  GridSection<T> section : (GridSection<T>[])new GridSection<?>[]{frozenRight,scrollableRight,footerRight}) {
    section.setHeaderSource(headerRight);
  }
  for (  GridSection<T> section : (GridSection<T>[])new GridSection<?>[]{headerLeft,frozenLeft,scrollableLeft}) {
    section.setFooterSource(footerLeft);
  }
  for (  GridSection<T> section : (GridSection<T>[])new GridSection<?>[]{headerRight,frozenRight,scrollableRight}) {
    section.setFooterSource(footerRight);
  }
  hive.setWidget(0,0,headerLeftContainer);
  hive.setWidget(0,1,headerRightContainer);
  hive.setWidget(1,0,frozenLeftContainer);
  hive.setWidget(1,1,frozenRightContainer);
  hive.setWidget(2,0,scrollableLeftContainer);
  hive.setWidget(2,1,scrollableRightContainer);
  hive.setWidget(3,0,footerLeftContainer);
  hive.setWidget(3,1,footerRightContainer);
  for (  Widget w : new Widget[]{headerLeftContainer,headerRightContainer,frozenLeftContainer,frozenRightContainer,scrollableLeftContainer,scrollableRightContainer,footerLeftContainer,footerRightContainer}) {
    w.setWidth("String_Node_Str");
    w.setHeight("String_Node_Str");
  }
  for (  Widget w : new Widget[]{headerRightContainer,frozenRightContainer,footerRightContainer,scrollableLeftContainer}) {
    w.getElement().getParentElement().getStyle().setOverflow(Style.Overflow.HIDDEN);
  }
  hive.getElement().getStyle().setTableLayout(Style.TableLayout.FIXED);
  hive.getElement().getStyle().setPosition(Style.Position.RELATIVE);
  for (  CellTable<?> tbl : new CellTable<?>[]{headerLeft,headerRight,frozenLeft,frozenRight,scrollableLeft,scrollableRight,footerLeft,footerRight}) {
    tbl.setTableLayoutFixed(true);
  }
  headerLeft.setHeaderBuilder(new ThemedHeaderOrFooterBuilder<T>(headerLeft,false,this));
  headerLeft.setFooterBuilder(new NullHeaderOrFooterBuilder<T>(headerLeft,true));
  headerRight.setHeaderBuilder(new ThemedHeaderOrFooterBuilder<T>(headerRight,false,this));
  headerRight.setFooterBuilder(new NullHeaderOrFooterBuilder<T>(headerRight,true));
  footerLeft.setHeaderBuilder(new NullHeaderOrFooterBuilder<T>(footerLeft,false));
  footerLeft.setFooterBuilder(new ThemedHeaderOrFooterBuilder<T>(footerLeft,true));
  footerRight.setHeaderBuilder(new NullHeaderOrFooterBuilder<T>(footerRight,false));
  footerRight.setFooterBuilder(new ThemedHeaderOrFooterBuilder<T>(footerRight,true));
  for (  GridSection<?> section : new GridSection<?>[]{frozenLeft,frozenRight,scrollableLeft,scrollableRight}) {
    GridSection<T> gSection=(GridSection<T>)section;
    gSection.setHeaderBuilder(new NullHeaderOrFooterBuilder<T>(gSection,false));
    gSection.setFooterBuilder(new NullHeaderOrFooterBuilder<T>(gSection,true));
  }
  for (  GridSection<?> section : new GridSection<?>[]{headerLeft,headerRight,frozenLeft,frozenRight,scrollableLeft,scrollableRight,footerLeft,footerRight}) {
    section.setAutoHeaderRefreshDisabled(true);
  }
  for (  GridSection<?> section : new GridSection<?>[]{headerLeft,headerRight,footerLeft,footerRight}) {
    section.setAutoFooterRefreshDisabled(true);
  }
  installCellBuilders();
  scrollableRightContainer.addScrollHandler(new ScrollHandler(){
    @Override public void onScroll(    ScrollEvent event){
      int aimTop=scrollableRightContainer.getElement().getScrollTop();
      int aimLeft=scrollableRightContainer.getElement().getScrollLeft();
      scrollableLeftContainer.getElement().setScrollTop(aimTop);
      int factTopDelta=aimTop - scrollableLeftContainer.getElement().getScrollTop();
      if (factTopDelta > 0) {
        scrollableLeftContainer.getElement().getStyle().setBottom(factTopDelta,Style.Unit.PX);
      }
 else {
        scrollableLeftContainer.getElement().getStyle().clearBottom();
      }
      headerRightContainer.getElement().setScrollLeft(aimLeft);
      int factLeftDelta0=aimLeft - headerRightContainer.getElement().getScrollLeft();
      if (factLeftDelta0 > 0) {
        headerRightContainer.getElement().getStyle().setRight(factLeftDelta0,Style.Unit.PX);
      }
 else {
        headerRightContainer.getElement().getStyle().clearRight();
      }
      frozenRightContainer.getElement().setScrollLeft(aimLeft);
      int factLeftDelta1=aimLeft - frozenRightContainer.getElement().getScrollLeft();
      if (factLeftDelta1 > 0) {
        frozenRightContainer.getElement().getStyle().setRight(factLeftDelta1,Style.Unit.PX);
      }
 else {
        frozenRightContainer.getElement().getStyle().clearRight();
      }
      footerRightContainer.getElement().setScrollLeft(scrollableRightContainer.getElement().getScrollLeft());
      int factLeftDelta2=aimLeft - footerRightContainer.getElement().getScrollLeft();
      if (factLeftDelta2 > 0) {
        footerRightContainer.getElement().getStyle().setRight(factLeftDelta2,Style.Unit.PX);
      }
 else {
        footerRightContainer.getElement().getStyle().clearRight();
      }
    }
  }
);
  ghostLine=Document.get().createDivElement();
  ghostLine.addClassName(RULER_STYLE);
  ghostLine.getStyle().setPosition(Style.Position.ABSOLUTE);
  ghostLine.getStyle().setTop(0,Style.Unit.PX);
  ghostColumn=Document.get().createDivElement();
  ghostColumn.addClassName(COLUMN_PHANTOM_STYLE);
  ghostColumn.getStyle().setPosition(Style.Position.ABSOLUTE);
  ghostColumn.getStyle().setTop(0,Style.Unit.PX);
  addDomHandler(new DragEnterHandler(){
    @Override public void onDragEnter(    DragEnterEvent event){
      if (DraggedColumn.instance != null) {
        if (DraggedColumn.instance.isMove()) {
          event.preventDefault();
          event.stopPropagation();
          DraggedColumn<T> target=findTargetDraggedColumn(event.getNativeEvent().getEventTarget());
          if (target != null) {
            showColumnMoveDecorations(target);
            event.getDataTransfer().<XDataTransfer>cast().setDropEffect("String_Node_Str");
          }
 else {
            event.getDataTransfer().<XDataTransfer>cast().setDropEffect("String_Node_Str");
          }
        }
 else {
        }
      }
 else {
        event.getDataTransfer().<XDataTransfer>cast().setDropEffect("String_Node_Str");
      }
    }
  }
,DragEnterEvent.getType());
  addDomHandler(new DragHandler(){
    @Override public void onDrag(    DragEvent event){
      if (DraggedColumn.instance != null && DraggedColumn.instance.isResize()) {
        event.stopPropagation();
        Element hostElement=Grid.this.getElement();
        int clientX=event.getNativeEvent().getClientX();
        int hostAbsX=hostElement.getAbsoluteLeft();
        int hostScrollX=hostElement.getScrollLeft();
        int docScrollX=hostElement.getOwnerDocument().getScrollLeft();
        int relativeX=clientX - hostAbsX + hostScrollX + docScrollX;
        ghostLine.getStyle().setLeft(relativeX,Style.Unit.PX);
        ghostLine.getStyle().setHeight(hostElement.getClientHeight(),Style.Unit.PX);
        if (ghostLine.getParentElement() != hostElement) {
          hostElement.appendChild(ghostLine);
        }
        int newWidth=event.getNativeEvent().getClientX() - DraggedColumn.instance.getCellElement().getAbsoluteLeft();
        if (newWidth > MINIMUM_COLUMN_WIDTH) {
          event.getDataTransfer().<XDataTransfer>cast().setDropEffect("String_Node_Str");
        }
 else {
          event.getDataTransfer().<XDataTransfer>cast().setDropEffect("String_Node_Str");
        }
      }
    }
  }
,DragEvent.getType());
  addDomHandler(new DragOverHandler(){
    @Override public void onDragOver(    DragOverEvent event){
      if (DraggedColumn.instance != null) {
        event.preventDefault();
        event.stopPropagation();
        if (DraggedColumn.instance.isMove()) {
          DraggedColumn<T> target=findTargetDraggedColumn(event.getNativeEvent().getEventTarget());
          if (target != null) {
            event.getDataTransfer().<XDataTransfer>cast().setDropEffect("String_Node_Str");
          }
 else {
            hideColumnDecorations();
            event.getDataTransfer().<XDataTransfer>cast().setDropEffect("String_Node_Str");
          }
        }
 else {
        }
      }
    }
  }
,DragOverEvent.getType());
  addDomHandler(new DragLeaveHandler(){
    @Override public void onDragLeave(    DragLeaveEvent event){
      if (DraggedColumn.instance != null) {
        event.stopPropagation();
        if (DraggedColumn.instance.isMove()) {
          if (event.getNativeEvent().getEventTarget() == (JavaScriptObject)Grid.this.getElement()) {
            hideColumnDecorations();
          }
        }
      }
    }
  }
,DragLeaveEvent.getType());
  addDomHandler(new DragEndHandler(){
    @Override public void onDragEnd(    DragEndEvent event){
      event.stopPropagation();
      hideColumnDecorations();
      DraggedColumn.instance=null;
    }
  }
,DragEndEvent.getType());
  addDomHandler(new DropHandler(){
    @Override public void onDrop(    DropEvent event){
      DraggedColumn<?> source=DraggedColumn.instance;
      DraggedColumn<T> target=targetDraggedColumn;
      hideColumnDecorations();
      DraggedColumn.instance=null;
      if (source != null) {
        event.preventDefault();
        event.stopPropagation();
        if (source.isMove()) {
          AbstractCellTable<T> sourceSection=(AbstractCellTable<T>)source.getTable();
          if (target != null) {
            Header<?> sourceHeader=source.getHeader();
            Header<?> targetHeader=target.getHeader();
            if (sourceHeader instanceof DraggableHeader<?> && targetHeader instanceof DraggableHeader<?>) {
              DraggableHeader<T> sourceDH=(DraggableHeader<T>)sourceHeader;
              DraggableHeader<T> targetDH=(DraggableHeader<T>)targetHeader;
              moveColumnNode(sourceDH.getHeaderNode(),targetDH.getHeaderNode());
            }
 else {
              int sourceIndex=source.getColumnIndex();
              int targetIndex=target.getColumnIndex();
              GridSection<T> targetSection=(GridSection<T>)target.getTable();
              boolean isSourceLeft=sourceSection == headerLeft || sourceSection == frozenLeft || sourceSection == scrollableLeft || sourceSection == footerLeft;
              boolean isTargetLeft=targetSection == headerLeft || targetSection == frozenLeft || targetSection == scrollableLeft || targetSection == footerLeft;
              sourceSection=isSourceLeft ? headerLeft : headerRight;
              targetSection=isTargetLeft ? headerLeft : headerRight;
              int generalSourceIndex=isSourceLeft ? sourceIndex : sourceIndex + frozenColumns;
              int generalTargetIndex=isTargetLeft ? targetIndex : targetIndex + frozenColumns;
              Header<?> header=sourceSection.getHeader(sourceIndex);
              if (header instanceof DraggableHeader) {
                ((DraggableHeader)header).setTable(targetSection);
              }
              if (generalSourceIndex != generalTargetIndex) {
                Column<T,?> column=(Column<T,?>)source.getColumn();
                if (!(header instanceof DraggableHeader) || ((DraggableHeader)header).isMoveable()) {
                  moveColumn(generalSourceIndex,generalTargetIndex);
                }
              }
            }
          }
        }
 else {
          Header<?> header=source.getHeader();
          if (!(header instanceof DraggableHeader) || ((DraggableHeader)header).isResizable()) {
            int newWidth=Math.max(event.getNativeEvent().getClientX() - source.getCellElement().getAbsoluteLeft(),MINIMUM_COLUMN_WIDTH);
            setColumnWidthFromHeaderDrag(((DraggedColumn<T>)source).getColumn(),newWidth,Style.Unit.PX);
          }
        }
      }
    }
  }
,DropEvent.getType());
  columnsChevron.getElement().getStyle().setPosition(Style.Position.ABSOLUTE);
  columnsChevron.getElement().addClassName(COLUMNS_CHEVRON_STYLE);
  getElement().appendChild(columnsChevron.getElement());
  columnsChevron.addDomHandler(new ClickHandler(){
    @Override public void onClick(    ClickEvent event){
      PopupPanel pp=new PopupPanel();
      pp.setAutoHideEnabled(true);
      pp.setAutoHideOnHistoryEventsEnabled(true);
      pp.setAnimationEnabled(true);
      MenuBar columnsMenu=new MenuBar(true);
      fillColumns(columnsMenu,headerLeft);
      fillColumns(columnsMenu,headerRight);
      pp.setWidget(columnsMenu);
      pp.setPopupPosition(columnsChevron.getAbsoluteLeft(),columnsChevron.getAbsoluteTop());
      pp.showRelativeTo(columnsChevron);
    }
    private void fillColumns(    MenuBar aTarget,    final GridSection<T> aSection){
      for (int i=0; i < aSection.getColumnCount(); i++) {
        Header<?> h=aSection.getHeader(i);
        final Column<T,?> column=aSection.getColumn(i);
        SafeHtml rendered;
        if (h.getValue() instanceof String) {
          String hVal=(String)h.getValue();
          rendered=hVal.startsWith("String_Node_Str") ? SafeHtmlUtils.fromTrustedString(hVal.substring(6)) : SafeHtmlUtils.fromString(hVal);
        }
 else {
          Cell.Context context=new Cell.Context(0,i,h.getKey());
          SafeHtmlBuilder sb=new SafeHtmlBuilder();
          h.render(context,sb);
          rendered=sb.toSafeHtml();
        }
        MenuItemCheckBox miCheck=new MenuItemCheckBox(!aSection.isColumnHidden(column),rendered.asString(),true);
        miCheck.addValueChangeHandler(new ValueChangeHandler<Boolean>(){
          @Override public void onValueChange(          ValueChangeEvent<Boolean> event){
            if (Boolean.TRUE.equals(event.getValue())) {
              showColumn(column);
            }
 else {
              hideColumn(column);
            }
            Grid.this.onResize();
          }
        }
);
        aTarget.addItem(miCheck);
      }
    }
  }
,ClickEvent.getType());
  ColumnSortEvent.Handler sectionSortHandler=new ColumnSortEvent.Handler(){
    @Override public void onColumnSort(    ColumnSortEvent event){
      boolean isCtrlKey=((GridSection<?>)event.getSource()).isCtrlKey();
      boolean contains=false;
      int containsAt=-1;
      for (int i=0; i < sortList.size(); i++) {
        if (sortList.get(i).getColumn() == event.getColumn()) {
          contains=true;
          containsAt=i;
          break;
        }
      }
      if (!contains) {
        if (!isCtrlKey) {
          sortList.clear();
        }
        sortList.insert(sortList.size(),new ColumnSortList.ColumnSortInfo(event.getColumn(),true));
      }
 else {
        boolean wasAscending=sortList.get(containsAt).isAscending();
        if (!isCtrlKey) {
          sortList.clear();
          if (wasAscending) {
            sortList.push(new ColumnSortList.ColumnSortInfo(event.getColumn(),false));
          }
        }
 else {
          sortList.remove(sortList.get(containsAt));
          if (wasAscending) {
            sortList.insert(containsAt,new ColumnSortList.ColumnSortInfo(event.getColumn(),false));
          }
        }
      }
      ColumnSortEvent.fire(Grid.this,sortList);
    }
  }
;
  headerLeft.getColumnSortList().setLimit(1);
  headerLeft.addColumnSortHandler(sectionSortHandler);
  headerRight.getColumnSortList().setLimit(1);
  headerRight.addColumnSortHandler(sectionSortHandler);
  gridColor=PublishedColor.create(211,211,211,255);
  regenerateDynamicTDStyles();
  regenerateDynamicOddRowsStyles();
  getElement().<XElement>cast().addResizingTransitionEnd(this);
}

Fixed version (ground truth):
public Grid(ProvidesKey<T> aKeyProvider){
  super();
  getElement().getStyle().setPosition(Style.Position.RELATIVE);
  getElement().appendChild(tdsStyleElement);
  getElement().appendChild(cellsStyleElement);
  getElement().appendChild(oddRowsStyleElement);
  getElement().appendChild(evenRowsStyleElement);
  setRowsHeight(25);
  hive=new FlexTable();
  setWidget(hive);
  hive.setCellPadding(0);
  hive.setCellSpacing(0);
  hive.setBorderWidth(0);
  headerLeft=new GridSection<T>(aKeyProvider);
  headerLeftContainer=new ScrollPanel(headerLeft);
  headerRight=new GridSection<T>(aKeyProvider);
  headerRightContainer=new ScrollPanel(headerRight);
  frozenLeft=new GridSection<T>(aKeyProvider){
    @Override protected void replaceAllChildren(    List<T> values,    SafeHtml html){
      super.replaceAllChildren(values,html);
      footerLeft.redrawFooters();
    }
    @Override protected void replaceChildren(    List<T> values,    int start,    SafeHtml html){
      super.replaceChildren(values,start,html);
      footerLeft.redrawFooters();
    }
  }
;
  frozenLeftContainer=new ScrollPanel(frozenLeft);
  frozenRight=new GridSection<T>(aKeyProvider){
    @Override protected void replaceAllChildren(    List<T> values,    SafeHtml html){
      super.replaceAllChildren(values,html);
      footerRight.redrawFooters();
    }
    @Override protected void replaceChildren(    List<T> values,    int start,    SafeHtml html){
      super.replaceChildren(values,start,html);
      footerRight.redrawFooters();
    }
  }
;
  frozenRightContainer=new ScrollPanel(frozenRight);
  scrollableLeft=new GridSection<T>(aKeyProvider){
    @Override protected void replaceAllChildren(    List<T> values,    SafeHtml html){
      super.replaceAllChildren(values,html);
      footerLeft.redrawFooters();
    }
    @Override protected void replaceChildren(    List<T> values,    int start,    SafeHtml html){
      super.replaceChildren(values,start,html);
      footerLeft.redrawFooters();
    }
  }
;
  scrollableLeftContainer=new ScrollPanel(scrollableLeft);
  scrollableRight=new GridSection<T>(aKeyProvider){
    @Override protected void replaceAllChildren(    List<T> values,    SafeHtml html){
      super.replaceAllChildren(values,html);
      footerRight.redrawFooters();
    }
    @Override protected void replaceChildren(    List<T> values,    int start,    SafeHtml html){
      super.replaceChildren(values,start,html);
      footerRight.redrawFooters();
    }
  }
;
  scrollableRightContainer=new ScrollPanel(scrollableRight);
  footerLeft=new GridSection<>(aKeyProvider);
  footerLeftContainer=new ScrollPanel(footerLeft);
  footerRight=new GridSection<>(aKeyProvider);
  footerRightContainer=new ScrollPanel(footerRight);
  for (  Widget w : new Widget[]{headerLeftContainer,headerRightContainer,frozenLeftContainer,frozenRightContainer,scrollableLeftContainer,footerLeftContainer,footerRightContainer}) {
    w.getElement().getStyle().setOverflow(Style.Overflow.HIDDEN);
  }
  for (  Widget w : new Widget[]{headerLeftContainer,headerRightContainer,frozenLeftContainer,frozenRightContainer,scrollableLeftContainer,scrollableRightContainer,footerLeftContainer,footerRightContainer}) {
    w.getElement().getFirstChildElement().getStyle().setPosition(Style.Position.ABSOLUTE);
  }
  headerLeft.setWidthPropagator(new GridWidthPropagator<T>(headerLeft){
    @Override public void changed(){
      super.changed();
      propagateHeaderWidth();
    }
  }
);
  for (  GridSection<T> section : (GridSection<T>[])new GridSection<?>[]{headerRight,frozenLeft,frozenRight,scrollableLeft,scrollableRight,footerLeft,footerRight}) {
    section.setWidthPropagator(new GridWidthPropagator<>(section));
  }
  headerLeft.setColumnsPartners(new AbstractCellTable[]{frozenLeft,scrollableLeft,footerLeft});
  headerRight.setColumnsPartners(new AbstractCellTable[]{frozenRight,scrollableRight,footerRight});
  ColumnsRemover leftColumnsRemover=new ColumnsRemoverAdapter<T>(headerLeft,frozenLeft,scrollableLeft,footerLeft);
  ColumnsRemover rightColumnsRemover=new ColumnsRemoverAdapter<T>(headerRight,frozenRight,scrollableRight,footerRight);
  for (  GridSection<T> section : (GridSection<T>[])new GridSection<?>[]{headerLeft,frozenLeft,scrollableLeft,footerLeft}) {
    section.setColumnsRemover(leftColumnsRemover);
  }
  for (  GridSection<T> section : (GridSection<T>[])new GridSection<?>[]{headerRight,frozenRight,scrollableRight,footerRight}) {
    section.setColumnsRemover(rightColumnsRemover);
  }
  for (  GridSection<T> section : (GridSection<T>[])new GridSection<?>[]{frozenLeft,scrollableLeft,footerLeft}) {
    section.setHeaderSource(headerLeft);
  }
  for (  GridSection<T> section : (GridSection<T>[])new GridSection<?>[]{frozenRight,scrollableRight,footerRight}) {
    section.setHeaderSource(headerRight);
  }
  for (  GridSection<T> section : (GridSection<T>[])new GridSection<?>[]{headerLeft,frozenLeft,scrollableLeft}) {
    section.setFooterSource(footerLeft);
  }
  for (  GridSection<T> section : (GridSection<T>[])new GridSection<?>[]{headerRight,frozenRight,scrollableRight}) {
    section.setFooterSource(footerRight);
  }
  hive.setWidget(0,0,headerLeftContainer);
  hive.setWidget(0,1,headerRightContainer);
  hive.setWidget(1,0,frozenLeftContainer);
  hive.setWidget(1,1,frozenRightContainer);
  hive.setWidget(2,0,scrollableLeftContainer);
  hive.setWidget(2,1,scrollableRightContainer);
  hive.setWidget(3,0,footerLeftContainer);
  hive.setWidget(3,1,footerRightContainer);
  for (  Widget w : new Widget[]{headerLeftContainer,headerRightContainer,frozenLeftContainer,frozenRightContainer,scrollableLeftContainer,scrollableRightContainer,footerLeftContainer,footerRightContainer}) {
    w.setWidth("String_Node_Str");
    w.setHeight("String_Node_Str");
  }
  for (  Widget w : new Widget[]{headerRightContainer,frozenRightContainer,footerRightContainer,scrollableLeftContainer}) {
    w.getElement().getParentElement().getStyle().setOverflow(Style.Overflow.HIDDEN);
  }
  hive.getElement().getStyle().setTableLayout(Style.TableLayout.FIXED);
  hive.getElement().getStyle().setPosition(Style.Position.RELATIVE);
  for (  CellTable<?> tbl : new CellTable<?>[]{headerLeft,headerRight,frozenLeft,frozenRight,scrollableLeft,scrollableRight,footerLeft,footerRight}) {
    tbl.setTableLayoutFixed(true);
  }
  headerLeft.setHeaderBuilder(new ThemedHeaderOrFooterBuilder<T>(headerLeft,false,this));
  headerLeft.setFooterBuilder(new NullHeaderOrFooterBuilder<T>(headerLeft,true));
  headerRight.setHeaderBuilder(new ThemedHeaderOrFooterBuilder<T>(headerRight,false,this));
  headerRight.setFooterBuilder(new NullHeaderOrFooterBuilder<T>(headerRight,true));
  footerLeft.setHeaderBuilder(new NullHeaderOrFooterBuilder<T>(footerLeft,false));
  footerLeft.setFooterBuilder(new ThemedHeaderOrFooterBuilder<T>(footerLeft,true));
  footerRight.setHeaderBuilder(new NullHeaderOrFooterBuilder<T>(footerRight,false));
  footerRight.setFooterBuilder(new ThemedHeaderOrFooterBuilder<T>(footerRight,true));
  for (  GridSection<?> section : new GridSection<?>[]{frozenLeft,frozenRight,scrollableLeft,scrollableRight}) {
    GridSection<T> gSection=(GridSection<T>)section;
    gSection.setHeaderBuilder(new NullHeaderOrFooterBuilder<T>(gSection,false));
    gSection.setFooterBuilder(new NullHeaderOrFooterBuilder<T>(gSection,true));
  }
  for (  GridSection<?> section : new GridSection<?>[]{headerLeft,headerRight,frozenLeft,frozenRight,scrollableLeft,scrollableRight,footerLeft,footerRight}) {
    section.setAutoHeaderRefreshDisabled(true);
  }
  for (  GridSection<?> section : new GridSection<?>[]{headerLeft,headerRight,footerLeft,footerRight}) {
    section.setAutoFooterRefreshDisabled(true);
  }
  installCellBuilders();
  scrollableRightContainer.addScrollHandler(new ScrollHandler(){
    @Override public void onScroll(    ScrollEvent event){
      int aimTop=scrollableRightContainer.getElement().getScrollTop();
      int aimLeft=scrollableRightContainer.getElement().getScrollLeft();
      scrollableLeftContainer.getElement().setScrollTop(aimTop);
      int factTopDelta=aimTop - scrollableLeftContainer.getElement().getScrollTop();
      if (factTopDelta > 0) {
        scrollableLeftContainer.getElement().getStyle().setBottom(factTopDelta,Style.Unit.PX);
      }
 else {
        scrollableLeftContainer.getElement().getStyle().clearBottom();
      }
      headerRightContainer.getElement().setScrollLeft(aimLeft);
      int factLeftDelta0=aimLeft - headerRightContainer.getElement().getScrollLeft();
      if (factLeftDelta0 > 0) {
        headerRightContainer.getElement().getStyle().setRight(factLeftDelta0,Style.Unit.PX);
      }
 else {
        headerRightContainer.getElement().getStyle().clearRight();
      }
      frozenRightContainer.getElement().setScrollLeft(aimLeft);
      int factLeftDelta1=aimLeft - frozenRightContainer.getElement().getScrollLeft();
      if (factLeftDelta1 > 0) {
        frozenRightContainer.getElement().getStyle().setRight(factLeftDelta1,Style.Unit.PX);
      }
 else {
        frozenRightContainer.getElement().getStyle().clearRight();
      }
      footerRightContainer.getElement().setScrollLeft(scrollableRightContainer.getElement().getScrollLeft());
      int factLeftDelta2=aimLeft - footerRightContainer.getElement().getScrollLeft();
      if (factLeftDelta2 > 0) {
        footerRightContainer.getElement().getStyle().setRight(factLeftDelta2,Style.Unit.PX);
      }
 else {
        footerRightContainer.getElement().getStyle().clearRight();
      }
    }
  }
);
  ghostLine=Document.get().createDivElement();
  ghostLine.addClassName(RULER_STYLE);
  ghostLine.getStyle().setPosition(Style.Position.ABSOLUTE);
  ghostLine.getStyle().setTop(0,Style.Unit.PX);
  ghostColumn=Document.get().createDivElement();
  ghostColumn.addClassName(COLUMN_PHANTOM_STYLE);
  ghostColumn.getStyle().setPosition(Style.Position.ABSOLUTE);
  ghostColumn.getStyle().setTop(0,Style.Unit.PX);
  addDomHandler(new DragEnterHandler(){
    @Override public void onDragEnter(    DragEnterEvent event){
      if (DraggedColumn.instance != null) {
        if (DraggedColumn.instance.isMove()) {
          event.preventDefault();
          event.stopPropagation();
          DraggedColumn<T> target=findTargetDraggedColumn(event.getNativeEvent().getEventTarget());
          if (target != null) {
            showColumnMoveDecorations(target);
            event.getDataTransfer().<XDataTransfer>cast().setDropEffect("String_Node_Str");
          }
 else {
            event.getDataTransfer().<XDataTransfer>cast().setDropEffect("String_Node_Str");
          }
        }
 else {
        }
      }
 else {
        event.getDataTransfer().<XDataTransfer>cast().setDropEffect("String_Node_Str");
      }
    }
  }
,DragEnterEvent.getType());
  addDomHandler(new DragHandler(){
    @Override public void onDrag(    DragEvent event){
      if (DraggedColumn.instance != null && DraggedColumn.instance.isResize()) {
        event.stopPropagation();
      }
    }
  }
,DragEvent.getType());
  addDomHandler(new DragOverHandler(){
    @Override public void onDragOver(    DragOverEvent event){
      if (DraggedColumn.instance != null) {
        event.preventDefault();
        event.stopPropagation();
        if (DraggedColumn.instance.isMove()) {
          DraggedColumn<T> target=findTargetDraggedColumn(event.getNativeEvent().getEventTarget());
          if (target != null) {
            event.getDataTransfer().<XDataTransfer>cast().setDropEffect("String_Node_Str");
          }
 else {
            hideColumnDecorations();
            event.getDataTransfer().<XDataTransfer>cast().setDropEffect("String_Node_Str");
          }
        }
 else {
          Element hostElement=Grid.this.getElement();
          int clientX=event.getNativeEvent().getClientX();
          int hostAbsX=hostElement.getAbsoluteLeft();
          int hostScrollX=hostElement.getScrollLeft();
          int docScrollX=hostElement.getOwnerDocument().getScrollLeft();
          int relativeX=clientX - hostAbsX + hostScrollX + docScrollX;
          ghostLine.getStyle().setLeft(relativeX,Style.Unit.PX);
          ghostLine.getStyle().setHeight(hostElement.getClientHeight(),Style.Unit.PX);
          if (ghostLine.getParentElement() != hostElement) {
            hostElement.appendChild(ghostLine);
          }
        }
      }
    }
  }
,DragOverEvent.getType());
  addDomHandler(new DragLeaveHandler(){
    @Override public void onDragLeave(    DragLeaveEvent event){
      if (DraggedColumn.instance != null) {
        event.stopPropagation();
        if (DraggedColumn.instance.isMove()) {
          if (event.getNativeEvent().getEventTarget() == (JavaScriptObject)Grid.this.getElement()) {
            hideColumnDecorations();
          }
        }
      }
    }
  }
,DragLeaveEvent.getType());
  addDomHandler(new DragEndHandler(){
    @Override public void onDragEnd(    DragEndEvent event){
      event.stopPropagation();
      hideColumnDecorations();
      DraggedColumn.instance=null;
    }
  }
,DragEndEvent.getType());
  addDomHandler(new DropHandler(){
    @Override public void onDrop(    DropEvent event){
      DraggedColumn<?> source=DraggedColumn.instance;
      DraggedColumn<T> target=targetDraggedColumn;
      hideColumnDecorations();
      DraggedColumn.instance=null;
      if (source != null) {
        event.preventDefault();
        event.stopPropagation();
        if (source.isMove()) {
          AbstractCellTable<T> sourceSection=(AbstractCellTable<T>)source.getTable();
          if (target != null) {
            Header<?> sourceHeader=source.getHeader();
            Header<?> targetHeader=target.getHeader();
            if (sourceHeader instanceof DraggableHeader<?> && targetHeader instanceof DraggableHeader<?>) {
              DraggableHeader<T> sourceDH=(DraggableHeader<T>)sourceHeader;
              DraggableHeader<T> targetDH=(DraggableHeader<T>)targetHeader;
              moveColumnNode(sourceDH.getHeaderNode(),targetDH.getHeaderNode());
            }
 else {
              int sourceIndex=source.getColumnIndex();
              int targetIndex=target.getColumnIndex();
              GridSection<T> targetSection=(GridSection<T>)target.getTable();
              boolean isSourceLeft=sourceSection == headerLeft || sourceSection == frozenLeft || sourceSection == scrollableLeft || sourceSection == footerLeft;
              boolean isTargetLeft=targetSection == headerLeft || targetSection == frozenLeft || targetSection == scrollableLeft || targetSection == footerLeft;
              sourceSection=isSourceLeft ? headerLeft : headerRight;
              targetSection=isTargetLeft ? headerLeft : headerRight;
              int generalSourceIndex=isSourceLeft ? sourceIndex : sourceIndex + frozenColumns;
              int generalTargetIndex=isTargetLeft ? targetIndex : targetIndex + frozenColumns;
              Header<?> header=sourceSection.getHeader(sourceIndex);
              if (header instanceof DraggableHeader) {
                ((DraggableHeader)header).setTable(targetSection);
              }
              if (generalSourceIndex != generalTargetIndex) {
                Column<T,?> column=(Column<T,?>)source.getColumn();
                if (!(header instanceof DraggableHeader) || ((DraggableHeader)header).isMoveable()) {
                  moveColumn(generalSourceIndex,generalTargetIndex);
                }
              }
            }
          }
        }
 else {
          Header<?> header=source.getHeader();
          if (!(header instanceof DraggableHeader) || ((DraggableHeader)header).isResizable()) {
            int newWidth=Math.max(event.getNativeEvent().getClientX() - source.getCellElement().getAbsoluteLeft(),MINIMUM_COLUMN_WIDTH);
            setColumnWidthFromHeaderDrag(((DraggedColumn<T>)source).getColumn(),newWidth,Style.Unit.PX);
          }
        }
      }
    }
  }
,DropEvent.getType());
  columnsChevron.getElement().getStyle().setPosition(Style.Position.ABSOLUTE);
  columnsChevron.getElement().addClassName(COLUMNS_CHEVRON_STYLE);
  getElement().appendChild(columnsChevron.getElement());
  columnsChevron.addDomHandler(new ClickHandler(){
    @Override public void onClick(    ClickEvent event){
      PopupPanel pp=new PopupPanel();
      pp.setAutoHideEnabled(true);
      pp.setAutoHideOnHistoryEventsEnabled(true);
      pp.setAnimationEnabled(true);
      MenuBar columnsMenu=new MenuBar(true);
      fillColumns(columnsMenu,headerLeft);
      fillColumns(columnsMenu,headerRight);
      pp.setWidget(columnsMenu);
      pp.setPopupPosition(columnsChevron.getAbsoluteLeft(),columnsChevron.getAbsoluteTop());
      pp.showRelativeTo(columnsChevron);
    }
    private void fillColumns(    MenuBar aTarget,    final GridSection<T> aSection){
      for (int i=0; i < aSection.getColumnCount(); i++) {
        Header<?> h=aSection.getHeader(i);
        final Column<T,?> column=aSection.getColumn(i);
        SafeHtml rendered;
        if (h.getValue() instanceof String) {
          String hVal=(String)h.getValue();
          rendered=hVal.startsWith("String_Node_Str") ? SafeHtmlUtils.fromTrustedString(hVal.substring(6)) : SafeHtmlUtils.fromString(hVal);
        }
 else {
          Cell.Context context=new Cell.Context(0,i,h.getKey());
          SafeHtmlBuilder sb=new SafeHtmlBuilder();
          h.render(context,sb);
          rendered=sb.toSafeHtml();
        }
        MenuItemCheckBox miCheck=new MenuItemCheckBox(!aSection.isColumnHidden(column),rendered.asString(),true);
        miCheck.addValueChangeHandler(new ValueChangeHandler<Boolean>(){
          @Override public void onValueChange(          ValueChangeEvent<Boolean> event){
            if (Boolean.TRUE.equals(event.getValue())) {
              showColumn(column);
            }
 else {
              hideColumn(column);
            }
            Grid.this.onResize();
          }
        }
);
        aTarget.addItem(miCheck);
      }
    }
  }
,ClickEvent.getType());
  ColumnSortEvent.Handler sectionSortHandler=new ColumnSortEvent.Handler(){
    @Override public void onColumnSort(    ColumnSortEvent event){
      boolean isCtrlKey=((GridSection<?>)event.getSource()).isCtrlKey();
      boolean contains=false;
      int containsAt=-1;
      for (int i=0; i < sortList.size(); i++) {
        if (sortList.get(i).getColumn() == event.getColumn()) {
          contains=true;
          containsAt=i;
          break;
        }
      }
      if (!contains) {
        if (!isCtrlKey) {
          sortList.clear();
        }
        sortList.insert(sortList.size(),new ColumnSortList.ColumnSortInfo(event.getColumn(),true));
      }
 else {
        boolean wasAscending=sortList.get(containsAt).isAscending();
        if (!isCtrlKey) {
          sortList.clear();
          if (wasAscending) {
            sortList.push(new ColumnSortList.ColumnSortInfo(event.getColumn(),false));
          }
        }
 else {
          sortList.remove(sortList.get(containsAt));
          if (wasAscending) {
            sortList.insert(containsAt,new ColumnSortList.ColumnSortInfo(event.getColumn(),false));
          }
        }
      }
      ColumnSortEvent.fire(Grid.this,sortList);
    }
  }
;
  headerLeft.getColumnSortList().setLimit(1);
  headerLeft.addColumnSortHandler(sectionSortHandler);
  headerRight.getColumnSortList().setLimit(1);
  headerRight.addColumnSortHandler(sectionSortHandler);
  gridColor=PublishedColor.create(211,211,211,255);
  regenerateDynamicTDStyles();
  regenerateDynamicOddRowsStyles();
  getElement().<XElement>cast().addResizingTransitionEnd(this);
}