Package com.solibri.smc.api.checking
Interface RuleResources
public interface RuleResources
Represents the resources of a rule.
The localization for the resources is specified in .properties files in the same Java package as the rule itself. The
name of the properties file must match the rule class name. See
Properties
for details. Use
getString(String)
and getString(String, Object...)
methods to access localized Strings.
Files of a rule that has English, French and German localization:
MyRule.java
MyRule.properties (English localization)
MyRule_fr.properties (French localization)
MyRule_de.properties (German localization)
Contents of MyRule.properties:
# The required rule information. # Note: These should be only in the English properties file.
AUTHOR=The author of the rule
AUTHOR_TAG=MyTag
UID=12345
VERSION=1.0
DATE=2018-01-01
# The localization of the name and description of the rule DEFAULT_NAME=My Rule DEFAULT_DESCRIPTION=This rule checks
the quality of the model.
# The localization of a parameter which parameter ID is rpComponentFilter rpComponentFilter.NAME = Components to
Check rpComponentFilter.DESCRIPTION = This filter specifies the set of components to check- Since:
- 9.10.2
-
Method Summary
Modifier and TypeMethodDescriptionstatic RuleResources
Return the common resources shared between all the rules.getImageUrl
(String filename) Returns the URL of the image with filename.Returns the resource bundle of the rule.Returns localized string mapped by the key.Returns localized string mapped by the key.static RuleResources
Return the resources of the specified rule instance.
-
Method Details
-
of
Return the resources of the specified rule instance.- Parameters:
rule
- the rule instance- Returns:
- the resources associated with the rule
- Since:
- 9.10.2
-
getCommon
Return the common resources shared between all the rules.- Returns:
- the common resources
- Since:
- 9.10.2
-
getJavaResourceBundle
ResourceBundle getJavaResourceBundle()Returns the resource bundle of the rule. Resource files must be located in a sub package of rule named res.- Returns:
- the resource bundle
- Since:
- 9.10.2
-
getString
Returns localized string mapped by the key.- Parameters:
key
- the key e.g. "DEFAULT_NAME"messageFormatArgs
- the arguments for java.text.MessageFormat- Returns:
- the localized string
- Since:
- 9.10.2
-
getString
Returns localized string mapped by the key.- Parameters:
key
- the key e.g. "DEFAULT_NAME"- Returns:
- the localized string
- Since:
- 9.10.2
-
getImageUrl
Returns the URL of the image with filename. For defining images in parameter view UI. This should be implemented depending on how the image resources are handled by the rule implementation.- Parameters:
filename
- the filename of an image resource- Returns:
- the URL of the image with filename
- Since:
- 9.10.2
-