edu.stanford.smi.protegex.owl.ui.widget
Interface OWLWidgetMetadata

All Known Implementing Classes:
AnnotationsWidgetMetadata, DataRangeFieldWidgetMetadata, HeaderWidgetMetadata, MultiLiteralWidgetMetadata, MultiResourceWidgetMetadata, OWLDateTimeWidgetMetadata, OWLDateWidgetMetadata, OWLTimeWidgetMetadata, RDFListWidgetMetadata, RDFSSubClassOfWidgetMetadata, SingleLiteralAreaWidgetMetadata, SingleLiteralWidgetMetadata, SingleResourceWidgetMetadata

public interface OWLWidgetMetadata

An interface for objects that provide metadata about a widget type. This is used by the OWLWidgetMapper to determine whether a certain widget class shall be chosen for a certain class/property combination.

The widget class should register an implementation of this in a static block.

Author:
Holger Knublauch

Field Summary
static int DEFAULT
          Indicates that this widget is the default widget unless some other plugin declares a widget with higher suitability
static int NOT_SUITABLE
          Indicates that this widget is not suitable for the given class/property combination
static int SUITABLE
          Indicates that this widget is suitable (but not necessarily default) for the given class/property combination
 
Method Summary
 int getSuitability(RDFSNamedClass cls, RDFProperty property)
          Gets the suitability index of a widget for a given class/property pair.
 

Field Detail

NOT_SUITABLE

public static final int NOT_SUITABLE
Indicates that this widget is not suitable for the given class/property combination

See Also:
Constant Field Values

SUITABLE

public static final int SUITABLE
Indicates that this widget is suitable (but not necessarily default) for the given class/property combination

See Also:
Constant Field Values

DEFAULT

public static final int DEFAULT
Indicates that this widget is the default widget unless some other plugin declares a widget with higher suitability

See Also:
Constant Field Values
Method Detail

getSuitability

public int getSuitability(RDFSNamedClass cls,
                          RDFProperty property)

Gets the suitability index of a widget for a given class/property pair. The suitability indicates whether a widget shall be selected as default widget on a form, or whether it shall be listed as one of the options in the form configuration component.

The system widgets of Protege-OWL all return one of the predefined constants NOT_SUITABLE, SUITABLE or DEFAULT. Custom widget classes can also return the same constants, or they can return higher values to override the current default. For example, returning DEFAULT + 1 will make sure that the widget will have higher preferences than any of the system widgets.

Parameters:
cls - the named class of the form
property - the property to get the suitability for
Returns:
an index >= 0