use of org.apache.pivot.collections.LinkedList in project pivot by apache.
the class Component method setSkin.
/**
* Sets the skin, replacing any previous skin.
*
* @param skin The new skin.
*/
@SuppressWarnings("unchecked")
protected void setSkin(Skin skin) {
Utils.checkNull(skin, "skin");
if (this.skin != null) {
throw new IllegalStateException("Skin is already installed.");
}
this.skin = skin;
styles = new BeanAdapter(skin);
skin.install(this);
// Apply any defined type styles
LinkedList<Class<?>> styleTypes = new LinkedList<>();
Class<?> type = getClass();
while (type != Object.class) {
styleTypes.insert(type, 0);
type = type.getSuperclass();
}
for (Class<?> styleType : styleTypes) {
Map<String, ?> stylesMap = typedStyles.get((Class<? extends Component>) styleType);
if (stylesMap != null) {
setStyles(stylesMap);
}
}
invalidate();
repaint();
}
Aggregations