Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[sapphire-dev] Removing empty element too aggressive

I have the following xml snippet to model:
 
<train-stop>
    <outcome>asas</outcome>
    <sequential>sadasd</sequential>
    <skip>ser</skip>
    <ignore>asdas</ignore>
</train-stop>
Here are "TrainStop" and  the "Outcome" property:
 
    // *** TrainStop ***
 
    @Type( base = Boolean.class )
    @Label( standard = "train stop" )
    @CustomXmlValueBinding( impl = BooleanElementBinding.class, params = "train-stop" )
    @DefaultValue( text = "false" )
    @Service( impl = TrainStopValidator.class )
    @DependsOn("/TaskFlow/Train")
    @Enablement( expr = "${parent().parent().BoundedTaskFlow}" )
 
    ValueProperty PROP_TRAIN_STOP = new ValueProperty( TYPE, "TrainStop" );
   
    Value<Boolean> isTrainStop();
    void setTrainStop( String value );
    void setTrainStop( Boolean value );
 
    // *** Outcome ***
 
   @XmlBinding( path = "train-stop/outcome")
   @Label(standard = "outcome")
   @Enablement( expr = "${ parent().parent().BoundedTaskFlow && TrainStop }" )
 
   ValueProperty PROP_OUTCOME = new ValueProperty( TYPE, "Outcome" ); 
   Value<String> getOutcome();
   void setOutcome(String outcome); 
 
Sequential, Skip and Ignore properties are modeled similiarly.

In UI, Outcome, Sequential, Skip and Ignore properties are only enabled when the TrainStop's value is "true".
 
If user edits "Outcome" property (or Sequential, Skip, Ignore properties) and then clears it, then <train-stop> element gets removed as well. This causes undesired result. The Train stop check box is unselected.
 
Any recommendation in how to fix this issue?
 
Thanks,
 
Shenxue

Back to the top