Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Sapphire » Custom Data Binding
Custom Data Binding [message #645884] Mon, 20 December 2010 22:39 Go to next message
Werner Keil is currently offline Werner KeilFriend
Messages: 1087
Registered: July 2009
Senior Member
This looks very interesting.

// *** ProductVersion ***

@Type( base = ProductVersion.class )
@XmlBinding( path = "version" )
@Label( standard = "version" )
@DefaultValue( "2.5" )

ValueProperty PROP_PRODUCT_VERSION = new ValueProperty( TYPE,
"ProductVersion" );

Value<ProductVersion> getProductVersion();
void setProductVersion( String value );
void setProductVersion( ProductVersion value );

I suppose, this may also work for my own or ICU4J datatypes?

Something like
Value<Unit> getUnit();
void setUnit(Unit unit);

Aiming for a Unit Converter using Sapphire.
Would that work?

Thanks,
Werner
Re: Custom Data Binding [message #645899 is a reply to message #645884] Tue, 21 December 2010 03:43 Go to previous messageGo to next message
Konstantin Komissarchik is currently offline Konstantin KomissarchikFriend
Messages: 1077
Registered: July 2009
Senior Member
In this case, ProductVersion is an enum which Sapphire supports natively, but..

Sapphire can store any object in a value property as long as you can write serialization service for it (read/write to string). It is highly recommended (but not enforced) that the object is immutable.

I see that there is no sample showing use of a custom value type, but in short you implement ValueSerializationService. Then you either...

1. Add @ValueSerialization annotation to your property with a reference to your serializer class, or

2. Register the serializer globally by creating sapphire-extension.xml file in your plugin's META-INF directory. Make sure that you are using version 0.2 of Sapphire and that you have Sapphire SDK installed in your dev eclipse. You will get an editor that will help you edit the extension file.

Let us know if you run into any issues.

- Konstantin
Re: Custom Data Binding [message #645932 is a reply to message #645899] Tue, 21 December 2010 09:01 Go to previous messageGo to next message
Werner Keil is currently offline Werner KeilFriend
Messages: 1087
Registered: July 2009
Senior Member
Thanks,

Do you think you could provide such sample at least in the course of 0.2 ?

UOMo 0.6 is scheduled about a month later, so I'd love to do something here.
Considering both projects were "born" on the same day (20-10-2010) it makes
sense ;-)

I know, Google may not have been Oracle's "Best Friend" lately, but how do
you see the WindowBuilder proposal, and are there potential synergies with
Sapphire?

Last but not leas, I'd appreciate further docs also at Eclipse.org about
i18n and how it may fit in with Babel.

Naturally I asked the same question to Eric from WB, and Google's proposal
contains some very good Locale and i18n support for many different platforms
as it seems.

Happy "Lunar Eclipse",
Werner
Re: Custom Data Binding [message #646251 is a reply to message #645932] Wed, 22 December 2010 21:48 Go to previous messageGo to next message
Konstantin Komissarchik is currently offline Konstantin KomissarchikFriend
Messages: 1077
Registered: July 2009
Senior Member
> Do you think you could provide such sample at least in the course of 0.2 ?

Yes. That shouldn't take more than a few minutes. I have opened a tracker bug:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=333118

> how do you see the WindowBuilder proposal, and are there potential
> synergies with Sapphire?

I was happy to see the WindowBuilder contribution. I understand that the editor framework is pretty flexible. If so, it could be a foundation on which Sapphire's future WYSIWYG editor is built on.

> Last but not leas, I'd appreciate further docs also at Eclipse.org about
> i18n and how it may fit in with Babel.

There is discussion of Sapphire's localization system in the developer guide that is part of the SDK. I have just confirmed with Babel project that they are capable of using property files from build rather than the source control system. A project that uses Sapphire would give Babel a reference to its p2 repository, rather than the source control system. Sapphire generates standard property files during build, so that should all be compatible with Babel or other translation tools.

http://www.eclipse.org/forums/index.php?t=msg&th=202171& amp;start=0&S=f3ca5d69fbf0e6143713e109046082bb

- Konstantin
Re: Custom Data Binding [message #647169 is a reply to message #646251] Tue, 04 January 2011 20:20 Go to previous message
Konstantin Komissarchik is currently offline Konstantin KomissarchikFriend
Messages: 1077
Registered: July 2009
Senior Member
The custom value types sample is now available in 0.2 source/build. See Bug 333118 for more details.
Previous Topic:@NoDuplicates not trigger validation
Next Topic:Announcing Sapphire 0.1 and 0.2
Goto Forum:
  


Current Time: Sat Apr 20 03:05:24 GMT 2024

Powered by FUDForum. Page generated in 0.02926 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top