Class 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". If the background is changed the PropertyChange "FieldAttribute" is fired.
    Usually editors listen to 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:
    Serialized Form
    • Constructor Detail

      • GridField

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

      • dispose

        protected void dispose()
        Dispose
      • loadLookup

        public void loadLookup()
        Set Lookup for columns with lookup
      • loadLookupNoValidate

        public void loadLookupNoValidate()
        bypass isdisplay validation, used by findwindow
      • lookupLoadComplete

        public void lookupLoadComplete()
        Wait until Load 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 the lookup is unstable
        Returns:
        true if lookup is validated
      • getDependentOn

        public ArrayList<String> getDependentOn()
        Get a list of variables, this field is dependent on. - for display purposes or - for lookup purposes
        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()
        Get Background Error.
        Returns:
        error
      • isMandatory

        public boolean isMandatory​(boolean checkContext)
        Is it Mandatory to enter for user? Mandatory checking is dome in MTable.getMandatory
        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 - checks IsActive, IsUpdateable, and isDisplayed
        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- checks IsActive, IsUpdateable, and isDisplayedGrid
        Parameters:
        checkContext - if true checks Context for Active, IsProcessed, LinkColumn
        Returns:
        true, if editable
      • isEditable

        public boolean isEditable​(Properties ctx,
                                  boolean checkContext,
                                  boolean isGrid)
        Is it Editable - checks IsActive, IsUpdateable, and isDisplayed
        Parameters:
        checkContext - if true checks Context for Active, IsProcessed, LinkColumn
        Returns:
        true, if editable
      • setInserting

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

        public Object getDefault()
        Create 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)
          
        this method code in mind GirdField lie at standard window, and default is receive when new record. maybe it will don't suitable for use at other place as info panel parameter,...
        Returns:
        default value or null
      • getDefaultForPanel

        public Object getDefaultForPanel()
        get default of field when field don't lie down at standard window
        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:
      • getDefaultValueByType

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

        protected boolean isIgnoreDefault()
      • defaultForSpecialCase

        protected Object defaultForSpecialCase()
        When field lie down at standard window, for make new record, some column is fix will special logic example: reference column at child tab always use parent value active column always true in system client always use system for client
        Returns:
      • defaultFromParent

        protected Object defaultFromParent()
      • defaultForActiveField

        protected Object defaultForActiveField()
      • defaultForClientOrg

        protected Object defaultForClientOrg()
      • defaultFromSQLExpression

        protected Object defaultFromSQLExpression()
      • defaultFromExpression

        protected Object defaultFromExpression()
      • defaultFromPreferenceForPanel

        protected Object defaultFromPreferenceForPanel()
        get preference when field don't lie down at standard window
        Returns:
      • defaultFromPreference

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

        protected Object defaultFromDatatype()
      • 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:
        checkContext - - check environment (requires correct row position)
        Returns:
        true, if visible
      • get_ValueAsString

        public String get_ValueAsString​(String variableName)
        Get Variable Value (Evaluatee)
        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)
        Parameters:
        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:
        column is virtual
      • isVirtualDBColumn

        public boolean isVirtualDBColumn()
        Is Virtual DB Column
        Returns:
        column is virtual DB
      • isVirtualUIColumn

        public boolean isVirtualUIColumn()
        Is Virtual UI Column
        Returns:
        column is virtual UI
      • isVirtualSearchColumn

        public boolean isVirtualSearchColumn()
        Is Virtual search Column
        Returns:
        column is virtual search
      • getHeader

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

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

        public int getAD_Reference_Value_ID()
        Get AD_Reference_Value_ID
        Returns:
        reference value
      • getAD_Window_ID

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

        public int getAD_Process_ID_Of_Panel()
        in case this field lie on parameter process panel, AD_Process_ID_Of_Panel is id of process will run in this panel it's difference with AD_Process_ID
      • getAD_Window_ID_Of_Panel

        public int getAD_Window_ID_Of_Panel()
        in case this field lie on parameter process panel, AD_Process_ID_Of_Panel is id of process will run in this panel it's difference with AD_Process_ID
      • getAD_Infowindow_ID

        public int getAD_Infowindow_ID()
      • getAD_Chart_ID

        public int getAD_Chart_ID()
        get AD_Chart_ID
        Returns:
        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:
        column
      • getDisplayLength

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

        public boolean isSameLine()
        Is SameLine
        Returns:
        trie if same line
      • isDisplayed

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

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

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

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

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

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

        public boolean isUpdateable()
        Is Updateable
        Returns:
        true if updateable
      • isAutocomplete

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

        public boolean isAllowCopy()
        Is Allow Copy
        Returns:
        true if allow copy
      • isAlwaysUpdateable

        public boolean isAlwaysUpdateable()
        Is Always Updateable
        Returns:
        true if always updateable
      • isHeading

        public boolean isHeading()
        Is Heading
        Returns:
        heading
      • isFieldOnly

        public boolean isFieldOnly()
        Is Field Only
        Returns:
        field only
      • isEncryptedField

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

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

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

        public boolean isSelectionColumn()
        Is Selection Column
        Returns:
        selection
      • isHtml

        public boolean isHtml()
        Is HTML Field (display)
        Returns:
        html field
      • getSeqNoSelection

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

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

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

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

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

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

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

        public String getValueMax()
        Get Value Max
        Returns:
        max
      • 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:
        key
      • isUUID

        public boolean isUUID()
        UUID
        Returns:
        is UUID
      • isParentColumn

        public boolean isParentColumn()
        Parent Column
        Returns:
        parent column
      • isParentValue

        public boolean isParentValue()
        Parent Link Value
        Returns:
        parent value
      • getCallout

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

        public int getAD_Process_ID()
        Get AD_Process_ID
        Returns:
        process
      • 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:
        focus
      • 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:
        field
      • setValue

        public void setValue()
        Set Value to null.

        Do not update context - called from GridTab.setCurrentRow Send Bean PropertyChange if there is a change

      • setValueAndUpdateContext

        public void setValueAndUpdateContext()
        Set Value to null.

        Do update context - called from GridTab.setCurrentRow Send Bean PropertyChange if there is a change

      • setValue

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

        Update context, if not text or RowID; Send Bean PropertyChange 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()
      • getAD_FieldStyle_ID

        public int getAD_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)
        Set old/previous Value. (i.e. don't fire Property change) Used by VColor.setField
        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 cuased some Error)
        Parameters:
        errorValue - error message
      • getErrorValue

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

        public boolean isErrorValue()
        Return true, if value has Error (for HTML interface) AND reset it to false
        Returns:
        has error
      • setDisplayLength

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

        public void setDisplayed​(boolean displayed)
        Overwrite Displayed
        Parameters:
        displayed - trie 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 Fields. Used by APanel.cmd_find and Viewer.cmd_find
        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 any 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:
        id Tab
      • 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 entries of this field with the actual AD_Client_ID.
        Returns:
        List of existing entries for this field
      • setGridTab

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

        public GridTab getGridTab()
        Returns:
        GridTab
      • getXPosition

        public int getXPosition()
      • getColumnSpan

        public int getColumnSpan()
      • getNumLines

        public int getNumLines()
      • isToolbarButton

        public boolean isToolbarButton()
      • isToolbarOnlyButton

        public boolean isToolbarOnlyButton()
      • isLockedRecord

        public boolean isLockedRecord()
      • setLockedRecord

        public void setLockedRecord​(boolean lockedRecord)
      • getPA_DashboardContent_ID

        public int getPA_DashboardContent_ID()
      • getPlaceholder

        public String getPlaceholder()
      • getPlaceholder2

        public String getPlaceholder2()
      • setPlaceholder

        public void setPlaceholder​(String placeholder)
      • 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
      • processUIVirtualColumn

        public void processUIVirtualColumn()