src/share/classes/javax/swing/plaf/synth/DefaultSynthStyleFactory.java

Print this page

        

*** 56,82 **** */ private List<StyleAssociation> _styles; /** * Used during lookup. */ ! private BakedArrayList _tmpList; /** * Maps from a List (BakedArrayList to be precise) to the merged style. */ ! private Map<BakedArrayList, SynthStyle> _resolvedStyles; /** * Used if there are no styles matching a widget. */ private SynthStyle _defaultStyle; DefaultSynthStyleFactory() { ! _tmpList = new BakedArrayList(5); ! _styles = new ArrayList<StyleAssociation>(); ! _resolvedStyles = new HashMap<BakedArrayList, SynthStyle>(); } public synchronized void addStyle(DefaultSynthStyle style, String path, int type) throws PatternSyntaxException { if (path == null) { --- 56,82 ---- */ private List<StyleAssociation> _styles; /** * Used during lookup. */ ! private BakedArrayList<SynthStyle> _tmpList; /** * Maps from a List (BakedArrayList to be precise) to the merged style. */ ! private Map<BakedArrayList<SynthStyle>, SynthStyle> _resolvedStyles; /** * Used if there are no styles matching a widget. */ private SynthStyle _defaultStyle; DefaultSynthStyleFactory() { ! _tmpList = new BakedArrayList<SynthStyle>(5); ! _styles = new ArrayList<>(); ! _resolvedStyles = new HashMap<>(); } public synchronized void addStyle(DefaultSynthStyle style, String path, int type) throws PatternSyntaxException { if (path == null) {
*** 98,108 **** * * @param c Component asking for * @param id ID of the Component */ public synchronized SynthStyle getStyle(JComponent c, Region id) { ! BakedArrayList matches = _tmpList; matches.clear(); getMatchingStyles(matches, c, id); if (matches.size() == 0) { --- 98,108 ---- * * @param c Component asking for * @param id ID of the Component */ public synchronized SynthStyle getStyle(JComponent c, Region id) { ! BakedArrayList<SynthStyle> matches = _tmpList; matches.clear(); getMatchingStyles(matches, c, id); if (matches.size() == 0) {
*** 136,146 **** /** * Fetches any styles that match the passed into arguments into * <code>matches</code>. */ ! private void getMatchingStyles(List matches, JComponent c, Region id) { String idName = id.getLowerCaseName(); String cName = c.getName(); if (cName == null) { --- 136,146 ---- /** * Fetches any styles that match the passed into arguments into * <code>matches</code>. */ ! private void getMatchingStyles(List<SynthStyle> matches, JComponent c, Region id) { String idName = id.getLowerCaseName(); String cName = c.getName(); if (cName == null) {
*** 164,183 **** } /** * Caches the specified style. */ ! private void cacheStyle(List styles, SynthStyle style) { ! BakedArrayList cachedStyles = new BakedArrayList(styles); _resolvedStyles.put(cachedStyles, style); } /** * Returns the cached style from the passed in arguments. */ ! private SynthStyle getCachedStyle(List styles) { if (styles.size() == 0) { return null; } return _resolvedStyles.get(styles); } --- 164,183 ---- } /** * Caches the specified style. */ ! private void cacheStyle(List<SynthStyle> styles, SynthStyle style) { ! BakedArrayList<SynthStyle> cachedStyles = new BakedArrayList<>(styles); _resolvedStyles.put(cachedStyles, style); } /** * Returns the cached style from the passed in arguments. */ ! private SynthStyle getCachedStyle(List<SynthStyle> styles) { // ?? if (styles.size() == 0) { return null; } return _resolvedStyles.get(styles); }
*** 185,195 **** /** * Creates a single Style from the passed in styles. The passed in List * is reverse sorted, that is the most recently added style found to * match will be first. */ ! private SynthStyle mergeStyles(List styles) { int size = styles.size(); if (size == 0) { return null; } --- 185,195 ---- /** * Creates a single Style from the passed in styles. The passed in List * is reverse sorted, that is the most recently added style found to * match will be first. */ ! private SynthStyle mergeStyles(List<SynthStyle> styles) { int size = styles.size(); if (size == 0) { return null; }