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

  1. #---------------------------------------------------------------------------
  2. #
  3. #      (c)     Cadre Technologies Inc.    1996
  4. #
  5. #      File:           @(#)cbpropdefi.tcl    /main/2
  6. #      Author:         <generated>
  7. #      Description:
  8. #---------------------------------------------------------------------------
  9. # SccsId = @(#)cbpropdefi.tcl    /main/2   11 Jun 1996 Copyright 1996 Cadre Technologies Inc.
  10.  
  11. # Start user added include file section
  12. require "propifdefs.tcl"
  13. # End user added include file section
  14.  
  15.  
  16. Class CBPropDefinition : {PropDefinition} {
  17.     constructor
  18.     method destructor
  19.     method promoter
  20.     method initDefaultValue
  21.     method getDefaultValue
  22.     method getDefaultValueFromEntrySet
  23.     attribute defaultValue
  24. }
  25.  
  26. constructor CBPropDefinition {class this} {
  27.     set this [PropDefinition::constructor $class $this]
  28.     # Start constructor user section
  29.     $this initDefaultValue
  30.     # End constructor user section
  31.     return $this
  32. }
  33.  
  34. method CBPropDefinition::destructor {this} {
  35.     # Start destructor user section
  36.     # End destructor user section
  37. }
  38.  
  39. method CBPropDefinition::promoter {this} {
  40.     $this initDefaultValue
  41. }
  42.  
  43. selfPromoter PropDefinition {this} {
  44.     CBPropDefinition promote $this
  45. }
  46.  
  47. method CBPropDefinition::initDefaultValue {this} {
  48.     $this defaultValue [$this getDefaultValue]
  49. }
  50.  
  51. method CBPropDefinition::getDefaultValue {this} {
  52.     set ifClass [$this ifClass]
  53.     set ifOptions [$this ifOptions]
  54.     if {$ifClass == "" || $ifOptions == ""} {
  55.         return ""
  56.     }
  57.  
  58.     global hasEntrySet defIndex
  59.     if {[info exists defIndex($ifClass)]} {
  60.         set defIdx $defIndex($ifClass)
  61.         if {[info exists hasEntrySet($ifClass)]} {
  62.             return [$this getDefaultValueFromEntrySet \
  63.                 $ifOptions $defIdx]
  64.         }
  65.         return "$defIdx"
  66.     }
  67.     # Handle very special case
  68.     if {$ifClass == "RWAccessRow"} {
  69.         set def [$this getDefaultValueFromEntrySet $ifOptions 0]
  70.         return "${def}-$def"
  71.     }
  72.     return ""
  73. }
  74.  
  75. method CBPropDefinition::getDefaultValueFromEntrySet {this ifOptions defIdx} {
  76.     set optList [concat $ifOptions]
  77.     set idx [lsearch -exact $optList -entrySet]
  78.     if {$idx != -1} {
  79.         incr idx
  80.         return [lindex [lindex $optList $idx] $defIdx]
  81.     }
  82.     return ""
  83. }
  84.  
  85. # Do not delete this line -- regeneration end marker
  86.  
  87.