Package overit.geocall.lang
Class Teacher
java.lang.Object
overit.geocall.lang.Teacher
- Direct Known Subclasses:
CacheTeacher,NullTeacher
This abstract class it must be extended to define a Teacher object, ie the object that will manages
all the translations of the graphic interface (static label translations) and database data (dinamic fields
translations) to implement the multi-language support.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected TeacherDutystatic final charCharacter used as the first character of the string to avoid the translationstatic final charCharacter used as the first character of the string to request the translationstatic final charCharacter used as the first character of the string to request the translation for the output -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal StringAdjusts the string passed as parameter; if the string starts with theTRYcharacter, it try to translates it, otherwise it returns it without translation.final StringadjustLabel(String source) Adjusts the label passed as parameter; if the label starts with theTRYcharacter, it try to translates it, otherwise it returns it without translation.protected abstract StringAbstract method that must be implemented.protected abstract StringconvertLabel(String source) Abstract method that must be implemente.protected abstract StringconvertName(String source) Abstract method that must be implemented.getDuty()Returns theTeacherDutystatic TeachergetTeacher(String name, String lang, boolean partial, Identity id, int maxDim) static TeachergetTeacher(String name, String lang, String tableSuffix, boolean partial, String belongingLayer, Identity id, int maxDim) Deprecated.static TeachergetTeacher(String name, String lang, String tableSuffix, LangType type, String pkg, Identity id, int maxDim) Returns the Teacher used for the translationsstatic TeachergetTeacher(String name, String lang, LangType type, Identity id, int maxDim) Returns the Teacher used for the translationsstatic TeachergetTeacher(String name, Identity identity, String belongingLayer) Returns the Teacher used for the translationsstatic TeachergetTeacher(UIClass uic, Identity identity) Returns the Teacher used for the translationsprotected static LangTypegetType4Legacy(boolean partial) protected booleanprotected Stringabstract voidreset()Resets the Teacher, ie empties the translations cachesfinal StringTranslates the string passed as parameterprotected final StringtranslateContent(ForeignField ff, Object o, String def, boolean forInput) final StringtranslateContent(ForeignField ff, List l, String def) Translates, if necessary, the static translation of the content of the field retrieved from the map, or simply retrieves the valuefinal StringtranslateContent(ForeignField ff, List l, String def, boolean forInput) Translates, if necessary, the static translation of the content of the field retrieved from the map, or simply retrieves the valuefinal StringtranslateContent(ForeignField ff, Map map, String def) Translates, if necessary, the static translation of the content of the field retrieved from the map, or simply retrieves the valuefinal StringtranslateContent(ForeignField ff, Map map, String def, boolean forInput) Translates, if necessary, the static translation of the content of the field retrieved from the map, or simply retrieves the valuefinal StringtranslateLabel(String source) Translates the label passed as parameterfinal ForeignFieldtranslateName(String name) final ForeignFieldtranslateName(String name, String def) final ForeignFieldtranslateName(String name, Map fieldPosition) final ForeignFieldtranslateName(String name, DBView dbv)
-
Field Details
-
TRY
public static final char TRYCharacter used as the first character of the string to request the translation- See Also:
-
TRY_OUTPUT
public static final char TRY_OUTPUTCharacter used as the first character of the string to request the translation for the output- See Also:
-
AVOID
public static final char AVOIDCharacter used as the first character of the string to avoid the translation- See Also:
-
_duty
-
-
Constructor Details
-
Teacher
-
-
Method Details
-
getDuty
Returns theTeacherDuty- Returns:
- The
TeacherDuty
-
convert
Abstract method that must be implemented. Converts the source string passed as parameter in the corresponding converted string- Parameters:
source- A valued and consistent string, with length greater than 0, that must be converted- Returns:
- The coversion of the source
-
convertLabel
Abstract method that must be implemente. Converts the label string passed as parameter in the corresponding converted label- Parameters:
source- A valued and consistent string, with length greater than 0, that must be converted- Returns:
- The conversion of the label
-
convertName
Abstract method that must be implemented. Converts the field name passed as parameter in the corresponding converted field name- Parameters:
source- A valued and consistent string, with length greater than 0, that must be converted- Returns:
- The coversion of the field name
-
reset
public abstract void reset()Resets the Teacher, ie empties the translations caches -
translateName
Translates the field name passed as parameter, considering the possible presence of the prohibition expressed by the characterAVOID, and returns the normalized name that can have the characterTRYas first character, to request the translation of the value- Parameters:
name- The field name to translate- Returns:
- The
ForeignFieldthat corresponds to the translation of the field name passed as parameter
-
translateName
Translates the field name passed as parameter, considering the possible presence of the prohibition expressed by the characterAVOID, and returns the normalized name that can have the characterTRYas first character, to request the translation of the value- Parameters:
name- The field name to translatedef- The default translation, the name returned if the name translation returnsnull- Returns:
- The
ForeignFieldthat corresponds to the translation of the field name passed as parameter
-
translateName
Translates the field name passed as parameter, considering the possible presence of the prohibition expressed by the characterAVOID, and returns the normalized name that can have the characterTRYas first character, to request the translation of the value- Parameters:
name- The field name to translatefieldPosition- Optional map (can benull) which associates the name of the fields with the position in the list- Returns:
- The
ForeignFieldthat corresponds to the translation of the field name passed as parameter
-
translateName
Translates the field name passed as parameter, considering the possible presence of the prohibition expressed by the characterAVOID, and returns the normalized name that can have the characterTRYas first character, to request the translation of the value- Parameters:
name- The field name to translatedbv- OptionalDBView(can benull) which associates the name of the fields with the position in the list- Returns:
- The
ForeignFieldthat corresponds to the translation of the field name passed as parameter
-
translateContent
Translates, if necessary, the static translation of the content of the field retrieved from the map, or simply retrieves the value- Parameters:
ff- TheForeignFieldof which the content must be translatedmap- The map from which we retrieve the fielddef- The default translation- Returns:
- The translation of the content of the field
-
translateContent
Translates, if necessary, the static translation of the content of the field retrieved from the map, or simply retrieves the value- Parameters:
ff- TheForeignFieldof which the content must be translatedmap- The map from which we retrieve the fielddef- The default translationforInput- Defines if the translation is required even for input or only for output- Returns:
- The translation of the content of the field
-
translateContent
Translates, if necessary, the static translation of the content of the field retrieved from the map, or simply retrieves the value- Parameters:
ff- TheForeignFieldof which the content must be translatedl- The list from which we retrieve the fielddef- The default translation- Returns:
- The translation of the content of the field
-
translateContent
Translates, if necessary, the static translation of the content of the field retrieved from the map, or simply retrieves the value- Parameters:
ff- TheForeignFieldof which the content must be translatedl- The list from which we retrieve the fielddef- The default translationforInput- Defines if the translation is required even for input or only for output- Returns:
- The translation of the content of the field
-
translateContent
-
translate
Translates the string passed as parameter- Parameters:
source- The string to translate- Returns:
- If the source is
null, or an empty string, or starts with theAVOIDcharacter, the method will returns the source (removing theAVOID) character).
In the other cases it will returns the translation of the source using theconvert(java.lang.String), method, and if the translation is not available it marks the source string and returns it in square brackets
-
translateLabel
Translates the label passed as parameter- Parameters:
source- The string to translate- Returns:
- If the source is
null, or an empty string, or starts with theAVOIDcharacter, the method will returns the source (removing theAVOIDcharacter).
In the other cases it will returns the translation of the source using theconvertLabel(java.lang.String), method, and if the translation is not available it marks the source string and returns it in square brackets
-
adjust
Adjusts the string passed as parameter; if the string starts with theTRYcharacter, it try to translates it, otherwise it returns it without translation.- Parameters:
source- The string to translate- Returns:
- If the source is
null, or an empty string, or don't starts with theTRYcharacter, the method will returns the source string as is.
In the other cases it will returns the translation of the source using theconvert(java.lang.String), method, and if the translation is not available it marks the source string and returns it in square brackets
-
adjustLabel
Adjusts the label passed as parameter; if the label starts with theTRYcharacter, it try to translates it, otherwise it returns it without translation.- Parameters:
source- The string to translate- Returns:
- If the source is
null, or an empty string, or don't starts with theTRYcharacter, the method will returns the source string as is.
In the other cases it will returns the translation of the source using theconvertLabel(java.lang.String), method, and if the translation is not available it marks the label string and returns it in square brackets
-
mark
-
isMarked
-
getType4Legacy
-
getTeacher
public static Teacher getTeacher(String name, String lang, boolean partial, Identity id, int maxDim) Deprecated UsegetTeacher(java.lang.String, java.lang.String, overit.geocall.lang.LangType, overit.geocall.util.Identity, int)- Parameters:
name- Name of the teacherlang- Name of the dictionary that must be used, it can be extracted from theIdentitypartial-trueto obtain a partial dictionary, that don't marks the omissed translationsid- TheIdentitymaxDim- Maximum dimension of the translations cache- Returns:
- The Teacher
-
getTeacher
Returns the Teacher used for the translations- Parameters:
name- Name of the teacherlang- Name of the dictionary that must be used, it can be extracted from theIdentitytype- TheLangTypethat contains the configuration for the type of translations (full or partial) or the type of the shortcutsid- identity TheIdentitymaxDim- Maximum dimension of the translations cache- Returns:
- The Teacher
-
getTeacher
@Deprecated public static Teacher getTeacher(String name, String lang, String tableSuffix, boolean partial, String belongingLayer, Identity id, int maxDim) Deprecated.- Parameters:
name- Name of the teacherlang- Name of the dictionary that must be used, it can be extracted from theIdentitytableSuffix- Suffix used for the names of the foreign tables, the ones that contains the fields in foreign languagespartial-trueto obtain a partial dictionary, that don't marks the omissed translationsbelongingLayer- The applicative packageid- The IdentitymaxDim- Maximum dimension of the translations cache- Returns:
- The Teacher
-
getTeacher
public static Teacher getTeacher(String name, String lang, String tableSuffix, LangType type, String pkg, Identity id, int maxDim) Returns the Teacher used for the translations- Parameters:
name- Name of the teacherlang- Name of the dictionary that must be used, it can be extracted from theIdentitytableSuffix- Suffix used for the names of the foreign tables, the ones that contains the fields in foreign languagestype- TheLangTypethat contains the configuration for the type of translations (full or partial) or the type of the shortcutspkg- The applicative packageid- the IdentitymaxDim- Maximum dimension of the translations cache- Returns:
- The Teacher
-
getTeacher
Returns the Teacher used for the translations- Parameters:
name- Name of the Teacheridentity- TheIdentityof the user currently logged in the applicationbelongingLayer- The package to which the Teacher belongs- Returns:
- The Teacher
-
getTeacher
Returns the Teacher used for the translations
-
getTeacher(java.lang.String, java.lang.String, java.lang.String, overit.geocall.lang.LangType, java.lang.String, overit.geocall.util.Identity, int)