00001 # Copyright (C) 1997-2004 The CDG Team <cdg@nats.informatik.uni-hamburg.de> 00002 # 00003 # This file is free software; as a special exception the author gives 00004 # unlimited permission to copy and/or distribute it, with or without 00005 # modifications, as long as this notice is preserved. 00006 # 00007 # This program is distributed in the hope that it will be useful, but 00008 # WITHOUT ANY WARRANTY, to the extent permitted by law; without even the 00009 # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00010 00011 ## ---------------------------------------------------------------------------- 00012 ## NetsearchDialog - gui for the netsearch CDG command. 00013 ## 00014 ## \author Michael Daum (see also AUTHORS and THANKS for more) 00015 ## $Id: netsearch.tcl,v 1.6 2004/02/25 14:40:41 micha Exp $ 00016 ## ---------------------------------------------------------------------------- 00017 class NetsearchDialog { 00018 inherit iwidgets::Dialog 00019 00020 # public methods 00021 public method activate {args}; ## \type TclList 00022 00023 constructor {args} {}; ## \type TclList 00024 00025 # private methods 00026 private method _ok_action {} 00027 00028 ## list of all network ids that should be solved 00029 private variable _netIds "" 00030 00031 ## agenda size for netsearch. defaults to 3000 00032 private variable _agSize 3000 00033 00034 ## threshold for netsearch. defaults to 0.0 00035 private variable _threshold 0.0 00036 00037 ## submode for netsearch. 00038 ## All possible selections are alocated in the constructor being 00039 ## - "branchbound" (default) 00040 ## - "fullsearch" 00041 ## \todo insert all other submodes of netsearch 00042 private variable _submode "branchbound" 00043 }; 00044 00045 ## ---------------------------------------------------------------------------- 00046 ## constructor 00047 ## ---------------------------------------------------------------------------- 00048 body NetsearchDialog::constructor {args} { 00049 00050 hide Apply 00051 hide Help 00052 buttonconfigure OK -command [code $this _ok_action] 00053 00054 set _agSize 3000 00055 set _threshold 0.0 00056 set _submode "branchbound" 00057 00058 set child [childsite] 00059 itk_component add selection { 00060 iwidgets::entryfield $child.selection \ 00061 -labeltext "Network: "\ 00062 -labelpos w \ 00063 -textvariable [scope _netIds] 00064 } {} 00065 00066 itk_component add _agSize { 00067 iwidgets::entryfield $child._agSize \ 00068 -labeltext "AgendaSize: " \ 00069 -labelpos w \ 00070 -textvariable [scope _agSize] \ 00071 -validate numeric 00072 } { } 00073 00074 itk_component add _threshold { 00075 iwidgets::entryfield $child._threshold \ 00076 -labeltext "Threshold: " \ 00077 -labelpos w \ 00078 -textvariable [scope _threshold] \ 00079 -validate real 00080 } { } 00081 00082 itk_component add method { 00083 iwidgets::combobox $child.method \ 00084 -labeltext "Method: " \ 00085 -labelpos w \ 00086 -margin 5 \ 00087 -labelmargin 5 \ 00088 -textvariable [scope _submode] \ 00089 } { 00090 00091 } 00092 $itk_component(method) insert list end \ 00093 "branchbound" \ 00094 "fullsearch" 00095 00096 iwidgets::Labeledwidget::alignlabels \ 00097 $itk_component(selection) \ 00098 $itk_component(method) \ 00099 $itk_component(_agSize) \ 00100 $itk_component(_threshold) 00101 00102 pack $itk_component(selection) \ 00103 $itk_component(method) \ 00104 $itk_component(_agSize) \ 00105 $itk_component(_threshold) \ 00106 -side top -expand 1 -fill both -padx 5 -pady 5 00107 00108 eval itk_initialize $args 00109 } 00110 00111 ## ---------------------------------------------------------------------------- 00112 ## activate the netsearch dialog. 00113 ## \param args an optional list of network ids that should be preselected. 00114 ## ---------------------------------------------------------------------------- 00115 body NetsearchDialog::activate {args} { 00116 00117 eval set _netIds $args 00118 00119 center . 00120 Shell::activate 00121 } 00122 00123 ## ---------------------------------------------------------------------------- 00124 ## slot for the ok button action. 00125 ## This function is bound to the "ok" button of the gui, which then deactivates 00126 ## the dialog and calls ::cmd::netsearch(). 00127 ## ---------------------------------------------------------------------------- 00128 body NetsearchDialog::_ok_action {} { 00129 deactivate 00130 foreach id $_netIds { 00131 ::cmd::Netsearch $id $_submode $_agSize $_threshold 00132 } 00133 }