Compiere 3.1

org.compiere.model
Class GridField

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

public class GridField
extends Object
implements Serializable, Evaluatee

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
See Also:
Serialized Form

Field Summary
static String INSERTING
          Indicator for new Value
static int MAXDISPLAY_LENGTH
          Max Display Length = 60
static String PROPERTY
          PropertyChange Name
 
Constructor Summary
GridField(GridFieldVO vo)
          Field Constructor.
 
Method Summary
 void addDependencies(ArrayList<String> list)
          Add Display Dependencies to given List.
 void addPropertyChangeListener(PropertyChangeListener l)
          Add Property Change Listener
static GridField[] createFields(Ctx ctx, int WindowNo, int TabNo, int AD_Tab_ID, int AD_UserDef_Win_ID)
          Create Fields.
protected  void dispose()
          Dispose
 String get_ValueAsString(String variableName)
          Get Variable Value (Evaluatee)
 int getAD_Column_ID()
          Get AD_Column_ID
 int getAD_Process_ID()
          Get AD_Process_ID
 int getAD_Reference_Value_ID()
          Get AD_Reference_Value_ID
 int getAD_Tab_ID()
          Get AD_Tab_ID
 int getAD_Window_ID()
          Get AD_Window_ID
 String getCallout()
          Get Callout
 String getColumnName()
          Get Column Name
 String getColumnSQL(boolean withAS)
          Get Column Name or SQL .. with/without AS
 Object getDefault(Ctx ctx, int windowNo)
          Create default value.
 String getDefaultValue()
          Get Default Value
 ArrayList<String> getDependentOn()
          Get a list of variables, this field is dependent on
 String getDescription()
          Get Description
 int getDisplayLength()
          Get Display Length
 String getDisplayLogic()
          Get DisplayLogic
 int getDisplayType()
          Get Display Type
 String getErrorValue()
          Get Error Value (the value, which cuased some Error) AND reset it to null
 String getFieldGroup()
          Get Field Group
 int getFieldLength()
          Get Field Length
 String getHeader()
          Get Header
 String getHelp()
          Get Help
 Lookup getLookup()
          Get Lookup, may return null
 MLookupInfo getLookupInfo()
          Get LookupInfo, may return null;
 char getMnemonic()
          Get Label Mnemonic
 String getObscureType()
          Get Obscure Type
 Object getOldValue()
          Get old/previous Value.
 int getSortNo()
          Get Sort No
 Object getValue()
          Get Value
 String getValueMax()
          Get Value Max
 String getValueMin()
          Get Value Min
 String getVFormat()
          Get VFormat
 GridFieldVO getVO()
          Get VO
 int getWindowNo()
          Get Window No
 boolean isAlwaysUpdateable()
          Is Always Updateable
 boolean isCreateMnemonic()
          Create Mnemonic for field
 boolean isDefaultFocus()
          Default Focus
 boolean isDisplayed()
          Is Displayed
 boolean isDisplayed(boolean checkContext)
          Is the Column Visible ?
 boolean isEditable(boolean checkContext)
          Is it Editable - checks IsActive, IsUpdateable, and isDisplayed
 boolean isEncrypted()
          Is Encrypted Field (display) or obscured
 boolean isEncryptedColumn()
          Is Encrypted Column (data)
 boolean isEncryptedField()
          Is Encrypted Field (display)
 boolean isError()
          Get Background Error.
 boolean isErrorValue()
          Return true, if value has Error (for HTML interface) AND reset it to false
 boolean isFieldOnly()
          Is Field Only
 boolean isHeading()
          Is Heading
 boolean isKey()
          Key
 boolean isLongField()
          Is this a long (string/text) field (over 60/2=30 characters)
 boolean isLookup()
          Is this field a Lookup?.
 boolean isMandatory(boolean checkContext)
          Is it Mandatory to enter for user?
 boolean isParentColumn()
          Parent Column
 boolean isParentValue()
          Parent Link Value
 boolean isReadOnly()
          Is ReadOnly
 boolean isSameLine()
          Is SameLine
 boolean isSelectionColumn()
          Is Selection Column
 boolean isUpdateable()
          Is Updateable
 boolean isVirtualColumn()
          Is Virtual Column
 void loadLookup()
          Set Lookup for columns with lookup
 void lookupLoadComplete()
          Wait until Load is complete
 boolean refreshLookup()
          Refresh Lookup if the lookup is unstable
 void removePropertyChangeListener(PropertyChangeListener l)
          Remove Property Change Listener
 void setDisplayed(boolean displayed)
          Overwrite Displayed
 void setDisplayLength(int length)
          Overwrite default DisplayLength
 void setDisplayType(int AD_Reference_ID)
          Get Display Type
 void setError(boolean error)
          Set Error.
 void setErrorValue(String errorValue)
          Set Error Value (the value, which cuased some Error)
 void setInserting(boolean inserting)
          Set Inserting (allows to enter not updateable fields).
 void setMnemonic(char mnemonic)
          Set Label Mnemonic
 void setValue()
          Set Value to null.
 void setValue(Object newValue, boolean inserting)
          Set Value.
 void setValueNoFire(boolean value)
          Set old/previous Value.
 String setValueValidate(String newValue, boolean inserting)
          Set Value and Validate
 String toString()
          String representation
 String toStringX()
          Extended String representation
 boolean validateValue()
          Validate initial Field Value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MAXDISPLAY_LENGTH

public static final int MAXDISPLAY_LENGTH
Max Display Length = 60

See Also:
Constant Field Values

PROPERTY

public static final String PROPERTY
PropertyChange Name

See Also:
Constant Field Values

INSERTING

public static final String INSERTING
Indicator for new Value

See Also:
Constant Field Values
Constructor Detail

GridField

public GridField(GridFieldVO vo)
Field Constructor. requires initField for complete instatanciation

Parameters:
vo - ValueObjecy
Method Detail

dispose

protected void dispose()
Dispose


loadLookup

public void loadLookup()
Set Lookup for columns with lookup


lookupLoadComplete

public void lookupLoadComplete()
Wait until Load is complete


getLookup

public Lookup getLookup()
Get Lookup, may return null

Returns:
lookup

getLookupInfo

public MLookupInfo getLookupInfo()
Get LookupInfo, may return null;

Returns:

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

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

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(Ctx ctx,
                         int windowNo)
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)
  

Returns:
default value or null

validateValue

public boolean validateValue()
Validate initial Field Value. Called from MTab.dataNew and MTab.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

get_ValueAsString

public String get_ValueAsString(String variableName)
Get Variable Value (Evaluatee)

Specified by:
get_ValueAsString in interface 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

isVirtualColumn

public boolean isVirtualColumn()
Is Virtual Column

Returns:
column is virtual

getHeader

public String getHeader()
Get Header

Returns:
header

getDisplayType

public int getDisplayType()
Get Display Type

Returns:
dt

setDisplayType

public void setDisplayType(int AD_Reference_ID)
Get Display Type

Parameters:
AD_Reference_ID - display type

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

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

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

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

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

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

isKey

public boolean isKey()
Key

Returns:
key

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

setValue

public void setValue()
Set Value to null.

Do not 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

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(Ctx ctx,
                                       int WindowNo,
                                       int TabNo,
                                       int AD_Tab_ID,
                                       int AD_UserDef_Win_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

Compiere 3.1

Compiere® is a registered trademark of ComPiere, Inc. ©2004-2008 HumanFlash.com All rights reserved.