home *** CD-ROM | disk | FTP | other *** search
/ PC World 1997 November / PCWorld_1997-11_cd.bin / software / programy / komix / DATA.Z / drssmitemo.tcl < prev    next >
Text File  |  1997-03-10  |  5KB  |  165 lines

  1. #---------------------------------------------------------------------------
  2. #
  3. #      (c)     Cayenne Software Inc.    1997
  4. #
  5. #      File:           @(#)drssmitemo.tcl    /main/hindenburg/8
  6. #      Author:         <generated>
  7. #      Description:
  8. #---------------------------------------------------------------------------
  9. # SccsId = @(#)drssmitemo.tcl    /main/hindenburg/8   10 Mar 1997 Copyright 1997 Cayenne Software Inc.
  10.  
  11. # Start user added include file section
  12. # End user added include file section
  13.  
  14. require "drsitemobj.tcl"
  15.  
  16. #Class DrsSMItemObject : {DrsItemObject} {
  17. #    method destructor
  18. #    constructor
  19. #    method getEditorTypes
  20. #    method linkComponents
  21. #    method levelName
  22. #    method levelType
  23. #    attribute semTypeName
  24. #    attribute smObject
  25. #}
  26.  
  27. method DrsSMItemObject::destructor {this} {
  28.     # Start destructor user section
  29.     # End destructor user section
  30.     $this DrsItemObject::destructor
  31. }
  32.  
  33. constructor DrsSMItemObject {class this smObject system systemV} {
  34.     set workItem [$smObject getWorkItem]
  35.     set this [DrsItemObject::constructor $class $this $workItem $system $systemV]
  36.     $this smObject $smObject
  37.         set semType [$smObject getSemType]
  38.         $this semTypeName [getSMTypeName $semType]
  39.     return $this
  40. }
  41.  
  42. method DrsSMItemObject::getEditorTypes {this} {
  43.     set smObject [$this smObject]
  44.         set semType [$smObject getSemType]
  45.     set semType [$semType name]
  46.     if {[llength $semType] == 2} {
  47.         return [string tolower [lindex $semType 0]]
  48.     }
  49.     if {$semType == "Class"} {
  50.         return "cad ccd etd std"
  51.     }
  52.     if {$semType == "Event"} {
  53.         return "mgd etd ccd ucd std"
  54.     }
  55.     if {$semType == "EventSender" || $semType == "EventReceiver"} {
  56.         return "ccd std etd ucd"
  57.     }
  58.     return [string tolower [lindex $semType 0]]
  59. }
  60.  
  61. method DrsSMItemObject::linkComponents {this currDoorsObject} {
  62.     set dxlCommand [$this dxlCommand]
  63.     set semTypeNames [m4_var get M4_doors_semantic_types]
  64.     set smTypes ""
  65.     foreach smTypeName $semTypeNames {
  66.         set smType [SMTypeDB::find $smTypeName]
  67.         if ![$smType isNil] {
  68.         lappend smTypes $smType
  69.         }
  70.     }
  71.     set otConnections [m4_var get M4_doors_connections_link_module]
  72.     $dxlCommand doorsObjectDeleteLinks $currDoorsObject $otConnections
  73.     set smObject [$this smObject]
  74.     if [$smObject isA SMConnector] {
  75.         # this is a link connector
  76.         set smConnector $smObject
  77.         foreach smType $smTypes { 
  78.         set smFrom [$smConnector getFrom $smType]
  79.         if ![llength $smFrom]  {
  80.             continue
  81.         }
  82.         set fromWorkItem [$smFrom getWorkItem]
  83.         if [$fromWorkItem isNil] {
  84.             continue
  85.         }
  86.         set itemProps [$fromWorkItem properties]
  87.         set fromDrsId [$itemProps  getPropertyValue ${FORMALMODULE}]
  88.         if ![llength $fromDrsId] {
  89.             continue
  90.         }
  91.         set fromDrsObj [$dxlCommand doorsObjectFind  $fromDrsId]
  92.                 $dxlCommand doorsObjectCreateLink $currDoorsObject $fromDrsObj\
  93.                         $otConnections
  94.         }
  95.         foreach smType $smTypes { 
  96.         set smTo [$smConnector getTo $smType]
  97.         if ![llength $smTo]  {
  98.             continue
  99.         }
  100.         set toWorkItem [$smTo getWorkItem]
  101.         if [$toWorkItem isNil] {
  102.             continue
  103.         }
  104.         set itemProps [$toWorkItem properties]
  105.         set toDrsId [$itemProps  getPropertyValue ${FORMALMODULE}]
  106.         if ![llength $toDrsId] {
  107.             continue
  108.         }
  109.         set toDrsObj [$dxlCommand doorsObjectFind  $toDrsId]
  110.                 $dxlCommand doorsObjectCreateLink $toDrsObj $currDoorsObject\
  111.                         $otConnections
  112.         }
  113.         return
  114.     } 
  115.  
  116.  
  117.     # current isa node
  118.     set smNode $smObject
  119.     foreach connType $smTypes { 
  120.         foreach oppType $smTypes {
  121.         foreach smConn [$smNode getConnectorsIn $connType $oppType] {
  122.             set connWorkItem [$smConn getWorkItem]
  123.             if [$connWorkItem isNil] {
  124.             continue
  125.             }
  126.             set itemProps [$connWorkItem properties]
  127.             set connDrsId [$itemProps  getPropertyValue ${FORMALMODULE}]
  128.             if ![llength $connDrsId] {
  129.             continue
  130.             }
  131.             set connDrsObj [$dxlCommand doorsObjectFind  $connDrsId]
  132.             $dxlCommand doorsObjectCreateLink $currDoorsObject \
  133.                 $connDrsObj $otConnections
  134.         }
  135.         foreach smConn [$smNode getConnectorsOut $connType $oppType] {
  136.             set connWorkItem [$smConn getWorkItem]
  137.             if [$connWorkItem isNil] {
  138.             continue
  139.             }
  140.             set itemProps [$connWorkItem properties]
  141.             set connDrsId [$itemProps  getPropertyValue ${FORMALMODULE}]
  142.             if ![llength $connDrsId] {
  143.             continue
  144.             }
  145.             set connDrsObj [$dxlCommand doorsObjectFind  $connDrsId]
  146.             $dxlCommand doorsObjectCreateLink $connDrsObj \
  147.                 $currDoorsObject $otConnections
  148.         }
  149.         }
  150.     }
  151. }
  152.  
  153. method DrsSMItemObject::levelName {this} {
  154.         set smObject [$this smObject]
  155.         set item [$this item]
  156.         return "[$item name].[$this levelType]"
  157. }
  158.  
  159. method DrsSMItemObject::levelType {this} {
  160.     return [$this semTypeName]
  161. }
  162.  
  163. # Do not delete this line -- regeneration end marker
  164.  
  165.