Class SynonymAwarePresentationProvider
- java.lang.Object
-
- com._1c.g5.v8.dt.md.resource.presentation.SynonymAwarePresentationProvider
-
- All Implemented Interfaces:
IPresentationAdapter
- Direct Known Subclasses:
PeriodFieldPresentationProvider
public class SynonymAwarePresentationProvider extends Object implements IPresentationAdapter
DefaultIPresentationAdapter
implementation for DbView fields based on object with synonym. This implementation uses synonym of given object. This object should be instance ofMdObject
orStandardAttribute
. If given object has no synonym or wrong type this provider will return field name according configuration script variant.This implementation can be used only with
DbViewFieldFieldDef
.
-
-
Field Summary
Fields Modifier and Type Field Description static String
BM_PERSISTENT_ADAPTER_CONTEXT_ENG_ID
static String
BM_PERSISTENT_ADAPTER_CONTEXT_KEY_SEPARATOR
static String
BM_PERSISTENT_ADAPTER_CONTEXT_KEY_SOURCE_URI
static String
BM_PERSISTENT_ADAPTER_CONTEXT_KEY_SUFFIX
static String
BM_PERSISTENT_ADAPTER_ID
-
Constructor Summary
Constructors Constructor Description SynonymAwarePresentationProvider(IBmModelManager bmModelManager)
Constructs the instance of the provider.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static void
addAdapter(IBmObject target, org.eclipse.emf.ecore.EObject objectWithSynonym)
Adds adapter data for the given context.static void
addAdapter(IBmObject target, org.eclipse.emf.ecore.EObject objectWithSynonym, String separator, String suffix)
Adds adapter data for the given context.protected IBmModelManager
getBmModelManager()
Gets theIBmModelManager
reference for descendant's use.protected String
getFieldName(DbViewFieldDef field)
Gets the field display name.protected String
getFromSynonym(IBmObject synonymSource, String languageCode)
Gets the name information from the synonym.protected String
getLocalizedSuffix(String suffix)
Gets the UI-localized representation of the suffix.String
getPresentation(IBmObject target, String languageCode)
Returns object presentation for given languageCode
-
-
-
Field Detail
-
BM_PERSISTENT_ADAPTER_ID
public static final String BM_PERSISTENT_ADAPTER_ID
- See Also:
- Constant Field Values
-
BM_PERSISTENT_ADAPTER_CONTEXT_KEY_SUFFIX
public static final String BM_PERSISTENT_ADAPTER_CONTEXT_KEY_SUFFIX
- See Also:
- Constant Field Values
-
BM_PERSISTENT_ADAPTER_CONTEXT_KEY_SEPARATOR
public static final String BM_PERSISTENT_ADAPTER_CONTEXT_KEY_SEPARATOR
- See Also:
- Constant Field Values
-
BM_PERSISTENT_ADAPTER_CONTEXT_KEY_SOURCE_URI
public static final String BM_PERSISTENT_ADAPTER_CONTEXT_KEY_SOURCE_URI
- See Also:
- Constant Field Values
-
BM_PERSISTENT_ADAPTER_CONTEXT_ENG_ID
public static final String BM_PERSISTENT_ADAPTER_CONTEXT_ENG_ID
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
SynonymAwarePresentationProvider
public SynonymAwarePresentationProvider(IBmModelManager bmModelManager)
Constructs the instance of the provider.- Parameters:
bmModelManager
- TheIBmModelManager
reference.
-
-
Method Detail
-
addAdapter
public static void addAdapter(IBmObject target, org.eclipse.emf.ecore.EObject objectWithSynonym)
Adds adapter data for the given context.- Parameters:
target
- The target object to store context in (notnull
)objectWithSynonym
- - the object with synonym (notnull
)
-
addAdapter
public static void addAdapter(IBmObject target, org.eclipse.emf.ecore.EObject objectWithSynonym, String separator, String suffix)
Adds adapter data for the given context.- Parameters:
target
- The target object to store context in (notnull
)objectWithSynonym
- The object with synonym (notnull
)separator
- The separator (notnull
)suffix
- - the suffix (notnull
)
-
getPresentation
public String getPresentation(IBmObject target, String languageCode)
Description copied from interface:IPresentationAdapter
Returns object presentation for given languageCode- Specified by:
getPresentation
in interfaceIPresentationAdapter
languageCode
- - the language code (notnull
)- Returns:
- object presentation for given languageCode (never
null
)
-
getBmModelManager
protected IBmModelManager getBmModelManager()
Gets theIBmModelManager
reference for descendant's use.- Returns:
- The instance of the
IBmModelManager
.
-
getFieldName
protected String getFieldName(DbViewFieldDef field)
Gets the field display name.- Parameters:
field
- The field.- Returns:
- The display name of the field.
-
getFromSynonym
protected String getFromSynonym(IBmObject synonymSource, String languageCode)
Gets the name information from the synonym.- Parameters:
synonymSource
- The source of the synonym data.languageCode
- The code of the language to get synonym data for.- Returns:
- The synonym data that corresponds the given language code.
-
-