Preserve column settings during an 'addTab' event, so it uses existing display.cfg settings if it can find them.
- M jbidwatcher/trunk/src/com/jbidwatcher/ui/FilterManager.java view
- M jbidwatcher/trunk/src/com/jbidwatcher/ui/table/AuctionTable.java view
- M jbidwatcher/trunk/src/com/jbidwatcher/util/config/JConfig.java view
| 553 | 564 | |
|---|---|---|
| 53 | 53 | } while (tabName != null); |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | /** | |
| 57 | * Creates a new tab by copying the background color from the main tab, | |
| 58 | * looking for an existing set of column settings, and copying them as | |
| 59 | * well from the main tab if they don't already exist. | |
| 60 | * | |
| 61 | * @param newTab - The name of the new tab to create. | |
| 62 | * | |
| 63 | * @return - An AuctionListHolder that encapsulates the UI and List | |
| 64 | * for the new tab. | |
| 65 | */ | |
| 56 | 66 | AuctionListHolder addTab(String newTab) { |
| 57 | 67 | Color mainBackground = mMainTab.getUI().getBackground(); |
| 58 | Properties dispProps = new Properties(); | |
| 59 | mMainTab.getUI().getColumnWidthsToProperties(dispProps, newTab); | |
| 60 | JConfig.addAllToDisplay(dispProps); | |
| 68 | Properties dispProps = JConfig.multiMatchDisplay(newTab + "."); | |
| 69 | if(dispProps.isEmpty()) { | |
| 70 | mMainTab.getUI().getColumnWidthsToProperties(dispProps, newTab); | |
| 71 | JConfig.addAllToDisplay(dispProps); | |
| 72 | } | |
| 61 | 73 | AuctionListHolder newList = new AuctionListHolder(newTab, mainBackground); |
| 62 | 74 | mList.add(newList); |
| 63 | 75 | return newList; |
| 556 | 564 | |
|---|---|---|
| 49 | 49 | |
| 50 | 50 | setModel(atm); |
| 51 | 51 | loadColumnSettings(name, atm); |
| 52 | doLayout(); | |
| 52 | 53 | } |
| 53 | 54 | |
| 54 | 55 | public String getToolTipText(MouseEvent event) { |
| --- | --- | |
| 164 | 165 | initialToSaved.put(curColumnName, Integer.parseInt(colIndex)); |
| 165 | 166 | } |
| 166 | 167 | getColumn(curColumnName).setPreferredWidth(Integer.parseInt(colWidth)); |
| 168 | getColumn(curColumnName).setWidth(Integer.parseInt(colWidth)); | |
| 167 | 169 | } |
| 168 | 170 | } |
| 169 | 171 | } catch(Exception e) { |
| 476 | 564 | |
|---|---|---|
| 502 | 502 | return displayProperty.getProperty(query, null); |
| 503 | 503 | } |
| 504 | 504 | |
| 505 | public static Properties multiMatchDisplay(String query) { | |
| 506 | Properties p = new Properties(); | |
| 507 | for(Object key : displayProperty.keySet()) { | |
| 508 | if(((String)key).startsWith(query)) { | |
| 509 | p.setProperty((String)key, displayProperty.getProperty((String)key)); | |
| 510 | } | |
| 511 | } | |
| 512 | ||
| 513 | return p; | |
| 514 | } | |
| 515 | ||
| 505 | 516 | public static String queryDisplayProperty(String query, String inDefault) { |
| 506 | 517 | String retVal = queryDisplayProperty(query); |
| 507 | 518 | |
