commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Carman" <ja...@carmanconsulting.com>
Subject Re: [betwixt] Problem with java.awt.Color
Date Mon, 21 May 2007 10:25:10 GMT
What platform are you using when you see this problem?  Is it a unix-based
platform ("headless" by any chance)?

On 5/20/07, Markus Härnvi <java@harnvi.net> wrote:
>
> Hi!
>
> 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='1.0' encoding='UTF-8' ?>
> <info primitiveTypes='attribute'>
> <element name="color">
>    <attribute name='className' value='java.awt.Color'/>
>    <hide property="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="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?
>
>     /Markus
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message