Program: 143473
Project: 143473
Buggy source:
public WebCellBasedView(final String id,final IApplication application,RuntimePortal scriptable,final Form form,final AbstractBase cellview,final IDataProviderLookup dataProviderLookup,final IScriptExecuter el,boolean addHeaders,final int startY,final int endY,final int sizeHint,int viewType){
  super(id);
  this.application=application;
  this.cellview=cellview;
  this.fc=el.getFormController();
  this.addHeaders=addHeaders;
  this.startY=startY;
  this.endY=endY;
  this.formDesignHeight=form.getSize().height;
  this.sizeHint=sizeHint;
  this.isListViewMode=viewType == IForm.LIST_VIEW || viewType == FormController.LOCKED_LIST_VIEW;
  this.bodyWidthHint=form.getWidth();
  double multiplier=Utils.getAsDouble(Settings.getInstance().getProperty("String_Node_Str","String_Node_Str"));
  if (multiplier > 1.1) {
    NEW_PAGE_MULITPLIER=multiplier;
  }
 else {
    NEW_PAGE_MULITPLIER=1.1;
  }
  useAJAX=Utils.getAsBoolean(application.getRuntimeProperties().get("String_Node_Str"));
  useAnchors=Utils.getAsBoolean(application.getRuntimeProperties().get("String_Node_Str"));
  if (useAJAX)   setVersioned(false);
  setScrollMode(Boolean.TRUE.equals(application.getClientProperty(IApplication.TABLEVIEW_WC_DEFAULT_SCROLLABLE)));
  isKeepLoadedRowsInScrollMode=Boolean.TRUE.equals(application.getClientProperty(IApplication.TABLEVIEW_WC_SCROLLABLE_KEEP_LOADED_ROWS));
  setOutputMarkupPlaceholderTag(true);
  dataRendererOnRenderWrapper=new DataRendererOnRenderWrapper(this);
  loadingInfo=new Label("String_Node_Str","String_Node_Str");
  loadingInfo.setVisible(false);
  add(loadingInfo);
  if (!useAJAX)   bodyHeightHint=sizeHint;
  String orientation=OrientationApplier.getHTMLContainerOrientation(application.getLocale(),application.getSolution().getTextOrientation());
  isLeftToRightOrientation=!OrientationApplier.RTL.equalsIgnoreCase(orientation);
  int tFormHeight=0;
  Iterator<Part> partIte=form.getParts();
  while (partIte.hasNext()) {
    Part p=partIte.next();
    if (p.getPartType() == Part.BODY) {
      tFormHeight=p.getHeight() - startY;
      break;
    }
  }
  formBodySize=new Dimension(form.getWidth(),tFormHeight);
  ChangesRecorder jsChangeRecorder=new ChangesRecorder(null,null){
    @Override public boolean isChanged(){
      boolean retval=false;
      if (super.isChanged()) {
        retval=true;
        return retval;
      }
      if (!retval) {
        Iterator<Component> iterator=elementToColumnIdentifierComponent.values().iterator();
        while (iterator.hasNext()) {
          Component object=iterator.next();
          if (object instanceof IProviderStylePropertyChanges) {
            if (((IProviderStylePropertyChanges)object).getStylePropertyChanges().isChanged()) {
              retval=true;
              break;
            }
          }
        }
      }
      if (retval) {
        MainPage page=(MainPage)getPage();
        page.getPageContributor().addTableToRender(WebCellBasedView.this);
        setRendered();
      }
      return false;
    }
    @Override public void setRendered(){
      super.setRendered();
      Iterator<Component> iterator=elementToColumnIdentifierComponent.values().iterator();
      while (iterator.hasNext()) {
        Component comp=iterator.next();
        if (comp instanceof IProviderStylePropertyChanges) {
          ((IProviderStylePropertyChanges)comp).getStylePropertyChanges().setRendered();
        }
      }
    }
  }
;
  this.scriptable=scriptable;
  ((ChangesRecorder)scriptable.getChangesRecorder()).setAdditionalChangesRecorder(jsChangeRecorder);
  add(TooltipAttributeModifier.INSTANCE);
  final int scrollbars=(cellview instanceof ISupportScrollbars) ? ((ISupportScrollbars)cellview).getScrollbars() : 0;
  add(new StyleAppendingModifier(new Model<String>(){
    private static final long serialVersionUID=1L;
    @Override public String getObject(){
      if (!isScrollMode() && findParent(IWebFormContainer.class) != null) {
        return "String_Node_Str";
      }
      return scrollBarDefinitionToOverflowAttribute(scrollbars,isScrollMode(),false,currentData == null || currentData.getSize() == 0);
    }
  }
));
  if (cellview instanceof BaseComponent) {
    ComponentFactory.applyBasicComponentProperties(application,this,(BaseComponent)cellview,ComponentFactory.getStyleForBasicComponent(application,cellview,form));
  }
  boolean sortable=true;
  String initialSortString=null;
  int onRenderMethodID=0;
  AbstractBase onRenderPersist=null;
  if (cellview instanceof Portal) {
    Portal p=(Portal)cellview;
    isListViewMode=p.getMultiLine();
    setRowBGColorScript(p.getRowBGColorCalculation(),p.getInstanceMethodArguments("String_Node_Str"));
    sortable=p.getSortable();
    initialSortString=p.getInitialSort();
    onRenderMethodID=p.getOnRenderMethodID();
    onRenderPersist=p;
    int portalAnchors=p.getAnchors();
    isAnchored=(((portalAnchors & IAnchorConstants.NORTH) > 0) && ((portalAnchors & IAnchorConstants.SOUTH) > 0)) || (((portalAnchors & IAnchorConstants.EAST) > 0) && ((portalAnchors & IAnchorConstants.WEST) > 0));
  }
 else   if (cellview instanceof Form) {
    initialSortString=form.getInitialSort();
    onRenderMethodID=form.getOnRenderMethodID();
    onRenderPersist=form;
    isAnchored=true;
  }
  if (onRenderMethodID > 0) {
    dataRendererOnRenderWrapper.getRenderEventExecutor().setRenderCallback(Integer.toString(onRenderMethodID),Utils.parseJSExpressions(onRenderPersist.getInstanceMethodArguments("String_Node_Str")));
    dataRendererOnRenderWrapper.getRenderEventExecutor().setRenderScriptExecuter(fc != null ? fc.getScriptExecuter() : null);
  }
  initDragNDrop(fc,startY);
  if (sortable) {
    if (initialSortString != null) {
      StringTokenizer tokByComma=new StringTokenizer(initialSortString,"String_Node_Str");
      while (tokByComma.hasMoreTokens()) {
        String initialSortFirstToken=tokByComma.nextToken();
        StringTokenizer tokBySpace=new StringTokenizer(initialSortFirstToken);
        if (tokBySpace.hasMoreTokens()) {
          String initialSortColumnName=tokBySpace.nextToken();
          if (tokBySpace.hasMoreTokens()) {
            String sortDir=tokBySpace.nextToken();
            boolean initialSortAsc=true;
            if (sortDir.equalsIgnoreCase("String_Node_Str"))             initialSortAsc=false;
            initialSortColumnNames.put(initialSortColumnName,new Boolean(initialSortAsc));
          }
        }
      }
    }
    if (initialSortColumnNames.size() == 0) {
      try {
        String dataSource=null;
        if (cellview instanceof Portal) {
          Portal p=(Portal)cellview;
          String relation=p.getRelationName();
          int lastDot=relation.lastIndexOf("String_Node_Str");
          if (lastDot >= 0) {
            relation=relation.substring(lastDot + 1);
          }
          Relation rel=application.getFlattenedSolution().getRelation(relation);
          if (rel != null) {
            dataSource=rel.getForeignDataSource();
          }
        }
 else {
          dataSource=form.getDataSource();
        }
        if (dataSource != null) {
          Iterator<String> pkColumnNames=application.getFoundSetManager().getTable(dataSource).getRowIdentColumnNames();
          while (pkColumnNames.hasNext()) {
            initialSortColumnNames.put(pkColumnNames.next(),Boolean.TRUE);
          }
        }
      }
 catch (      RepositoryException e) {
        Debug.log("String_Node_Str",e);
      }
    }
  }
  maxHeight=0;
  try {
    if (isListViewMode() && !(cellview instanceof Portal)) {
      int headerHeight=0;
      int titleHeaderHeight=0;
      Iterator<Part> pIte=form.getParts();
      while (pIte.hasNext()) {
        Part p=pIte.next();
        if (p.getPartType() == Part.BODY) {
          maxHeight=p.getHeight();
        }
 else         if (p.getPartType() == Part.HEADER) {
          headerHeight=p.getHeight();
        }
 else         if (p.getPartType() == Part.TITLE_HEADER) {
          titleHeaderHeight=p.getHeight();
        }
      }
      if (headerHeight != 0) {
        maxHeight=maxHeight - headerHeight;
      }
 else {
        maxHeight=maxHeight - titleHeaderHeight;
      }
    }
 else {
      int minElY=0;
      boolean isMinElYSet=false;
      int height;
      Iterator<IPersist> components=cellview.getAllObjects(PositionComparator.XY_PERSIST_COMPARATOR);
      while (components.hasNext()) {
        IPersist element=components.next();
        if (element instanceof Field || element instanceof GraphicalComponent) {
          if (element instanceof GraphicalComponent && ((GraphicalComponent)element).getLabelFor() != null) {
            labelsFor.put(((GraphicalComponent)element).getLabelFor(),element);
            continue;
          }
          Point l=((IFormElement)element).getLocation();
          if (l == null) {
            continue;
          }
          if (l.y >= startY && l.y < endY) {
            if (isListViewMode()) {
              height=l.y + ((IFormElement)element).getSize().height;
              if (!isMinElYSet || minElY > l.y) {
                minElY=l.y;
                isMinElYSet=true;
              }
            }
 else {
              height=((IFormElement)element).getSize().height;
            }
            if (height > maxHeight)             maxHeight=height;
          }
        }
      }
      maxHeight=maxHeight - minElY;
    }
    if (maxHeight == 0)     maxHeight=20;
  }
 catch (  Exception ex1) {
    Debug.error("String_Node_Str",ex1);
  }
  tableContainerBody=new WebMarkupContainer("String_Node_Str");
  tableContainerBody.setOutputMarkupId(true);
  table=new WebCellBasedViewListView("String_Node_Str",data,1,cellview,dataProviderLookup,el,startY,endY,form);
  table.setReuseItems(true);
  tableContainerBody.add(table);
  add(tableContainerBody);
  final LinkedHashMap<String,IDataAdapter> dataadapters=new LinkedHashMap<String,IDataAdapter>();
  final SortedList<IPersist> columnTabSequence=new SortedList<IPersist>(TabSeqComparator.INSTANCE);
  createComponents(application,form,cellview,dataProviderLookup,el,startY,endY,new ItemAdd(){
    public void add(    IPersist element,    Component comp){
      if (element instanceof IFormElement && comp instanceof IComponent) {
        ((IComponent)comp).setLocation(((IFormElement)element).getLocation());
        ((IComponent)comp).setSize(((IFormElement)element).getSize());
      }
      elementToColumnIdentifierComponent.put(element,comp);
      if (cellview instanceof Form && element instanceof ISupportTabSeq && ((ISupportTabSeq)element).getTabSeq() >= 0) {
        columnTabSequence.add(element);
      }
      if (comp instanceof IDisplayData) {
        String dataprovider=((IDisplayData)comp).getDataProviderID();
        WebCellAdapter previous=(WebCellAdapter)dataadapters.get(dataprovider);
        if (previous == null) {
          WebCellAdapter wca=new WebCellAdapter(dataprovider,WebCellBasedView.this);
          dataadapters.put(dataprovider,wca);
        }
        if (dataprovider != null) {
          if (initialSortColumnNames.containsKey(dataprovider))           initialSortedColumns.put(comp.getId(),initialSortColumnNames.get(dataprovider));
        }
      }
    }
  }
);
  for (int i=columnTabSequence.size() - 1; i >= 0; i--) {
    elementTabIndexes.put(columnTabSequence.get(i),Integer.valueOf(i));
  }
  if (addHeaders) {
    headers=new SortableCellViewHeaders(form,this,"String_Node_Str",table,cellview,application,initialSortedColumns,new IHeaders(){
      public void registerHeader(      IPersist matchingElement,      Component headerComponent){
        SortableCellViewHeader sortableHeader=(SortableCellViewHeader)headerComponent;
        Component columnIdentifier=WebCellBasedView.this.elementToColumnIdentifierComponent.get(matchingElement);
        if (columnIdentifier instanceof IProviderStylePropertyChanges) {
          String width=((IProviderStylePropertyChanges)columnIdentifier).getStylePropertyChanges().getJSProperty("String_Node_Str");
          if (width != null) {
            sortableHeader.setWidth(Integer.parseInt(width.substring(0,width.length() - 2)));
          }
 else           if (matchingElement instanceof BaseComponent)           sortableHeader.setWidth(((BaseComponent)matchingElement).getSize().width);
        }
        sortableHeader.setTabSequenceIndex(ISupportWebTabSeq.SKIP);
        sortableHeader.setScriptExecuter(el);
        sortableHeader.setResizeClass(columnIdentifier.getId());
        WebCellBasedView.this.registerHeader(matchingElement,headerComponent);
      }
    }
);
    add(headers);
  }
  if (useAJAX) {
    add(pagingNavigator=new ServoyAjaxPagingNavigator("String_Node_Str",table));
    add(tableResizeBehavior=new ServoyTableResizeBehavior(startY,endY,cellview));
    if (isScrollMode())     add(new HeaderHeightCalculationBehavior());
  }
 else {
    add(pagingNavigator=new ServoySubmitPagingNavigator("String_Node_Str",table));
  }
  showPageNavigator=!((scrollbars & ISupportScrollbars.VERTICAL_SCROLLBAR_NEVER) == ISupportScrollbars.VERTICAL_SCROLLBAR_NEVER);
  try {
    if (cellview instanceof Portal) {
      relationName=((Portal)cellview).getRelationName();
      Relation[] rels=application.getFlattenedSolution().getRelationSequence(((Portal)cellview).getRelationName());
      if (rels != null) {
        Relation r=rels[rels.length - 1];
        if (r != null) {
          defaultSort=((FoundSetManager)application.getFoundSetManager()).getSortColumns(application.getFoundSetManager().getTable(r.getForeignDataSource()),((Portal)cellview).getInitialSort());
        }
      }
    }
 else {
      defaultSort=((FoundSetManager)application.getFoundSetManager()).getSortColumns(((Form)cellview).getDataSource(),((Form)cellview).getInitialSort());
    }
  }
 catch (  RepositoryException e) {
    Debug.error(e);
    defaultSort=new ArrayList<SortColumn>(1);
  }
  try {
    dal=new DataAdapterList(application,dataProviderLookup,elementToColumnIdentifierComponent,el.getFormController(),dataadapters,null);
  }
 catch (  RepositoryException ex) {
    Debug.error(ex);
  }
  table.setPageabeMode(!isScrollMode());
  if (isScrollMode()) {
    tableContainerBody.add(new StyleAppendingModifier(new Model<String>(){
      private static final long serialVersionUID=1L;
      @Override public String getObject(){
        int scrollPadding=0;
        return scrollBarDefinitionToOverflowAttribute(scrollbars,isScrollMode(),true,currentData == null || currentData.getSize() == 0) + "String_Node_Str" + (scrollableHeaderHeight == -1 ? "String_Node_Str" : "String_Node_Str" + scrollableHeaderHeight + "String_Node_Str")+ "String_Node_Str"+ scrollPadding+ "String_Node_Str";
      }
    }
));
    tableContainerBody.add(new SimpleAttributeModifier("String_Node_Str","String_Node_Str"));
    tableContainerBody.add(scrollBehavior=new ScrollBehavior("String_Node_Str"));
    tableContainerBody.add(topPlaceholderUpdater=new TopPlaceholderUpdater());
  }
  add(new StyleAppendingModifier(new Model<String>(){
    private static final long serialVersionUID=1L;
    @Override public String getObject(){
      WebForm container=findParent(WebForm.class);
      if (container != null && container.getBorder() instanceof TitledBorder) {
        int offset=ComponentFactoryHelper.getTitledBorderHeight(container.getBorder());
        return "String_Node_Str" + offset + "String_Node_Str";
      }
      return "String_Node_Str";
    }
  }
){
    @Override public boolean isEnabled(    Component component){
      WebForm container=component.findParent(WebForm.class);
      if (container != null && container.getBorder() instanceof TitledBorder) {
        return super.isEnabled(component);
      }
      return false;
    }
  }
);
  add(new ServoyAjaxEventBehavior("String_Node_Str",null,true){
    @Override protected void onEvent(    AjaxRequestTarget target){
      int i=fc.getFormModel().getSelectedIndex();
      boolean downArrow=Utils.getAsBoolean(RequestCycle.get().getRequest().getParameter("String_Node_Str"));
      if (downArrow) {
        i++;
      }
 else {
        i--;
      }
      if (i >= 0) {
        fc.getFormModel().setSelectedIndex(i);
        WebEventExecutor.generateResponse(target,getPage());
      }
    }
    @Override protected CharSequence generateCallbackScript(    final CharSequence partialCall){
      return super.generateCallbackScript(partialCall + "String_Node_Str");
    }
    @Override protected IAjaxCallDecorator getAjaxCallDecorator(){
      return new AjaxCallDecorator(){
        private static final long serialVersionUID=1L;
        @Override public CharSequence decorateScript(        CharSequence script){
          return "String_Node_Str" + script + "String_Node_Str"+ getMarkupId()+ "String_Node_Str";
        }
      }
;
    }
  }
);
  if (!isListViewMode()) {
    add(new ServoyAjaxEventBehavior("String_Node_Str",null,true){
      @Override protected void onEvent(      AjaxRequestTarget target){
        if (application.getFoundSetManager().getEditRecordList().isEditing()) {
          application.getFoundSetManager().getEditRecordList().stopEditing(false);
          WebEventExecutor.generateResponse(target,getPage());
        }
      }
      @Override protected IAjaxCallDecorator getAjaxCallDecorator(){
        return new AjaxCallDecorator(){
          private static final long serialVersionUID=1L;
          @Override public CharSequence decorateScript(          CharSequence script){
            return "String_Node_Str" + script + "String_Node_Str";
          }
        }
;
      }
    }
);
  }
}

Fixed version (ground truth):
public WebCellBasedView(final String id,final IApplication application,RuntimePortal scriptable,final Form form,final AbstractBase cellview,final IDataProviderLookup dataProviderLookup,final IScriptExecuter el,boolean addHeaders,final int startY,final int endY,final int sizeHint,int viewType){
  super(id);
  this.application=application;
  this.cellview=cellview;
  this.fc=el.getFormController();
  this.addHeaders=addHeaders;
  this.startY=startY;
  this.endY=endY;
  this.formDesignHeight=form.getSize().height;
  this.sizeHint=sizeHint;
  this.isListViewMode=viewType == IForm.LIST_VIEW || viewType == FormController.LOCKED_LIST_VIEW;
  this.bodyWidthHint=form.getWidth();
  double multiplier=Utils.getAsDouble(Settings.getInstance().getProperty("String_Node_Str","String_Node_Str"));
  if (multiplier > 1.1) {
    NEW_PAGE_MULITPLIER=multiplier;
  }
 else {
    NEW_PAGE_MULITPLIER=1.1;
  }
  useAJAX=Utils.getAsBoolean(application.getRuntimeProperties().get("String_Node_Str"));
  useAnchors=Utils.getAsBoolean(application.getRuntimeProperties().get("String_Node_Str"));
  if (useAJAX)   setVersioned(false);
  setScrollMode(Boolean.TRUE.equals(application.getClientProperty(IApplication.TABLEVIEW_WC_DEFAULT_SCROLLABLE)));
  isKeepLoadedRowsInScrollMode=Boolean.TRUE.equals(application.getClientProperty(IApplication.TABLEVIEW_WC_SCROLLABLE_KEEP_LOADED_ROWS));
  setOutputMarkupPlaceholderTag(true);
  dataRendererOnRenderWrapper=new DataRendererOnRenderWrapper(this);
  loadingInfo=new Label("String_Node_Str","String_Node_Str");
  loadingInfo.setVisible(false);
  add(loadingInfo);
  if (!useAJAX)   bodyHeightHint=sizeHint;
  String orientation=OrientationApplier.getHTMLContainerOrientation(application.getLocale(),application.getSolution().getTextOrientation());
  isLeftToRightOrientation=!OrientationApplier.RTL.equalsIgnoreCase(orientation);
  int tFormHeight=0;
  Iterator<Part> partIte=form.getParts();
  while (partIte.hasNext()) {
    Part p=partIte.next();
    if (p.getPartType() == Part.BODY) {
      tFormHeight=p.getHeight() - startY;
      break;
    }
  }
  formBodySize=new Dimension(form.getWidth(),tFormHeight);
  ChangesRecorder jsChangeRecorder=new ChangesRecorder(null,null){
    @Override public boolean isChanged(){
      boolean retval=false;
      if (super.isChanged()) {
        retval=true;
        return retval;
      }
      if (!retval) {
        Iterator<Component> iterator=elementToColumnIdentifierComponent.values().iterator();
        while (iterator.hasNext()) {
          Component object=iterator.next();
          if (object instanceof IProviderStylePropertyChanges) {
            if (((IProviderStylePropertyChanges)object).getStylePropertyChanges().isChanged()) {
              retval=true;
              break;
            }
          }
        }
      }
      if (retval) {
        MainPage page=(MainPage)getPage();
        page.getPageContributor().addTableToRender(WebCellBasedView.this);
        setRendered();
      }
      return false;
    }
    @Override public void setRendered(){
      super.setRendered();
      Iterator<Component> iterator=elementToColumnIdentifierComponent.values().iterator();
      while (iterator.hasNext()) {
        Component comp=iterator.next();
        if (comp instanceof IProviderStylePropertyChanges) {
          ((IProviderStylePropertyChanges)comp).getStylePropertyChanges().setRendered();
        }
      }
    }
  }
;
  this.scriptable=scriptable;
  ((ChangesRecorder)scriptable.getChangesRecorder()).setAdditionalChangesRecorder(jsChangeRecorder);
  add(TooltipAttributeModifier.INSTANCE);
  final int scrollbars=(cellview instanceof ISupportScrollbars) ? ((ISupportScrollbars)cellview).getScrollbars() : 0;
  add(new StyleAppendingModifier(new Model<String>(){
    private static final long serialVersionUID=1L;
    @Override public String getObject(){
      if (!isScrollMode() && findParent(IWebFormContainer.class) != null) {
        return "String_Node_Str";
      }
      return scrollBarDefinitionToOverflowAttribute(scrollbars,isScrollMode(),false,currentData == null || currentData.getSize() == 0);
    }
  }
));
  if (cellview instanceof BaseComponent) {
    ComponentFactory.applyBasicComponentProperties(application,this,(BaseComponent)cellview,ComponentFactory.getStyleForBasicComponent(application,cellview,form));
  }
  boolean sortable=true;
  String initialSortString=null;
  int onRenderMethodID=0;
  AbstractBase onRenderPersist=null;
  if (cellview instanceof Portal) {
    Portal p=(Portal)cellview;
    isListViewMode=p.getMultiLine();
    setRowBGColorScript(p.getRowBGColorCalculation(),p.getInstanceMethodArguments("String_Node_Str"));
    sortable=p.getSortable();
    initialSortString=p.getInitialSort();
    onRenderMethodID=p.getOnRenderMethodID();
    onRenderPersist=p;
    int portalAnchors=p.getAnchors();
    isAnchored=(((portalAnchors & IAnchorConstants.NORTH) > 0) && ((portalAnchors & IAnchorConstants.SOUTH) > 0)) || (((portalAnchors & IAnchorConstants.EAST) > 0) && ((portalAnchors & IAnchorConstants.WEST) > 0));
  }
 else   if (cellview instanceof Form) {
    initialSortString=form.getInitialSort();
    onRenderMethodID=form.getOnRenderMethodID();
    onRenderPersist=form;
    isAnchored=true;
  }
  if (onRenderMethodID > 0) {
    dataRendererOnRenderWrapper.getRenderEventExecutor().setRenderCallback(Integer.toString(onRenderMethodID),Utils.parseJSExpressions(onRenderPersist.getInstanceMethodArguments("String_Node_Str")));
    dataRendererOnRenderWrapper.getRenderEventExecutor().setRenderScriptExecuter(fc != null ? fc.getScriptExecuter() : null);
  }
  initDragNDrop(fc,startY);
  if (sortable) {
    if (initialSortString != null) {
      StringTokenizer tokByComma=new StringTokenizer(initialSortString,"String_Node_Str");
      while (tokByComma.hasMoreTokens()) {
        String initialSortFirstToken=tokByComma.nextToken();
        StringTokenizer tokBySpace=new StringTokenizer(initialSortFirstToken);
        if (tokBySpace.hasMoreTokens()) {
          String initialSortColumnName=tokBySpace.nextToken();
          if (tokBySpace.hasMoreTokens()) {
            String sortDir=tokBySpace.nextToken();
            boolean initialSortAsc=true;
            if (sortDir.equalsIgnoreCase("String_Node_Str"))             initialSortAsc=false;
            initialSortColumnNames.put(initialSortColumnName,new Boolean(initialSortAsc));
          }
        }
      }
    }
    if (initialSortColumnNames.size() == 0) {
      try {
        String dataSource=null;
        if (cellview instanceof Portal) {
          Portal p=(Portal)cellview;
          String relation=p.getRelationName();
          int lastDot=relation.lastIndexOf("String_Node_Str");
          if (lastDot >= 0) {
            relation=relation.substring(lastDot + 1);
          }
          Relation rel=application.getFlattenedSolution().getRelation(relation);
          if (rel != null) {
            dataSource=rel.getForeignDataSource();
          }
        }
 else {
          dataSource=form.getDataSource();
        }
        if (dataSource != null) {
          Iterator<String> pkColumnNames=application.getFoundSetManager().getTable(dataSource).getRowIdentColumnNames();
          while (pkColumnNames.hasNext()) {
            initialSortColumnNames.put(pkColumnNames.next(),Boolean.TRUE);
          }
        }
      }
 catch (      RepositoryException e) {
        Debug.log("String_Node_Str",e);
      }
    }
  }
  maxHeight=0;
  try {
    if (isListViewMode() && !(cellview instanceof Portal)) {
      int headerHeight=0;
      int titleHeaderHeight=0;
      Iterator<Part> pIte=form.getParts();
      while (pIte.hasNext()) {
        Part p=pIte.next();
        if (p.getPartType() == Part.BODY) {
          maxHeight=p.getHeight();
        }
 else         if (p.getPartType() == Part.HEADER) {
          headerHeight=p.getHeight();
        }
 else         if (p.getPartType() == Part.TITLE_HEADER) {
          titleHeaderHeight=p.getHeight();
        }
      }
      if (headerHeight != 0) {
        maxHeight=maxHeight - headerHeight;
      }
 else {
        maxHeight=maxHeight - titleHeaderHeight;
      }
    }
 else {
      int minElY=0;
      boolean isMinElYSet=false;
      int height;
      Iterator<IPersist> components=cellview.getAllObjects(PositionComparator.XY_PERSIST_COMPARATOR);
      while (components.hasNext()) {
        IPersist element=components.next();
        if (element instanceof Field || element instanceof GraphicalComponent) {
          if (element instanceof GraphicalComponent && ((GraphicalComponent)element).getLabelFor() != null) {
            labelsFor.put(((GraphicalComponent)element).getLabelFor(),element);
            continue;
          }
          Point l=((IFormElement)element).getLocation();
          if (l == null) {
            continue;
          }
          if (l.y >= startY && l.y < endY) {
            if (isListViewMode()) {
              height=l.y + ((IFormElement)element).getSize().height;
              if (!isMinElYSet || minElY > l.y) {
                minElY=l.y;
                isMinElYSet=true;
              }
            }
 else {
              height=((IFormElement)element).getSize().height;
            }
            if (height > maxHeight)             maxHeight=height;
          }
        }
      }
      maxHeight=maxHeight - minElY;
    }
    if (maxHeight == 0)     maxHeight=20;
  }
 catch (  Exception ex1) {
    Debug.error("String_Node_Str",ex1);
  }
  tableContainerBody=new WebMarkupContainer("String_Node_Str");
  tableContainerBody.setOutputMarkupId(true);
  table=new WebCellBasedViewListView("String_Node_Str",data,1,cellview,dataProviderLookup,el,startY,endY,form);
  table.setReuseItems(true);
  tableContainerBody.add(table);
  add(tableContainerBody);
  final LinkedHashMap<String,IDataAdapter> dataadapters=new LinkedHashMap<String,IDataAdapter>();
  final SortedList<IPersist> columnTabSequence=new SortedList<IPersist>(TabSeqComparator.INSTANCE);
  createComponents(application,form,cellview,dataProviderLookup,el,startY,endY,new ItemAdd(){
    public void add(    IPersist element,    Component comp){
      if (element instanceof IFormElement && comp instanceof IComponent) {
        ((IComponent)comp).setLocation(((IFormElement)element).getLocation());
        ((IComponent)comp).setSize(((IFormElement)element).getSize());
      }
      elementToColumnIdentifierComponent.put(element,comp);
      if (cellview instanceof Form && element instanceof ISupportTabSeq && ((ISupportTabSeq)element).getTabSeq() >= 0) {
        columnTabSequence.add(element);
      }
      if (comp instanceof IDisplayData) {
        String dataprovider=((IDisplayData)comp).getDataProviderID();
        WebCellAdapter previous=(WebCellAdapter)dataadapters.get(dataprovider);
        if (previous == null) {
          WebCellAdapter wca=new WebCellAdapter(dataprovider,WebCellBasedView.this);
          dataadapters.put(dataprovider,wca);
        }
        if (dataprovider != null) {
          if (initialSortColumnNames.containsKey(dataprovider))           initialSortedColumns.put(comp.getId(),initialSortColumnNames.get(dataprovider));
        }
      }
    }
  }
);
  for (int i=columnTabSequence.size() - 1; i >= 0; i--) {
    elementTabIndexes.put(columnTabSequence.get(i),Integer.valueOf(i));
  }
  if (addHeaders) {
    headers=new SortableCellViewHeaders(form,this,"String_Node_Str",table,cellview,application,initialSortedColumns,new IHeaders(){
      public void registerHeader(      IPersist matchingElement,      Component headerComponent){
        SortableCellViewHeader sortableHeader=(SortableCellViewHeader)headerComponent;
        Component columnIdentifier=WebCellBasedView.this.elementToColumnIdentifierComponent.get(matchingElement);
        if (columnIdentifier instanceof IProviderStylePropertyChanges) {
          String width=((IProviderStylePropertyChanges)columnIdentifier).getStylePropertyChanges().getJSProperty("String_Node_Str");
          if (width != null) {
            sortableHeader.setWidth(Integer.parseInt(width.substring(0,width.length() - 2)));
          }
 else           if (matchingElement instanceof BaseComponent)           sortableHeader.setWidth(((BaseComponent)matchingElement).getSize().width);
        }
        sortableHeader.setTabSequenceIndex(ISupportWebTabSeq.SKIP);
        sortableHeader.setScriptExecuter(el);
        sortableHeader.setResizeClass(columnIdentifier.getId());
        WebCellBasedView.this.registerHeader(matchingElement,headerComponent);
      }
    }
);
    add(headers);
  }
  if (useAJAX) {
    add(pagingNavigator=new ServoyAjaxPagingNavigator("String_Node_Str",table));
    add(tableResizeBehavior=new ServoyTableResizeBehavior(startY,endY,cellview));
    if (isScrollMode())     add(new HeaderHeightCalculationBehavior());
  }
 else {
    add(pagingNavigator=new ServoySubmitPagingNavigator("String_Node_Str",table));
  }
  showPageNavigator=!((scrollbars & ISupportScrollbars.VERTICAL_SCROLLBAR_NEVER) == ISupportScrollbars.VERTICAL_SCROLLBAR_NEVER);
  try {
    if (cellview instanceof Portal) {
      relationName=((Portal)cellview).getRelationName();
      Relation[] rels=application.getFlattenedSolution().getRelationSequence(((Portal)cellview).getRelationName());
      if (rels != null) {
        Relation r=rels[rels.length - 1];
        if (r != null) {
          defaultSort=((FoundSetManager)application.getFoundSetManager()).getSortColumns(application.getFoundSetManager().getTable(r.getForeignDataSource()),((Portal)cellview).getInitialSort());
        }
      }
    }
 else {
      defaultSort=((FoundSetManager)application.getFoundSetManager()).getSortColumns(((Form)cellview).getDataSource(),((Form)cellview).getInitialSort());
    }
  }
 catch (  RepositoryException e) {
    Debug.error(e);
    defaultSort=new ArrayList<SortColumn>(1);
  }
  try {
    dal=new DataAdapterList(application,dataProviderLookup,elementToColumnIdentifierComponent,el.getFormController(),dataadapters,null);
  }
 catch (  RepositoryException ex) {
    Debug.error(ex);
  }
  table.setPageabeMode(!isScrollMode());
  if (isScrollMode()) {
    tableContainerBody.add(new StyleAppendingModifier(new Model<String>(){
      private static final long serialVersionUID=1L;
      @Override public String getObject(){
        int scrollPadding=0;
        return scrollBarDefinitionToOverflowAttribute(scrollbars,isScrollMode(),true,currentData == null || currentData.getSize() == 0) + "String_Node_Str" + scrollableHeaderHeight+ "String_Node_Str"+ scrollPadding+ "String_Node_Str";
      }
    }
));
    tableContainerBody.add(new SimpleAttributeModifier("String_Node_Str","String_Node_Str"));
    tableContainerBody.add(scrollBehavior=new ScrollBehavior("String_Node_Str"));
    tableContainerBody.add(topPlaceholderUpdater=new TopPlaceholderUpdater());
  }
  add(new StyleAppendingModifier(new Model<String>(){
    private static final long serialVersionUID=1L;
    @Override public String getObject(){
      WebForm container=findParent(WebForm.class);
      if (container != null && container.getBorder() instanceof TitledBorder) {
        int offset=ComponentFactoryHelper.getTitledBorderHeight(container.getBorder());
        return "String_Node_Str" + offset + "String_Node_Str";
      }
      return "String_Node_Str";
    }
  }
){
    @Override public boolean isEnabled(    Component component){
      WebForm container=component.findParent(WebForm.class);
      if (container != null && container.getBorder() instanceof TitledBorder) {
        return super.isEnabled(component);
      }
      return false;
    }
  }
);
  add(new ServoyAjaxEventBehavior("String_Node_Str",null,true){
    @Override protected void onEvent(    AjaxRequestTarget target){
      int i=fc.getFormModel().getSelectedIndex();
      boolean downArrow=Utils.getAsBoolean(RequestCycle.get().getRequest().getParameter("String_Node_Str"));
      if (downArrow) {
        i++;
      }
 else {
        i--;
      }
      if (i >= 0) {
        fc.getFormModel().setSelectedIndex(i);
        WebEventExecutor.generateResponse(target,getPage());
      }
    }
    @Override protected CharSequence generateCallbackScript(    final CharSequence partialCall){
      return super.generateCallbackScript(partialCall + "String_Node_Str");
    }
    @Override protected IAjaxCallDecorator getAjaxCallDecorator(){
      return new AjaxCallDecorator(){
        private static final long serialVersionUID=1L;
        @Override public CharSequence decorateScript(        CharSequence script){
          return "String_Node_Str" + script + "String_Node_Str"+ getMarkupId()+ "String_Node_Str";
        }
      }
;
    }
  }
);
  if (!isListViewMode()) {
    add(new ServoyAjaxEventBehavior("String_Node_Str",null,true){
      @Override protected void onEvent(      AjaxRequestTarget target){
        if (application.getFoundSetManager().getEditRecordList().isEditing()) {
          application.getFoundSetManager().getEditRecordList().stopEditing(false);
          WebEventExecutor.generateResponse(target,getPage());
        }
      }
      @Override protected IAjaxCallDecorator getAjaxCallDecorator(){
        return new AjaxCallDecorator(){
          private static final long serialVersionUID=1L;
          @Override public CharSequence decorateScript(          CharSequence script){
            return "String_Node_Str" + script + "String_Node_Str";
          }
        }
;
      }
    }
);
  }
}