%3 ::xotcl::Object ::xotcl::Object → getExitHandler → setExitHandler → unsetExitHandler __object_configureparameter __timediff abstract ad_doc ad_forward ad_proc asHTML check class db_0or1row db_1row debug destroy_on_cleanup ds extractConfigureArg filter filtersearch forward hasclass init invar isclass ismetaclass ismixin isobject istype log method mixin mset msg parametercmd proc procsearch qn self serialize set_instance_vars_defaults unknown vwait www-show-object ::xo::OrderedComposite ::xo::OrderedComposite __compare __compare_tcl add children contains deep_copy delete destroy last_child orderby show ::xo::OrderedComposite->::xotcl::Object ::xo::tdom::Object ::xo::tdom::Object render ::xo::tdom::Object->::xo::OrderedComposite ::xo::tdom::AttributeManager ::xo::tdom::AttributeManager ::xo::tdom::Object->::xo::tdom::AttributeManager ::xowiki::Tree ::xowiki::Tree → include_head_entries → renderer add_item add_pages init open_tree render ::xowiki::Tree->::xo::OrderedComposite ::ListWidget ::ListWidget render ::ListWidget->::xo::OrderedComposite ::xo::Chat ::xo::Chat active_user_list add_msg broadcast_msg check_age current_message_valid encode get_all get_new get_users init init_user_color json_encode json_encode_msg last_activity login logout noencode nr_active_users nsv_get register_nsvs render set_options subscribe sweeper urlencode usable_screen_name user_active user_color user_name ::xo::Chat->::xo::OrderedComposite ::xo::Table ::xo::Table __bulkactions actions column_names columns destroy format_csv render_with write_csv ::xo::Table->::xo::OrderedComposite ::xowiki::formfield::FormField ::xowiki::formfield::FormField → fc_decode → fc_encode → get_from_name → get_single_spec → interprete_condition CSSclass_list_add add_statistics answer_check=AND answer_check=answer_words answer_check=btwn answer_check=contains answer_check=contains-not answer_check=eq answer_check=ge answer_check=gt answer_check=in answer_check=le answer_check=lt answer_check=match answer_is_correct asWidgetSpec behavior booleanAttributes config_from_spec convert_to_external convert_to_internal describe dict_to_fc dict_to_spec dict_value escape_message_keys field_value handle_transmit_always has_instance_variable init initialize interprete_single_spec is_disabled is_repeat_template_p leaf_components localize make_correct pretty_image pretty_value process_correct_when_modifier remove_omit render render_answer_statistics render_collapsed render_disabled_as_div render_error_msg render_form_widget render_help_text render_input render_item render_localizer render_modal render_result_statistics render_word_statistics repeat repeat_add_label resetBooleanAttributes reset_on_validation_error reset_parameter same_value set_disabled set_feedback set_is_repeat_template stats_record_count validate validation_check value_if_nothing_is_returned_from_form word_statistics ::xowiki::formfield::FormField->::xo::tdom::Object ::xowiki::MenuComponent ::xowiki::MenuComponent html_id js_name ::xowiki::MenuComponent->::xo::tdom::Object ::xowiki::TreeNode ::xowiki::TreeNode open_tree render some_child_has_items ::xowiki::TreeNode->::xowiki::Tree ::xowiki::Chat ::xowiki::Chat ::xowiki::Chat->::xo::Chat ::TableWidget ::TableWidget init ::TableWidget->::xo::Table ::xowiki::YUIDataTable ::xowiki::YUIDataTable init ::xowiki::YUIDataTable->::xo::Table ::xowiki::BootstrapTable ::xowiki::BootstrapTable init ::xowiki::BootstrapTable->::xo::Table

Class ::xo::OrderedComposite

::xo::OrderedComposite[i] create ...

Defined in

Class Relations

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

Methods (to be applied on instances)

  • __compare (scripted)

     <instance of xo::OrderedComposite[i]> __compare

    Testcases:
    includelet_childresources, xowiki
    set by ${:__orderby}
    set x [$a set $by]
    set y [$b set $by]
    return [ns_strcoll $x $y]
  • __compare_tcl (scripted)

    #
    # Comparison based on plain Tcl compare. This behaves reasonable
    # on numbers (integer or real) and in mixed cases of numbers and
    # strings.
    #
    set by ${:__orderby}
    set x [$a set $by]
    set y [$b set $by]
    if {$x < $y} {
      return -1
    } elseif {$x > $y} {
      return 1
    } else {
      return 0
    }
  • add (scripted)

    lappend :__children $obj
    $obj set __parent [self]
    #:log "-- adding __parent [self] to $obj -- calling after_insert"
    #$obj __after_insert
  • children (scripted)

    if {![info exists :__children]} {
      return ""
    }
    
    if {[info exists :__orderby] && [llength ${:__children}] > 0} {
      set firstChild [lindex ${:__children} 0]
      if {[$firstChild exists ${:__orderby}]} {
        set order [expr {[info exists :__order] ? ${:__order} : "increasing"}]
        set compare [expr {[info exists :__ordercompare] ? ${:__ordercompare} : "__compare"}]
        #ns_log notice SORT=[list lsort -command :$compare -$order ${:__children}]
        return [lsort -command :$compare -$order ${:__children}]
      } else {
        ad_log warning "ignore invalid sorting criterion '${:__orderby}'"
      }
    }
    return ${:__children}
  • contains (scripted)

    :requireNamespace ;# legacy for older XOTcl versions
    set m [Object info instmixin]
    if {"[self class]::ChildManager" ni $m} {
      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]
    set errorOccurred 0
    # check, if we have Tcl's apply available
    if {[info procs ::apply] eq ""} {
      set applyCmd [list ::apply [list {} $cmds [self]]]
    } else {
      set applyCmd [list namespace eval [self$cmds]
    }
    try {
      {*}$applyCmd
    } on error {errorMsg} {
      set errorOccurred 1
    } finally {
      # pop the last active composite
      set composite [lrange $composite 0 end-1]
    
      if {$insert} {
        Object instmixin delete [self class]::ChildManager
      }
    }
    if {$errorOccurred} {error $errorMsg}
  • deep_copy (scripted)

    set copy [:copy [::xotcl::Object new]]
    if {[info exists :__children]} {
      $copy set __children {}
      foreach c ${:__children} {
        $copy add [$c copy [::xotcl::Object new]]
      }
    }
    return $copy
  • delete (scripted)

    set p [lsearch -exact ${:__children} $obj]
    if {$p == -1} {error "can't delete '$obj' from ${:__children}"}
    set :__children [lreplace ${:__children} $p $p]
    $obj destroy
  • destroy (scripted)

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

    lindex ${:__children} end
  • orderby (scripted)

    #
    # Specify the sorting properties order in OrderedComposites. The
    # sorting is defined via sorting attribute, sorting order and the
    # sorting type (defining the comparison operators).
    #
    # @param order one of "increasing" or "decreasing"
    # @param type one of "integer", "real", "index" or "dictionary" (default "dictionary")
    #
    #ns_log notice "OrderedComposite called with order '$order' type '$type' attribute '$attribute'"
    set :__order $order
    set :__orderby $attribute
    set :__ordercompare [ad_decode $type real __compare_tcl integer __compare_tcl __compare]
    if {$type eq "index"} {
      :mixin add ::xo::OrderedComposite::IndexCompare
    }
  • show (scripted)

    next
    foreach child [:children] {
      $child show
    }