@Component(value="cuba_ScreensHelper")
public class ScreensHelper
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
protected static class |
ScreensHelper.ScreenType |
Modifier and Type | Field and Description |
---|---|
protected java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.String>> |
availableScreensCache |
protected BeanLocator |
beanLocator |
protected java.util.Map<java.lang.String,java.lang.String> |
captionCache |
protected Dom4jTools |
dom4JTools |
protected LayoutLoaderConfig |
layoutLoaderConfig |
protected MessageTools |
messageTools |
protected Metadata |
metadata |
protected MetadataTools |
metadataTools |
static java.lang.String |
NAME |
protected Resources |
resources |
protected java.util.Map<java.lang.String,java.util.List<ScreenComponentDescriptor>> |
screenComponentsCache |
protected UserSessionSource |
userSessionSource |
protected WindowConfig |
windowConfig |
Constructor and Description |
---|
ScreensHelper() |
Modifier and Type | Method and Description |
---|---|
protected void |
cacheCaption(java.lang.String key,
java.lang.String value) |
protected void |
cacheScreenComponents(java.lang.String key,
java.util.List<ScreenComponentDescriptor> value) |
protected void |
cacheScreens(java.lang.String key,
java.util.Map<java.lang.String,java.lang.String> value) |
protected boolean |
checkWindowType(java.lang.Class<? extends FrameOwner> controllerClass,
ScreensHelper.ScreenType filterScreenType) |
void |
clearCache() |
protected org.dom4j.Element |
elementByID(org.dom4j.Element root,
java.lang.String elementId) |
protected java.lang.String |
findLookupElementDataAttributeId(org.dom4j.Element lookupElement,
java.lang.String dataAttribute) |
void |
findScreenComponents(java.util.List<ScreenComponentDescriptor> components,
ScreenComponentDescriptor parent,
org.dom4j.Element root) |
java.util.Map<java.lang.String,java.lang.String> |
getAvailableBrowserScreens(java.lang.Class entityClass) |
java.util.Map<java.lang.String,java.lang.String> |
getAvailableScreens(java.lang.Class entityClass) |
java.util.Map<java.lang.String,java.lang.String> |
getAvailableScreens(java.lang.Class entityClass,
boolean useComplexSearch)
Method returns a map of the screens that use the provided entity class in a data element
(data container or datasource)
|
protected java.util.Map<java.lang.String,java.lang.String> |
getAvailableScreensMap(java.lang.Class entityClass,
ScreensHelper.ScreenType filterScreenType,
boolean useComplexSearch) |
protected java.lang.String |
getCaptionCacheKey(java.lang.String src,
java.util.Locale locale) |
protected java.util.List<java.lang.String> |
getCompositionAndAssociationFieldNames(MetaClass editedEntityClass,
MetaClass targetEntityClass) |
protected java.lang.String |
getDataContainerId(org.dom4j.Element window,
java.lang.Class<? extends FrameOwner> controllerClass,
ScreensHelper.ScreenType filterScreenType) |
protected java.util.List<java.lang.String> |
getDataElementsIdForComposition(org.dom4j.Element data,
java.lang.Class entityClass,
java.lang.String editedEntityDeId) |
protected java.lang.String |
getDatasourceId(org.dom4j.Element window,
ScreensHelper.ScreenType filterScreenType) |
WindowInfo |
getDefaultBrowseScreen(MetaClass metaClass) |
protected java.lang.String |
getDetailedScreenCaption(java.lang.String caption,
java.lang.String windowId) |
java.lang.String |
getDetailedScreenCaption(WindowInfo windowInfo) |
java.lang.String |
getDetailedScreenCaption(WindowInfo windowInfo,
java.util.Locale locale) |
protected java.util.List<org.dom4j.Element> |
getFrameElements(org.dom4j.Element frameElement) |
protected org.dom4j.Element |
getRootLayoutElement(java.lang.String src) |
protected java.lang.String |
getScreenCaption(org.dom4j.Element window,
java.lang.String src) |
protected java.lang.String |
getScreenCaption(org.dom4j.Element window,
java.lang.String src,
java.util.Locale locale) |
java.lang.String |
getScreenCaption(WindowInfo windowInfo) |
java.lang.String |
getScreenCaption(WindowInfo windowInfo,
java.util.Locale locale) |
java.util.List<ScreenComponentDescriptor> |
getScreenComponents(java.lang.String screenId) |
protected java.lang.String |
getScreenComponentsCacheKey(java.lang.String screenId,
java.util.Locale locale) |
protected java.lang.String |
getScreensCacheKey(java.lang.String className,
java.util.Locale locale,
ScreensHelper.ScreenType filterScreenType,
boolean useComplexSearch) |
protected org.dom4j.Element |
getWindowElement(java.lang.String src) |
protected boolean |
isAction(org.dom4j.Element element) |
protected boolean |
isComponentElement(org.dom4j.Element element) |
protected boolean |
isEntityAvailable(org.dom4j.Element window,
java.lang.Class<? extends FrameOwner> controllerClass,
java.lang.Class entityClass,
ScreensHelper.ScreenType filterScreenType,
boolean useComplexSearch) |
protected boolean |
isEntityAvailableForClass(java.lang.Class entityClass,
java.lang.String className) |
protected boolean |
isEntityAvailableInDataElement(java.lang.Class entityClass,
org.dom4j.Element dataContainer) |
protected boolean |
isEntityAvailableInDataElement(java.lang.Class entityClass,
org.dom4j.Element dataElement,
java.lang.String datasourceId) |
protected boolean |
isExclusion(org.dom4j.Element element) |
protected boolean |
isField(org.dom4j.Element element) |
protected boolean |
isFieldGroupColumn(org.dom4j.Element element) |
protected boolean |
isFormColumn(org.dom4j.Element element) |
protected boolean |
isFrame(org.dom4j.Element element) |
protected boolean |
isRow(org.dom4j.Element element) |
protected boolean |
isTab(org.dom4j.Element element) |
protected boolean |
isTableRows(org.dom4j.Element element) |
protected java.lang.String |
packageFromFilePath(java.lang.String path) |
protected java.lang.String |
resolveEditedEntityContainerId(java.lang.Class<? extends FrameOwner> controllerClass) |
protected java.lang.String |
resolveLookupComponentId(java.lang.Class<? extends FrameOwner> controllerClass) |
protected java.lang.String |
resolveLookupDataContainer(org.dom4j.Element window,
java.lang.Class<? extends FrameOwner> controllerClass) |
protected java.lang.String |
resolveLookupDatasource(org.dom4j.Element window) |
void |
sortWindowInfos(java.util.List<WindowInfo> windowInfoCollection)
Sorts window infos alphabetically, takes into account $ mark.
|
public static final java.lang.String NAME
@Inject protected WindowConfig windowConfig
@Inject protected MessageTools messageTools
@Inject protected Resources resources
@Inject protected UserSessionSource userSessionSource
@Inject protected MetadataTools metadataTools
@Inject protected Metadata metadata
@Inject protected LayoutLoaderConfig layoutLoaderConfig
@Inject protected BeanLocator beanLocator
@Inject protected Dom4jTools dom4JTools
protected java.util.Map<java.lang.String,java.lang.String> captionCache
protected java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.String>> availableScreensCache
protected java.util.Map<java.lang.String,java.util.List<ScreenComponentDescriptor>> screenComponentsCache
public void sortWindowInfos(java.util.List<WindowInfo> windowInfoCollection)
windowInfoCollection
- mutable list of window infos@Nullable public WindowInfo getDefaultBrowseScreen(MetaClass metaClass)
public java.util.List<ScreenComponentDescriptor> getScreenComponents(java.lang.String screenId)
public void findScreenComponents(java.util.List<ScreenComponentDescriptor> components, @Nullable ScreenComponentDescriptor parent, org.dom4j.Element root)
protected java.util.List<org.dom4j.Element> getFrameElements(org.dom4j.Element frameElement)
protected boolean isFrame(org.dom4j.Element element)
protected boolean isComponentElement(org.dom4j.Element element)
protected boolean isAction(org.dom4j.Element element)
protected boolean isTab(org.dom4j.Element element)
protected boolean isRow(org.dom4j.Element element)
protected boolean isField(org.dom4j.Element element)
protected boolean isFieldGroupColumn(org.dom4j.Element element)
protected boolean isFormColumn(org.dom4j.Element element)
protected boolean isExclusion(org.dom4j.Element element)
protected boolean isTableRows(org.dom4j.Element element)
public java.util.Map<java.lang.String,java.lang.String> getAvailableBrowserScreens(java.lang.Class entityClass)
public java.util.Map<java.lang.String,java.lang.String> getAvailableScreens(java.lang.Class entityClass)
public java.util.Map<java.lang.String,java.lang.String> getAvailableScreens(java.lang.Class entityClass, boolean useComplexSearch)
entityClass
- entity class used to searchuseComplexSearch
- if the value is 'true', all screens that use provided entity class in some data element
will be returned (including screens for entities that contain the provided class as a
composition or association).
if value equals 'false', only main screens (browser, lookup, editor) for the provided
entity class will be returned.protected java.util.Map<java.lang.String,java.lang.String> getAvailableScreensMap(java.lang.Class entityClass, ScreensHelper.ScreenType filterScreenType, boolean useComplexSearch)
protected boolean isEntityAvailable(org.dom4j.Element window, java.lang.Class<? extends FrameOwner> controllerClass, java.lang.Class entityClass, ScreensHelper.ScreenType filterScreenType, boolean useComplexSearch)
@Nullable protected java.lang.String getDataContainerId(org.dom4j.Element window, java.lang.Class<? extends FrameOwner> controllerClass, ScreensHelper.ScreenType filterScreenType)
@Nullable protected java.lang.String resolveLookupComponentId(java.lang.Class<? extends FrameOwner> controllerClass)
@Nullable protected java.lang.String resolveLookupDataContainer(org.dom4j.Element window, java.lang.Class<? extends FrameOwner> controllerClass)
protected boolean checkWindowType(java.lang.Class<? extends FrameOwner> controllerClass, ScreensHelper.ScreenType filterScreenType)
protected java.util.List<java.lang.String> getDataElementsIdForComposition(org.dom4j.Element data, java.lang.Class entityClass, java.lang.String editedEntityDeId)
protected java.util.List<java.lang.String> getCompositionAndAssociationFieldNames(MetaClass editedEntityClass, MetaClass targetEntityClass)
protected boolean isEntityAvailableForClass(java.lang.Class entityClass, java.lang.String className)
protected boolean isEntityAvailableInDataElement(java.lang.Class entityClass, org.dom4j.Element dataContainer)
protected boolean isEntityAvailableInDataElement(java.lang.Class entityClass, org.dom4j.Element dataElement, java.lang.String datasourceId)
@Nullable protected java.lang.String resolveEditedEntityContainerId(java.lang.Class<? extends FrameOwner> controllerClass)
@Nullable protected java.lang.String getDatasourceId(org.dom4j.Element window, ScreensHelper.ScreenType filterScreenType)
@Nullable protected java.lang.String resolveLookupDatasource(org.dom4j.Element window)
@Nullable protected java.lang.String findLookupElementDataAttributeId(org.dom4j.Element lookupElement, java.lang.String dataAttribute)
@Nullable protected org.dom4j.Element elementByID(org.dom4j.Element root, java.lang.String elementId)
@Nullable protected org.dom4j.Element getWindowElement(java.lang.String src) throws java.io.FileNotFoundException
java.io.FileNotFoundException
@Nullable protected org.dom4j.Element getRootLayoutElement(java.lang.String src) throws java.io.FileNotFoundException
java.io.FileNotFoundException
@Nullable public java.lang.String getScreenCaption(WindowInfo windowInfo) throws java.io.FileNotFoundException
java.io.FileNotFoundException
@Nullable public java.lang.String getScreenCaption(WindowInfo windowInfo, java.util.Locale locale) throws java.io.FileNotFoundException
java.io.FileNotFoundException
protected java.lang.String getScreenCaption(org.dom4j.Element window, java.lang.String src)
protected java.lang.String getScreenCaption(org.dom4j.Element window, java.lang.String src, java.util.Locale locale)
public java.lang.String getDetailedScreenCaption(WindowInfo windowInfo) throws java.io.FileNotFoundException
java.io.FileNotFoundException
public java.lang.String getDetailedScreenCaption(WindowInfo windowInfo, java.util.Locale locale) throws java.io.FileNotFoundException
java.io.FileNotFoundException
protected java.lang.String getDetailedScreenCaption(java.lang.String caption, java.lang.String windowId)
@Nullable protected java.lang.String packageFromFilePath(java.lang.String path)
protected void cacheCaption(java.lang.String key, java.lang.String value)
protected void cacheScreens(java.lang.String key, java.util.Map<java.lang.String,java.lang.String> value)
protected void cacheScreenComponents(java.lang.String key, java.util.List<ScreenComponentDescriptor> value)
protected java.lang.String getCaptionCacheKey(java.lang.String src, java.util.Locale locale)
protected java.lang.String getScreensCacheKey(java.lang.String className, java.util.Locale locale, ScreensHelper.ScreenType filterScreenType, boolean useComplexSearch)
protected java.lang.String getScreenComponentsCacheKey(java.lang.String screenId, java.util.Locale locale)
public void clearCache()