Java Solaris Communities Sun Store Join SDN My Profile Why Join?
 
Bug Database
Bug Detail
Quick Lists
Top 25 Bugs
Top 25 RFE's
Recently Closed Bugs
Printable Page Printable Page


Bug Database
Bug ID: 5056424
Votes 0
Synopsis Loading a SynthStyle and its resources from any URL
Category java:classes_swing
Reported Against tiger-beta2
Release Fixed mustang(b53)
State 10-Fix Delivered, request for enhancement
Priority: 4-Low
Related Bugs
Submit Date 02-JUN-2004
Description


A DESCRIPTION OF THE REQUEST :
The current "load" method of SynthLookAndFeel requires to pass a "Class"  customer  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) 
======================================================================
Posted Date : 2005-09-01 18:06:20.0
Work Around
N/A
Evaluation

  xxxxx@xxxxx  , thought you might want to own this one for a bit.
  xxxxx@xxxxx   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.
  xxxxx@xxxxx   2004-06-04
Posted Date : 2005-09-13 18:06:16.0
Comments
  
  Include a link with my name & email   

Submitted On 05-JUN-2004
l2fprod
I had another look at the issue and maybe you want to let the user specify how he want to load image not only by using an URL as a base. Instead of "load(style, url)", you have "load(style, imageResolver)" where imageResolver is an interface with a method like "Icon load(string path)", this could let the user load image from any places. don't know if it is useful now...



PLEASE NOTE: JDK6 is formerly known as Project Mustang