commit-gnue
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnue] r8280 - in trunk/gnue-forms/src: . GFObjects


From: johannes
Subject: [gnue] r8280 - in trunk/gnue-forms/src: . GFObjects
Date: Mon, 3 Apr 2006 18:21:53 -0500 (CDT)

Author: johannes
Date: 2006-03-29 02:46:43 -0600 (Wed, 29 Mar 2006)
New Revision: 8280

Removed:
   trunk/gnue-forms/src/GFObjects/GFColsrc.py
   trunk/gnue-forms/src/GFObjects/GFColumn.py
   trunk/gnue-forms/src/GFObjects/GFLeaf.py
   trunk/gnue-forms/src/GFObjects/GFTree.py
Modified:
   trunk/gnue-forms/src/GFObjects/GFBlock.py
   trunk/gnue-forms/src/GFObjects/GFBox.py
   trunk/gnue-forms/src/GFObjects/GFButton.py
   trunk/gnue-forms/src/GFObjects/GFComponent.py
   trunk/gnue-forms/src/GFObjects/GFContainer.py
   trunk/gnue-forms/src/GFObjects/GFDataSource.py
   trunk/gnue-forms/src/GFObjects/GFEntry.py
   trunk/gnue-forms/src/GFObjects/GFField.py
   trunk/gnue-forms/src/GFObjects/GFImage.py
   trunk/gnue-forms/src/GFObjects/GFLabel.py
   trunk/gnue-forms/src/GFObjects/GFLayout.py
   trunk/gnue-forms/src/GFObjects/GFLogic.py
   trunk/gnue-forms/src/GFObjects/GFMask.py
   trunk/gnue-forms/src/GFObjects/GFObj.py
   trunk/gnue-forms/src/GFObjects/GFOption.py
   trunk/gnue-forms/src/GFObjects/GFOptions.py
   trunk/gnue-forms/src/GFObjects/GFPage.py
   trunk/gnue-forms/src/GFObjects/GFParameter.py
   trunk/gnue-forms/src/GFObjects/GFScrollBar.py
   trunk/gnue-forms/src/GFObjects/GFTabStop.py
   trunk/gnue-forms/src/GFObjects/GFValue.py
   trunk/gnue-forms/src/GFObjects/__init__.py
   trunk/gnue-forms/src/GFParser.py
Log:
Started code cleanup. Removed GFTree* stuff (as it wasn't really 
implemented).


Modified: trunk/gnue-forms/src/GFObjects/GFBlock.py
===================================================================
--- trunk/gnue-forms/src/GFObjects/GFBlock.py   2006-03-29 03:34:36 UTC (rev 
8279)
+++ trunk/gnue-forms/src/GFObjects/GFBlock.py   2006-03-29 08:46:43 UTC (rev 
8280)
@@ -43,8 +43,6 @@
     self.mode = 'normal'
     self._convertAsterisksToPercent = gConfigForms('AsteriskWildcard')
 
-    self._inits = [self.__initialize]
-
     #self._datasource = None
     self._resultSet = None
     self._dataSourceLink = None
@@ -199,7 +197,9 @@
   #
   # Primary initialization
   #
-  def __initialize(self):
+  def _phase1Init_ (self):
+    GFContainer._phase1Init_ (self)
+
     self._form = form = self.findParentOfType('GFForm')
     self._logic = logic = self.findParentOfType('GFLogic')
 


Property changes on: trunk/gnue-forms/src/GFObjects/GFBox.py
___________________________________________________________________
Name: svn:keywords
   + Id

Modified: trunk/gnue-forms/src/GFObjects/GFButton.py
===================================================================
--- trunk/gnue-forms/src/GFObjects/GFButton.py  2006-03-29 03:34:36 UTC (rev 
8279)
+++ trunk/gnue-forms/src/GFObjects/GFButton.py  2006-03-29 08:46:43 UTC (rev 
8280)
@@ -32,12 +32,13 @@
 #
 # GFButton
 #
-class GFButton(GFTabStop):
+class GFButton (GFTabStop):
+
+  _navigableInQuery_ = False
+
   def __init__(self, parent=None):
     GFTabStop.__init__(self, parent, 'GFButton')
     self.label = ""
-    self._inits = [self.initialize]
-    self._navigable = True
     self._validTriggers ={ 'ON-ACTION':      'On-Action',
                            'PRE-FOCUSOUT':   'Pre-FocusOut',
                            'POST-FOCUSOUT':  'Post-FocusOut',
@@ -47,26 +48,18 @@
                            'ON-PREVIOUS-ENTRY':  'On-Previous-Entry'}
 
 
-  def initialize(self):
-    self._page = self.findParentOfType('GFPage')
-    self._form = self.findParentOfType('GFForm')
-    self._page._entryList.append(self)
-    self._navigable = self.navigable
+  def _phase1Init_ (self):
 
+    GFTabStop._phase1Init_ (self)
+    self._page._entryList.append (self)
+
     listeners = {
       'requestKEYPRESS': self.__handleKEYPRESS,
       'requestENTER':    self.__handleENTER
     }
-    self.subEventHandler.registerEventListeners(listeners)
+    self.subEventHandler.registerEventListeners (listeners)
 
-  def isNavigable(self, mode):
-    # Buttons aren't navigable during queries
-    if mode == 'query':
-      return False
-    else:
-      return GFTabStop.isNavigable(self, mode)
 
-
   # Helper method for user events: fire button
   def __fire (self):
     self.processTrigger ('On-Action', False)


Property changes on: trunk/gnue-forms/src/GFObjects/GFButton.py
___________________________________________________________________
Name: svn:keywords
   + Id

Deleted: trunk/gnue-forms/src/GFObjects/GFColsrc.py
===================================================================
--- trunk/gnue-forms/src/GFObjects/GFColsrc.py  2006-03-29 03:34:36 UTC (rev 
8279)
+++ trunk/gnue-forms/src/GFObjects/GFColsrc.py  2006-03-29 08:46:43 UTC (rev 
8280)
@@ -1,59 +0,0 @@
-#
-# This file is part of GNU Enterprise.
-#
-# GNU Enterprise is free software; you can redistribute it 
-# and/or modify it under the terms of the GNU General Public 
-# License as published by the Free Software Foundation; either 
-# version 2, or (at your option) any later version.
-#
-# GNU Enterprise is distributed in the hope that it will be 
-# useful, but WITHOUT ANY WARRANTY; without even the implied 
-# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-# PURPOSE. See the GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public
-# License along with program; see the file COPYING. If not,
-# write to the Free Software Foundation, Inc., 59 Temple Place
-# - Suite 330, Boston, MA 02111-1307, USA.
-#
-# Copyright 2000-2006 Free Software Foundation
-#
-#
-# FILE:
-# GFColumn.py
-#
-# DESCRIPTION:
-"""
-Column data source information for GFLeaf
-"""
-# NOTES:
-#
-
-from GFValue import GFValue
-from GFObj import GFObj
-import string
-
-#
-# GFColsrc
-#
-class GFColsrc (GFObj):
-  def __init__(self, parent=None):
-    GFObj.__init__(self, parent, 'GFColsrc')
-
-    # Runtime Variables
-    self._inits = [self.initialize]
-
-  def _buildObject(self):
-    return GFObj._buildObject(self)
-
-  #
-  # Routines called during a phaseInit
-  #
-  def initialize(self):
-    self._form = self.findParentOfType ('GFForm')
-    self._leaf = self.findParentOfType ('GFLeaf')
- 
-    self._leaf._colsrcList.append (self)
-    self._leaf._colsrcMap[self.covers] = self
-    print "added colsrc for: ", self.covers
-

Deleted: trunk/gnue-forms/src/GFObjects/GFColumn.py
===================================================================
--- trunk/gnue-forms/src/GFObjects/GFColumn.py  2006-03-29 03:34:36 UTC (rev 
8279)
+++ trunk/gnue-forms/src/GFObjects/GFColumn.py  2006-03-29 08:46:43 UTC (rev 
8280)
@@ -1,59 +0,0 @@
-#
-# This file is part of GNU Enterprise.
-#
-# GNU Enterprise is free software; you can redistribute it 
-# and/or modify it under the terms of the GNU General Public 
-# License as published by the Free Software Foundation; either 
-# version 2, or (at your option) any later version.
-#
-# GNU Enterprise is distributed in the hope that it will be 
-# useful, but WITHOUT ANY WARRANTY; without even the implied 
-# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-# PURPOSE. See the GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public
-# License along with program; see the file COPYING. If not,
-# write to the Free Software Foundation, Inc., 59 Temple Place
-# - Suite 330, Boston, MA 02111-1307, USA.
-#
-# Copyright 2000-2006 Free Software Foundation
-#
-#
-# FILE:
-# GFColumn.py
-#
-# DESCRIPTION:
-"""
-Column information for GFTree
-"""
-# NOTES:
-#
-
-from GFValue import GFValue
-from GFObj import GFObj
-import string
-
-#
-# GFColumn
-#
-class GFColumn (GFObj):
-  def __init__(self, parent=None):
-    GFObj.__init__(self, parent, 'GFColumn')
-
-    # Runtime Variables
-    self._inits = [self.initialize]
-
-  def _buildObject(self):
-    return GFObj._buildObject(self)
-
-  #
-  # Routines called during a phaseInit
-  #
-  def initialize(self):
-    self._form = self.findParentOfType ('GFForm')
-    self._tree = self.findParentOfType ('GFTree')
- 
-    self._tree._colList.append (self)
-    #self._tree._colMap[self.name] = self
-    print "added column: ", self.name
-

Modified: trunk/gnue-forms/src/GFObjects/GFComponent.py
===================================================================
--- trunk/gnue-forms/src/GFObjects/GFComponent.py       2006-03-29 03:34:36 UTC 
(rev 8279)
+++ trunk/gnue-forms/src/GFObjects/GFComponent.py       2006-03-29 08:46:43 UTC 
(rev 8280)
@@ -46,8 +46,6 @@
     self.type = "URL"
     self.Char__height = int(gConfigForms('widgetHeight'))
 
-    # Runtime Variables
-    self._inits = [self.initialize]
 
   def _buildObject(self):
     if not hasattr(self, 'rows') and hasattr(self,'visibleCount'):
@@ -62,7 +60,10 @@
   #
   # Routines called during a phaseInit
   #
-  def initialize(self):
+  def _phase1Init_ (self):
+    
+    GFValue._phase1Init_ (self)
+
     #
     # Find parents/relatives
     #
@@ -87,8 +88,6 @@
     
     self._form = self._block._form
 
-    self._navigable = False # self.navigable
-                                        
     self._displayHandler = displayHandlers.Component(self,
                               self._form._instance.eventController,
                               self.subEventHandler)


Property changes on: trunk/gnue-forms/src/GFObjects/GFComponent.py
___________________________________________________________________
Name: svn:keywords
   + Id


Property changes on: trunk/gnue-forms/src/GFObjects/GFContainer.py
___________________________________________________________________
Name: svn:keywords
   + Id


Property changes on: trunk/gnue-forms/src/GFObjects/GFDataSource.py
___________________________________________________________________
Name: svn:keywords
   + Id

Modified: trunk/gnue-forms/src/GFObjects/GFEntry.py
===================================================================
--- trunk/gnue-forms/src/GFObjects/GFEntry.py   2006-03-29 03:34:36 UTC (rev 
8279)
+++ trunk/gnue-forms/src/GFObjects/GFEntry.py   2006-03-29 08:46:43 UTC (rev 
8280)
@@ -1,6 +1,9 @@
+# Short line describing the purpose of this file
 #
-# This file is part of GNU Enterprise.
+# Copyright 2001-2006 Free Software Foundation
 #
+# This file is part of GNU Enterprise
+#
 # GNU Enterprise is free software; you can redistribute it
 # and/or modify it under the terms of the GNU General Public
 # License as published by the Free Software Foundation; either
@@ -16,159 +19,184 @@
 # write to the Free Software Foundation, Inc., 59 Temple Place
 # - Suite 330, Boston, MA 02111-1307, USA.
 #
-# Copyright 2000-2006 Free Software Foundation
-#
-# FILE:
-# GFEntry.py
-#
-# DESCRIPTION:
+# $Id$
+
 """
 The primary data entry widget in forms
 """
-# NOTES:
-#
 
+from gnue.common.apps import errors
 from gnue.forms.input import displayHandlers
 from GFTabStop import GFTabStop
+from gnue.common.definitions import GParser
 
-############################################################
-# GFEntry
-#
-# Matches the Entry form tag in the gfd
-#
-# It send events to its parent GFBlock
-#
-class GFEntry(GFTabStop):
-  def __init__(self, parent=None, value=None):
-    GFTabStop.__init__(self, parent, 'GFEntry')
+# =============================================================================
+# Exceptions
+# =============================================================================
 
+class BlockNotFoundError (GParser.MarkupError):
+  def __init__ (self, block, entry):
+    msg = u_("Entry '%(entry)s' references non-existent block '%(block)s'") \
+          % {'entry': entry.name, 'block': block}
+    GParser.MarkupError.__init__ (self, msg, entry._url, entry._lineNumber)
+
+class FieldNotFoundError (GParser.MarkupError):
+  def __init__ (self, field, entry):
+    msg = u_("Entry '%(entry)s' references non-existent field '%(field)s'") \
+          % {'entry': entry.name, 'field': field}
+    GParser.MarkupError.__init__ (self, msg, entry._url, entry._lineNumber)
+
+
+# =============================================================================
+# Class for data entry widgets
+# =============================================================================
+
+class GFEntry (GFTabStop):
+
+  # ---------------------------------------------------------------------------
+  # Constructor
+  # ---------------------------------------------------------------------------
+
+  def __init__ (self, parent = None, value = None):
+
+    GFTabStop.__init__ (self, parent, 'GFEntry')
+
     # Default attributes (these may be replaced by parser)
-    self.Char__height = int(gConfigForms('widgetHeight'))
-    self.Char__width = int(gConfigForms('widgetWidth'))
+    self.Char__height = int (gConfigForms ('widgetHeight'))
+    self.Char__width  = int (gConfigForms ('widgetWidth'))
     self.style = "default"
     self.label = ""
-    self._queryable = True
 
-    self._inits = [self.initialize]
+    # Trigger exposure
+    self._validTriggers = {'PRE-FOCUSOUT'     : 'Pre-FocusOut',
+                           'POST-FOCUSOUT'    : 'Post-FocusOut',
+                           'PRE-FOCUSIN'      : 'Pre-FocusIn',
+                           'POST-FOCUSIN'     : 'Post-FocusIn',
+                           'ON-NEXT-ENTRY'    : 'On-Next-Entry',
+                           'ON-PREVIOUS-ENTRY': 'On-Previous-Entry'}
 
-    self._rows = 1
-    self._gap = 0
-
-    #
-    # Trigger exposure
-    #
-    self._validTriggers ={ 'PRE-FOCUSOUT':   'Pre-FocusOut',
-                           'POST-FOCUSOUT':  'Post-FocusOut',
-                           'PRE-FOCUSIN':    'Pre-FocusIn',
-                           'POST-FOCUSIN':   'Post-FocusIn',
-                           'ON-NEXT-ENTRY':  'On-Next-Entry',
-                           'ON-PREVIOUS-ENTRY':  'On-Previous-Entry',
-                         }
-    self._triggerFunctions={'set':{'function':self.triggerSetValue},
-                            'get':{'function':self.getValue}
-                             }
+    self._triggerFunctions = {'set': {'function': self.triggerSetValue},
+                              'get': {'function': self.getValue}}
     self._triggerSet = self.triggerSetValue
     self._triggerGet = self.getValue
 
     self._triggerProperties = {
-          'rows':     { 'get': self._getRows},
-          'value':    { 'set':self.triggerSetValue,
-                        'get':self.getValue },
-          'hidden':   { 'set':self.triggerSetHidden,
-                        'get':self.triggerGetHidden },
-          'navigable':{ 'set':self.triggerSetNavigable,
-                        'get':self.triggerGetNavigable },
-      }
+          'rows':     {'get': self.triggerGetRows},
+          'value':    {'set': self.triggerSetValue,
+                       'get': self.getValue },
+          'hidden':   {'set': self.triggerSetHidden,
+                       'get': self.triggerGetHidden },
+          'navigable':{'set': self.triggerSetNavigable,
+                       'get': self.triggerGetNavigable },
+    }
 
-  def _buildObject(self):
-    return GFTabStop._buildObject(self)
 
-  def initialize(self):
+  # ---------------------------------------------------------------------------
+  # Phase I init
+  # ---------------------------------------------------------------------------
 
-    #
+  def _phase1Init_ (self):
+    """
+    On Phase 1 initialization add the entry to the owning blocks' entry list as
+    well as to the pages' field list.
+    """
+
+    GFTabStop._phase1Init_ (self)
+
     # Find parents/relatives
-    #
+    # ... Block
 
-    # ...Block
-    try:
-      self._block = block = 
self.findParentOfType('GFForm')._logic._blockMap[self.block]
-      block._entryList.append(self)
-    except KeyError:
-      raise gException, u_("Entry references non-existent block '%s'") \
-                        % self.block
+    if not self.block in self._form._logic._blockMap:
+      raise BlockNotFoundError, (self.block, self)
 
-    # ...Field
-    try:
-      self._field = field = block._fieldMap[self.field]
-      field._entryList.append(self)
-    except KeyError:
-      raise gException, u_("Entry references non-existent field '%s'") \
-                        % self.field
+    self._block = block = self._form._logic._blockMap [self.block]
+    block._entryList.append (self)
 
-    # ...Page
-    self._page = self.findParentOfType('GFPage')
-    self._page._entryList.append(self)
+    # ... Field
+    if not self.field in block._fieldMap:
+      raise FieldNotFoundError, (self.field, self)
 
-    self._form = self._block._form
+    self._field = field = block._fieldMap [self.field]
+    field._entryList.append (self)
 
+    # ... Page
+    self._page._entryList.append (self)
 
-    # Navigable? or no?
-    self._navigable = self.navigable
-    if self.style == 'label' or self.hidden:
-      self._navigable = False
-      self._queryable = False
+    # Have a look wether the entry will be navigable or not
+    if self.style == 'label':
+      self.navigable = False
 
-    self._formatmask = ""
-    self._inputmask = hasattr(self,'inputmask') and self.inputmask or ""
-    self._displaymask = hasattr(self,'displaymask') and self.displaymask or ""
+    self._formatmask  = ""
+    self._inputmask   = getattr (self, 'inputmask', '')
+    self._displaymask = getattr (self, 'displaymask', '')
 
     # Associate a display handler with this instance
-    self._displayHandler = displayHandlers.factory(self,
+    self._displayHandler = displayHandlers.factory (self,
                              self._form._instance.eventController,
                              self.subEventHandler,
-                             self._displaymask, self._inputmask)
+                             self._displaymask,
+                             self._inputmask)
 
     # Row settings
-    if hasattr(self,'rows'):
-      self._rows = self.rows
-    else:
-      self._rows = self._field._rows
+    self._rows = getattr (self, 'rows', self._field._rows)
+    self._gap  = getattr (self, 'rowSpacer', self._field._gap)
 
-    if hasattr(self,'rowSpacer'):
-      self._gap = self.rowSpacer
-    else:
-      self._gap = self._field._gap
 
+  # ---------------------------------------------------------------------------
+  # Implementation of virtual methods
+  # ---------------------------------------------------------------------------
 
-  def _getRows(self):
-    return self._rows
+  def _isNavigable_ (self, mode):
 
-  def isNavigable(self, mode):
-    # TODO: Check for read-only, etc
-    return self._navigable and self._block.navigable and not self.hidden
+    return self.navigable and self._block.navigable and not self.hidden
 
-  def isEditable(self, mode):
-    return self._field.isEditable(mode)
 
-  ####################################################################
-  #
+  # ===========================================================================
   # Trigger functions
-  #
-  def getValue(self, *args, **parms):
-    return self._field.getValue(*args, **parms)
+  # ===========================================================================
 
-  def triggerSetValue(self, *args, **parms):
-    return self._field.triggerSetValue(*args, **parms)
+  def getValue (self, *args, **parms):
 
-  def triggerSetHidden(self, value):
-    self.hidden = bool(value)
+    return self._field.getValue (*args, **parms)
 
-  def triggerGetHidden(self):
+
+  # ---------------------------------------------------------------------------
+
+  def triggerSetValue (self, *args, **parms):
+
+    return self._field.triggerSetValue (*args, **parms)
+
+
+  # ---------------------------------------------------------------------------
+
+  def triggerGetRows (self):
+
+    return self._rows
+
+
+  # ---------------------------------------------------------------------------
+
+  def triggerSetHidden (self, value):
+
+    self.hidden = bool (value)
+
+
+  # ---------------------------------------------------------------------------
+
+  def triggerGetHidden (self):
+
     return self.hidden
 
-  def triggerSetNavigable(self, value):
-    self.navigable = bool(value)
 
-  def triggerGetNavigable(self):
+  # ---------------------------------------------------------------------------
+
+  def triggerSetNavigable (self, value):
+
+    self.navigable = bool (value)
+
+
+  # ---------------------------------------------------------------------------
+
+  def triggerGetNavigable (self):
+
     return self.navigable
-


Property changes on: trunk/gnue-forms/src/GFObjects/GFEntry.py
___________________________________________________________________
Name: svn:keywords
   + Id

Modified: trunk/gnue-forms/src/GFObjects/GFField.py
===================================================================
--- trunk/gnue-forms/src/GFObjects/GFField.py   2006-03-29 03:34:36 UTC (rev 
8279)
+++ trunk/gnue-forms/src/GFObjects/GFField.py   2006-03-29 08:46:43 UTC (rev 
8280)
@@ -57,7 +57,6 @@
     self._numeric = False
     self._queryable = True
 
-    self._inits = [self.initialize]
     self._allowedValues = None
     self._allowedValuesDescr = [""]
 
@@ -159,8 +158,10 @@
 
     return GFValue._buildObject(self)
 
-  def initialize(self):
+  def _phase1Init_ (self):
 
+    GFValue._phase1Init_ (self)
+
     self._block = block = self.findParentOfType('GFBlock')
     block._fieldMap[self.name] = self
     block._fieldList.append(self)


Property changes on: trunk/gnue-forms/src/GFObjects/GFField.py
___________________________________________________________________
Name: svn:keywords
   + Id

Modified: trunk/gnue-forms/src/GFObjects/GFImage.py
===================================================================
--- trunk/gnue-forms/src/GFObjects/GFImage.py   2006-03-29 03:34:36 UTC (rev 
8279)
+++ trunk/gnue-forms/src/GFObjects/GFImage.py   2006-03-29 08:46:43 UTC (rev 
8280)
@@ -32,8 +32,28 @@
 # Copyright (c) 2000 Free Software Foundation
 #
 
+from gnue.common.apps import errors
 from GFTabStop import GFTabStop
 from gnue.forms.input import displayHandlers
+from gnue.common.definitions import GParser
+
+# =============================================================================
+# Exceptions
+# =============================================================================
+
+class BlockNotFoundError (GParser.MarkupError):
+  def __init__ (self, block, image):
+    msg = u_("Image '%(image)s' references non-existent block '%(block)s'") \
+          % {'image': image.name, 'block': block}
+    GParser.MarkupError.__init__ (self, msg, image._url, image._lineNumber)
+
+class FieldNotFoundError (GParser.MarkupError):
+  def __init__ (self, field, image):
+    msg = u_("Image '%(image)s' references non-existent field '%(field)s'") \
+          % {'image': image.name, 'field': field}
+    GParser.MarkupError.__init__ (self, msg, image._url, image._lineNumber)
+
+
 #
 #GFLabel
 #
@@ -45,11 +65,7 @@
     self.type = "URL"
     self.Char__height = int(gConfigForms('widgetHeight'))
 
-    # Runtime Variables
-    self._inits = [self.initialize]
 
-#    self.isNavigable = GFTabStop.isNavigable
-
   def _buildObject(self):
     if not hasattr(self, 'rows') and hasattr(self,'visibleCount'):
       self.rows = self.visibleCount
@@ -60,50 +76,39 @@
     if not self._value:
       GFTabStop.setValue(self,value)
 
-  #
-  # Routines called during a phaseInit
-  #
-  def initialize(self):
-    #
-    # Find parents/relatives
-    #
+  # ---------------------------------------------------------------------------
 
-    # ...Block
-    try:
-      self._block = block = 
self.findParentOfType('GFForm')._logic._blockMap[self.block]
-      block._entryList.append(self)
-    except KeyError:
-      raise "Image references non-existent block '%s'" % self.block
+  def _phase1Init_ (self):
 
-    # ...Field
-    try:
-      self._field = field = block._fieldMap[self.field]
-      field._entryList.append(self)
-    except KeyError:
-      raise "Image references non-existent field '%s'" % self.field
+    GFTabStop._phase1Init_ (self)
 
-    # ...Page
-    self._page = self.findParentOfType('GFPage')
-    self._page._entryList.append(self)
+    if not self.block in self._form._logic._blockMap:
+      raise BlockNotFoundError, (self.block, self)
 
-    self._form = self._block._form
+    self._block = block = self._form._logic._blockMap [self.block]
+    block._entryList.append (self)
 
-    self._navigable = False # self.navigable
+    # ... Field
+    if not self.field in block._fieldMap:
+      raise FieldNotFoundError, (self.field, self)
 
-    # print "Controller", self._form._instance.eventController
-    # print "Sub Handler", self.subEventHandler
-    # print displayHandlers.Image
-    self._displayHandler = displayHandlers.factory(self,
+    self._field = field = block._fieldMap [self.field]
+    field._entryList.append (self)
+
+    # ...Page
+    self._page._entryList.append (self)
+
+    self._displayHandler = displayHandlers.factory (self,
                               self._form._instance.eventController,
-                              self.subEventHandler,None, None)
+                              self.subEventHandler, None, None)
 
+
   # TODO: Conversion:  Does this belong here or not?
   def getValue(self, *args, **parms):
     return self._field.getValue(*args, **parms)
 
 
 
-  def isNavigable(self, mode):
-    # TODO: Check for read-only, etc
-    return GFTabStop.isNavigable(self, mode)
+  def _isNavigable_ (self, mode):
+    return False
 


Property changes on: trunk/gnue-forms/src/GFObjects/GFImage.py
___________________________________________________________________
Name: svn:keywords
   + Id

Modified: trunk/gnue-forms/src/GFObjects/GFLabel.py
===================================================================
--- trunk/gnue-forms/src/GFObjects/GFLabel.py   2006-03-29 03:34:36 UTC (rev 
8279)
+++ trunk/gnue-forms/src/GFObjects/GFLabel.py   2006-03-29 08:46:43 UTC (rev 
8280)
@@ -42,9 +42,6 @@
     self.alignment = "left"
     self.Char__height = int(gConfigForms('widgetHeight'))
 
-    # Runtime Variables
-    self._inits = [self.initialize]
-
   def _buildObject(self):
     if not hasattr(self, 'rows') and hasattr(self,'visibleCount'):
       self.rows = self.visibleCount
@@ -58,7 +55,8 @@
   #
   # Routines called during a phaseInit
   #
-  def initialize(self):
+  def _phase1Init_ (self):
+    GFValue._phase1Init_ (self)
     self._block = self.findParentOfType('GFBlock')
 
 


Property changes on: trunk/gnue-forms/src/GFObjects/GFLabel.py
___________________________________________________________________
Name: svn:keywords
   + Id

Modified: trunk/gnue-forms/src/GFObjects/GFLayout.py
===================================================================
--- trunk/gnue-forms/src/GFObjects/GFLayout.py  2006-03-29 03:34:36 UTC (rev 
8279)
+++ trunk/gnue-forms/src/GFObjects/GFLayout.py  2006-03-29 08:46:43 UTC (rev 
8280)
@@ -38,7 +38,6 @@
 class GFLayout(GFObj):
   def __init__(self, parent=None):
     GFObj.__init__(self, parent, "GFLayout")
-    self._inits =[self.initialize]
     self._pageList = []
     self.tabbed = 'none'
     self._triggerGlobal = 1
@@ -50,7 +49,9 @@
 
     return GFObj._buildObject(self)
 
-  def initialize(self):
+  def _phase1Init_ (self):
+
+    GFObj._phase1Init_ (self)
     self._xmlchildnamespaces = self._findNamespaces(self)
 
 


Property changes on: trunk/gnue-forms/src/GFObjects/GFLayout.py
___________________________________________________________________
Name: svn:keywords
   + Id

Deleted: trunk/gnue-forms/src/GFObjects/GFLeaf.py
===================================================================
--- trunk/gnue-forms/src/GFObjects/GFLeaf.py    2006-03-29 03:34:36 UTC (rev 
8279)
+++ trunk/gnue-forms/src/GFObjects/GFLeaf.py    2006-03-29 08:46:43 UTC (rev 
8280)
@@ -1,66 +0,0 @@
-#
-# This file is part of GNU Enterprise.
-#
-# GNU Enterprise is free software; you can redistribute it 
-# and/or modify it under the terms of the GNU General Public 
-# License as published by the Free Software Foundation; either 
-# version 2, or (at your option) any later version.
-#
-# GNU Enterprise is distributed in the hope that it will be 
-# useful, but WITHOUT ANY WARRANTY; without even the implied 
-# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-# PURPOSE. See the GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public
-# License along with program; see the file COPYING. If not,
-# write to the Free Software Foundation, Inc., 59 Temple Place
-# - Suite 330, Boston, MA 02111-1307, USA.
-#
-# Copyright 2000-2006 Free Software Foundation
-#
-#
-# FILE:
-# GFTree.py
-#
-# DESCRIPTION:
-"""
-Leaf support (sub-tree pointing to another table)
-"""
-# NOTES:
-#
-
-from GFValue import GFValue
-from GFObj import GFObj
-import string
-
-#
-# GFLeaf
-#
-class GFLeaf (GFObj):
-  def __init__(self, parent=None):
-    GFObj.__init__(self, parent, 'GFLeaf')
-
-    # Runtime Variables
-    self._inits = [self.initialize]
-
-    self._colsrcMap = {}    # column source information
-    self._colsrcList = []   # column source information
-
-  def _buildObject(self):
-    if not hasattr(self, 'rows') and hasattr(self,'visibleCount'):
-      self.rows = self.visibleCount
-      del self.visibleCount
-    return GFObj._buildObject(self)
-
-  #
-  # Routines called during a phaseInit
-  #
-  def initialize(self):
-    if hasattr (self, 'block'):
-      self._form = form = self.findParentOfType ('GFForm')
-      self._tree =        self.findParentOfType ('GFTree')
-      self._blk = form._logic._blockMap[self.block]
-
-    if hasattr (self, 'tblhint'):
-      self._tree._leafMap[self.tblhint] = self
-

Modified: trunk/gnue-forms/src/GFObjects/GFLogic.py
===================================================================
--- trunk/gnue-forms/src/GFObjects/GFLogic.py   2006-03-29 03:34:36 UTC (rev 
8279)
+++ trunk/gnue-forms/src/GFObjects/GFLogic.py   2006-03-29 08:46:43 UTC (rev 
8280)
@@ -38,14 +38,8 @@
 class GFLogic(GFObj):
   def __init__(self, parent=None):
     GFObj.__init__(self, parent, "GFLogic")
-    self._inits =[self.initialize]
     self._blockMap = {}
     self._blockList = []
 
   def _buildObject(self):
     return GFObj._buildObject(self)
-
-  def initialize(self):
-    pass
-
-


Property changes on: trunk/gnue-forms/src/GFObjects/GFLogic.py
___________________________________________________________________
Name: svn:keywords
   + Id


Property changes on: trunk/gnue-forms/src/GFObjects/GFMask.py
___________________________________________________________________
Name: svn:keywords
   + Id

Modified: trunk/gnue-forms/src/GFObjects/GFObj.py
===================================================================
--- trunk/gnue-forms/src/GFObjects/GFObj.py     2006-03-29 03:34:36 UTC (rev 
8279)
+++ trunk/gnue-forms/src/GFObjects/GFObj.py     2006-03-29 08:46:43 UTC (rev 
8280)
@@ -1,6 +1,9 @@
+# GNU Enterprise Forms - GFObjects - Base class for all GF* objects
 #
-# This file is part of GNU Enterprise.
+# Copyright 2001-2006 Free Software Foundation
 #
+# This file is part of GNU Enterprise
+#
 # GNU Enterprise is free software; you can redistribute it
 # and/or modify it under the terms of the GNU General Public
 # License as published by the Free Software Foundation; either
@@ -16,110 +19,163 @@
 # write to the Free Software Foundation, Inc., 59 Temple Place
 # - Suite 330, Boston, MA 02111-1307, USA.
 #
-# Copyright 2000-2006 Free Software Foundation
-#
-# FILE:
-# GFObjects.py
-#
-# DESCRIPTION:
+# $Id$
 """
-Base for all Form-related GObjects
+Base class for all objects represented by an XML tag in a GFD tree.
 """
-# NOTES:
-#
-# HISTORY:
-#
 
 from gnue.common.definitions.GObjects import GObj
 from gnue.common.logic.GTrigger import GTriggerExtension
 
-#
-# Class GFObj
-#
-# Base internal object for GNUE Forms
-#
-class GFObj(GObj, GTriggerExtension):
-  def __repr__(self):
-    try:
-      name = self.name
-    except AttributeError:
-      try: 
-        name = self.id
-      except AttributeError:
-        return '<%s instance at %s>' % (self.__class__, id(self))
-    return '<%s instance (%s) at %s>' % (self.__class__, self.name, id(self))
+
+# =============================================================================
+# Base class for GF* objects
+# =============================================================================
+
+class GFObj (GObj, GTriggerExtension):
     
-  def __init__(self, parent=None, type='GFObj'):
-    GTriggerExtension.__init__(self)
-    GObj.__init__(self, parent, type)
-    self.hidden = False
-    self.readonly = False
+  # ---------------------------------------------------------------------------
+  # Constructor
+  # ---------------------------------------------------------------------------
+
+  def __init__ (self, parent = None, type = 'GFObj'):
+    
+    GTriggerExtension.__init__ (self)
+    GObj.__init__ (self, parent, type)
+
+    self.hidden        = False
+    self.readonly      = False
+    self.name = "%s%x" % (("%s" % self.__class__).split ('.') [-1], id (self))
+
     self._visibleIndex = 0
-    self.name = "__GF%s" % id(self)
-    self._rows = 1
-    self._gap = 0
-    self._inits = []
+    self._rows         = 1
+    self._gap          = 0
+    self._inits        = [self.phase1Init]
 
     # The reference to the uiWidget will be set by the
     # uidrivers._base.UIdriver._buildUI () function
     self.uiWidget = None
 
-  def isNavigable(self, mode='edit'):
+
+  # ---------------------------------------------------------------------------
+  # String representation
+  # ---------------------------------------------------------------------------
+
+  def __repr__ (self):
+
+    return '<%s instance (%s) at %s>' % (self.__class__, self.name, id (self))
+
+
+  # ---------------------------------------------------------------------------
+  # Check wether an object is navigable or not
+  # ---------------------------------------------------------------------------
+
+  def isNavigable (self, mode = 'edit'):
     """
-    Is the current object currently navigable?
-    Mode can be 'edit', 'query', or 'new'
+    Return wether the object is currently navigable or not.
+
+    @param mode: current state of the object. Can be 'edit', 'query' or 'new'
+    @returns: True or False
     """
-    return False
 
-  #
-  # get an Option
-  #
-  def getOption(self, name):
+    return self._isNavigable_ (mode)
+
+
+  # ---------------------------------------------------------------------------
+  # Phase 1 initialization
+  # ---------------------------------------------------------------------------
+
+  def phase1Init (self):
+    """
+    Phase 1 initialization called after all objects of the XML tree were
+    created.
+    """
+
+    self._phase1Init_ ()
+
+
+  # ---------------------------------------------------------------------------
+  # Get an option of the object
+  # ---------------------------------------------------------------------------
+
+  def getOption (self, name):
+    """
+    Return the value of a given option of the object or None if no such option
+    is present.
+
+    @param name: name of the option to be queried
+    @returns: the value of the requested option or None
+    """
+
     option = None
-    for child in self._children:
-      if child._type == "GFOptions":
-        for o in child._children:
-          if o._type == "GFOption":
-            if o.name == name:
-              option = o.value
+
+    for child in self.findChildrenOfType ('GFOption', False, True):
+      if child.name == name:
+        option = child.value
+        break
+
     return option
 
-  #
-  # recalculateVisible
-  #
-  def recalculateVisible(self, adjustment, currentRecord, recordCount):
-    if not self.hidden:
-      index = self._visibleIndex + adjustment
 
-      if index < 0 : index = 0
+  # ---------------------------------------------------------------------------
+  # Recalculate the visible index of an object
+  # ---------------------------------------------------------------------------
 
-      # Don't let index pass the number of widgets on screen
-      if index >= int(self._rows):
-        index = int(self._rows)-1
+  def recalculateVisible (self, adjustment, currentRecord, recordCount):
+    """
+    Recalculate the visible index of an object. This determines that real UI
+    widget of a 'row-based grid' which should be visible.
 
-      # Don't let the index past the number of records in the
-      # system
-      lowestVisible = currentRecord - index
-      if lowestVisible < 0 : lowestVisible = 0
+    @param adjustment: value to change the visible index, e.g. 1 or -1
+    @param currentRecord: the currently active record
+    @param recordCount: the number of records available at all
+
+    As a result of this recalculation the property self._visibleIndex will be
+    set to the new value.
+    """
+
+    if not self.hidden:
+      index = min (max (self._visibleIndex + adjustment, 0), int 
(self._rows)-1)
+
+      # Don't let the index pass the number of records
+      lowestVisible = max (currentRecord - index, 0)
       if lowestVisible + index > recordCount:
         index = index -1
 
-#      # If the current record has rolled around
-#      # from the top to the bottom then reset
-#      # the counter
+      # If the current record has rolled around from the top to the bottom then
+      # reset the counter
       if currentRecord == 0:
         index = 0
 
       self._visibleIndex = index
-      self.lowestVisible = lowestVisible
 
-##  def processTrigger(self, *args, **parms):
-##    try:
-##      GTriggerExtension.processTrigger(self, *args, **parms)
-##    except:
-##      form = self.findParentOfType('GFForm')
 
+  # ---------------------------------------------------------------------------
+  # Virtual methods to be implemented by descendants
+  # ---------------------------------------------------------------------------
 
+  def _isNavigable_ (self, mode):
+    """
+    Return wether the object is currently navigable or not.
 
+    @param mode: current state of the object. Can be 'edit', 'query' or 'new'
 
+    Descendants can overwrite this method to return either True or False. If
+    this method is not overwritten it returns False.
+    """
 
+    return False
+
+
+  # ---------------------------------------------------------------------------
+  # Phase 1 initialization
+  # ---------------------------------------------------------------------------
+
+  def _phase1Init_ (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.
+    """
+
+    pass


Property changes on: trunk/gnue-forms/src/GFObjects/GFObj.py
___________________________________________________________________
Name: svn:keywords
   + Id


Property changes on: trunk/gnue-forms/src/GFObjects/GFOption.py
___________________________________________________________________
Name: svn:keywords
   + Id


Property changes on: trunk/gnue-forms/src/GFObjects/GFOptions.py
___________________________________________________________________
Name: svn:keywords
   + Id

Modified: trunk/gnue-forms/src/GFObjects/GFPage.py
===================================================================
--- trunk/gnue-forms/src/GFObjects/GFPage.py    2006-03-29 03:34:36 UTC (rev 
8279)
+++ trunk/gnue-forms/src/GFObjects/GFPage.py    2006-03-29 08:46:43 UTC (rev 
8280)
@@ -36,7 +36,7 @@
 class GFPage(GFContainer):
   def __init__(self, parent=None):
     GFContainer.__init__(self, parent,"GFPage")
-    self._inits = [self.initialize, self.init2]
+    self._inits.append (self.phase2Init)
 
     self._validTriggers = {
                   'PRE-FOCUSOUT':   'Pre-FocusOut',
@@ -48,13 +48,14 @@
     self._entryList = []
 
 
-  def initialize(self):
+  def _phase1Init_ (self):
+    GFContainer._phase1Init_ (self)
     self._form = self.findParentOfType('GFForm')
 
     layout = self.findParentOfType('GFLayout')
     layout._pageList.append(self)
 
-  def init2(self):
+  def phase2Init (self):
     # Get all focusable items, ordered correctly
     self._focusOrder = self._entryList # self.getFocusOrder()
 


Property changes on: trunk/gnue-forms/src/GFObjects/GFPage.py
___________________________________________________________________
Name: svn:keywords
   + Id


Property changes on: trunk/gnue-forms/src/GFObjects/GFParameter.py
___________________________________________________________________
Name: svn:keywords
   + Id

Modified: trunk/gnue-forms/src/GFObjects/GFScrollBar.py
===================================================================
--- trunk/gnue-forms/src/GFObjects/GFScrollBar.py       2006-03-29 03:34:36 UTC 
(rev 8279)
+++ trunk/gnue-forms/src/GFObjects/GFScrollBar.py       2006-03-29 08:46:43 UTC 
(rev 8280)
@@ -26,15 +26,19 @@
 
 from gnue.common.apps import errors
 from gnue.forms.GFObjects.GFObj import GFObj
+from gnue.common.definitions import GParser
 
+
 # =============================================================================
 # Exceptions
 # =============================================================================
 
-class MissingBlockError (errors.ApplicationError):
-  def __init__ (self, block):
-    msg = u_("Scrollbar references a non-existent block '%s'") % block
-    errors.ApplicationError.__init__ (self, msg)
+class BlockNotFoundError (GParser.MarkupError):
+  def __init__ (self, block, widget):
+    msg = u_("Scrollbar '%(widget)s' references non-existent " \
+             "block '%(block)s'") \
+          % {'widget': widget.name, 'block': block}
+    GParser.MarkupError.__init__ (self, msg, widget._url, widget._lineNumber)
 
 
 # =============================================================================
@@ -53,28 +57,25 @@
     self.label = ""
     self._scrollrows  = 1
 
-    self._inits = [self.__initialize]
 
-
   # ---------------------------------------------------------------------------
   # Phase I init: find the parent GFForm and the bound GFBlock
   # ---------------------------------------------------------------------------
 
-  def __initialize (self):
+  def _phase1Init_ (self):
 
+    GFObj._phase1Init_ (self)
+
     self._form = self.findParentOfType ('GFForm')
 
     # ...Block
     if not self.block in self._form._logic._blockMap:
-      raise MissingBlockError, self.block
+      raise BlockNotFoundError, (self.block, self)
 
     self._block = self._form._logic._blockMap [self.block]
     self._block.registerScrollbar (self)
 
-    if hasattr(self, 'scrollrows'):
-      self._scrollrows = self.scrollrows
-    else:
-      self._scrollrows = self._block._rows
+    self._scrollrows = getattr (self, 'scrollrows', self._block._rows)
 
 
   # ---------------------------------------------------------------------------

Modified: trunk/gnue-forms/src/GFObjects/GFTabStop.py
===================================================================
--- trunk/gnue-forms/src/GFObjects/GFTabStop.py 2006-03-29 03:34:36 UTC (rev 
8279)
+++ trunk/gnue-forms/src/GFObjects/GFTabStop.py 2006-03-29 08:46:43 UTC (rev 
8280)
@@ -1,6 +1,9 @@
+# GNU Enterprise Forms - GFObjects - Navigable Objects
 #
-# This file is part of GNU Enterprise.
+# Copyright 2001-2006 Free Software Foundation
 #
+# This file is part of GNU Enterprise
+#
 # GNU Enterprise is free software; you can redistribute it
 # and/or modify it under the terms of the GNU General Public
 # License as published by the Free Software Foundation; either
@@ -16,38 +19,74 @@
 # write to the Free Software Foundation, Inc., 59 Temple Place
 # - Suite 330, Boston, MA 02111-1307, USA.
 #
-# Copyright 2002-2006 Free Software Foundation
-#
-# FILE:
-# GFContainer.py
-#
-# DESCRIPTION:
+# $Id$
+
 """
-A base class for all GFObjects that can receive focus on the UI
+Base class for all objects that can receive the keyboard focus on the UI.
 """
 
 from gnue.common import events
-
 from GFObj import GFObj
 
-class GFTabStop(GFObj):
+# =============================================================================
+# Base class for navigable controls
+# =============================================================================
+
+class GFTabStop (GFObj):
   """
-  A base class for all GFObjects that can receive focus on the UI
+  A base class for all GFObjects that can receive focus on the UI.
+
+  @cvar _navigableInQuery_: If True the object can recieve the keyboard focus
+    in query mode, otherwise not
   """
   
-  _navigable = True
+  _navigableInQuery_ = True
 
-  def __init__(self, parent, type):
+  # ---------------------------------------------------------------------------
+  # Constructor
+  # ---------------------------------------------------------------------------
+
+  def __init__ (self, parent, type):
+
     GFObj.__init__(self, parent, type)
-    
-    # The sub-event handler handles the events that are passed from
-    # the GFInstance.  This is the event handler that display handlers 
-    self.subEventHandler = events.EventController()
 
-  def isNavigable(self, mode="edit"):
-    # TODO: Check for read-only, etc
-    if mode == 'query':
-      return self._navigable and self._queryable
+    # The sub-event handler handles the events that are passed from the
+    # GFInstance. This is the event handler that display handlers 
+    self.subEventHandler = events.EventController ()
+
+
+  # ---------------------------------------------------------------------------
+  # Implementation of virtual methods
+  # ---------------------------------------------------------------------------
+
+  def _phase1Init_ (self):
+    """
+    On phase 1 initialization find the owning GFPage- and GFForm-instance.
+    These instances are then available through self._form and self._page.
+    """
+
+    GFObj._phase1Init_ (self)
+
+    self._page = self.findParentOfType ('GFPage')
+    self._form = self._page.findParentOfType ('GFForm')
+
+
+  # ---------------------------------------------------------------------------
+
+  def _isNavigable_ (self, mode):
+    """
+    In general an object is navigable if it is not hidden and it's navigable
+    xml-attribute is set. If mode is 'query' it additionally depends wether an
+    object is 'queryable' or not. If mode is 'edit' or 'new' only objects are
+    navigable which are not 'readonly'.
+    """
+
+    if self.hidden:
+      return False
+
     else:
-      return (self._navigable) and (not self.readonly)
+      if mode == 'query':
+        return self.navigable and self._navigableInQuery_
+      else:
+        return self.navigable and (not self.readonly)
 


Property changes on: trunk/gnue-forms/src/GFObjects/GFTabStop.py
___________________________________________________________________
Name: svn:keywords
   + Id

Deleted: trunk/gnue-forms/src/GFObjects/GFTree.py
===================================================================
--- trunk/gnue-forms/src/GFObjects/GFTree.py    2006-03-29 03:34:36 UTC (rev 
8279)
+++ trunk/gnue-forms/src/GFObjects/GFTree.py    2006-03-29 08:46:43 UTC (rev 
8280)
@@ -1,452 +0,0 @@
-#
-# This file is part of GNU Enterprise.
-#
-# GNU Enterprise is free software; you can redistribute it 
-# and/or modify it under the terms of the GNU General Public 
-# License as published by the Free Software Foundation; either 
-# version 2, or (at your option) any later version.
-#
-# GNU Enterprise is distributed in the hope that it will be 
-# useful, but WITHOUT ANY WARRANTY; without even the implied 
-# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-# PURPOSE. See the GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public
-# License along with program; see the file COPYING. If not,
-# write to the Free Software Foundation, Inc., 59 Temple Place
-# - Suite 330, Boston, MA 02111-1307, USA.
-#
-# Copyright 2000-2006 Free Software Foundation
-#
-#
-# FILE:
-# GFTree.py
-#
-# DESCRIPTION:
-"""
-Logical tree support
-"""
-# NOTES:
-#
-
-from GFValue import GFValue
-from GFObj import GFObj
-from gnue.common import events
-from GFBlock import GFBlock
-import string
-import copy
-
-#
-# internal tree node representation
-#
-class TreeNode:
-  def __init__(self, parent=None):
-    self.desc     = "n/a"    # description -- will appear in the tree view
-    self.id       = 0        # database ID -- may be used to find the selected 
value in the DB
-    self.parent   = parent   # parent node
-    self.children = []       # children list (to spawn a subtree)
-    self.columns  = []       # values of the columns
-    self.leaf     = None     # GFLeaf reference
-    self.srcinfo  = None     # reference to info struct in GFTree._infoMap
-    self.recno    = 0        # record number in the block
-    self._ui_obj = None      # this one will be set to the TreeItem obj by the 
UI
-
-  def getUiObj (self):
-    return self._ui_obj
-
-  def setUiObj (self, obj=None):
-    self._ui_obj = obj
-
-#
-# will hold information on the various sources (GFBlocks)
-# and column namings.
-#
-class NodeInfo:
-  def __init__(self):
-    self.block = None      # the block we represent
-    self.fld_id = ""       # ID field (primary key)
-    self.fld_desc = ""     # Description field (Human readable)
-    self.fld_query = ""    # Query field
-    self.pat_query = None  # Query pattern
-
-#
-# GFTree
-#
-class GFTree (GFObj):
-  def __init__(self, parent=None):
-    GFObj.__init__(self, parent, 'GFTree')
-
-    # Default attributes (these may be replaced by parser)
-    self.Char__height = int(gConfigForms('widgetHeight'))
-
-    # Runtime Variables
-    self._inits = [self.initialize]
-
-    self._treeRoot = TreeNode() # here's our internal tree representation
-    self._leafMap = {}          # block information for other tables (leaves)
-    self._colList = []          # column information for main tree
-
-    self._infoMap = {}          # saves information on tree/leaves 
sources/fields/blocks
-
-    self._incompleteNodes = []  # nodes that don't have columns yet set (but 
their kids have)
-
-    self._loadList = []         # root items we have to load kids for (i.e. on 
IdleEvent)
-
-    # note on columns:
-    # the ListView right next to the tree will hold
-    # be updated OnSelect to contain all children of
-    # the current selection. (alternative: update it
-    # to give the feel of an Qt-ListView
-    # (multi-column tree-view)
-
-    # note on leaves:
-    # leaves should have an attribute "big" or "don't show in tree"
-    # or whatever. it should prevent the items of a leafnode
-    # from being loaded into the tree and instead only be shown
-    # in the ListView (which might be implemented to have a decent
-    # caching). 'normal' tree items (no leafnodes) are assumed to be
-    # "small" (loadable in one single step, no caching needed...)
-
-    # operations on big leaves (like computation/loading of several
-    # columns) should be done in idleEvents.
-
-    # still need to specify decent column info
-
-    # trigger stuff
-    self._validTriggers = {
-               'ON-SELECTED':      'On-Selected',
-               'POST-KIDSCHANGED': 'Post-KidsChanged'
-       }
-
-    self._triggerGlobal = 1
-    self._triggerFunctions = {
-                       'setNodeCol':        { 'function': self._trigSetNodeCol 
},
-                       'getIncompleteNode': { 'function': 
self._trigGetIncompleteNode },
-                        'popIncompleteNode': { 'function': 
self._trigPopIncompleteNode }
-               }
-   
-    #self._triggerProperties = {'name': {'get': self.getName} }
-
-  #
-  # builds _infoMap structure
-  #
-  def _buildInfoMap (self):
-    ## tree nodes info
-    i = NodeInfo()
-    i.block     = self._blk
-    i.fld_id    = self.fld_id
-    i.fld_desc  = self.fld_desc
-    i.fld_query = self.fld_parentid
-    i.pat_query = ''   # this only goes for the root node! FIXME!
-    self._infoMap[self.name] = i
-
-    ## leaf nodes info
-    for leaf in self._leafMap.values():
-      info = NodeInfo()
-      info.block     = leaf._blk
-      info.fld_id    = leaf.fld_id
-      info.fld_desc  = leaf.fld_desc
-      info.fld_query = leaf.fld_id
-      info.pat_query = '*'
-      self._infoMap[leaf.name] = info
-
-  #
-  # returns the currently changing (i.e. no-column-values-set-yet) node
-  #
-  def _trigGetIncompleteNode (self):
-    if not self._incompleteNodes:
-      return None
-    else:
-      return self._incompleteNodes[0]
-
-  #
-  # pops the next incomplete node from the incomplete-list (-> node is 
"complete" now)
-  #
-  def _trigPopIncompleteNode (self):
-    self._incompleteNodes.pop (0)
-  
-  #
-  # sets the column text for the current node
-  #
-  def _trigSetNodeCol (self, col, val):
-    pass
-
-  def _buildObject(self):
-    if not hasattr(self, 'rows') and hasattr(self,'visibleCount'):
-      self.rows = self.visibleCount
-      del self.visibleCount
-    return GFObj._buildObject(self)
-
-  #
-  # Routines called during a phaseInit
-  #
-  def initialize(self):
-    if hasattr (self, 'block'):
-      self._form = form = self.findParentOfType ('GFForm')
-      self._orig_blk = form._logic._blockMap[self.block]
-      self._blk = self._orig_blk
-      
-      # bad attempt to make a copy of a block... :-(
-      #self._blk = copy.copy (self._orig_blk)
-      #self._blk.initialize()
-
-    self.evtCtrl = self._form._instance.eventController
-    self.evtCtrl.registerEventListeners ({
-               'uitreeItemSelected':  self._onItemSelected,
-               'uitreeItemExpanded':  self._onItemExpanded,
-               'uitreeItemCollapsed': self._onItemCollapsed
-       })
-  
-  #
-  # OnExpand handler. params: node
-  #
-  def _onItemExpanded (self, event):
-    pass
-
-  #
-  # OnCollapse handler. params: node (surprise :-)
-  #
-  def _onItemCollapsed (self, event):
-    pass
-
-  #
-  # OnSelect handler. params: cursel, lastsel
-  #
-  def _onItemSelected (self, event):
-    try:
-      blk = event.cursel.parent.leaf._blk
-      blk.jumpRecord (event.cursel.recno)
-      blk = event.lastsel.parent.leaf._blk
-    except AttributeError:
-      pass
-
-    self.processTrigger ('ON-SELECTED')
-
-  #
-  # build tree from DB
-  #
-  def buildTree (self):
-
-    self._buildInfoMap()
-
-    self._treeRoot.id      = 0
-    self._treeRoot.desc    = "kick me!"
-    self._treeRoot.srcinfo = self._infoMap[self.name]
-
-    #self.__populate_tree (self._treeRoot)
-
-    self.__pop_query (self._treeRoot, 0)
-    self.__pop_load_init (self._treeRoot)
-    self.__pop_load_part (self._treeRoot, -1)
-    self.__pop_load_finish (self._treeRoot)
-
-    return self._treeRoot
-
-  #
-  # wrapper function for __populate_base
-  # to populate tree nodes
-  #
-  def __populate_tree (self, rootnode):
-    self.__populate_base (rootnode, self._blk,
-                          self.fld_id, self.fld_desc,
-                          self.fld_parentid, rootnode.id)
-
-  # wrapper function for __populate_base
-  # to populate leaf nodes
-  def __populate_leaf (self, rootnode):
-    leaf = rootnode.leaf
-    self.__populate_base (rootnode, leaf._blk,
-                          leaf.fld_id, leaf.fld_desc,
-                          leaf.fld_id, '*')
- 
-  #
-  # starts query for items to populate a (sub)tree with.
-  # parameters:
-  #   rootnode:  the root node
-  #   pat_query: select pattern
-  #
-  def __pop_query (self, rootnode, val_query): 
-    blk = rootnode.srcinfo.block
-    fld_query = blk._fieldMap[rootnode.srcinfo.fld_query]
-    #print "query for ", rootnode.srcinfo.fld_query, "=", val_query
-    blk.initQuery()
-    fld_query.setValue (val_query)
-    blk.processQuery()
-
-  #
-  # initializes load phase for tree items
-  # parameters:
-  #   rootnode: root node to add items to
-  #
-  def __pop_load_init (self, rootnode):
-    rootnode.srcinfo.block.firstRecord()
-    self._loadList.append (rootnode)
-
-  #
-  # loads given number of tree items (call __pop_load_init first!)
-  # nr: maximum number of items to read
-  # returns the number of items actually loaded
-  #
-  def __pop_load_part (self, rootnode, nr):
-    blk      = rootnode.srcinfo.block
-    fld_id   = blk._fieldMap[rootnode.srcinfo.fld_id]
-    fld_desc = blk._fieldMap[rootnode.srcinfo.fld_desc]
-
-    total   = nr
-    do_loop = not blk._resultSet.isLastRecord()
-
-    while nr != 0 and do_loop:
-      ## main item stuff
-      node_data = TreeNode (rootnode)
-      node_data.id       = fld_id.getValue()
-      node_data.desc     = fld_desc.getValue()
-      node_data.children = []
-      node_data.recno    = blk._currentRecord
-      node_data.columns  = []
-      node_data.leaf     = None
-      node_data.srcinfo  = self._infoMap[self.name] # goes for tree nodes
-
-      ## column stuff (pretty clumsy... still waiting for enlightenment)
-      if blk == self._blk:        # if this is tree-node (!= leaf-node)...
-        leaf_tbl = blk._fieldMap[self.fld_tblhint].getValue()
-        if leaf_tbl:
-          node_data.leaf    = self._leafMap[leaf_tbl]
-          node_data.srcinfo = self._infoMap[node_data.leaf.name]
-        for ci in self._colList:  # add columns to the tree item
-          node_data.columns.append (blk._fieldMap[ci.field].getValue())
-      else:
-        #node_data.srcinfo = self._infoMap[node_data.leaf.name]
-        for ci in self._colList:  # add column to a leaf
-          colsrc = rootnode.leaf._colsrcMap[ci.name]
-          node_data.columns.append (blk._fieldMap[colsrc.field].getValue())
-
-      rootnode.children.append (node_data)
-      
-      ## while-loop stuff
-      nr = nr - 1
-      do_loop = not blk._resultSet.isLastRecord()
-      blk.nextRecord()
-
-    # while-loop ends.
-
-    self.evtCtrl.dispatchEvent (events.Event ('gftreeAppendKids',
-                            root=rootnode, kids=rootnode.children,
-                            _form=self._form))
-
-    return total-nr
-
-  #
-  # ends load phase for tree items
-  #
-  def __pop_load_finish (self, rootnode):
-    self._loadList.remove (rootnode)
-
-    ## populate sub-trees/leaves
-    if rootnode.srcinfo.block == self._blk:    # if this is _not_ a leaf-list
-      for n in rootnode.children:
-        pat = '*'
-        if n.leaf == None: pat = n.id
-        self.__pop_query (n, pat)
-        self.__pop_load_init (n)
-        self.__pop_load_part (n, -1)
-
-    # trigger KidsChanged -- that should fill in column values for tree nodes
-    if rootnode != self._treeRoot:
-      self._incompleteNodes.append (rootnode)
-      self.processTrigger ('POST-KIDSCHANGED')
-
-  #
-  # aborts load phase for tree items
-  #
-  def __pop_load_cancel (self, rootnode, blk):
-    pass
-
-  #
-  # functions populates list subnode 'rootnode' with
-  # items from DB with items in the DB that have parent id 'rootid'
-  #
-  # (or populates with items from another table that match the
-  #  val_query in fld_query => leafnodes)
-  #
-  # fld_id:    ID field (primary key). will be used to jump to records (??)
-  # fld_desc:  human readable information field
-  # fld_query: "use it or not"-decision information field
-  # val_query: "use it or nor"-decision query string
-  # blk:       block to use
-  # rootnode:  root node to insert items into (see above for type)
-  #
-  def __populate_base (self, rootnode, blk, fld_id, fld_desc, fld_query, 
val_query):
-
-    blk.initQuery()
-    blk._fieldMap[fld_query].setValue (val_query)
-    blk.processQuery()
-   
-    blk.firstRecord()
-    go = not blk._resultSet.isLastRecord()
-    while go == True:
-      item = blk
-      node_data = TreeNode (rootnode)
-      node_data.desc     = item._fieldMap[fld_desc].getValue()
-      node_data.id       = item._fieldMap[fld_id].getValue()
-      node_data.parent   = rootnode
-      node_data.children = []
-      node_data.columns  = []
-      node_data.recno    = blk._currentRecord
-      node_data.leaf     = None
-
-      # if this is a leafnode (main tree item which
-      # spawns a sub-tree from another table)
-      if blk == self._blk:
-        leaf_tbl = item._fieldMap[self.fld_tblhint].getValue()
-        if leaf_tbl:
-          node_data.leaf = self._leafMap[leaf_tbl]
-        
-        # load column information for tree-nodes and leaf-nodes
-        for ci in self._colList:
-          node_data.columns.append (item._fieldMap[ci.field].getValue())
-
-      else:
-
-        # load columns for leaf-ends
-       #for ci in rootnode.leaf._colsrcList:
-        #  node_data.columns.append (item._fieldMap[ci.field].getValue())
-        for ci in self._colList:
-          colsrc = rootnode.leaf._colsrcMap[ci.name]
-          node_data.columns.append (item._fieldMap[colsrc.field].getValue())
-
-      rootnode.children.append (node_data)
-
-      go = not blk._resultSet.isLastRecord()
-      if go:
-         blk.nextRecord()
-
-    # end 'while'
-    
-    self.evtCtrl.dispatchEvent (events.Event ('gftreeAppendKids',
-                                root=rootnode, kids=rootnode.children,
-                                _form=self._form))
-
-    ## populate sub-trees/leaves
-    if blk == self._blk:
-      for n in rootnode.children:
-        if n.leaf == None:
-          self.__populate_tree (n)
-        else:
-          self.__populate_leaf (n)
-
-    # trigger KidsChanged -- that should fill in column values for tree nodes
-    if rootnode != self._treeRoot:
-      self._incompleteNodes.append (rootnode)
-      self.processTrigger ('POST-KIDSCHANGED')
-
-  #
-  # removes the children of a node (and sends rm event to ui)
-  # 
-  def __remove_kids (self, rootnode):
-    for item in rootnode.children:
-      if item.children:
-        self.__remove_kids (item)
-    self.evtCtrl.dispatchEvent (events.Event ('gftreeRemoveKids',
-                                root=rootnode, _form=self._form))
-    for item in rootnode.children:
-      rootnode.children.remove (item)


Property changes on: trunk/gnue-forms/src/GFObjects/GFValue.py
___________________________________________________________________
Name: svn:keywords
   + Id

Modified: trunk/gnue-forms/src/GFObjects/__init__.py
===================================================================
--- trunk/gnue-forms/src/GFObjects/__init__.py  2006-03-29 03:34:36 UTC (rev 
8279)
+++ trunk/gnue-forms/src/GFObjects/__init__.py  2006-03-29 08:46:43 UTC (rev 
8280)
@@ -1,28 +1,25 @@
+# GNU Enterprise Forms - Wrapper for XML Objects
 #
-# This file is part of GNU Enterprise.
+# Copyright 2001-2006 Free Software Foundation
 #
-# GNU Enterprise is free software; you can redistribute it 
-# and/or modify it under the terms of the GNU General Public 
-# License as published by the Free Software Foundation; either 
+# This file is part of GNU Enterprise
+#
+# GNU Enterprise is free software; you can redistribute it
+# and/or modify it under the terms of the GNU General Public
+# License as published by the Free Software Foundation; either
 # version 2, or (at your option) any later version.
 #
-# GNU Enterprise is distributed in the hope that it will be 
-# useful, but WITHOUT ANY WARRANTY; without even the implied 
-# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
+# GNU Enterprise is distributed in the hope that it will be
+# useful, but WITHOUT ANY WARRANTY; without even the implied
+# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
 # PURPOSE. See the GNU General Public License for more details.
 #
-# You should have received a copy of the GNU General Public 
+# You should have received a copy of the GNU General Public
 # License along with program; see the file COPYING. If not,
 # write to the Free Software Foundation, Inc., 59 Temple Place
 # - Suite 330, Boston, MA 02111-1307, USA.
 #
-# Copyright 2000-2006 Free Software Foundation
-#
-# FILE:
-#
-# DESCRIPTION: 
-"""
-"""
+# $Id$
 
 __all__ = [
         "GFBlock",
@@ -31,10 +28,6 @@
         "GFOption",
         "GFScrollBar",
         "GFBox",
-        "GFTree",
-        "GFLeaf",
-        "GFColumn",
-        "GFColsrc",
         "GFOptions",
         "GFValue",
         "GFButton",
@@ -51,10 +44,5 @@
 
 for module in __all__:
   exec "from gnue.forms.GFObjects.%s import %s" % (module,module)
-#  print "importing", module
-#  __import__(module,globals(), locals(), [module])
- 
-#from GFObj import GFObj 
 
-
 from GFParameter import GFCParam


Property changes on: trunk/gnue-forms/src/GFObjects/__init__.py
___________________________________________________________________
Name: svn:keywords
   + Id

Modified: trunk/gnue-forms/src/GFParser.py
===================================================================
--- trunk/gnue-forms/src/GFParser.py    2006-03-29 03:34:36 UTC (rev 8279)
+++ trunk/gnue-forms/src/GFParser.py    2006-03-29 08:46:43 UTC (rev 8280)
@@ -765,115 +765,6 @@
                         'the user can push or click, and that event can run '
                         'a bound trigger.' },
 
-     'tree': {
-         'BaseClass': GFObjects.GFTree,
-         'Attributes': {
-            'name': {
-               'Unique': True,
-               'Typecast': GTypecast.name,
-               'Description': 'Unique name of the tree.' },
-            'rows': {
-               'Typecast': GTypecast.whole,
-               'Description': 'Overrides the rows setting defined at '
-                              'the block level.' },
-            'rowSpacer': {
-               'Typecast': GTypecast.whole,
-               'Label': _('Row Spacing'),
-               'Description': 'Overriders the rowSpace setting defined at '
-                              'the block level.' },
-             'block': {
-               'Typecast': GTypecast.name,
-               'Required': True,
-               'References': 'block.name',
-               'Description': 'The name of the block the tree ties to.' },
-            'fld_desc': {
-               'Label': _('Description field'),
-               'Typecast': GTypecast.name,
-               'Required': True,
-               'Description': 'The visible text of the TreeViewItem' },
-            'fld_id': {
-               'Label': _('Own ID field'),
-               'Typecast': GTypecast.name,
-               'Required': True,
-               'Description': 'The field containing the TreeViewItem ID' },
-            'fld_parentid': {
-               'Label': _('Parent ID field'),
-               'Typecast': GTypecast.name,
-               'Required': True,
-               'Description': 'The field containing the TreeViewItem parent' },
-            'fld_tblhint': {
-               'Label': _('Table hint for leaf tables'),
-               'Typecast': GTypecast.name,
-               'Required': True,
-               'Description': 'The field containing the table-hint for leaves' 
} },
-           'Positionable': True,
-           'ParentTags': ('page',),
-           'Description': 'Tree/List-View of a table' },
-
-      'leaf': {
-         'BaseClass': GFObjects.GFLeaf,
-         'Attributes': {
-            'name': {
-               'Unique': True,
-               'Typecast': GTypecast.name,
-               'Description': 'Leaf of the Tree Widget' },
-            'block': {
-               'Typecast': GTypecast.name,
-               'Required': True,
-               'References': 'block.name',
-               'Description': 'Block used for db operations' },
-            'fld_id': {
-               'Label': _('ID of a field'),   # TODO: we need some kind of 
restriction
-               'Typecast': GTypecast.name,    # TODO: on which entries we 
pick...
-               'Required': True,
-               'Description': 'TODO' },
-            'fld_desc': {
-               'Label': _('Description field'),
-               'Typecast': GTypecast.name,
-               'Required': True,
-               'Description': 'TODO' },
-            'tblhint': {
-               'Typecast': GTypecast.name,
-               'Required': True,
-               'Description': 'Table of this leaf' } },
-         'Positionable': True,
-         'ParentTags': ('tree',),
-         'Description': 'Leaf information of a tree view' },
-
-      'column': {
-        'BaseClass': GFObjects.GFColumn,
-          'Attributes': {
-             'name': {
-               'Unique': True,
-               'Required': True,
-               'Typecast': GTypecast.name,
-               'Description': 'Column info for leaves/trees' },
-             'align': {
-               'Typecast': GTypecast.name,
-               'Required': True,
-               'Description': 'Contents alignment: left/right/center' },
-             'field': {  # we'll have to remove this, or replace it with some 
more general source
-               'Typecast': GTypecast.name,
-               'Description': 'Field to get column text from' } },
-          'Positionable': False,
-          'ParentTags': ('tree',),
-          'Descrpition': 'Column information for trees' },
-
-      'colsrc': {
-        'BaseClass': GFObjects.GFColsrc,
-          'Attributes': {
-             'covers': {
-               'Unique': True,
-               'Required': True,
-               'Typecast': GTypecast.name,
-               'Description': 'Specifies the column this belongs to' },
-             'field': {
-               'Typecast': GTypecast.name,
-               'Description': 'Field to get column text from' } },
-          'Positionable': False,
-          'ParentTags': ('leaf',),
-          'Descrpition': 'Column information for trees' },
-
       'options': {
          'BaseClass': GFObjects.GFOptions,
          'UsableBySiblings': True,





reply via email to

[Prev in Thread] Current Thread [Next in Thread]