<commit_before>package com.foc.vaadin.gui.components;

import java.text.Format;

import org.xml.sax.Attributes;

import com.foc.Globals;
import com.foc.dataWrapper.FocDataWrapper;
import com.foc.dataWrapper.FocListWrapper;
import com.foc.desc.FocDesc;
import com.foc.desc.FocObject;
import com.foc.desc.field.FNumField;
import com.foc.list.FocList;
import com.foc.property.FInt;
import com.foc.property.FProperty;
import com.foc.shared.dataStore.IFocData;
import com.foc.vaadin.gui.FocXMLGuiComponent;
import com.foc.vaadin.gui.FocXMLGuiComponentDelegate;
import com.foc.vaadin.gui.xmlForm.FXML;
import com.foc.vaadin.gui.xmlForm.FocXMLAttributes;
import com.vaadin.data.Property;
import com.vaadin.server.Resource;
import com.vaadin.ui.Field;
import com.vaadin.ui.Table;

@SuppressWarnings("serial")
public class FVTable extends Table implements FocXMLGuiComponent, ITableTree{
  
  private FocListWrapper    focListWrapper         = null;   
  private TableTreeDelegate tableTreeDelegate      = null;
  private FocXMLGuiComponentDelegate delegate      = null;
  private boolean           focListWrapper_Owner   = false;
  
  public FVTable(Attributes attributes) {
  	getTableTreeDelegate(attributes);
  	delegate = new FocXMLGuiComponentDelegate(this);
    init(attributes);
//    if(Globals.getApp().isUnitTest()) {
//    	setCacheRate(1000);
//    }
//    addStyleName(ValoTheme.TABLE_COMPACT);
  }
    
  @Override
  public void dispose(){
    if(delegate != null){
      delegate.dispose();
      delegate = null;
    }
    if(focListWrapper != null){
    	if(focListWrapper_Owner) focListWrapper.dispose();
      focListWrapper = null;
    }
    focListWrapper_Owner = false;    
    if(tableTreeDelegate != null){
      tableTreeDelegate.dispose();
      tableTreeDelegate = null;
    }
  }

	private void init(Attributes attributes){
    getTableTreeDelegate().init();
  }
  
  public FocList getFocList(){
    return (focListWrapper != null) ? focListWrapper.getFocList() : null; 
  }
  
  public void applyFocListAsContainer(){
    //getDelegate().adjustGeneratedColumns();
  	getTableTreeDelegate().pushVisibleColumns();
  	getTableTreeDelegate().setContainerDataSource(focListWrapper);
//    setColumnCollapsed(focListWrapper, true);
    setAttributes(getAttributes());
    <commit_msg>Take into account the Gui XML attribute "maskDataFoundError" for Tables.<commit_after>package com.foc.vaadin.gui.components;

import java.text.Format;

import org.xml.sax.Attributes;

import com.foc.Globals;
import com.foc.dataWrapper.FocDataWrapper;
import com.foc.dataWrapper.FocListWrapper;
import com.foc.desc.FocDesc;
import com.foc.desc.FocObject;
import com.foc.desc.field.FNumField;
import com.foc.list.FocList;
import com.foc.property.FInt;
import com.foc.property.FProperty;
import com.foc.shared.dataStore.IFocData;
import com.foc.vaadin.gui.FocXMLGuiComponent;
import com.foc.vaadin.gui.FocXMLGuiComponentDelegate;
import com.foc.vaadin.gui.xmlForm.FXML;
import com.foc.vaadin.gui.xmlForm.FocXMLAttributes;
import com.vaadin.data.Property;
import com.vaadin.server.Resource;
import com.vaadin.ui.Field;
import com.vaadin.ui.Table;

@SuppressWarnings("serial")
public class FVTable extends Table implements FocXMLGuiComponent, ITableTree{
  
  private FocListWrapper    focListWrapper         = null;   
  private TableTreeDelegate tableTreeDelegate      = null;
  private FocXMLGuiComponentDelegate delegate      = null;
  private boolean           focListWrapper_Owner   = false;
  
  public FVTable(Attributes attributes) {
  	getTableTreeDelegate(attributes);
  	delegate = new FocXMLGuiComponentDelegate(this);
    init(attributes);
//    if(Globals.getApp().isUnitTest()) {
//    	setCacheRate(1000);
//    }
//    addStyleName(ValoTheme.TABLE_COMPACT);
  }
    
  @Override
  public void dispose(){
    if(delegate != null){
      delegate.dispose();
      delegate = null;
    }
    if(focListWrapper != null){
    	if(focListWrapper_Owner) focListWrapper.dispose();
      focListWrapper = null;
    }
    focListWrapper_Owner = false;    
    if(tableTreeDelegate != null){
      tableTreeDelegate.dispose();
      tableTreeDelegate = null;
    }
  }

	private void init(Attributes attributes){
    getTableTreeDelegate().init();
  }
  
  public FocList getFocList(){
    return (focListWrapper != null) ? focListWrapper.getFocList() : null; 
  }
  
  public void applyFocListAsContainer(){
  	try {
	    //getDelegate().adjustGeneratedColumns();
	  	getTableTreeDelegate().pushVisibleColumns();
	  	getTableTreeDelegate().setContainerDataSource(focListWrapper);
	//    setColumnCollapsed(focListWrapper, true);
	    setAttributes(getAttributes());
  	} catch (IllegalArgumentException e1) {
  		String value = getAttributes() != null ? getAttributes().getValue(FXML.ATT_MASK_DATA_FOUND_ERROR) : null;
  		if(value == null || (!value.equalsIgnoreCase("true") && !value.equals("1"))){
  			Globals.logException(e1);
  		}
  	} catch (Exception e) {
  		Globals.logException(e);
  	}
{'fraction_non_alphanumeric': 0.11217756448710257, 'fraction_numerical': 0.0021995600879824036, 'mean_word_length': 4.088504577822991, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 6}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1691025', 'n_tokens_mistral': 1663, 'n_tokens_neox': 1627, 'n_words': 272}