home *** CD-ROM | disk | FTP | other *** search
/ PC World 1997 November / PCWorld_1997-11_cd.bin / software / programy / komix / DATA.Z / cbpropfilt.tcl < prev    next >
Text File  |  1996-05-29  |  2KB  |  75 lines

  1. #---------------------------------------------------------------------------
  2. #
  3. #      (c)     Cadre Technologies Inc.    1996
  4. #
  5. #      File:           @(#)cbpropfilt.tcl    1.6
  6. #      Author:         <generated>
  7. #      Description:
  8. #---------------------------------------------------------------------------
  9. # SccsId = @(#)cbpropfilt.tcl    1.6   20 Mar 1996 Copyright 1996 Cadre Technologies Inc.
  10.  
  11. # Start user added include file section
  12. require cbpropdefi.tcl
  13. # End user added include file section
  14.  
  15. require "cbfilterel.tcl"
  16.  
  17. Class CBPropFilterElement : {CBFilterElement} {
  18.     constructor
  19.     method destructor
  20.     method letsPass
  21.     method addPropHolder
  22.     method removePropHolder
  23.     attribute propHolderSet
  24. }
  25.  
  26. constructor CBPropFilterElement {class this name propDefinition} {
  27.     set this [CBFilterElement::constructor $class $this $name $propDefinition]
  28.     $this propHolderSet [List new]
  29.     # Start constructor user section
  30.     # End constructor user section
  31.     return $this
  32. }
  33.  
  34. method CBPropFilterElement::destructor {this} {
  35.     # Start destructor user section
  36.     # End destructor user section
  37.     $this CBFilterElement::destructor
  38. }
  39.  
  40. method CBPropFilterElement::letsPass {this feature} {
  41.     if {![$this enabled]} {
  42.         return 1
  43.     }
  44.  
  45.     set propName [[$this propDefinition] name]
  46.     [$this propHolderSet] foreach prpHldr {
  47.         set propObject [eval $prpHldr]
  48.         set value ""
  49.         if {$propObject != "" && ![$propObject isNil]} {
  50.             set propVal [$propObject findProperty $propName]
  51.             if {[$propVal isNil]} {
  52.                 set value [[$this propDefinition] defaultValue]
  53.             } else {
  54.                 set value [$propVal value]
  55.             }
  56.         }
  57.         if {![$this match $value]} {
  58.             return 0
  59.         }
  60.     }
  61.     return 1
  62. }
  63.  
  64. # Do not delete this line -- regeneration end marker
  65.  
  66. method CBPropFilterElement::addPropHolder {this newPropHolder} {
  67.     [$this propHolderSet] append $newPropHolder
  68.  
  69. }
  70.  
  71. method CBPropFilterElement::removePropHolder {this oldPropHolder} {
  72.     [$this propHolderSet] removeValue $oldPropHolder
  73. }
  74.  
  75.