home *** CD-ROM | disk | FTP | other *** search
- #---------------------------------------------------------------------------
- #
- # (c) Cadre Technologies Inc. 1996
- #
- # File: @(#)custbrowso.tcl /main/3
- # Author: <generated>
- # Description:
- #---------------------------------------------------------------------------
- # SccsId = @(#)custbrowso.tcl /main/3 12 Jun 1996 Copyright 1996 Cadre Technologies Inc.
-
- # Start user added include file section
- # End user added include file section
-
-
- Class CustBrowsObject : {Object} {
- constructor
- method destructor
- method visible
- method validScope
- method validEnvironment
- method validSpecLevel
- method displayName
- method infoList
- attribute editable
- attribute specLevel
- attribute readOnly
- attribute scope
- attribute name
- attribute objSpec
- attribute type
- attribute userDefined
- attribute alwaysInScope
- attribute alwaysVisible
- attribute _visible
- attribute _displayName
- }
-
- constructor CustBrowsObject {class this name_1} {
- set this [Object::constructor $class $this $name_1]
- $this editable 0
- # Start constructor user section
-
- $this readOnly 0
- $this scope {}
- $this userDefined 0
- $this alwaysInScope 1
- $this alwaysVisible 1
- $this _visible {1 1 1 1 1}
-
- # End constructor user section
- return $this
- }
-
- method CustBrowsObject::destructor {this} {
- # Start destructor user section
- # End destructor user section
- }
-
- method CustBrowsObject::visible {this args} {
-
- set visible {}
-
- if {$args == ""} {
- return [$this _visible]
- } else {
- set count 0
- $this _visible [join $args]
- $this alwaysVisible 0
- if {[lsearch [$this _visible] 0] == -1} {
- $this alwaysVisible 1
- }
- }
- }
-
- method CustBrowsObject::validScope {this curPath} {
-
- if [$this alwaysInScope] {
- return 1
- }
-
- # extract corporate
- set curPath [lreplace $curPath 0 0]
-
- # if curPath is corporate, the object is always in scope
- if [lempty $curPath] {
- return 1
- }
-
- set index 0
- set objScope [$this scope]
- foreach i $curPath {
- set x [lindex $objScope $index]
- if { $x != "" && $x != "*" } {
- if {$index == 3} {
- if [$i isA Document] {
- if {[lsearch $x "document"] == -1} {
- return 0
- }
- } else {
- if {[lsearch $x "system"] == -1} {
- return 0
- }
- }
- } else {
- if {$index == 0} {
- set name [$i name]
- } else {
- set name [[$i \
- $icaseLevelNames($index)] name]
- }
- if {[lsearch $x $name] == -1} {
- return 0
- }
- }
- }
- incr index
- }
- return 1
- }
-
- method CustBrowsObject::validEnvironment {this curPath} {
-
- # extract corporate
- set curPathLen [expr {[llength $curPath]-1}]
-
- if {![$this alwaysVisible]} {
- # check if the object is visible on this level
- if {[lindex [$this visible] $curPathLen] == 0 } {
- return 0
- }
- }
-
- set objScope [$this scope]
- if {$curPathLen < [llength $objScope]} {
- return 0
- }
-
- return [$this validScope $curPath]
- }
-
- method CustBrowsObject::validSpecLevel {this curLevel} {
-
- set objScope [$this scope]
- set level 0
-
- # user defines are always read in level corporate, do not check
- if [$this userDefined] {
- return 1
- }
-
- if {$objScope == "" && $curLevel != "corporate"} {
- return 0
- }
-
- foreach i $objScope {
- if {$i == "*" || [llength $i] > 1} {
- break
- } else {
- incr level
- }
- }
-
- if {$icaseLevel($level) != $curLevel} {
- return 0
- } else {
- return 1
- }
- }
-
- method CustBrowsObject::displayName {this args} {
-
- if {$args == ""} {
- return [$this _displayName]
- } else {
- $this _displayName [join $args]
- }
- }
-
- method CustBrowsObject::infoList {this} {
-
- set readOnly "Yes"
- if ![$this readOnly] {
- set readOnly "No"
- }
- set userDefined "Yes"
- if ![$this userDefined] {
- set userDefined "No"
- }
-
- return "Name \{[$this displayName]\} \
- Type [$this type] \
- {Specification Level} [$this specLevel]
- Scope \{[$this scope]\} \
- ReadOnly $readOnly \
- UserDefined $userDefined "
- }
-
- # Do not delete this line -- regeneration end marker
-
-