Пример #1
0
  private void populateTableModel(List subconfig) {
    CCActionTable tbl = (CCActionTable) getChild(AMPropertySheetModel.TBL_SUB_CONFIG);
    CCActionTableModel tblModel = (CCActionTableModel) tbl.getModel();
    tblModel.clearAll();

    if (subconfig != null) {
      SerializedField szCache = (SerializedField) getChild(SZ_CACHE);
      List cache = new ArrayList(subconfig.size());

      if (!subconfig.isEmpty()) {
        tblModel.clearAll();
        boolean firstEntry = true;

        for (Iterator iter = subconfig.iterator(); iter.hasNext(); ) {
          if (firstEntry) {
            firstEntry = false;
          } else {
            tblModel.appendRow();
          }
          SMSubConfig conf = (SMSubConfig) iter.next();
          tblModel.setValue(AMPropertySheetModel.TBL_SUB_CONFIG_DATA_NAME, conf.getName());
          tblModel.setValue(AMPropertySheetModel.TBL_SUB_CONFIG_HREF_NAME, conf.getName());
          tblModel.setValue(AMPropertySheetModel.TBL_SUB_CONFIG_DATA_TYPE, conf.getType());
          cache.add(conf);
        }
      }
      szCache.setValue((ArrayList) cache);
    }
  }
  private void populateTableModel(List<SMSubConfig> subConfigs) {
    CCActionTable tbl = (CCActionTable) getChild(TBL_SUB_CONFIG);
    CCActionTableModel tblModel = (CCActionTableModel) tbl.getModel();
    tblModel.clearAll();

    if (CollectionUtils.isEmpty(subConfigs)) {
      return;
    }
    SerializedField szCache = (SerializedField) getChild(SZ_CACHE);
    List<SMSubConfig> cache = new ArrayList<>(subConfigs.size());
    boolean firstEntry = true;

    for (SMSubConfig conf : subConfigs) {
      if (firstEntry) {
        firstEntry = false;
      } else {
        tblModel.appendRow();
      }
      tblModel.setValue(TBL_SUB_CONFIG_DATA_NAME, conf.getName());
      tblModel.setValue(TBL_SUB_CONFIG_HREF_NAME, conf.getName());
      tblModel.setValue(TBL_SUB_CONFIG_DATA_TYPE, conf.getType());
      cache.add(conf);
    }
    szCache.setValue(cache);
  }