Class DataControl

    • Constructor Detail

      • DataControl

        public DataControl()
    • Method Detail

      • getProcessActionIds

        public Set<String> getProcessActionIds()
                                        throws PortalException
        Description copied from interface: IDataControl
        Returns the process action identifiers for which this control sets parameters to. A return value of null indicates that the control sets parameters in all process action handlers.
        Specified by:
        getProcessActionIds in interface IDataControl
        Returns:
        the set of process action identifiers.
        Throws:
        PortalException
      • createDataType

        protected IDouiDataType createDataType()
                                        throws PortalException
        Creates the data type to be used for this control.
        Returns:
        the data type to be used for this control, or null if this control does not knows which data type to use.
        Throws:
        PortalException
        Since:
        4.0.10
      • getDataType

        protected final IDouiDataType getDataType()
        Returns the data type for this control. If the data type for this control is not known, UNKNOWN_DATA_TYPE is returned.
        Returns:
        the data type for this control.
        Since:
        4.0.10
        See Also:
        createDataType()
      • createConverter

        protected IConverter createConverter()
                                      throws PortalException
        Creates the converter instance for this control.
        Returns:
        the converter instance or null if this control has no converter.
        Throws:
        PortalException
        Since:
        4.0.10
      • getValueClass

        protected Class<?> getValueClass()
                                  throws PortalException
        Returns the class the possible values of this control are assignable to.

        This default implementation uses IDouiDataType.getValueClass() of the data type of this control.

        Returns:
        the class the possible values of this control are assignable to.
        Throws:
        PortalException
        Since:
        4.0.4
      • convertValueToControlValue

        protected Object convertValueToControlValue​(Object value,
                                                    Locale locale,
                                                    String pattern)
                                             throws PortalException,
                                                    ConversionException
        Method to centralize the implementation of conversion of a value to this control's value.

        Uses this control's converter to convert the value to this control's value class.

        Parameters:
        value - the value.
        locale - the locale to use in the conversion.
        pattern - the pattern to use in the conversion.
        Returns:
        the value converted to this control's value class.
        Throws:
        ConversionException - if an exception is thrown by this control's converter.
        PortalException
        Since:
        4.0.10
      • isTrim

        protected boolean isTrim()
        Returns if the value for this control should be trimmed. The trimming should occur in the setValue(Object) method.
        Returns:
        if the value for this control should be trimmed.
        Since:
        4.0.11
      • setTrim

        protected void setTrim​(boolean trim)
        Sets if the value for this control should be trimmed.
        Parameters:
        trim - true to enable the trimming or false to disable it. This does not affect the value already set in the control.
        Since:
        4.0.11
        See Also:
        isTrim()
      • setRawValue

        protected void setRawValue​(Object value)
                            throws PortalException
        Sets directly the value in this control.
        Parameters:
        value - the value to set.
        Throws:
        PortalException
        Since:
        4.0.4
      • getParameterValue

        protected Object getParameterValue​(String parameterName)
                                    throws PortalException
        Returns the value for this control, reading from request the parameters based on the specified name.

        loadFromRequest() calls this method when necessary, to read the value to be set in the control.

        Parameters:
        parameterName - the parameter name where the value is to be read from. For controls that require multiple request parameters, it is recommended to use the control's identifier as a prefix to its parameter names during render, and then can implement this method as using the given parameter name as the prefix.
        Returns:
        the value.
        Throws:
        PortalException
        Since:
        4.1.1
      • valueIsArray

        public boolean valueIsArray()
                             throws PortalException
        Returns true if the value in the control is expected to be an array.
        Returns:
        Throws:
        PortalException
      • setProcessActionHandlerParameter

        protected void setProcessActionHandlerParameter​(IProcessActionHandler processActionHandler,
                                                        String parameterName)
                                                 throws PortalException
        Set the process action parameter with the control current value.
        Parameters:
        processActionHandler - the process action handler
        parameterName - the parameter name
        Throws:
        PortalException
      • setProcessActionHandlerParameter

        protected void setProcessActionHandlerParameter​(IProcessActionHandler processActionHandler,
                                                        String parameterName,
                                                        Object value)
                                                 throws PortalException
        Set the process action parameter name and value.
        Parameters:
        processActionHandler - the process action handler
        parameterName - the parameter name
        parameterValue - the parameter value
        Throws:
        PortalException
      • getProcessActionHandlerParameterName

        protected String getProcessActionHandlerParameterName()
                                                       throws PortalException
        Define the name of the process action parameter to be set. This name is defined by the processActionParameterName attribute of the control definition. If undefined, the default name will be the control id.
        Returns:
        the name of the process action parameter set by the control.
        Throws:
        PortalException
      • setSourceParameters

        protected void setSourceParameters()
                                    throws PortalException
        Sets the appropriate source parameters.
        Throws:
        PortalException
        Since:
        11.2.0
      • setSourceParameter

        protected void setSourceParameter​(String parameterName,
                                          String sourceId)
                                   throws PortalException
        Set the parameter with the given name in source with the given identifier.
        Parameters:
        parameterName - the parameter name
        sourceId - the source identifier
        Throws:
        PortalException
        Since:
        11.2.0
      • setSourceParameter

        protected void setSourceParameter​(Source source,
                                          String parameterName)
                                   throws PortalException
        Sets the parameter with the given name in the given source.
        Parameters:
        source - the source
        parameterName - the parameter name
        Throws:
        PortalException
        Since:
        11.2.0