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
DefaultIPresentationAdapterimplementation for DbView fields based on object with synonym. This implementation uses synonym of given object. This object should be instance ofMdObjectorStandardAttribute. 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 StringBM_PERSISTENT_ADAPTER_CONTEXT_KEY_SEPARATORstatic StringBM_PERSISTENT_ADAPTER_CONTEXT_KEY_SUFFIXstatic StringBM_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 voidaddAdapter(IBmObject target, org.eclipse.emf.ecore.EObject objectWithSynonym)Adds adapter data for the given context.static voidaddAdapter(IBmObject target, org.eclipse.emf.ecore.EObject objectWithSynonym, String separator, String suffix)Adds adapter data for the given context.protected IBmModelManagergetBmModelManager()Gets theIBmModelManagerreference for descendant's use.protected StringgetFieldName(DbViewFieldDef field)Gets the field display name.protected StringgetFromSynonym(IBmObject synonymSource, String languageCode)Gets the name information from the synonym.protected StringgetLocalizedSuffix(String suffix)Gets the UI-localized representation of the suffix.StringgetPresentation(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
-
-
Constructor Detail
-
SynonymAwarePresentationProvider
public SynonymAwarePresentationProvider(IBmModelManager bmModelManager)
Constructs the instance of the provider.- Parameters:
bmModelManager- TheIBmModelManagerreference.
-
-
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:IPresentationAdapterReturns object presentation for given languageCode- Specified by:
getPresentationin interfaceIPresentationAdapterlanguageCode- - the language code (notnull)- Returns:
- object presentation for given languageCode (never
null)
-
getBmModelManager
protected IBmModelManager getBmModelManager()
Gets theIBmModelManagerreference 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.
-
-