src/share/classes/sun/swing/plaf/synth/DefaultSynthStyle.java
Print this page
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 2002, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
@@ -59,11 +59,11 @@
*/
private StateInfo[] states;
/**
* User specific data.
*/
- private Map data;
+ private Map<Object, Object> data;
/**
* Font to use if there is no matching StateInfo, or the StateInfo doesn't
* define one.
*/
@@ -104,11 +104,11 @@
counter--) {
states[counter] = (StateInfo)style.states[counter].clone();
}
}
if (style.data != null) {
- data = new HashMap();
+ data = new HashMap<>();
data.putAll(style.data);
}
font = style.font;
synthGraphics = style.synthGraphics;
painter = style.painter;
@@ -122,11 +122,11 @@
* an opaque color
* @param states StateInfos describing properties per state
* @param data Style specific data.
*/
public DefaultSynthStyle(Insets insets, boolean opaque,
- StateInfo[] states, Map data) {
+ StateInfo[] states, Map<Object, Object> data) {
this.insets = insets;
this.opaque = opaque;
this.states = states;
this.data = data;
}
@@ -364,20 +364,20 @@
* Sets style specific values. This does NOT copy the data, it
* assigns it directly to this Style.
*
* @param data Style specific values
*/
- public void setData(Map data) {
+ public void setData(Map<Object, Object> data) {
this.data = data;
}
/**
* Returns the style specific data.
*
* @return Style specific data.
*/
- public Map getData() {
+ public Map<Object, Object> getData() {
return data;
}
/**
* Getter for a region specific style property.
@@ -400,11 +400,11 @@
return getKeyFromData(data, key);
return getDefaultValue(state, key);
}
- private Object getKeyFromData(Map stateData, Object key) {
+ private Object getKeyFromData(Map<Object, Object> stateData, Object key) {
Object value = null;
if (stateData != null) {
synchronized(stateData) {
value = stateData.get(key);
@@ -460,11 +460,11 @@
for (int counter = states.length - 1; counter >= 0; counter--) {
style.states[counter] = (StateInfo)states[counter].clone();
}
}
if (data != null) {
- style.data = new HashMap();
+ style.data = new HashMap<>();
style.data.putAll(data);
}
return style;
}
@@ -568,11 +568,11 @@
}
}
}
if (data != null) {
if (style.data == null) {
- style.data = new HashMap();
+ style.data = new HashMap<>();
}
style.data.putAll(data);
}
return style;
}
@@ -706,11 +706,11 @@
/**
* StateInfo represents Style information specific to the state of
* a component.
*/
public static class StateInfo {
- private Map data;
+ private Map<Object, Object> data;
private Font font;
private Color[] colors;
private int state;
/**
@@ -744,25 +744,25 @@
public StateInfo(StateInfo info) {
this.state = info.state;
this.font = info.font;
if(info.data != null) {
if(data == null) {
- data = new HashMap();
+ data = new HashMap<>();
}
data.putAll(info.data);
}
if (info.colors != null) {
this.colors = new Color[info.colors.length];
System.arraycopy(info.colors, 0, colors, 0,info.colors.length);
}
}
- public Map getData() {
+ public Map<Object, Object> getData() {
return data;
}
- public void setData(Map data) {
+ public void setData(Map<Object, Object> data) {
this.data = data;
}
/**
* Sets the font for this state.
@@ -834,11 +834,11 @@
if (font != null) {
info.font = font;
}
if(data != null) {
if(info.data == null) {
- info.data = new HashMap();
+ info.data = new HashMap<>();
}
info.data.putAll(data);
}
if (colors != null) {
if (info.colors == null) {