I use the code below to populate my skin list and give the user the possibility the change the skin at runtime.
public List getSkinChoices() {
List choices = new ArrayList();
String skinFamily = null;
String skinLabel = null;
SkinFactory sf = SkinFactory.getFactory();
FacesContext context = FacesContext.getCurrentInstance();
for (Iterator i = sf.getSkinIds(); i.hasNext();) {
String skinID = (String) i.next();
Skin skin = sf.getSkin(context, skinID);
skinFamily = skin.getFamily();
skinLabel = skinFamily;
if (skin.getRenderKitId().indexOf("desktop") > 0 ) {
choices.add(new SelectItem(skinFamily, skinLabel));
}
}
return choices;
}
Now that i am using Jdev 12.1.3 the method sf.getSkinIds();
is deprecated.
The method is no more loading all skin as usually
Could somebody directes me to the new implementation way? Is there any alternativ to get all availlable skins?
NB: The code about loads all availlable skin in Jdev 12.1.2.
Thanks
The SkinFactory
class is part of the Trinidad API and according to its javadoc, you have to:
Use
SkinProvider#getSkinMetadata()
to get the list of skins supported.
So, you have to do something like this:
Collection<SkinMetadata> supportedSkins = SkinProvider.getSkinMetadata(context);
Iterator<SkinMetadata> iterator = supportedSkins.iterator();
while (iterator.hasNext()) {
SkinMetadata next = iterator.next();
skinFamily = next.getFamily();
//etc.
}