Class ContainerBean

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable
    Direct Known Subclasses:
    DialogBean

    public abstract class ContainerBean
    extends Component
    implements java.lang.Cloneable
    ContainerBean with a PageContent that contains backing beans.
    Since:
    1.1
    See Also:
    Serialized Form
    • Field Detail

      • CONTAINER_TAG_CHAR

        public static final char CONTAINER_TAG_CHAR
        Container tag char: c. containerBean path format: c0_c0_c0.
        See Also:
        Constant Field Values
      • CONTAINER_BEAN_VAR

        public static final java.lang.String CONTAINER_BEAN_VAR
        ContainerBean name in requestScope. The current containerBean can be accessed by #{requestScope.containerBean} or by calling RequestHelper.getAttribute(String) with CONTAINER_BEAN_VAR parameter.
        See Also:
        Constant Field Values
      • REQUEST_GET_RESOURCE_BUNDLE

        public static final java.lang.String REQUEST_GET_RESOURCE_BUNDLE
        Module request event: getResourceBundle(containerBean)
        Since:
        5.14
        See Also:
        Constant Field Values
      • containerMenuBean

        protected ContainerMenuBean containerMenuBean
        containerMenuBean: main menu of this ContainerBean
    • Constructor Detail

      • ContainerBean

        public ContainerBean()
        Default constructor
    • Method Detail

      • getResourceBundle

        public java.util.ResourceBundle getResourceBundle()
        Description copied from class: Component
        Get the ResourceBundle for this component.
        Overrides:
        getResourceBundle in class Component
        Returns:
        ResourceBundle object.
      • getDataAccessUnit

        public DataAccessUnit getDataAccessUnit​(boolean returnNullForBoundDataAccessUnit)
        Get the DataAccessUnit of this containerBean. If this containerBean has a parent and its DataAccessUnit is not set, return its parent's DataAccessUnit (recursive).
        Overrides:
        getDataAccessUnit in class Component
        Parameters:
        returnNullForBoundDataAccessUnit - whether to return null for current bound dataAccessUnit.
        Returns:
        DataAccessUnit instance. Default is current bound DataAccessUnit.
        Since:
        5.13
      • setDataAccessUnit

        public void setDataAccessUnit​(DataAccessUnit dataAccessUnit)
        Set the DataAccessUnit of this containerBean
        Parameters:
        dataAccessUnit - DataAccessUnit instance.
        Since:
        5.13
      • init

        @PostConstruct
        public void init()
        Called after this containerBean is created and before it is put into service.
      • initFrom

        protected void initFrom​(ContainerBean containerBean)
        Copy data from the containerBean. copy references instead of deep copy. After the copy, the containerBean will not be used any more.
        Parameters:
        containerBean - the containerBean to copy data from
      • getPageContent

        public PageContent getPageContent()
        Get the PageContent of this ContainerBean. If it is null, a new instance will be created.
        Returns:
        PageContent instance.
      • setPageContent

        public void setPageContent​(PageContent pageContent)
        Set the PageContent of this ContainerBean.
        Parameters:
        pageContent - the new pageContent
        Since:
        5.6
      • getContainerMenuBean

        public ContainerMenuBean getContainerMenuBean()
        Get the ContainerMenuBean of this ContainerBean. Container menu is the main menu of a ContainerBean.
        Returns:
        ContainerMenuBean instance.
      • setContainerMenuBean

        public void setContainerMenuBean​(ContainerMenuBean containerMenuBean)
        Set the ContainerMenuBean of this ContainerBean. Container menu is the main menu of a ContainerBean.
        Parameters:
        containerMenuBean - the container menu to set.
      • createEntityBackingBean

        public static <T extends PersistenceEntityEntityBackingBean<T> createEntityBackingBean​(java.lang.Class<T> entityType,
                                                                                                 EntityDataSource eds,
                                                                                                 EntityViewConfig viewConfig,
                                                                                                 boolean manageMode,
                                                                                                 ContainerBean containerBean)
                                                                                          throws SystemException
        Create the EntityBackingBean for the entity. parentComponent is null.
        Parameters:
        entityType - entity type
        eds - the EntityDataSource that contains the entity to show
        viewConfig - entityViewConfig. if null, use default.
        manageMode - manage mode. If true, entity editing will be enabled if user has the permission.
        containerBean - the ContainerBean of the EntityBackingBean to be created
        Returns:
        EntityBackingBean instance
        Throws:
        BackingBeanException - throw if an backing bean related error occurs
        SystemException - throw if any other error occurs
      • createEntityBackingBean

        public static <T extends PersistenceEntityEntityBackingBean<T> createEntityBackingBean​(Component parentComponent,
                                                                                                 java.lang.Class<T> entityType,
                                                                                                 EntityDataSource eds,
                                                                                                 EntityViewConfig viewConfig,
                                                                                                 boolean manageMode,
                                                                                                 ContainerBean containerBean)
                                                                                          throws SystemException
        Create the EntityBackingBean for the entity.
        Parameters:
        parentComponent - parent component, can be null
        entityType - entity type
        eds - the EntityDataSource that contains the entity to show
        viewConfig - entityViewConfig. if null, use default.
        manageMode - manage mode. If true, entity editing will be enabled if user has the permission.
        containerBean - the ContainerBean of the EntityBackingBean to be created
        Returns:
        EntityBackingBean instance
        Throws:
        BackingBeanException - throw if an backing bean related error occurs
        SystemException - throw if any other error occurs
      • createEntityBackingBean

        public static <T extends PersistenceEntityEntityBackingBean<? super T> createEntityBackingBean​(Component parentComponent,
                                                                                                         java.lang.Class<T> entityType,
                                                                                                         java.lang.Class backingBeanType,
                                                                                                         EntityViewConfig viewConfig,
                                                                                                         EntityInitializer entityInitializer,
                                                                                                         ContainerBean containerBean,
                                                                                                         MenuNodeFactory menuNodeFactory,
                                                                                                         DataAccessUnit dataAccessUnit)
                                                                                                  throws BackingBeanException
        Create entity backing bean for the entity initialized with the EntityInitializer.
        Parameters:
        parentComponent - parent component
        entityType - entity type
        backingBeanType - the EntityBackingBean type override default mapping
        viewConfig - entityViewConfig. if null, use default.
        entityInitializer - entity property value initializer.
        containerBean - the ContainerBean of the EntityBackingBean to be created
        menuNodeFactory - entityType menu node factory with which the EntityBackingBean is associated.
        dataAccessUnit - the dataAccessUnit of the entity, ignored if null
        Returns:
        EntityBackingBean instance
        Throws:
        BackingBeanException - throw if an error occurs
      • createEntityListBackingBean

        public static <T extends PersistenceEntityEntityListBackingBean<T> createEntityListBackingBean​(java.lang.Class<T> entityType,
                                                                                                         EntityDataSource eds,
                                                                                                         EntityListViewConfig viewConfig,
                                                                                                         boolean manageMode,
                                                                                                         ContainerBean containerBean)
                                                                                                  throws SystemException
        Create entity list backing bean whose parentComponent is null.
        Parameters:
        entityType - entity type
        eds - the EntityDataSource that contains a QueryCriteria to retrieve entities or a MemoryEntityList instance.
        viewConfig - entityViewConfig. if null, use default.
        manageMode - manage mode. If true, entity editing will be enabled if user has the permission.
        containerBean - the ContainerBean of the EntityBackingBean to be created
        Returns:
        EntityBackingBean instance
        Throws:
        BackingBeanException - throw if an backing bean related error occurs
        SystemException - throw if any other error occurs
      • createEntityListBackingBean

        public static <T extends PersistenceEntityEntityListBackingBean<T> createEntityListBackingBean​(Component parentComponent,
                                                                                                         java.lang.Class<T> entityType,
                                                                                                         EntityDataSource<T> eds,
                                                                                                         EntityListViewConfig viewConfig,
                                                                                                         boolean manageMode,
                                                                                                         ContainerBean containerBean)
                                                                                                  throws SystemException
        Create entity list backing bean.
        Parameters:
        parentComponent - parent component, can be null
        entityType - entity type
        eds - the EntityDataSource that contains a QueryCriteria to retrieve entities or a MemoryEntityList instance.
        viewConfig - entityViewConfig. if null, use default.
        manageMode - manage mode. If true, entity editing will be enabled if user has the permission.
        containerBean - the ContainerBean of the EntityBackingBean to be created
        Returns:
        EntityBackingBean instance
        Throws:
        BackingBeanException - throw if an backing bean related error occurs
        SystemException - throw if any other error occurs
      • getRenderRegionNumber

        public static java.lang.Integer getRenderRegionNumber​(java.util.List<java.lang.Integer> renderRegions)
        Get the region number to put backing bean. It is the first region number in the list.
        Parameters:
        renderRegions - a list of region numbers.
        Returns:
        region number. return 0 if the renderRegions is empty or null.
      • showEntity

        public PageNavigation showEntity​(java.lang.Class entityType,
                                         EntityDataSource eds,
                                         EntityViewConfig viewConfig,
                                         boolean manageMode,
                                         java.lang.Integer pageId)
                                  throws BackingBeanException,
                                         SystemException
        Create the EntityBackingBean for the entity and place it in the PageContent of this ContainerBean for display.

        The render regions to show the bean can be specified in the EntityDataSource using EntityDataSource.setRenderRegions(List, Boolean). If render regions is not specified, use the default regions for query results: getDefaultQueryResultsRenderRegions().

        Parameters:
        entityType - entity type
        eds - the EntityDataSource that contains the entity to show
        viewConfig - entityViewConfig. if null, use default.
        manageMode - manage mode. If true, entity editing will be enabled if user has the permission.
        pageId - the pageId to navigate to if not null.
        Returns:
        a PageNavigation
        Throws:
        BackingBeanException - throw if an backing bean related error occurs
        SystemException - throw if any other error occurs
      • showSingleEntity

        public PageNavigation showSingleEntity​(java.lang.Class entityType,
                                               java.util.List<CriteriaElement> propertyQueryElements,
                                               ParameterizedMessage title,
                                               boolean createIfEmpty,
                                               java.util.List<java.lang.Integer> renderRegions,
                                               boolean clearRenderRegions,
                                               EntityViewConfig viewConfig,
                                               MenuNodeFactory menuNodeFactory,
                                               DataAccessUnit dataAccessUnit)
                                        throws SystemException
        Create an EntityBackingBean to show the entity retrieved by the query criteria specified by the propertyQueryElements.
        Parameters:
        entityType - entity type
        propertyQueryElements - query criteria
        title - bean title
        createIfEmpty - where to show a form to create if no entities are not found
        renderRegions - the render regions to show the entity
        clearRenderRegions - whether to clear existing beans in the render regions
        viewConfig - entityViewConfig, null for using default.
        menuNodeFactory - the MenuNodeFactory that is associated with showing the entity
        Returns:
        a PageNavigation
        Throws:
        BackingBeanException - throw if an error occurs in creating the bean.
        SystemException - throw if an error occurs in retrieving the entity.
      • showBean

        public PageNavigation showBean​(BackingBean bean,
                                       java.lang.Integer regionNumber)
        Add the bean to the region. All the existing beans in the region will be removed.
        Parameters:
        bean - the bean to show
        regionNumber - region number. if null, use default regions: getDefaultQueryResultsRenderRegions()
        Returns:
        a PageNavigation
      • showBean

        public PageNavigation showBean​(BackingBean bean,
                                       java.util.List<java.lang.Integer> renderRegions,
                                       boolean clearRenderRegions)
        Add the bean to the regions. The first region will be used to add the bean.
        Parameters:
        bean - the bean to show
        renderRegions - render regions. null for default regions
        clearRenderRegions - whether to remove existing bean in the regions. will be removed.
        Returns:
        a PageNavigation
      • showBean

        public PageNavigation showBean​(BackingBean bean,
                                       boolean addGeneratedBeans,
                                       java.util.List<java.lang.Integer> renderRegions,
                                       boolean clearRenderRegions,
                                       java.lang.Integer regionForGeneratedBeans,
                                       java.lang.Integer pageId)
        Add the bean to the regions. The first region will be used to add the bean.
        Parameters:
        bean - the bean to show
        addGeneratedBeans - whether to add the regenerated beans of the bean
        renderRegions - render regions. null for default regions
        clearRenderRegions - whether to remove existing bean in the regions. will be removed.
        regionForGeneratedBeans - where to add generated beans if addGeneratedBeans is true. null for adding to the same region.
        pageId - a pageId to navigate. null to keep current page. and always be null for ajax.
        Returns:
        a PageNavigation.
      • showBeanList

        public PageNavigation showBeanList​(java.util.List<BackingBean> beans,
                                           boolean addGeneratedBeans,
                                           java.util.List<java.lang.Integer> renderRegions,
                                           boolean clearRenderRegions,
                                           java.lang.Integer pageId)
        Add a list beans to the regions. The first region will be used to add the bean.
        Parameters:
        beans - the beans to show
        addGeneratedBeans - whether to add the regenerated beans of the bean
        renderRegions - render regions. null for default regions
        clearRenderRegions - whether to remove existing bean in the regions. will be removed.
        pageId - a pageId to navigate. null to keep current page. and always be null for ajax.
        Returns:
        a PageNavigation.
      • showEntityList

        public PageNavigation showEntityList​(java.lang.Class entityType,
                                             EntityDataSource eds,
                                             boolean showCreateForm,
                                             boolean manageMode,
                                             java.lang.Integer pageId)
                                      throws BackingBeanException,
                                             SystemException
        Create an EntityListBackingBean for the entity list and place it in the PageContent of this ContainerBean for display.

        The entity list can be specified using QueryCriteria or MemoryEntityList in the EntityDataSource.

        The render regions to show the bean can be specified in the EntityDataSource using EntityDataSource.setRenderRegions(List, Boolean). If render regions is not specified, use the default regions for query results: getDefaultQueryResultsRenderRegions().

        Parameters:
        entityType - entity type
        eds - the EntityDataSource that specifies the entity list to show
        showCreateForm - whether to show a form to create new entity
        manageMode - manage mode. If true, entity editing will be enabled if user has the permission.
        pageId - the page to navigate to
        Returns:
        a PageNavigation
        Throws:
        BackingBeanException - throw if an backing bean related error occurs
        SystemException - throw if any other error occurs
      • showEntityList

        public PageNavigation showEntityList​(java.lang.Class entityType,
                                             EntityDataSource eds,
                                             EntityListViewConfig viewConfig,
                                             boolean showCreateForm,
                                             boolean manageMode,
                                             java.lang.Integer pageId,
                                             boolean createIfEmpty)
                                      throws BackingBeanException,
                                             SystemException
        Create an EntityListBackingBean for the entity list and place it in the PageContent of this ContainerBean for display.

        The entity list can be specified using QueryCriteria or MemoryEntityList in the EntityDataSource.

        The render regions to show the bean can be specified in the EntityDataSource using EntityDataSource.setRenderRegions(List, Boolean). If render regions is not specified, use the default regions for query results: getDefaultQueryResultsRenderRegions().

        Parameters:
        entityType - entity type
        eds - the EntityDataSource that specifies the entity list to show
        viewConfig - entityListViewConfig. if null, use default.
        showCreateForm - whether to show a form to create new entity
        manageMode - manage mode. If true, entity editing will be enabled if user has the permission.
        pageId - the page to navigate to
        createIfEmpty - whether to show a form to create if the entity list is empty.
        Returns:
        a PageNavigation
        Throws:
        BackingBeanException - throw if an backing bean related error occurs
        SystemException - throw if any other error occurs
      • createEntity

        public static <T extends PersistenceEntityEntityBackingBean<? super T> createEntity​(java.lang.Class<T> entityType,
                                                                                              java.util.List<CriteriaElement> propertyQueryElements,
                                                                                              EntityViewConfig viewConfig,
                                                                                              ContainerBean containerBean,
                                                                                              MenuNodeFactory menuNodeFactory,
                                                                                              DataAccessUnit dataAccessUnit)
                                                                                       throws BackingBeanException
        Create an EntityBackingBean for creating entity
        Parameters:
        entityType - entity type
        propertyQueryElements - the property value initializer
        viewConfig - entityViewConfig. if null, use default.
        containerBean - the containerBean of the EntityBackingBean to be created
        menuNodeFactory - the MenuNodeFactory that is associated with showing the entity
        dataAccessUnit - the DataAccessUnit of the entity to be created
        Returns:
        an EntityBackingBean
        Throws:
        BackingBeanException - throw if an error occurs
      • getQueryPageId

        protected java.lang.Integer getQueryPageId()
        Get the page to show query form. Default is current page.
        Returns:
        page
      • showQueryFormBean

        public <T extends PersistenceEntityPageNavigation showQueryFormBean​(java.lang.Class<T> entityType,
                                                                              EntityInitializer entityInitializer,
                                                                              boolean showQueryForm,
                                                                              EntityViewConfig queryViewConfig,
                                                                              java.util.List<java.lang.Integer> renderRegions,
                                                                              boolean showQueryResults,
                                                                              EntityListViewConfig queryResultViewConfig,
                                                                              QueryResultTransformer queryResultTransformer,
                                                                              MenuNodeFactory menuNodeFactory,
                                                                              DataAccessUnit dataAccessUnit)
                                                                       throws SystemException
        Show query form and/or query results beans for the entity type.
        Parameters:
        entityType - the entity type to query
        entityInitializer - the entity initializer for query
        showQueryForm - whether to show query form
        queryViewConfig - query viewConfig
        renderRegions - the region numbers to show the query form bean
        showQueryResults - whether to show query results
        queryResultViewConfig - query results viewConfig. If not null, it will be merged to queryViewConfig's queryResultsViewConfig.
        queryResultTransformer - query result transformer that is used to transform entities retrieved from persistence.
        menuNodeFactory - the MenuNodeFactory that is associated with showing query form and/or query results
        Returns:
        a PageNavigation
        Throws:
        SystemException - throw if an error occurs in creating backing beans
      • initPageInfo

        protected void initPageInfo()
                             throws SystemException
        Initialize page info including icon, logo, title, meta keywords and description.
        Throws:
        SystemException - throw if an error occurs
      • getOutputLink

        public java.lang.String getOutputLink​(PersistenceEntity entity,
                                              boolean trackSession)
                                       throws SystemException
        Get the bookmarkable URL to show the entity
        Parameters:
        entity - the entity to show
        trackSession - if true, add session id to the URL if necessary
        Returns:
        url, default is null.
        Throws:
        SystemException - throw if an error occurs
      • clear

        public void clear()
        Clear pageContent, containerMenu and properties.
      • cleanCache

        public void cleanCache()
        Clean cache, including cached ResourceBundle.
        Since:
        5.4
      • localeChanged

        public void localeChanged()
                           throws SystemException
        This method will be called when user locale is changed.
        Throws:
        SystemException - throw if an error occurs
        Since:
        5.21
      • setParameter

        public void setParameter​(java.lang.String name,
                                 java.lang.Object value)
        Set parameter value.
        Parameters:
        name - property name
        value - property value
      • removeParameter

        public void removeParameter​(java.lang.String name)
        Remove the parameter with the name.
        Parameters:
        name - the name of the parameter to remove
      • getParameter

        public java.lang.Object getParameter​(java.lang.String name)
        Get parameter value for the name.
        Parameters:
        name - parameter name
        Returns:
        parameter value
      • getDialogBean

        public DialogBean getDialogBean​(boolean create,
                                        DialogBean.DialogType type)
        Get or create dialogBean from this containerBean.

        If the dialog exists, it will not be re-rendered including its title, icons. But if its content changes, changed content will be refreshed.

        if a new dialog is created, it will be opened automatically. For a completely new dialog, call newDialogBean(), which will override existing dialogBean if any.

        Parameters:
        create - if true, create new dialog if the dialog does not exist.
        type - the dialogType of the new dialog to create
        Returns:
        dialogBean
      • getDialogBean

        public DialogBean getDialogBean​(boolean create)
        Get or create dialogBean(type:REGULAR) from this containerBean.

        If the dialog exists, it will not be re-rendered including its title, icons. But if its content changes, changed content will be refreshed.

        if a new dialog is created, it will be opened automatically. For a completely new dialog, call newDialogBean(), which will override existing dialogBean if any.

        Parameters:
        create - if true, create new dialog(type: REGULAR) if the dialog does not exist.
        Returns:
        dialogBean
      • newDialogBean

        public DialogBean newDialogBean​(DialogBean.DialogType type)
        Create a new dialog from this containerBean, existing dialogBean (if any) of this containerBean will be overridden since one containerBean can have one dialogBean only. DialogBean can have its own dialogBean.
        Parameters:
        type - dialogType
        Returns:
        a new dialogBean
      • newDialogBean

        public DialogBean newDialogBean()
        Create a new dialog (type: REGULAR) from this containerBean, existing dialogBean (if any) of this containerBean will be overridden since one containerBean can have one dialogBean only. DialogBean can have its own dialogBean.
        Returns:
        a new dialogBean
      • getDialogBean

        public DialogBean getDialogBean()
        Get existing dialogBean of this containerBean.
        Returns:
        a DialogBean
      • createDialogBean

        protected DialogBean createDialogBean​(DialogBean.DialogType type)
        Create a dialogBean that is a child component of this containerBean.
        Parameters:
        type - dialogType
        Returns:
        DialogBean
      • clone

        public java.lang.Object clone()
        Overrides:
        clone in class java.lang.Object
      • isDialogOpened

        public boolean isDialogOpened()
        Is the dialogBean of this ContainerBean visible?
        Returns:
        true if dialogBean is visible.
      • isLayoutFullPage

        public boolean isLayoutFullPage()
        Whether layout code is full page layout? If yes, <body> is the border layout target.
        Returns:
        true for full page layout
      • setLayoutFullPage

        public void setLayoutFullPage​(boolean layoutFullPage)
        Set whether layout code is full page layout. If yes, <body> is the border layout target.
        Parameters:
        layoutFullPage - true for full page layout
      • getRootContainerBean

        public ContainerBean getRootContainerBean()
        Get root containerBean. A dialogBean's containerBean can be dialogBean or root.
        Returns:
        root containerBean.
      • getLeafContainerBean

        public ContainerBean getLeafContainerBean()
        Get leaf containerBean. A containerBean has at most one child dialog bean,
        Returns:
        containerBean
        Since:
        5.13
      • isRoot

        public boolean isRoot()
        Is this containerBean the root contianerBean?
        Returns:
        true if this containerBean is the root
      • getPathIdentifier

        public java.lang.String getPathIdentifier()
        Get container path identifier: path in the container/dialog tree For example: c0_c1_c1, start from root: first child, second child, third child, and so on.
        Returns:
        path identifier, null for root containerBean.
      • getChildPathIdentifier

        public java.lang.String getChildPathIdentifier​(int childIndex)
        Get the path identifier for child contianerBean
        Parameters:
        childIndex - the index of child containerBean.
        Returns:
        child container path identifier
      • isValidPathIdentifier

        public boolean isValidPathIdentifier​(java.lang.String pathId)
        Whether the pathId is valid in terms of syntax. empty: is valid for root.
        Parameters:
        pathId - the path identifier to verify
        Returns:
        true if valid, false otherwise
      • findChildByPathIdentifier

        public ContainerBean findChildByPathIdentifier​(java.lang.String pathId)
        Get the child containerBean from the path identifier
        Parameters:
        pathId - path identifier
        Returns:
        child ContainerBean
      • getChildIndex

        public int getChildIndex​(ContainerBean childContainerBean)
        Get the index of the child containerBean. The index is always 0 since only one child dialog is supported.
        Parameters:
        childContainerBean - child containerBean
        Returns:
        index. return -1 if the childContainerBean is not the child DialogBean.
      • getChildContainerBean

        public ContainerBean getChildContainerBean​(int childIndex)
        Get the child containerBean at the index. The index is always 0 since only one child dialog is supported.
        Parameters:
        childIndex - the index of child containerBean
        Returns:
        child ContainerBean. return null if not found.
      • isSameOrDescendantContainerBean

        public boolean isSameOrDescendantContainerBean​(ContainerBean containerBean)
        Is the containerBean the same as this ContainerBean or a descendant of this ContainerBean?
        Parameters:
        containerBean - a ContainerBean
        Returns:
        true if the containerBean is the same or a descendant, false otherwise.
      • getDefaultQueryRenderRegions

        public abstract java.util.List<java.lang.Integer> getDefaultQueryRenderRegions()
        Get the default render regions to show query form (EntityBackingBean query view). The first region is used to add beans. The rest of regions may be cleared.
        Returns:
        a list of region numbers.
        See Also:
        EntityDataSource.isClearRenderRegions()
      • getDefaultQueryResultsRenderRegions

        public abstract java.util.List<java.lang.Integer> getDefaultQueryResultsRenderRegions()
        Get the default render regions to show query results, including any backing beans that is not a query EntityBackingBean. The first region is used to add beans. The rest of regions may be cleared.
        Returns:
        a list of region numbers.
        See Also:
        EntityDataSource.isClearRenderRegions()
      • showConfirmDialog

        public PageNavigation showConfirmDialog​(ParameterizedMessage title,
                                                java.util.List<BackingBeanMessage> messages,
                                                ConfirmBean.Command[] commands,
                                                java.lang.String[] commandVisibleNames,
                                                DialogBean dialogBean)
                                         throws SystemException
        Show confirm dialog with the messages and commands.
        Parameters:
        title - dialog title
        messages - message content
        commands - commands to show on the bottom
        commandVisibleNames - command visible names. if null, use command names.
        dialogBean - if null, a new dialogBean instance will be create. DialogListener can be set in dialogBean.
        Returns:
        a PageNavigation
        Throws:
        SystemException - throw if an error occurs
        See Also:
        ConfirmBean
      • showConfirmDialogWithBeans

        public PageNavigation showConfirmDialogWithBeans​(ParameterizedMessage title,
                                                         java.util.List<PersistenceDataBackingBean> beans,
                                                         ConfirmBean.Command[] commands,
                                                         java.lang.String[] commandVisibleNames,
                                                         DialogBean dialogBean)
                                                  throws SystemException
        Show confirm dialog with the list of beans as content and commands.
        Parameters:
        title - dialog title
        beans - a list of beans as content
        commands - commands to show on the bottom
        commandVisibleNames - command visible names. if null, use command names.
        dialogBean - if null, a new dialogBean instance will be create. DialogListener can be set in dialogBean.
        Returns:
        a PageNavigation
        Throws:
        SystemException - throw if an error occurs
        Since:
        5.20
        See Also:
        ConfirmBean
      • showProgressDialog

        public PageNavigation showProgressDialog​(MenuNode targetMenuNode,
                                                 java.lang.Integer initialValue,
                                                 java.lang.String labelTemplate,
                                                 boolean ajax,
                                                 boolean displayOnly,
                                                 boolean closeDilaogOncomplete)
                                          throws SystemException
        Show progress dialog.
        Parameters:
        targetMenuNode - the menu node for which to track progress
        initialValue - progress initial value, default is zero.
        labelTemplate - progress label template such as {value}%, use default if null
        ajax - whether to ajax poll progress value from server side
        displayOnly - whether to display progress statically
        closeDilaogOncomplete - whether to close progress dialog when targetMenuNode command is successfully executed
        Returns:
        a webPage (null)
        Throws:
        SystemException - throw if an error occurs in creating progress bean
        See Also:
        ProgressBean.createProgressModalDialog(MenuNode, Integer, String, boolean, boolean, boolean, ContainerBean)
      • getContainerBean

        public ContainerBean getContainerBean()
        Get the parent ContainerBean of this ContainerBean
        Overrides:
        getContainerBean in class Component
        Returns:
        parent containerBean
      • setContainerBean

        public void setContainerBean​(ContainerBean containerBean)
        Set the parent ContainerBean of this ContainerBean
        Parameters:
        containerBean - parent containerBean
      • entityCommitted

        public <T extends PersistenceEntity> void entityCommitted​(PersistenceDataBackingBean<T> backingBean,
                                                                  java.util.List<T> entities,
                                                                  ActionDescriptor ad)
                                                           throws SystemException
        entityCommitted: called when an entity is created, deleted, or changed in persistence. default: do nothing.
        Parameters:
        backingBean - the backing bean of the entities committed
        entities - the entities created, deleted or changed.
        ad - ActionDescriptor
        Throws:
        SystemException - throw if an error occurs
      • getPrintViewContainerBean

        public ContainerBean getPrintViewContainerBean()
        Get the containerBean that is used to show content for print view.
        Returns:
        ContainerBean instance. default is this ContainerBean.
      • getPrintViewPageId

        public java.lang.Integer getPrintViewPageId()
        Get the print view page Id.
        Returns:
        page id, default is null using the same page
        See Also:
        PageNavigation
      • handleError

        public java.lang.String handleError​(java.lang.Throwable t)
        Handle error. Show or log error message.
        Parameters:
        t - a Throwable
        Returns:
        action result for page navigation.
      • getLocale

        public java.util.Locale getLocale()
        Get the current locale for current user.
        Overrides:
        getLocale in class Component
        Returns:
        locale.
      • getLocaleLanguageTag

        public java.lang.String getLocaleLanguageTag()
        Get user locale as language tag such as en-US.
        Returns:
        language tag
        Since:
        5.18
      • getUrlLocaleLanguageTag

        public java.lang.String getUrlLocaleLanguageTag()
        Get URL locale as language tag such as en-US, used as URL locale parameter value.
        Returns:
        language tag
        Since:
        6.0
      • postAddToView

        public void postAddToView()
        postAddToView: called after viewRoot is added to view when building new view or restoring view.
        Since:
        6.0
      • preRenderView

        public void preRenderView()
                           throws SystemException
        preRenderView: called after buildView and before renderView.
        Throws:
        SystemException - throw if an error occurs
      • isRenderable

        public boolean isRenderable()
        Whether this containerBean is renderable. Default is true. If it is not renderable, any components of this containerBean will not be added to render targets.
        Returns:
        true if renderable.
      • setRenderable

        public void setRenderable​(boolean renderable)
        Set whether this containerBean is renderable. Default is true. If it is not renderable, any components of this containerBean will not be added to render targets.
        Parameters:
        renderable - true if renderable
      • isSaveStates

        public boolean isSaveStates()
        Whether to save states for JSF pages backed by this containerBean? Saving states is disabled for bots(search engines). If request parameter saveState=false, saving states will be disabled. But saveState=true will be ignored.

        Saving states should be disabled for pages that does not have any POST actions.

        Returns:
        true if saving states. default is true.
      • setSaveStates

        public void setSaveStates​(java.lang.Boolean saveStates)
        Set whether to save states for JSF pages backed by this containerBean
        Parameters:
        saveStates - true for saving status. null for using default.
      • getLogo

        public java.lang.String getLogo()
        Get the logo URL of the view backed by this containerBean. Default is the instanceType icon of current bound InstanceType.
        Returns:
        image URL such as http://domain:port/context/image/logo.png. return null if icon is not defined for the instanceType.
      • getTitle

        public ParameterizedMessage getTitle​(boolean includeBrand)
                                      throws SystemException
        Get the title of the view backed by this ContainerBean, which is usually shown on the top of a page. It is different from page title that is shown as browser title. Default is the name of current bound instanceType.
        Parameters:
        includeBrand - whether to include brand name
        Returns:
        instanceType name that is translated using resource bundle
        Throws:
        SystemException - throw if an error occurs
      • getDisplayTitle

        public final java.lang.String getDisplayTitle​(boolean includeBrand)
                                               throws SystemException
        Get the title of the view for display using resource bundle.
        Parameters:
        includeBrand - whether to include brand name
        Returns:
        display title
        Throws:
        SystemException - throw if an error occurs in getting title from bean
      • getName

        public abstract java.lang.String getName()
        Get the name of this ContainerBean.
        Returns:
        container name
      • getPageSize

        public java.lang.Integer getPageSize()
        Get the page size (rows per page) for this ContainerBean for current user.
        Returns:
        page size
      • isMobile

        public boolean isMobile()
        Whether user agent is mobile or desktop?
        Returns:
        true for mobile, false for desktop.
      • getViewInfo

        public ViewInfo getViewInfo()
        Get the ViewInfo of the view backed by this container bean.
        Returns:
        ViewInfo instance
      • setViewInfo

        public void setViewInfo​(ViewInfo viewInfo)
        Set the ViewInfo of the view backed by this container bean.
        Parameters:
        viewInfo - ViewInfo instance
      • isOpenDialogSupported

        public boolean isOpenDialogSupported()
        Can a dialog be opened from this containerBean? default is true.
        Returns:
        true if a dialog can be opened.
      • getPageInfo

        public PageInfo getPageInfo()
        Get page info that contains page title, keywords and description.
        Returns:
        PageInfo instance
      • setPageInfo

        public void setPageInfo​(PageInfo pageInfo)
        Set page info that contains page title, keywords and description.
        Parameters:
        pageInfo - PageInfo instance
      • getStyleClass

        public java.lang.String getStyleClass()
        Get containerBean styleClass that is associated with containerBean name and responsive type(mobile or desktop).
         Desktop: ui-[containerBean name] ui-desktop
         Mobile: ui-[containerBean name]
         
        For mobile, <html> tag will be enhanced by adding ui-mobile style class.
        Returns:
        style class
      • clearRegionsOnCommand

        public void clearRegionsOnCommand​(MenuNode menuNode)
        Clear regions before executing the command of the menu node. Default doing nothing.
        Parameters:
        menuNode - the menu node to click
        Since:
        5.5
        See Also:
        MenuViewConfig.getClearRegionsOnCommand(String)
      • getPage

        public Page getPage()
        Get the page shown in this containerBean.
        Returns:
        Page instance. return null there is no page shown.
        Since:
        5.5
      • getPageObjectResolver

        public final PageObjectResolver getPageObjectResolver()
        Get page embedded object (bean) resolver. If not initialized, it will be created and cached.
        Returns:
        PageObjectResolver instance
        Since:
        5.7
      • createPageObjectResolver

        protected abstract PageObjectResolver createPageObjectResolver()
        Create a page object (bean) resolver.
        Returns:
        PageObjectResolver instance
        Since:
        6.0
      • getBeansOfEntityType

        public <T extends PersistenceEntity> java.util.List<PersistenceDataBackingBean<T>> getBeansOfEntityType​(java.lang.Class<T> entityType,
                                                                                                                boolean recursive,
                                                                                                                ViewType... viewTypes)
        Find all beans(entity and/or entity list beans) with the entity type (or its subclass).
        Parameters:
        entityType - entity type
        viewTypes - if not null, return those whose viewType matching one of the viewTypes
        recursive - if true, search this containerBean and its descendant dialogBeans. if false, search this containerBean only.
        Returns:
        a list of beans
        Since:
        5.13
      • getFirstBeanOfEntityType

        public <T extends PersistenceEntityPersistenceDataBackingBean<T> getFirstBeanOfEntityType​(java.lang.Class<T> entityType,
                                                                                                    boolean recursive,
                                                                                                    ViewType... viewTypes)
        Find the first bean(entity and/or entity list bean) with the entity type (or its subclass).
        Parameters:
        entityType - entity type
        viewTypes - if not null, return those whose viewType matching one of the viewTypes
        recursive - if true, search this containerBean and its descendant dialogBeans. if false, search this containerBean only.
        Returns:
        a PersistenceDataBackingBean
        Since:
        5.19