< prev index next >
src/share/classes/javax/swing/plaf/synth/DefaultSynthStyleFactory.java
Print this page
rev 1580 : 6727661: Code improvement and warnings removing from the swing/plaf packages
Summary: Removed unnecessary castings and other warnings
Reviewed-by: alexp
Contributed-by: Florian Brunner <fbrunnerlist@gmx.ch>
*** 61,82 ****
private BakedArrayList _tmpList;
/**
* Maps from a List (BakedArrayList to be precise) to the merged style.
*/
! private Map _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();
}
public synchronized void addStyle(DefaultSynthStyle style,
String path, int type) throws PatternSyntaxException {
if (path == null) {
--- 61,82 ----
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) {
*** 136,146 ****
/**
* Fetches any styles that match the passed into arguments into
* <code>matches</code>.
*/
! private void getMatchingStyles(java.util.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 matches, JComponent c,
Region id) {
String idName = id.getLowerCaseName();
String cName = c.getName();
if (cName == null) {
*** 164,195 ****
}
/**
* Caches the specified style.
*/
! private void cacheStyle(java.util.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(java.util.List styles) {
if (styles.size() == 0) {
return null;
}
! return (SynthStyle)_resolvedStyles.get(styles);
}
/**
* 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(java.util.List styles) {
int size = styles.size();
if (size == 0) {
return null;
}
--- 164,195 ----
}
/**
* 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);
}
/**
* 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;
}
< prev index next >