Class GridField

java.lang.Object
org.compiere.model.GridField
All Implemented Interfaces:
Serializable, Cloneable, Evaluatee

public class GridField extends Object implements Serializable, Evaluatee, Cloneable
Grid Field Model.

Fields are a combination of AD_Field (the display attributes) and AD_Column (the storage attributes).

The Field maintains the current edited value. If the value is changed, it fire PropertyChange "FieldValue" event.
Usually editors listen to PropertyChange event of their fields.

Version:
$Id: GridField.java,v 1.5 2006/07/30 00:51:02 jjanke Exp $
Author:
Jorg Janke, Victor Perez , e-Evolution.SC FR [ 1757088 ], [1877902] Implement JSR 223 Scripting APIs to Callout https://sourceforge.net/p/adempiere/feature-requests/318/ to FR [1877902], Carlos Ruiz, qss FR [1877902], Juan David Arboleda (arboleda), GlobalQSS, [ 1795398 ] Process Parameter: add display and readonly logic, Teo Sarca, teo.sarca@gmail.com
  • BF [ 2874646 ] GridField issue when a lookup is key https://sourceforge.net/p/adempiere/bugs/2164/, victor.perez@e-evolution.com,www.e-evolution.com
  • BF [ 2910358 ] Error in context when a field is found in different tabs. https://sourceforge.net/p/adempiere/bugs/2255/
  • BF [ 2910368 ] Error in context when IsActive field is found in different https://sourceforge.net/p/adempiere/bugs/2256/
  • BF [ 3007342 ] Included tab context conflict issue https://sourceforge.net/p/adempiere/bugs/2409/
  • See Also:
    • Field Details

    • Constructor Details

      • GridField

        public GridField(GridFieldVO vo)
        Field Constructor. requires initField for complete instantiation
        Parameters:
        vo - ValueObjecy
    • Method Details

      • dispose

        protected void dispose()
        Clean up
      • loadLookup

        public void loadLookup()
        Set Lookup for columns with lookup and IsDisplayed=true
      • loadLookupNoValidate

        public void loadLookupNoValidate()
        Skip isDisplay checking
      • lookupLoadComplete

        public void lookupLoadComplete()
        Wait until loading of lookup is complete
      • getLookup

        public Lookup getLookup()
        Get Lookup, may return null
        Returns:
        lookup
      • isLookup

        public boolean isLookup()
        Is this field a Lookup?.
        Returns:
        true if lookup field
      • refreshLookup

        public boolean refreshLookup()
        Refresh Lookup if necessary
        Returns:
        true if lookup is validated
      • getDependentOn

        public ArrayList<String> getDependentOn()
          Get a list of variables that this field is dependent on.
          - for display logic or
          - for readonly logic or
          - for mandatory or
          - for lookup validation
          
        Returns:
        ArrayList
      • setError

        public void setError(boolean error)
        Set Error. Used by editors to set the color.
        Parameters:
        error - true if error
      • isError

        public boolean isError()
        Returns:
        true if there's error
      • isMandatory

        public boolean isMandatory(boolean checkContext)
        Is it Mandatory to enter for user?
        Parameters:
        checkContext - - check environment (requires correct row position)
        Returns:
        true if mandatory
      • isEditablePara

        public boolean isEditablePara(boolean checkContext)
        Is parameter Editable - checks if parameter is Read Only
        Parameters:
        checkContext - if true checks Context
        Returns:
        true, if editable
      • isEditable

        public boolean isEditable(boolean checkContext)
        Is it Editable
        Parameters:
        checkContext - if true checks Context for Active, IsProcessed, LinkColumn
        Returns:
        true, if editable
      • isEditableGrid

        public boolean isEditableGrid(boolean checkContext)
        Is it Editable in Grid
        Parameters:
        checkContext - if true checks environment context
        Returns:
        true, if editable
      • isEditable

        public boolean isEditable(Properties ctx, boolean checkContext, boolean isGrid)
        Is it Editable
        Parameters:
        checkContext - if true checks environment context
        Returns:
        true, if editable
      • setInserting

        public void setInserting(boolean inserting)
        Set Inserting (allows to enter not updatable fields). Reset when setting the Field Value.
        Parameters:
        inserting - true if inserting
      • setDefaultLogic

        public void setDefaultLogic(String defaultValue)
        Parameters:
        defaultValue -
      • setDefault2Logic

        public void setDefault2Logic(String defaultValue2)
        Parameters:
        defaultValue2 - default value for range field
      • getDefault

        public Object getDefault()
        Get default value.
        
        		(a) Key/Parent/IsActive/SystemAccess
              (b) SQL Default
        		(c) Column Default		//	system integrity
              (d) User Preference
        		(e) System Preference
        		(f) DataType Defaults
        
          Don't default from Context => use explicit defaultValue
          (would otherwise copy previous record)
          
        Returns:
        default value or null
      • getDefaultForPanel

        public Object getDefaultForPanel()
        Get default of field when field not inside standard AD window (i.e not AD_Tab+AD_Field)
        Returns:
      • getDefault

        public Object getDefault(String seqGetDefaultValueStr)
        Get default value with priority define by seqGetDefaultValueStr
        Parameters:
        seqGetDefaultValueStr -
        Returns:
      • getDefault

        public Object getDefault(org.idempiere.util.ParseSeq seqGetDefaultValue)
        Get default value with priority define by seqGetDefaultValue
        Parameters:
        seqGetDefaultValue -
        Returns:
        default value
      • getDefaultValueByType

        protected Object getDefaultValueByType(Character defaultValueType)
         defaultValueType:
         "1" special case
         "2" sql default
         "3" default logic
         "4" user preference
         "5" system preference
         "6" preference for field as process parameter, info parameter,...
         "7" data-type default
         
        Parameters:
        defaultValueType -
        Returns:
        default value
      • isIgnoreDefault

        protected boolean isIgnoreDefault()
        Returns:
        true to ignore default value
      • defaultForSpecialCase

        protected Object defaultForSpecialCase()
        When field is inside standard AD window, for new record, some column is fix with special logic.
        For example: reference column at child tab always uses parent value.
        Active column always true.
        In system client, always use system for client.
        Returns:
        default value or null
      • defaultFromParent

        protected Object defaultFromParent()
        Get default value from parent tab
        Returns:
        default value or null
      • defaultForActiveField

        protected Object defaultForActiveField()
        Returns:
        default value or null
      • defaultForClientOrg

        protected Object defaultForClientOrg()
        Default value for AD_Org_ID and AD_Client_ID
        Returns:
        default value or null
      • defaultFromSQLExpression

        protected Object defaultFromSQLExpression()
        Default value from SQL
        Returns:
        default value or null
      • defaultFromExpression

        protected Object defaultFromExpression()
        Default value from expression
        Returns:
        default value or null
      • defaultFromPreferenceForPanel

        protected Object defaultFromPreferenceForPanel()
        Get preference when field not inside standard AD window
        Returns:
        default value or null
      • defaultFromPreference

        protected Object defaultFromPreference(Character defaultValueType)
        Parameters:
        defaultValueType - "4" for user preference and "5" for system preference
        Returns:
        default value or null
      • defaultFromDatatype

        protected Object defaultFromDatatype()
        Default value by data type
        Returns:
        default value or null
      • validateValueNoDirect

        public boolean validateValueNoDirect()
        Validate initial Field Value. Do not push direct value if it doesn't exist. Called from GridTab.dataNew when inserting.
        Returns:
        true if valid
      • validateValue

        public boolean validateValue()
        Deprecated.
        use validateValueNoDirect instead
        Validate initial Field Value. Push direct value if it doesn't exist Called from GridTab.setCurrentRow when inserting
        Returns:
        true if valid
      • isDisplayed

        public boolean isDisplayed(boolean checkContext)
        Is the Column Visible ?
        Parameters:
        checkContext - - check environment (requires correct row position)
        Returns:
        true, if visible
      • isDisplayed

        public boolean isDisplayed(Properties ctx, boolean checkContext)
        Is the Column Visible ?
        Parameters:
        ctx -
        checkContext - - check environment (requires correct row position)
        Returns:
        true, if visible
      • isDisplayedGrid

        public boolean isDisplayedGrid(boolean checkContext)
        Is the Grid Column Visible ?
        Parameters:
        checkContext - - check environment (requires correct row position)
        Returns:
        true, if visible
      • isDisplayedGrid

        public boolean isDisplayedGrid(Properties ctx, boolean checkContext)
        Is the Grid Column Visible ?
        Parameters:
        ctx -
        checkContext - - check environment (requires correct row position)
        Returns:
        true, if visible
      • get_ValueAsString

        public String get_ValueAsString(String variableName)
        Get variable value (Evaluatee) as string
        Specified by:
        get_ValueAsString in interface Evaluatee
        Parameters:
        variableName - name
        Returns:
        value
      • get_ValueAsString

        public String get_ValueAsString(Properties ctx, String variableName)
        Get variable value (Evaluatee) as string
        Parameters:
        ctx -
        variableName - name
        Returns:
        value
      • addDependencies

        public void addDependencies(ArrayList<String> list)
        Add display dependencies to given List. Source: DisplayLogic.
        Parameters:
        list - list to be added to
      • getColumnName

        public String getColumnName()
        Get Column Name
        Returns:
        column name
      • getColumnSQL

        public String getColumnSQL(boolean withAS)
        Get Column Name or SQL .. with/without AS
        Parameters:
        withAS - include AS ColumnName for virtual columns in select statements
        Returns:
        column name
      • getSearchColumnSQL

        public String getSearchColumnSQL()
        Get Column Name or SQL for search queries
        Returns:
        column name
      • isVirtualColumn

        public boolean isVirtualColumn()
        Is Virtual Column
        Returns:
        true if column is virtual
      • isVirtualDBColumn

        public boolean isVirtualDBColumn()
        Is Virtual DB Column (not using @SQL= and loaded as part of main query)
        Returns:
        true if column is virtual DB
      • isVirtualUIColumn

        public boolean isVirtualUIColumn()
        Is Virtual UI Column (using @SQL= and loaded separately from main query)
        Returns:
        column is virtual UI
      • isVirtualSearchColumn

        public boolean isVirtualSearchColumn()
        Is Virtual search Column (using @SQLFIND= and it is for find window usage only)
        Returns:
        column is virtual search
      • getHeader

        public String getHeader()
        Get Header
        Returns:
        header
      • getEntityType

        public String getEntityType()
        Get EntityType
        Returns:
        Window Entity Type
      • getDisplayType

        public int getDisplayType()
        Get Display Type
        Returns:
        display type
      • getAD_Reference_Value_ID

        public int getAD_Reference_Value_ID()
        Get AD_Reference_Value_ID
        Returns:
        AD_Reference_ID
      • getAD_Window_ID

        public int getAD_Window_ID()
        Get AD_Window_ID
        Returns:
        AD_Window_ID
      • getAD_Process_ID_Of_Panel

        public int getAD_Process_ID_Of_Panel()
        Returns:
        AD_Process_ID of containing panel
      • getAD_Window_ID_Of_Panel

        public int getAD_Window_ID_Of_Panel()
        Returns:
        AD_Window_ID of containing panel
      • getAD_InfoWindow_ID_of_Panel

        public int getAD_InfoWindow_ID_of_Panel()
        Returns:
        AD_InfoWindow_ID of containing panel
      • getAD_Chart_ID

        public int getAD_Chart_ID()
        get AD_Chart_ID
        Returns:
        AD_Chart_ID
      • getWindowNo

        public int getWindowNo()
        Get Window No
        Returns:
        window no
      • getAD_Column_ID

        public int getAD_Column_ID()
        Get AD_Column_ID
        Returns:
        AD_Column_ID
      • getDisplayLength

        public int getDisplayLength()
        Get Display Length
        Returns:
        display length
      • isSameLine

        public boolean isSameLine()
        Is SameLine
        Returns:
        true if same line with previous field
      • isDisplayed

        public boolean isDisplayed()
        Is Displayed
        Returns:
        true if displayed
      • isDisplayedGrid

        public boolean isDisplayedGrid()
        Is Displayed
        Returns:
        true if displayed in grid mode
      • getSeqNoGrid

        public int getSeqNoGrid()
        Grid sequence number
        Returns:
        grid sequence number
      • getDisplayLogic

        public String getDisplayLogic()
        Get DisplayLogic
        Returns:
        display logic
      • getDefaultValue

        public String getDefaultValue()
        Get Default Value
        Returns:
        default value
        See Also:
      • isReadOnly

        public boolean isReadOnly()
        Is ReadOnly
        Returns:
        true if read only
        See Also:
      • isUpdateable

        public boolean isUpdateable()
        Is Updatable
        Returns:
        true if updatable
      • isAutocomplete

        public boolean isAutocomplete()
        Is Autocomplete
        Returns:
        true if autocomplete
      • isAllowCopy

        public boolean isAllowCopy()
        Is Allow Copy
        Returns:
        true if allow copy value of field to new record
      • isAlwaysUpdateable

        public boolean isAlwaysUpdateable()
        Is Always Updateable
        Returns:
        true if field is always updatable
      • isHeading

        public boolean isHeading()
        Is Heading
        Returns:
        true if heading only (no field editor)
      • isFieldOnly

        public boolean isFieldOnly()
        Is Field Only
        Returns:
        true if field editor only (no label)
      • isEncryptedField

        public boolean isEncryptedField()
        Is Encrypted Field (display)
        Returns:
        true if encrypted field
      • isEncrypted

        public boolean isEncrypted()
        Is Encrypted Field (display) or obscured
        Returns:
        true if encrypted or obscured field
      • isEncryptedColumn

        public boolean isEncryptedColumn()
        Is Encrypted Column (data)
        Returns:
        true if encrypted column
      • isSelectionColumn

        public boolean isSelectionColumn()
        Is Selection Column
        Returns:
        true if selection column (column in simple find window)
      • isHtml

        public boolean isHtml()
        Is HTML Field (display)
        Returns:
        true if it is html field
      • getSeqNoSelection

        public int getSeqNoSelection()
        Selection column sequence
        Returns:
        Selection column sequence
      • getObscureType

        public String getObscureType()
        Get Obscure Type
        Returns:
        obscure type
      • getSortNo

        public int getSortNo()
        Get Sort No
        Returns:
        sequence in sort
      • getFieldLength

        public int getFieldLength()
        Get Field Length
        Returns:
        field length
      • getVFormat

        public String getVFormat()
        Get VFormat
        Returns:
        value format
      • getFormatPattern

        public String getFormatPattern()
        Get Format Pattern
        Returns:
        value format pattern
      • getValueMin

        public String getValueMin()
        Get Value Min
        Returns:
        min value
      • getValueMax

        public String getValueMax()
        Get Value Max
        Returns:
        max value
      • getFieldGroup

        public String getFieldGroup()
        Get Field Group
        Returns:
        field group
      • getFieldGroupType

        public String getFieldGroupType()
        Get Field Group Type
        Returns:
        field group type
      • isKey

        public boolean isKey()
        Key
        Returns:
        true if this is key field
      • isUUID

        public boolean isUUID()
        UUID
        Returns:
        true if this is UUID field
      • isParentColumn

        public boolean isParentColumn()
        Parent Column
        Returns:
        true if this is a parent column
      • isParentValue

        public boolean isParentValue()
        Parent Link Value
        Returns:
        true if this is field for parent link column
      • getCallout

        public String getCallout()
        Get Callout
        Returns:
        callout
      • getAD_Process_ID

        public int getAD_Process_ID()
        Get AD_Process_ID
        Returns:
        AD_Process_ID
      • getAD_InfoWindow_ID

        public int getAD_InfoWindow_ID()
        Get AD_InfoWindow_ID
        Returns:
        AD_InfoWindow_ID
      • getDescription

        public String getDescription()
        Get Description
        Returns:
        description
      • getHelp

        public String getHelp()
        Get Help
        Returns:
        help
      • getAD_Tab_ID

        public int getAD_Tab_ID()
        Get AD_Tab_ID
        Returns:
        tab
      • getVO

        public GridFieldVO getVO()
        Get VO
        Returns:
        value object
      • isDefaultFocus

        public boolean isDefaultFocus()
        Default Focus
        Returns:
        true if this is the default focus field
      • isLongField

        public boolean isLongField()
        Is this a long (string/text) field (over 60/2=30 characters)
        Returns:
        true if long field
      • getAD_Field_ID

        public int getAD_Field_ID()
        Get AD_Field_ID
        Returns:
        AD_Field_ID
      • setValue

        public void setValue()
        Set Value to null.

        Do not update context - called from GridTab.setCurrentRow. Send Bean PropertyChange event if there is a change (i.e current value is not null).

      • setValueAndUpdateContext

        public void setValueAndUpdateContext()
        Set Value to null.

        Do update context - called from GridTab.setCurrentRow. Send Bean PropertyChange event if there is a change (i.e current value is not null).

      • setValue

        public void setValue(Object newValue, boolean inserting)
        Set Value.

        Update context, if not text or RowID; Send Bean PropertyChange event if there is a change.

        Parameters:
        newValue - new value
        inserting - true if inserting
      • updateContext

        public void updateContext()
        Update env. context with current value
      • getAD_LabelStyle_ID

        public int getAD_LabelStyle_ID()
        Returns:
        AD_LabelStyle_ID
      • getAD_FieldStyle_ID

        public int getAD_FieldStyle_ID()
        Returns:
        AD_FieldStyle_ID
      • setValueValidate

        public String setValueValidate(String newValue, boolean inserting)
        Set Value and Validate
        Parameters:
        newValue - value
        inserting - insert
        Returns:
        null or error message
      • getValue

        public Object getValue()
        Get Value
        Returns:
        current value
      • setValueNoFire

        public void setValueNoFire(boolean value)
        Parameters:
        value - if false property change will always be fires
      • getOldValue

        public Object getOldValue()
        Get old/previous Value. Called from MTab.processCallout.
        Returns:
        old value
      • setErrorValue

        public void setErrorValue(String errorValue)
        Set Error Value (the value, which caused some Error)
        Parameters:
        errorValue - error value
      • getErrorValue

        public String getErrorValue()
        Get Error Value (the value, which caused some Error) AND reset error value to null
        Returns:
        error value
      • isErrorValue

        public boolean isErrorValue()
        Get error value flag AND reset error value flag to false
        Returns:
        true if error value is set
      • setDisplayLength

        public void setDisplayLength(int length)
        Overwrite default DisplayLength
        Parameters:
        length - new length
      • setDisplayed

        public void setDisplayed(boolean displayed)
        Overwrite Displayed
        Parameters:
        displayed - true if displayed
      • isCreateMnemonic

        public boolean isCreateMnemonic()
        Create Mnemonic for field
        Returns:
        no for r/o, client, org, document no
      • getMnemonic

        public char getMnemonic()
        Get Label Mnemonic
        Returns:
        Mnemonic
      • setMnemonic

        public void setMnemonic(char mnemonic)
        Set Label Mnemonic
        Parameters:
        mnemonic - Mnemonic
      • toString

        public String toString()
        String representation
        Overrides:
        toString in class Object
        Returns:
        string representation
      • toStringX

        public String toStringX()
        Extended String representation
        Returns:
        string representation
      • removePropertyChangeListener

        public void removePropertyChangeListener(PropertyChangeListener l)
        Remove Property Change Listener
        Parameters:
        l - listener
      • addPropertyChangeListener

        public void addPropertyChangeListener(PropertyChangeListener l)
        Add Property Change Listener
        Parameters:
        l - listener
      • createFields

        public static GridField[] createFields(Properties ctx, int WindowNo, int TabNo, int AD_Tab_ID)
        Create GridFields for AD_Tab
        Parameters:
        ctx - context
        WindowNo - window
        TabNo - tab no
        AD_Tab_ID - tab
        Returns:
        array of all fields in display order
      • restoreValue

        public void restoreValue()
        Restore the backup value (if available) author teo_sarca [ 1699826 ]
      • setVFormat

        public void setVFormat(String strNewFormat)
        Feature Request [1707462] Enable user to change VFormat on runtime
        Parameters:
        strNewFormat - VFormat mask author fer_luck
      • getIncluded_Tab_ID

        public int getIncluded_Tab_ID()
        Feature Request FR [ 1757088 ] Get the id tab include
        Returns:
        Included_Tab_ID
      • setIsCollapsedByDefault

        public void setIsCollapsedByDefault(boolean flag)
        Set the default state of collapse field group type
        Parameters:
        flag -
      • getIsCollapsedByDefault

        public boolean getIsCollapsedByDefault()
        Get the default state of collapse field group type
      • getEntries

        public List<String> getEntries()
        Returns a list containing all existing values of this field (for current login client).
        Returns:
        List of existing values for this field
      • setGridTab

        public void setGridTab(GridTab gridTab)
        Parameters:
        gridTab -
      • getGridTab

        public GridTab getGridTab()
        Returns:
        GridTab
      • getXPosition

        public int getXPosition()
        IDEMPIERE-358
        Returns:
        X position in form
      • getColumnSpan

        public int getColumnSpan()
        Returns:
        column span (for form)
      • getNumLines

        public int getNumLines()
        Returns:
        number of lines (for form)
      • isToolbarButton

        public boolean isToolbarButton()
        Returns:
        true if render as toolbar button
      • isToolbarOnlyButton

        public boolean isToolbarOnlyButton()
        Returns:
        true if only render as toolbar button
      • isLockedRecord

        public boolean isLockedRecord()
        Returns:
        true if record is lock
      • setLockedRecord

        public void setLockedRecord(boolean lockedRecord)
        Parameters:
        lockedRecord -
      • getPA_DashboardContent_ID

        public int getPA_DashboardContent_ID()
        Returns:
        PA_DashboardContent_ID
      • getPlaceholder

        public String getPlaceholder()
        Returns:
        place holder text for editor
      • getPlaceholder2

        public String getPlaceholder2()
        Returns:
        place holder text 2 for editor (for range field)
      • setPlaceholder

        public void setPlaceholder(String placeholder)
        Parameters:
        placeholder -
      • clone

        public GridField clone(Properties ctx)
        Parameters:
        ctx -
        Returns:
        clone GridField
      • setLookupEditorSettingValue

        public void setLookupEditorSettingValue(boolean b)
        Parameters:
        b -
      • isLookupEditorSettingValue

        public boolean isLookupEditorSettingValue()
        Returns:
        true if the setting value of this field by UI is in progress
      • isQuickForm

        public boolean isQuickForm()
        Is Quick Form
        Returns:
        true if displayed in Quick Form
      • getDateRangeOption

        public String getDateRangeOption()
        Get Date Range Options
        Returns:
        The option, how the date editor will be displayed.
      • processUIVirtualColumn

        public void processUIVirtualColumn()
        Load virtual UI column
      • setParentEvaluatee

        public void setParentEvaluatee(Evaluatee evaluatee)
        Set parent Evaluatee that take precedence over value return from GridField's Evaluatee implementation.
        Parameters:
        evaluatee -