Ejemplo n.º 1
0
  public AbstractDataTable(final Class<T> dataModelClass, final List<T> data) {
    super();
    try {
      this.dataModelClass = dataModelClass;
      this.dataTable = GeneralUtil.getDataTable(dataModelClass);
      this.colMetaData = GeneralUtil.getDataTableFields(this.dataModelClass);
      final int noOfRows;
      if (this.dataTable.fixNoOfRows()) {
        noOfRows = data.size();
      } else {
        if (data == null) {
          noOfRows = this.dataTable.minNoOfRows();
        } else {
          if (this.dataTable.minNoOfRows() > data.size()) {
            noOfRows = this.dataTable.minNoOfRows();
          } else {
            noOfRows = data.size() + 1;
          }
        }
      }

      this.setModel(
          new AbstractDataTableModel<T>(
              this, data, this.dataModelClass, this.dataTable, this.colMetaData, noOfRows));
      putClientProperty("terminateEditOnFocusLost", Boolean.TRUE);
      validateTableFields();
    } catch (Exception exception) {
      throw new UtilException(exception);
    }
  }
Ejemplo n.º 2
0
 public AbstractDataTable(final Class<T> dataModelClass) {
   super();
   try {
     this.dataModelClass = dataModelClass;
     this.dataTable = GeneralUtil.getDataTable(dataModelClass);
     this.colMetaData = GeneralUtil.getDataTableFields(this.dataModelClass);
     this.setModel(
         new AbstractDataTableModel<T>(
             this,
             new LinkedList<T>(),
             this.dataModelClass,
             this.dataTable,
             this.colMetaData,
             this.dataTable.minNoOfRows()));
     putClientProperty("terminateEditOnFocusLost", Boolean.TRUE);
     validateTableFields();
     // this.setcDefaultRenderer( Object.class, new AbstractDataTableCellRenderer(
     //        this.getModel() ));
   } catch (Exception exception) {
     throw new UtilException(exception);
   }
 }