Author: spadkins
Date: Wed Apr 25 07:56:42 2007
New Revision: 9449
Modified:
p5ee/trunk/App-Widget/lib/App/Widget/HierSelector.pm
p5ee/trunk/App-Widget/lib/App/Widget/ImageBarSelector.pm
Log:
add tracing. fix bug where internal state was not being maintained when selector manipulated by select() (i.e. node_list(1)=writeable
Modified: p5ee/trunk/App-Widget/lib/App/Widget/HierSelector.pm
==============================================================================
--- p5ee/trunk/App-Widget/lib/App/Widget/HierSelector.pm (original)
+++ p5ee/trunk/App-Widget/lib/App/Widget/HierSelector.pm Wed Apr 25 07:56:42 2007
@@ -58,8 +58,10 @@
# uncomment this when I need to do more than just call SUPER::_init()
sub _init {
+ &App::sub_entry if ($App::trace);
my $self = shift;
$self->SUPER::_init(@_);
+ &App::sub_exit() if ($App::trace);
}
######################################################################
@@ -68,6 +70,7 @@
# Usage: $widget->handle_event($wname, $event, @args);
sub handle_event {
+ &App::sub_entry if ($App::trace);
my ($self, $wname, $event, @args) = @_;
my ($nodenumber, $x, $y);
@@ -98,10 +101,12 @@
else {
return $self->SUPER::handle_event($wname, $event, @args);
}
+ &App::sub_exit() if ($App::trace);
return 1;
}
sub select_first {
+ &App::sub_entry if ($App::trace);
my $self = shift;
my $node = $self->node_list();
@@ -144,9 +149,11 @@
else {
$self->open_exclusively("1");
}
+ &App::sub_exit() if ($App::trace);
}
sub select {
+ &App::sub_entry if ($App::trace);
my ($self, $nodeattrib, $value) = @_;
my $node = $self->node_list();
my $success = 0;
@@ -157,12 +164,15 @@
last;
}
}
+ &App::sub_exit($success) if ($App::trace);
return($success);
}
sub open_selected_exclusively {
+ &App::sub_entry if ($App::trace);
my ($self) = @_;
$self->open_exclusively($self->{selected});
+ &App::sub_exit() if ($App::trace);
}
# i.e. $self->open_exclusively("2.2");
@@ -171,9 +181,10 @@
# if "2.2.1" exists, it should set the first open to the "selected"
# else it should set itself "2.2" as the "selected"
sub open_exclusively {
+ &App::sub_entry if ($App::trace);
my ($self, $opennodenumber) = @_;
my ($nodebase, $nodeidx, $nodenumber);
- my $node = $self->node_list();
+ my $node = $self->node_list(1);
# set after get to ensure a deep data structure is stored in the session
$self->set("node", $node);
@@ -201,9 +212,11 @@
if (!defined $node->{"$opennodenumber.1"}) {
$self->set("selected", $opennodenumber);
}
+ &App::sub_exit() if ($App::trace);
}
sub node_list {
+ &App::sub_entry if ($App::trace);
my ($self, $writeable) = @_;
my ($node);
my $auth_node = $self->{auth_node};
@@ -230,6 +243,7 @@
$node = $self->{node};
$self->set("node", $node) if ($writeable);
}
+ &App::sub_exit($node) if ($App::trace);
return($node);
}
@@ -239,9 +253,10 @@
# if "2.2.1" exists, it should set the first open to the "selected"
# else it should set itself "2.2" as the "selected"
sub select_first_open_leaf {
+ &App::sub_entry if ($App::trace);
my ($self, $selected_nodenumber) = @_;
- my $node = $self->node_list();
+ my $node = $self->node_list(1);
my $nodebase = $selected_nodenumber;
my $nodeidx = 1;
my ($nodenumber);
@@ -276,6 +291,7 @@
$nodeidx++;
}
}
+ &App::sub_exit() if ($App::trace);
#$self->{debug} .= "select_first_open_leaf($selected_nodenumber): [$nodenumber]<br>";
}
@@ -284,6 +300,7 @@
######################################################################
sub get_selected {
+ &App::sub_entry if ($App::trace);
my ($self, $nodeattrib) = @_;
my ($nodenumber);
@@ -295,10 +312,12 @@
my $node = $self->node_list();
$nodenumber = $self->get_tag_nodenumber($nodenumber);
+ &App::sub_exit($node->{$nodenumber}{$nodeattrib}) if ($App::trace);
return $node->{$nodenumber}{$nodeattrib};
}
sub get_tag_nodenumber {
+ &App::sub_entry if ($App::trace);
my ($self, $tag) = @_;
my $node = $self->node_list();
@@ -315,6 +334,8 @@
else {
$nodenumber = $tag;
}
+
+ &App::sub_exit($nodenumber) if ($App::trace);
return $nodenumber;
}
@@ -323,6 +344,7 @@
######################################################################
sub html {
+ &App::sub_entry if ($App::trace);
my $self = shift;
my ($html, $label);
@@ -360,7 +382,8 @@
}
}
- $html;
+ &App::sub_exit() if ($App::trace);
+ $html;
}
1;
Modified: p5ee/trunk/App-Widget/lib/App/Widget/ImageBarSelector.pm
==============================================================================
--- p5ee/trunk/App-Widget/lib/App/Widget/ImageBarSelector.pm (original)
+++ p5ee/trunk/App-Widget/lib/App/Widget/ImageBarSelector.pm Wed Apr 25 07:56:42 2007
@@ -39,25 +39,32 @@
######################################################################
sub _init {
+ &App::sub_entry if ($App::trace);
my $self = shift;
$self->SUPER::_init(@_);
+ my $node = $self->{context}{"hotel-selector"}{auth_node}[1];
if (! $self->get("selected")) {
$self->select_first();
}
+ &App::sub_exit() if ($App::trace);
}
sub select {
+ &App::sub_entry if ($App::trace);
my ($self, $nodeattrib, $value) = @_;
my $success = $self->SUPER::select($nodeattrib, $value);
$self->open_selected_exclusively();
+ &App::sub_exit($success) if ($App::trace);
return($success);
}
sub open_exclusively {
+ &App::sub_entry if ($App::trace);
my ($self, $opennodenumber) = @_;
#$self->{debug} .= "open_exclusively($opennodenumber)<br>";
$self->SUPER::open_exclusively($opennodenumber);
$self->select_first_open_leaf($opennodenumber);
+ &App::sub_exit() if ($App::trace);
}
######################################################################
@@ -65,6 +72,7 @@
######################################################################
sub html {
+ &App::sub_entry if ($App::trace);
my $self = shift;
my $context = $self->{context};
@@ -178,6 +186,7 @@
$html .= "<!-- ImageBarSelector (END) -->\n";
}
+ &App::sub_exit() if ($App::trace);
$html;
}
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.