Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Sapphire » ListProperty editor and "nested" properties
ListProperty editor and "nested" properties [message #1011132] Mon, 18 February 2013 22:55 Go to next message
Ellen Badgley is currently offline Ellen BadgleyFriend
Messages: 35
Registered: October 2012
Member
I'm not sure how this would be accomplished. I have a ListProperty consisting of a list of Sensor elements. Each Sensor has a series of properties, all declared as ValueProperties. Most of these properties are primitive types, but one is a custom GeoPosition type, representing a basic coordinate:

@XmlBinding(path="position")
@Type(base=GeoPosition.class)
@Label(full="Position", standard = "Position")
@Required
ValueProperty PROP_POSITION = new ValueProperty(TYPE, "position");

Value<GeoPosition> getPosition();
void setPosition(GeoPosition position);
void setPosition(String position);


GeoPosition has two ValueProperties of its own:

@XmlBinding(path="Lat")
@Type(base=BigDecimal.class)
@Required
ValueProperty PROP_LAT = new ValueProperty(TYPE, "Lat");

Value<BigDecimal> getLat();
void setLat(BigDecimal value);
void setLat(String value);
	
@XmlBinding(path="Lon")
@Type(base=BigDecimal.class)
@Required
ValueProperty PROP_LON = new ValueProperty(TYPE, "Lon");

Value<BigDecimal> getLon();
void setLon(BigDecimal value);
void setLon(String value);


I'd like to allow the user to edit the lat/lon in the ListProperty editor, *but* I'm not sure how to do this and preserve the use of the GeoPosition type. Could this be done?

(The alternative is to declare lat and lon as properties of the Sensor type directly and adjust the @XmlBinding annotation accordingly (setting path to "position/lat", for example). This would probably be fine for my purposes, but I'd like to know if I have another option.)
Re: ListProperty editor and "nested" properties [message #1011137 is a reply to message #1011132] Mon, 18 February 2013 23:03 Go to previous messageGo to next message
Konstantin Komissarchik is currently offline Konstantin KomissarchikFriend
Messages: 1077
Registered: July 2009
Senior Member
The list property editor currently can only edit value properties directly contained by the list entry, so you should go ahead and flatten the model like you've described. I can see enhancing the property editor to handle this case, so would you open an enhancement request?

Note that a value property cannot hold a model element (the position property in your snippet). To hold an element, you need either an ElementProperty or an ImpliedElementProperty. See samples.

- Konstantin
Re: ListProperty editor and "nested" properties [message #1011553 is a reply to message #1011137] Tue, 19 February 2013 19:38 Go to previous message
Ellen Badgley is currently offline Ellen BadgleyFriend
Messages: 35
Registered: October 2012
Member
Thanks! Enhancement request created.
Previous Topic:Use EL for Sapphire Validation
Next Topic:Enabling "New Folder" capability for browse button?
Goto Forum:
  


Current Time: Thu Apr 25 05:58:31 GMT 2024

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

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

Back to the top