Proper use of/examples for InitialValueService? [message #1015720] |
Fri, 01 March 2013 21:36 |
Ellen Badgley Messages: 35 Registered: October 2012 |
Member |
|
|
I'm facing some confusion about the proper way to initialize an ImpliedElementProperty, and I'm wondering if 1) InitialValueService is the right way to go, and 2) if there are any examples for what I am attempting.
I have a model element type called Node (for simplicity). Node has two properties, a ValueProperty called "Id" and another property representing a location, like so:
@Required
@XmlBinding(path="displayPosition")
@Type(base=GeoPosition.class)
ImpliedElementProperty PROP_DISPLAYPOSITION = new ImpliedElementProperty(TYPE, "displayPosition");
GeoPosition getDisplayPosition();
where GeoPosition is a pretty basic lat/lon pair:
@GenerateImpl
public interface GeoPosition extends IModelElement {
ModelElementType TYPE = new ModelElementType(GeoPosition.class);
@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);
}
When a new Node is created, I want to set an initial value for its <displayPosition>, and I want it to be dynamic (lat/lon computed based on the locations of other model elements of a type other than Node).
What is the proper approach to doing this? I've tried implementing an InitialValueService and applying it to PROP_DISPLAYPOSITION, but it doesn't seem to be triggering. Any advice would be much appreciated.
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03426 seconds