Package gnue :: Package forms :: Package GFObjects :: Module GFField :: Class GFField
[show private | hide private]

Type GFField

 GTriggerCore --+        
                |        
   object --+   |        
            |   |        
    ParserObj --+        
                |        
             GObj --+    
                    |    
GTriggerExtension --+    
                    |    
                GFObj --+
                        |
                       GFField


A field manages a database column, possibly with foreign key lookup.

A field has two different values. The DB value, which is the value read from/written into the database backend, and the user value, which is the value displayed in a form. Those values are different when the field uses foreign key lookup.
Method Summary
  __init__(self, parent)
  _phase_1_init_(self)
Phase 1 initialization called after all objects of the XML tree were created.
  allowedValues(self)
Return a tuple with allowed values dictionary (mapping keys to values) and a sequence of the fk-descriptions.
tuple of (unicode, integer) autocomplete(self, value, cursor)
Return the first valid user value that starts with the provided part.
  focus_in(self)
Notify the field that it has received the focus.
  focus_out(self)
Notify the field that it is going to lose the focus.
  get_value(self, offset)
Return the current user value of the field.
  is_editable(self, offset)
  isEmpty(self)
  refresh_choices(self)
  resetForeignKey(self, resultSet)
Reload the allowed values of the field.
  resetToDefault(self)
Reset the current field to the default value.
  reverse_lookup(self, value)
Return the DB value for a given user value.
  set_value(self, value)
Set the current user value of the field.
  triggerAutofillBySequence(self, sequenceName)
  validate(self)
Validate the field to decide whether the focus can be moved away from it.
  value_changed(self, new_value)
Notify the field that the db or query value behind it has changed.
  __dsCursorMoved(self, event)
  __dsResultSetActivated(self, event)
  __get_default(self)
  __get_editable(self)
  __get_value(self, offset)
Return the current value of the field, depending on the state of the form and the block.
  __loadAllowedValues(self, resultSet)
  __refresh_ui_all(self)
  __refresh_ui_choices(self)
  __refresh_ui_current(self)
  __set_editable(self, value)
  __set_value(self, value)
Set the current value of the field, depending on the state of the form and the block.
  _event_new_current_record(self)
The current record of our own ResultSet has changed.
  getValue(self, offset)
Return the current value of the field, depending on the state of the form and the block.
  setValue(self, value)
Set the current value of the field, depending on the state of the form and the block.
    Inherited from GFObj
  _is_navigable_(self, mode)
Return wether the object is currently navigable or not.
  get_block(self)
Return the objects' block from the block mapping.
  get_field(self)
Returns the objects' field from the blocks' field mapping
  get_option(self, name)
Return the value of a given option of the object or None if no such option is present.
  is_navigable(self, mode)
Return wether the object is currently navigable or not.
  phase_1_init(self)
Phase 1 initialization called after all objects of the XML tree were created.
    Inherited from GObj
  __getitem__(self, key)
  __setitem__(self, key, value)
  _dumpXML_(self, lookupDict, treeDump, gap, xmlnamespaces, textEncoding, stripPrefixes, escape)
Dumps an XML representation of the object
  buildAndInitObject(self, **params)
This is a convenience function for applications NOT using GParser to load an object tree.
  buildObject(self, **params)
A convenience function for applications NOT using GParser to load an object tree.
string getXmlTag(self, stripPrefixes)
Returns the xml tag to be used to represent the object.
  iterator(self, test, types, includeSelf)
Return a python iterator of child objects.
  maxInits(self)
maxInits returns the maximum size of all the _inits list from this object or it's children
  phaseInit(self, iterations)
Starts GNUe's phased initialization system from this object down.
  showTree(self, indent)
A recusive function to print an indented text representation of the GObj tree from this object down.
  walk(self, function, *args, **parms)
Function that recursively walks down through a tree of ParserObj instances and applies a function to them.
  _buildObject(self)
This function is called after the parsers have completely constructed.
  _phaseInit(self, phase)
Used internally by phaseInit to walk through the object tree initializing objects.
  _setItemHook(self, key, value)
This bit of nastiness is here to let GNUe Designer capture the setting of GObject properties.
    Inherited from GTriggerCore
  __repr__(self)
  create_namespace_object(self, global_namespace, namespace_name)
Construct a namespace object tree from an XML (definitions.GObjects.GObj) object tree.
  get_namespace_object(self)
Return the namespace object that mirrors this object in the action/trigger namespace.
    Inherited from ParserObj
  _diffActionWalker_(self, obj, action)
Set the action attribute of a given object to the specified action.
  _getAsContents_(self)
Get the contents of this object.
  _id_(self, maxIdLength)
Return a compareable and identifying id of an object within a tree.
  _set_initial_attributes_(self, attributes)
Set attributes loaded by GParser.
  addChild(self, child)
Add an object to the list of children
  assign(self, source, recursive)
Assign all attributes from a given object to this one.
  diff(self, goal, maxIdLength)
Build an object tree representing the difference between two object trees.
  dumpXML(self, lookupDict, treeDump, gap, xmlnamespaces, textEncoding, stripPrefixes, escape)
Return a XML representation of the object.
  findChildNamed(self, name, childType)
Moves downward though the children of an object till it finds the child with the specified name.
  findChildOfType(self, childType, includeSelf, allowAllChildren)
Moves downward through the children of an object till it finds the child of the specified type.
  findChildrenOfType(self, childType, includeSelf, allowAllChildren)
Find all children of a specific type.
  findParentOfType(self, parentType, includeSelf)
Moves upward though the parents of an object till it finds the parent of the specified type.
  getChildrenAsContent(self)
Returns the content of any GContent objects that are children of this object.
  getDescription(self)
Return a useful description of the object.
any getParent(self)
Returns the immediate parent of an object instance in a GObj tree.
  merge(self, other, maxIdLength, overwrite)
Merge another object tree into this tree.
  setParent(self, newParent)
Set the immediate parent of an object instance in a GObj tree
    Inherited from object
  __delattr__(...)
x.__delattr__('name') <==> del x.name
  __getattribute__(...)
x.__getattribute__('name') <==> x.name
  __hash__(x)
Return hash(x)...
  __new__(T, S, ...)
Return a new object with type S, a subtype of T...
  __reduce__(...)
helper for pickle
  __reduce_ex__(...)
helper for pickle
  __setattr__(...)
x.__setattr__('name', value) <==> x.name = value
  __str__(x)
Return str(x)...
    Inherited from GTriggerExtension
  associateTrigger(self, key, function)
Associate a trigger with this object.
  processTrigger(self, key, ignoreAbort)
Fire the requested trigger if a trigger of that type has been associated with this object.

Property Summary
    Inherited from GFObj
  has_label

Instance Variable Summary
    Inherited from GTriggerCore
  _triggerFunctions: Dictionary defining the functions this object should present in action/trigger code.
  _triggerGet: Can be set to a method that returns the string value of the object.
  _triggerGlobal: If set to True, this object is added to the global namespace.
  _triggerProperties: Dictionary defining the properties this object should present in action/trigger code.
  _triggerSet: Can be set to a method that sets the value of this object.

Class Variable Summary
    Inherited from GTriggerExtension
dict _validTriggers: Dictionary with valid trigger names as keys.

Method Details

__init__(self, parent=None)
(Constructor)

Overrides:
gnue.forms.GFObjects.GFObj.GFObj.__init__

_phase_1_init_(self)

Phase 1 initialization called after all objects of the XML tree were created. Descendants can overwrite this function to perform actions after construction of the objects.
Overrides:
gnue.forms.GFObjects.GFObj.GFObj._phase_1_init_ (inherited documentation)

allowedValues(self)

Return a tuple with allowed values dictionary (mapping keys to values) and a sequence of the fk-descriptions.

autocomplete(self, value, cursor)

Return the first valid user value that starts with the provided part.

The entry can use this function to implement autocompletion.
Parameters:
value - User entered string.
           (type=unicode)
cursor - Position of the current insertion point
           (type=integer)
Returns:
tuple of autocompleted string and the new position of the insertion point
           (type=tuple of (unicode, integer))

focus_in(self)

Notify the field that it has received the focus.

focus_out(self)

Notify the field that it is going to lose the focus.

The focus change is already decided at this moment, there is no way to stop the focus from changing now.

get_value(self, offset=0)

Return the current user value of the field. For lookup fields, this is the foreign key description.

is_editable(self, offset)

isEmpty(self)

refresh_choices(self)

resetForeignKey(self, resultSet=None)

Reload the allowed values of the field. If a ResultSet is provided the values will be retrieved from it, otherwise a new ResultSet will be creteated (using the fk_source).
Parameters:
resultSet - if not None, the values will be loaded from this ResultSet

resetToDefault(self)

Reset the current field to the default value.

reverse_lookup(self, value)

Return the DB value for a given user value.
Parameters:
value - A valid lookup value for this field.
Returns:
The corresponding DB value.

set_value(self, value)

Set the current user value of the field. For lookup fields, this is the foreign key description.

triggerAutofillBySequence(self, sequenceName)

validate(self)

Validate the field to decide whether the focus can be moved away from it.

This function can raise an exception, in which case the focus change will be prevented.

value_changed(self, new_value)

Notify the field that the db or query value behind it has changed.

This function gets called whenever the user interface has to be updated.
Parameters:
new_value - the new value for this field.

__dsCursorMoved(self, event)

__dsResultSetActivated(self, event)

__get_default(self)

__get_editable(self)

__get_value(self, offset=0)

Return the current value of the field, depending on the state of the form and the block.
Parameters:
offset - offset from the current record (to get values of records other than the current record).

__loadAllowedValues(self, resultSet)

__refresh_ui_all(self)

__refresh_ui_choices(self)

__refresh_ui_current(self)

__set_editable(self, value)

__set_value(self, value)

Set the current value of the field, depending on the state of the form and the block.

_event_new_current_record(self)

The current record of our own ResultSet has changed. So make sure the fk ResultSet follows.

getValue(self, offset=0)

Return the current value of the field, depending on the state of the form and the block.
Parameters:
offset - offset from the current record (to get values of records other than the current record).

setValue(self, value)

Set the current value of the field, depending on the state of the form and the block.


GNUe Home

Private API

Developer's Corner