United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-5056424 Loading a SynthStyle and its resources from any URL
JDK-5056424 : Loading a SynthStyle and its resources from any URL

Details
Type:
Enhancement
Submit Date:
2004-06-02
Status:
Resolved
Updated Date:
2005-09-20
Project Name:
JDK
Resolved Date:
2005-09-20
Component:
client-libs
OS:
windows_xp
Sub-Component:
javax.swing
CPU:
x86
Priority:
P4
Resolution:
Fixed
Affected Versions:
5.0
Fixed Versions:

Related Reports

Sub Tasks

Description
Name: gm110360			Date: 06/02/2004


A DESCRIPTION OF THE REQUEST :
The current "load" method of SynthLookAndFeel requires to pass a "Class" object to resolve the resources inside the style: "load(InputStream input, Class<?> resourceBase)".

Now let's suppose I have written a style made of several images (I'm using the SynthLookAndFeel and no custom painters). In the style file, I reference the images relatively to the style file.

I have the following files in the "mystyle" folder:
style.xml
images/checkbox-selected.png
images/checkbox-unselected.png

Case 1: I have my style and icons in the jar of my application.
Solution 1:
I need to have a "Class" in the same package of "style.xml". This class will serve as a hook to get the resources. I'm ok with that.

Case 2: I have several styles packaged, each packaged in zip files, those zip files are not in the classpath. How can I load my styles?
Solution 2.1:
I do not see any way to do it with the current implementation. If I had a method like "load(URL styleXml)" where the styleXML url context would be used to load the resources, it would be enough. Better would be to support this concept of "self-contained themes" (aka themepacks in SkinLF) and to be able to load the style with "loadStyle(URL styleZIP)".
Solution 2.2:
Write my own custom "SynthParser" and fill the SynthStyleFactory from this new "SynthParser". Should not this be built in Swing instead?




JUSTIFICATION :
Having an easier way to load the style from any location would make it possible to bundle styles in one zip/jar theme. This will ease the job of graphics designer and could help to spread the concept of SynthLookAndFeel and style files (having the equivalent of www.themexp.org but with Java themes).

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
New methods to be added to SynthLookAndFeel to load a theme from a "zip file" or to provide an URL as the resourceBase instead of a class.
(Incident Review ID: 275571) 
======================================================================

                                    

Comments
EVALUATION

Name: sh120115			Date: 06/02/2004

###@###.###, thought you might want to own this one for a bit.
###@###.### 2004-06-02


The class is used as the base, we could certainly ues a URL as the base too.
This is a good idea and should be added.
###@###.### 2004-06-04
                                     
2004-06-02



Hardware and Software, Engineered to Work Together