psdi.webclient.controls

Class PortletDataInstance

  • All Implemented Interfaces:
    java.lang.Cloneable
    Direct Known Subclasses:
    FavoriteAppsPortlet, InboxPortlet, KPIPortlet, QuickInsertPortlet, ReportListPortlet, ResultSetPortlet


    public class PortletDataInstance
    extends DatasrcInstance
    This class represents a DatasrcInstance for portlet controls. It is extended from the super to implement a customized initialization in which the PortletBean behind this control will be setup according to proper parent and and relationship, most of which is performed dynamically. This class also contains utility method for code reduction and common use.
    • Constructor Detail

      • PortletDataInstance

        public PortletDataInstance()
    • Method Detail

      • getPortletCacheId

        public java.lang.String getPortletCacheId()
        Returns:
        String as portlet's cacheId
      • instantiatedatasrc

        public void instantiatedatasrc()
        Overridden to set up the data source on the control. any controls that need to create a datasource should be an instance of this class. If the datasource is not already created, one will be created and stored in the appropriate place (app or page).
        Overrides:
        instantiatedatasrc in class DatasrcInstance
        See Also:
        DatasrcInstance.instantiatedatasrc()
      • initialize

        public void initialize()
        Initializes the control instance and sets up the portlet cache name and base properties
        Overrides:
        initialize in class ControlInstance
      • getAppId

        public java.lang.String getAppId()
        Returns the application id in which the control lives
        Returns:
        String app id
      • createRenderData

        public void createRenderData()
        Deprecated. 
        To be implmented by the sub class to suit the creation of render data. This method is called on the initialise.
      • hasData

        public boolean hasData()
        Returns true if the data source has records. The flag will be set in the implementation of a PortletDataInstance
        Returns:
        true if data source has records.
      • setHasData

        public void setHasData(boolean newFlag)
        Used to sets the flag for presence of data source in the data bean behind this PortletDataInstanec. The flag will be set in the implementation of a PortletDataInstance
        Parameters:
        newFlag -
      • isPortletVisible

        public java.lang.String isPortletVisible(java.lang.String sMinOrMax)
        Utility method that returns the display parameter for the portlet depending upon its current size.r
      • getKPIImage

        public java.lang.String getKPIImage(java.lang.String status,
                                            java.lang.String trend)
        Utility method that returns image url for the trend of the KPI These are common to the KPI Portlets
        Parameters:
        String - - status of KPI
        String - - trend of the KPI
        Returns:
        String KPIImage
      • percentKPIMark

        public java.lang.String percentKPIMark()
        Utility method that returns a percent mark for KPIs that are of type percentage
        Returns:
        String - HTML of % character
      • formatNumber

        public java.lang.String formatNumber(java.lang.Object objNumber)
        Format the number to remove trailing zeros
        Parameters:
        Object - - number as Double or Float
        Returns:
        String - text representation of number without trailing 0s
      • getLabels

        public java.lang.String[] getLabels(java.lang.String group,
                                            java.lang.String[] keys)
        Returns labels for the control. This method is called by the sub classes.
        Returns:
        String array of locale specific labels
      • getAppBean

        public StartCenterAppBean getAppBean()
        Returns start center app bean. This is a utility method for quickly getting a handle of the startcenter app bean
        Returns:
        StartCenterAppBean
      • deleteportlet

        public int deleteportlet()
        Deletes portlet and its control instance.
      • editportlet

        public void editportlet()
        Take user to the configuration application for the respective portlet
      • toggleportlet

        public void toggleportlet()
        Simply toggles the expanded state of the section
      • togglefilter

        public void togglefilter()
        Simply toggles the expanded state of the section
      • filter

        public void filter()
        Flags the portlet as filtered and refresable.
      • refreshdata

        public void refreshdata()
        Called when user clicks "Refresh" link on the portlet
      • sort

        public int sort()
        Called when a user sorts an attribute in a portlet that has sort implemented
      • getSortAttribute

        public java.lang.String getSortAttribute(java.lang.String colIndex)
        Return the attribute name for sorting given a column index
        Parameters:
        colIndex -
        Returns:
        Attribute Name
      • scroll

        public void scroll()
        Simply scroll the data for the portlet list.
      • isMaximised

        public java.lang.String isMaximised()
        Returns whether portlet is expanded
        Returns:
        String - expanded?
      • isFilterOpen

        public java.lang.String isFilterOpen()
        Returns whether filter panel is open
        Returns:
        String - "true" if filter panel is open
      • isFilterToggled

        public boolean isFilterToggled()
        Returns:
        boolean - Returns the filterToggled.
      • setFilterToggled

        public void setFilterToggled(boolean flag)
      • isFiltered

        public boolean isFiltered()
        Returns:
        boolean - Returns true if the data was filtered.
      • setFiltered

        public void setFiltered(boolean newFlag)
        Parameters:
        boolean - - Sets new flag for portlet data being filtered
      • isPortletStateChanged

        public boolean isPortletStateChanged()
        Returns:
        boolean - Returns true if the portlet's state was changed
      • setPortletStateChanged

        public void setPortletStateChanged(boolean newPortletState)
        Parameters:
        boolean - - Takes new flag for occurance of portlet delete event
      • openrecord

        public int openrecord(java.lang.String gotoApp,
                              java.lang.String uniqueId)
        This method is handles event that open another application with a uniqueid. We need this method because we can only pass app name or uniqueid from the front end as enet value, NOT both All subclasses that need this behavious must have a method for the event name 'openrecord' and pass the appname. Othweriwse if implementation is more specific then it can be overloaded
        Parameters:
        gotoApp -
        uniqueId -
        Returns:
      • setHasLinkedReportsOrKPIs

        public void setHasLinkedReportsOrKPIs(java.util.Vector kpis)
        Sets the flag for this portlet having links to report, kpi or both This flag is then used in the JSP to render the columns to provide the link as need be.
      • isLinkedToReport

        public boolean isLinkedToReport()
        Returns true if this portlet has any KPI linked to report
      • isLinkedToKPI

        public boolean isLinkedToKPI()
        Returns true if this portlet has any KPI linked to report
      • isPortletUpdated

        public boolean isPortletUpdated()
        Returns true of portlet was udpated
        Returns:
        true
      • setPortletUpdated

        public void setPortletUpdated(boolean portletUpdated)
        Sets portlet updated state
        Parameters:
        portletUpdated -
      • checkOrStoreCachedProperty

        public java.lang.String checkOrStoreCachedProperty(java.lang.String cacheId,
                                                           java.lang.String prop)
        Checks if the value for a given cache id is present, If yes then it sets as a property. If no, then it gets from property and sets to cache
        Parameters:
        cacheId -
        prop -
        Returns:
        value as available
      • getStateManager

        public PortletStateImpl getStateManager()
        REturns state manager for this portlet