avatar

564

Preserve column settings during an 'addTab' event, so it uses existing display.cfg settings if it can find them.

by mrs, 21 Jul, 2008 02:40 AM
553 564  
5353     } while (tabName != null);
5454   }
5555 
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    */
5666   AuctionListHolder addTab(String newTab) {
5767     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     }
6173     AuctionListHolder newList = new AuctionListHolder(newTab, mainBackground);
6274     mList.add(newList);
6375     return newList;
556 564  
4949 
5050     setModel(atm);
5151     loadColumnSettings(name, atm);
52     doLayout();
5253   }
5354 
5455   public String getToolTipText(MouseEvent event) {
------
164165             initialToSaved.put(curColumnName, Integer.parseInt(colIndex));
165166           }
166167           getColumn(curColumnName).setPreferredWidth(Integer.parseInt(colWidth));
168           getColumn(curColumnName).setWidth(Integer.parseInt(colWidth));
167169         }
168170       }
169171     } catch(Exception e) {
476 564  
502502     return displayProperty.getProperty(query, null);
503503   }
504504 
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 
505516   public static String queryDisplayProperty(String query, String inDefault) {
506517     String retVal = queryDisplayProperty(query);
507518