commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Markus Härnvi <j...@harnvi.net>
Subject Re: [betwixt] Problem with java.awt.Color
Date Mon, 21 May 2007 12:57:31 GMT

Hi!

> 
> What platform are you using when you see this problem?  Is it a unix-based
> platform ("headless" by any chance)?

One platform is headless (Tomcat). The other is a Swing application 
built on Netbeans Platform.

       /Markus


>> I have an issue (de)serializing instances of java.awt.Color. I have a
>> working solution:
>> 
>> I Added a java.awt packages in my own source code and added a .betwixt
>> file there:
>> 
>> <?xml version=3D'1.0' encoding=3D'UTF-8' ?>
>> <info primitiveTypes=3D'attribute'>
>> <element name=3D"color">
>> <attribute name=3D'className' value=3D'java.awt.Color'/>
>> <hide property=3D"colorSpace"/>
>> <addDefaults/>
>> </element>
>> </info>
>> 
>> Then I implemented ChainedBeanCreator and got the RGB values from the
>> attribute:
>> mapping.getAttributes().getValue("red"), and return a new Color instance.
>> 
>> It works fine, but when used in Tomcat and in an application built on
>> Netbeans Platform the betwixt file is not found. I think it's a
>> classloading issue. Tomcat and Netbeans won't let me load things from
>> the java.awt package inside my jar file. The result is that the RGB
>> values end up as elements instead of attributes, and my
>> ChainedBeanCreator fails.
>> 
>> So, I need to rework the ChainedBeanCreator to work with elements, and
>> I can't figure it out. Here is the resulting XML (without the betwixt
>> file in action):
>> 
>> <color id=3D"1285042238">
>> <RGB><![CDATA[-65536]]></RGB>
>> <alpha><![CDATA[255]]></alpha>
>> <blue><![CDATA[0]]></blue>
>> <green><![CDATA[0]]></green>
>> <red><![CDATA[255]]></red>
>> ....
>> </color>
>> 
>> Anyone have an example on how to work with elements in a
>> ChainedBeanCreator? I guess other people need to deal with
>> java.awt.Color properties?



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message