public ObjectTableSorter(ObjectTableModel model) { this.model = model; this.valueComparators = new Comparator<?>[this.model.getColumnCount()]; for (int i = 0; i < valueComparators.length; i++) { this.setValueComparator(i, null); } setFallbackComparator(null); }
/** * We use this method to get the data, since we are using * ObjectTableModel, so the calling getDataVector doesn't * work as expected. * * @param model {@link ObjectTableModel} * @param formats Array of {@link Format} array can contain null formatters in this case value is added as is * @return the data from the model */ public static List<List<Object>> getAllTableData(ObjectTableModel model, Format[] formats) { List<List<Object>> data = new ArrayList<>(); if (model.getRowCount() > 0) { for (int rw = 0; rw < model.getRowCount(); rw++) { int cols = model.getColumnCount(); List<Object> column = new ArrayList<>(); data.add(column); for (int idx = 0; idx < cols; idx++) { Object val = model.getValueAt(rw, idx); if (formats[idx] != null) { column.add(formats[idx].format(val)); } else { column.add(val); } } } } return data; }
/** * We use this method to get the data, since we are using * ObjectTableModel, so the calling getDataVector doesn't * work as expected. * * @param model {@link ObjectTableModel} * @param formats Array of {@link Format} array can contain null formatters in this case value is added as is * @return the data from the model */ public static List<List<Object>> getAllTableData(ObjectTableModel model, Format[] formats) { List<List<Object>> data = new ArrayList<List<Object>>(); if (model.getRowCount() > 0) { for (int rw = 0; rw < model.getRowCount(); rw++) { int cols = model.getColumnCount(); List<Object> column = new ArrayList<Object>(); data.add(column); for (int idx = 0; idx < cols; idx++) { Object val = model.getValueAt(rw, idx); if (formats[idx] != null) { column.add(formats[idx].format(val)); } else { column.add(val); } } } } return data; }
/** * We use this method to get the data, since we are using * ObjectTableModel, so the calling getDataVector doesn't * work as expected. * @param model {@link ObjectTableModel} * @param formats Array of {@link Format} array can contain null formatters in this case value is added as is * @return the data from the model */ public static List<List<Object>> getAllTableData(ObjectTableModel model, Format[] formats) { List<List<Object>> data = new ArrayList<>(); if (model.getRowCount() > 0) { for (int rw=0; rw < model.getRowCount(); rw++) { int cols = model.getColumnCount(); List<Object> column = new ArrayList<>(); data.add(column); for (int idx=0; idx < cols; idx++) { Object val = model.getValueAt(rw,idx); if(formats[idx] != null) { column.add(formats[idx].format(val)); } else { column.add(val); } } } } return data; }
for(int i=0;i<getColumnCount();i++){ Functor setMethod = writeFunctors.get(i); if (setMethod != null