home *** CD-ROM | disk | FTP | other *** search
- #---------------------------------------------------------------------------
- #
- # (c) Cadre Technologies Inc. 1996
- #
- # File: @(#)localsecti.tcl /main/hindenburg/4
- # Author: <generated>
- # Description:
- #---------------------------------------------------------------------------
- # SccsId = @(#)localsecti.tcl /main/hindenburg/4 19 Sep 1996 Copyright 1996 Cadre Technologies Inc.
-
- # Start user added include file section
- # End user added include file section
-
- require "docsection.tcl"
- require "extfvdbobj.tcl"
-
- Class LocalSection : {DocSection ExtFVDbObj} {
- method destructor
- constructor
- method promoter
- method browserObjType
- method canBeDragged
- method edit
- method generateStructure
- method generateContents
- method generateTypeContents
- method isDocDirUpToDate
- method updateDocDir
- method type
- method uiName
- method uiClass
- }
-
- method LocalSection::destructor {this} {
- # Start destructor user section
- # End destructor user section
- $this DocSection::destructor
- $this ExtFVDbObj::destructor
- }
-
- constructor LocalSection {class this name document} {
- set this [ExtFVDbObj::constructor $class $this $name]
- set this [DocSection::constructor $class $this $name $document]
- return $this
- }
-
- selfPromoter ExtFVDbObj {this} {
- if [info exists SysVDbObj::this] {
- set sysV ${SysVDbObj::this}
- if {! [isCommand $sysV]} return
- } else {
- set sysV [[ClientContext::global] currentSystem]
- }
- if [$sysV isNil] return
- if [[$sysV findFileVersionLink -byFileVersion $this] isNil] return
- if {"[[$sysV system] type]" != "document"} return
- set editor [$sysV editor]
- if {! [isCommand $editor]} return
-
- set editorName [$editor name]
- set editorVersion [$editor version]
- set type [[$this file] type]
- set class [Document::getClass $editorName $editorVersion $type]
-
- if {$class != ""} {
- $class promote $this $sysV
- }
- }
-
- method LocalSection::promoter {this document} {
- $this DocSection::promoter $document
- }
-
- proc LocalSection::associations {} {
- return "[ExtFVDbObj::associations]"
- }
-
- method LocalSection::browserObjType {this} {
- return "LocalSection"
- }
-
- method LocalSection::canBeDragged {this} {
- return 0
- }
-
- proc LocalSection::childTypes {assoc} {
- if {[lsearch -exact "[LocalSection::associations]" "$assoc"] == -1} {
- return ""
- }
- return "[BrowserProcs::childTypes $assoc]"
- }
-
- proc LocalSection::controlledLists {} {
- return "[ExtFVDbObj::controlledLists]"
- }
-
- proc LocalSection::infoProperties {} {
- return "[ExtFVDbObj::infoProperties]"
- }
-
- method LocalSection::edit {this} {
- $this DocSection::edit
- }
-
- method LocalSection::generateStructure {this withContents} {
-
- # read the property structureGen of the section
- set structureGen [$this findProperty structureGen]
-
- if [$structureGen isNil] {
- return
- }
- set structureGen [$structureGen value]
- regsub -all " |\\t" "$structureGen" "" strippedValue
- if {"$strippedValue" == ""} {
- return
- }
- set tmpFile [args_file {}]
- if [catch {eval "$structureGen [list $tmpFile] $this"} msg] {
- wmtkerror "Error while executing structure generator\
- procedure '$structureGen'\n\tfor section '[$this uiName]'.\
- \n\t:$msg"
- }
- generator generateSection $this $tmpFile $withContents
- unlink $tmpFile
- }
-
- method LocalSection::generateContents {this} {
-
- # read the property contentsGen of the section
- set contentsGen [$this findProperty contentsGen]
-
- # check if there's a generate defined with this section
- # if not, generate contents according to the section type
- wmtkmessage "Generate contents for section '[$this uiName]'"
- if [$contentsGen isNil] {
- $this generateTypeContents
- return
- }
- set contentsGen [$contentsGen value]
- regsub -all " |\\t" "$contentsGen" "" strippedValue
- if {"$strippedValue" == ""} {
- $this generateTypeContents
- return
- }
- if [catch {eval "dispatchContentsGen $contentsGen $this"} msg] {
- wmtkerror "Error while executing contents generator\
- procedure '$contentsGen'\n\tfor section '[$this uiName]'.\
- :\n\t$msg"
- }
- }
-
- method LocalSection::generateTypeContents {this} {
-
- # default no contents generated
- }
-
- method LocalSection::isDocDirUpToDate {this} {
-
- # do not update if document is frozen
- if {"[[$this document] getInfo Status]" == "frozen"} {
- return 1
- }
-
- if {! [file exists [$this docLocation]]} {
- return 0
- }
-
- # do not update frozen section
- if {"[$this getInfo Status]" == "frozen"} {
- return 1
- }
-
- if {[[[$this document] editor] printsIncluded] == "y"} {
- # check also the 'not-localsection-children'
- [$this childSectionSet] foreach child {
- if {![$child isA LocalSection]} {
- if {![$child isDocDirUpToDate]} {
- return 0
- }
- }
- }
- }
- return 1
- }
-
- method LocalSection::updateDocDir {this} {
-
- set path [$this docLocation]
- if {"[$this getInfo Status]" != "working"} {
- catch {BasicFS::removeFile $path}
- }
- if {! [file exists $path]} {
- $this synchWithFileSystem
- set retval 0
- } else {
- set retval 1
- }
-
- if {[[[$this document] editor] printsIncluded] == "y"} {
- # update also the 'not-localsection-children'
- [$this childSectionSet] foreach child {
- if {![$child isA LocalSection]} {
- if {![$child updateDocDir]} {
- set retval 0
- }
- }
- }
- }
- return $retval
- }
-
- method LocalSection::type {this} {
- return [[$this file] type]
- }
-
- method LocalSection::uiName {this args} {
-
- if {$args == ""} {
- return [[$this file] name]
- } else {
- # can not change name (yet)
- }
- }
-
- method LocalSection::uiClass {this} {
- return LocalSection
- }
-
- # Do not delete this line -- regeneration end marker
-
-