The developer can now specify a custom collation for a list index, such a collation that ignores letter case differences.
ElementList
{
Index<T> index( ValueProperty property )
Index<T> index( ValueProperty property, Comparator<String> comparator )
Index<T> index( String property )
Index<T> index( String property, Comparator<String> comparator )
}
The new @Collation annotation can be used to specify collation for a property. The specified collation is leveraged by various parts of the framework, such as the NoDuplicates annotation. The @Collation annotation supports Sapphire EL.
@NoDuplicates @Collation( ignoreCaseDifferences = "true" ) ValueProperty PROP_NAME = new ValueProperty( TYPE, "Name" ); Value<String> getName(); void setName( String value );
When more control is necessary, a custom implementation of CollationService can be provided.
@NoDuplicates @Service( impl = ExampleCollationService.class ) ValueProperty PROP_NAME = new ValueProperty( TYPE, "Name" ); Value<String> getName(); void setName( String value );
public class ExampleCollationService extends CollationService
{
@Override
protected Comparator<String> compute()
{
return new Comparator()
{
public int compare( final String a, final String b )
{
...
}
};
}
}
Determine if an element is empty using the new method. An element is empty when all of its properties are empty.
Element
{
public boolean empty()
}
Find all non-empty properties in an element using the new method.
Element
{
public SortedSet<Property> content()
}
Create collections that can be monitored for changes. An Observable wrapper is provided for List, Set and Map.
ObservableMap<String,String> map = new ObservableMap<String,String>();
Listener listener = new Listener()
{
public void handle( final Event event )
{
...
}
};
map.attach( listener );
...
map.detach( listener );
Replaces all occurrences of a regular expression pattern with the provided replacement text. The full semantics
are specified by Java's
${ Message.Replace( "\n", "<br/>" ) }
${ Message.Replace( "[0-9]", "x" ) }
Encodes a string for use as XML element content or an attribute value.
${ Message.EncodeToXml }
Returns a map of global objects maintained through Sapphire.global() API.
Sapphire.global().put( "User", "John" );
${ Global.User }
When the finish operation of a SapphireWizard fails with an error status, a dialog is opened showing the failure message. In some cases, customization of the failure handling behavior is desired.
SapphireWizard
{
protected boolean handleFinishFailure( Status status )
}
Certain use cases require access to the corresponding part from a SapphireWizard instance.
SapphireWizard
{
public WizardPart part()
}
Examining a model in a debug session is difficult as the logical structure is hidden among complex implementation details. A debugger extension is now provided to show the logical structure of elements and properties.