If there are less than 2 columns in any given tab, freak out and fill it in with defaults... Also log that information. ALSO don't try to make JBidwatcher 0x0 pixels if the display.cfg file is corrupt. Hopefully display.cfg will be corrupted less, now that we're closing the file regularly.
- M jbidwatcher/trunk/src/com/jbidwatcher/ui/table/AuctionTable.java view
- M jbidwatcher/trunk/src/com/jbidwatcher/util/config/JConfig.java view
| 564 | 597 | |
|---|---|---|
| 4 | 4 | import com.jbidwatcher.util.config.JConfig; |
| 5 | 5 | import com.jbidwatcher.util.config.ErrorManagement; |
| 6 | 6 | import com.jbidwatcher.util.Constants; |
| 7 | import com.jbidwatcher.util.queue.SuperQueue; | |
| 7 | 8 | |
| 8 | 9 | import javax.swing.*; |
| 9 | 10 | import javax.swing.table.TableModel; |
| --- | --- | |
| 139 | 140 | } |
| 140 | 141 | } |
| 141 | 142 | |
| 143 | private static final String[][] DEFAULT_COLUMNS = new String[][]{ | |
| 144 | {"Number", "100"}, | |
| 145 | {"Current", "89"}, | |
| 146 | {"Max", "62"}, | |
| 147 | {"Description", "297"}, | |
| 148 | {"Time left", "127"}, | |
| 149 | {"Status", "67"}, | |
| 150 | {"Seller", "147"}, | |
| 151 | }; | |
| 152 | ||
| 153 | private static int notify_delay = 0; | |
| 154 | ||
| 142 | 155 | private void loadColumnSettings(String prefix, TableModel atm) { |
| 143 | 156 | String curColumnName = ""; |
| 144 | 157 | |
| --- | --- | |
| 175 | 188 | ErrorManagement.logDebug("No longer loading column widths from configuration."); |
| 176 | 189 | } |
| 177 | 190 | |
| 191 | // If there are less than 2 columns, freak out and refresh. | |
| 192 | if(initialToSaved.size() < 2) { | |
| 193 | SuperQueue.getInstance().preQueue("NOTIFY Column data for '" + prefix + "' was corrupted; resetting to defaults", "Swing", System.currentTimeMillis() + Constants.ONE_SECOND * 12 + notify_delay); | |
| 194 | ErrorManagement.logMessage("Column data for '\" + prefix + \"' was corrupted; resetting to defaults"); | |
| 195 | notify_delay += 2 * Constants.ONE_SECOND; | |
| 196 | for(String[] column : DEFAULT_COLUMNS) { | |
| 197 | if(column[0].equals("Time left") && prefix.equals("complete")) continue; | |
| 198 | ||
| 199 | TableColumn tc = new TableColumn(TableColumnController.getInstance().getColumnNumber(column[0])); | |
| 200 | tc.setHeaderValue(column[0]); | |
| 201 | tc.setIdentifier(column[0]); | |
| 202 | addColumn(tc); | |
| 203 | getColumn(column[0]).setPreferredWidth(Integer.parseInt(column[1])); | |
| 204 | getColumn(column[0]).setWidth(Integer.parseInt(column[1])); | |
| 205 | } | |
| 206 | } | |
| 207 | ||
| 178 | 208 | if(!initialToSaved.isEmpty()) { |
| 179 | 209 | for (String colName : initialToSaved.keySet()) { |
| 180 | 210 | int colFrom = getColumnModel().getColumnIndex(colName); |
