xotcl.wu-wien.ac.at
Begin main content
Methods: Source: Variables:
[All Methods | Documented Methods | Hide Methods] [Display Source | Hide Source] [Show Variables | Hide Variables]

::xotcl::Class[i] ::xo::OrderedComposite

Class Hierarchy of ::xo::OrderedComposite

  • ::xotcl::Object[i]
    Meta-class:
    ::xotcl::Class[i]
    Methods for instances:
    __api_make_doc, __api_make_forward_doc, __timediff, abstract, ad_doc, ad_forward, ad_proc, appendC, arrayC, asHTML, autonameC, check, classC, cleanupC, configureC, containsC, copyC, db_0or1rowC, db_1rowC, debug, defaultmethodC, destroyC, destroy_on_cleanup, ds, evalC, existsC, extractConfigureArg, filterC, filterguardC, filtersearch, forward, hasclass, incrC, infoC, init, instvarC, invarC, isclass, ismetaclass, ismixin, isobject, istype, lappendC, log, method, mixinC, mixinguardC, moveC, msg, noinitC, objectparameter, parametercmdC, proc, procsearch, qn, requireNamespaceC, residualargsC, self, serialize, setC, set_instance_vars_defaults, show-object, substC, traceC, unknown, unsetC, uplevelC, upvarC, volatileC, vwait
    Methods to be applied on the class (in addition to the methods provided by the meta-class):
    getExitHandler, setExitHandler, unsetExitHandler
    • ::xo::OrderedComposite[i]
      Meta-class:
      ::xotcl::Class[i]
      Methods for instances:
      __compare, add, children, contains, delete, destroy, last_child, orderby, show
      Methods to be applied on the class:
      Methods provided by the meta-class

Class Relations

  • superclass: ::xotcl::Object[i]
  • subclass: ::ListWidget[i], ::xo::Chat[i], ::xo::Table[i], ::xo::tdom::Object[i], ::xowiki::Tree[i]
::xotcl::Class create ::xo::OrderedComposite \
     -superclass ::xotcl::Object

Methods

  • instproc __compare

    ::997713 instproc __compare {a b} {
        set by [my set __orderby]
        set x [$a set $by]
        set y [$b set $by]
        if {$x < $y} {
          return -1
        } elseif {$x > $y} {
          return 1
        } else {
          return 0
        }
      }
    
  • instproc add

    ::997713 instproc add obj {
        my lappend __children $obj
        $obj set __parent [self]
        #my log "-- adding __parent [self] to $obj -- calling after_insert"
        #$obj __after_insert
      }
    
  • instproc children

    ::997713 instproc children {} {
        set children [expr {[my exists __children] ? [my set __children] : ""}]
        if {[my exists __orderby]} {
          set order [expr {[my exists __order] ? [my set __order] : "increasing"}]
          return [lsort -command [list my __compare] -$order $children]
        } else {
          return $children
        }
      }
    
  • instproc contains

    ::997713 instproc contains cmds {
        my requireNamespace ;# legacy for older xotcl versions
        set m [Object info instmixin]
        if {[lsearch $m [self class]::ChildManager] == -1} {
          set insert 1
          Object instmixin add [self class]::ChildManager
        } else { 
          set insert 0
        }
        #
        [self class]::ChildManager instvar composite
        # push the active composite
        lappend composite [self]
        ns_log notice "+++ CONTAINS by [self] cmds $cmds"
        # check, if we have Tcl's apply available
        if {$::tcl_version >= 8.5 && [info proc ::apply] eq ""} {
          ns_log notice "+++ CONTAINS using apply"
          set errorOccurred [catch {::apply [list {} $cmds [self]]} errorMsg]
        } else {
          ns_log notice "+++ CONTAINS using ns eval"
          set errorOccurred [catch {namespace eval [self] $cmds} errorMsg]
        }
    
        # pop the last active composite
        set composite [lrange $composite 0 end-1]
    
        if {$insert} {
          Object instmixin delete [self class]::ChildManager
        }
        if {$errorOccurred} {error $errorMsg}
      }
    
  • instproc delete

    ::997713 instproc delete obj {
        my instvar __children
        set p [lsearch -exact $__children $obj]
        if {$p == -1} {error "can't delete '$obj' from $__children"}
        set __children [lreplace $__children $p $p]
        $obj destroy
      }
    
  • instproc destroy

    ::997713 instproc destroy {} {
        # destroy all children of the ordered composite
        if {[my exists __children]} {
          #my log "--W destroying children [my set __children]"
          foreach c [my set __children] { 
    	if {[my isobject $c]} {$c destroy}
          }
        }
        #show_stack;my log "--W children murdered, now next, chlds=[my info children]"
        #namespace eval [self] {namespace forget *}  ;# for pre 1.4.0 versions
        next
      }
    
  • instproc last_child

    ::997713 instproc last_child {} {
        lindex [my set __children] end
      }
    
  • instproc orderby

    ::997713 instproc orderby {{-order "increasing"} variable} {
        my set __order $order
        my set __orderby $variable
      }
    
  • instproc show

    ::997713 instproc show {} {
        next
        foreach child [my children] {
          $child show
        }
      }
    

Methods: Source: Variables:
[All Methods | Documented Methods | Hide Methods] [Display Source | Hide Source] [Show Variables | Hide Variables]