diff options
author | Maarten Vanraes <alien@mageia.org> | 2015-11-23 21:16:10 +0100 |
---|---|---|
committer | Maarten Vanraes <alien@mageia.org> | 2015-12-05 14:39:19 +0100 |
commit | 178760dea68526879d3fe3b30bf7d8ea4cd557be (patch) | |
tree | 3057b9cf37d4f5dc50d141d587f27cddd8ab3330 /lib/ManaTools/Shared/GUI/ExtTab.pm | |
parent | 59fbf9df9165a78a860804b6fd676f0d2b25ce85 (diff) | |
download | manatools-178760dea68526879d3fe3b30bf7d8ea4cd557be.tar manatools-178760dea68526879d3fe3b30bf7d8ea4cd557be.tar.gz manatools-178760dea68526879d3fe3b30bf7d8ea4cd557be.tar.bz2 manatools-178760dea68526879d3fe3b30bf7d8ea4cd557be.tar.xz manatools-178760dea68526879d3fe3b30bf7d8ea4cd557be.zip |
error in recursive ExtTab: clean up properly
Diffstat (limited to 'lib/ManaTools/Shared/GUI/ExtTab.pm')
-rw-r--r-- | lib/ManaTools/Shared/GUI/ExtTab.pm | 44 |
1 files changed, 43 insertions, 1 deletions
diff --git a/lib/ManaTools/Shared/GUI/ExtTab.pm b/lib/ManaTools/Shared/GUI/ExtTab.pm index 0eb95a7e..4232d7e1 100644 --- a/lib/ManaTools/Shared/GUI/ExtTab.pm +++ b/lib/ManaTools/Shared/GUI/ExtTab.pm @@ -161,7 +161,7 @@ has 'lastItem' => ( ); has 'itemcollection' => ( - is => 'ro', + is => 'rw', isa => 'yui::YItemCollection', init_arg => undef, default => sub { @@ -361,6 +361,33 @@ sub buildItem { #============================================================= +=head2 clearItems + +=head3 INPUT + + $self: this object + +=head3 DESCRIPTION + + clears the tab to prepare for re-adding new items, call finishedItems() afterwards + +=cut + +#============================================================= +sub clearItems { + my $self = shift; + my $items = $self->items(); + + # remove all events before deleting all items + $self->clearEvents(); + + for (my $i = 0; $i < scalar(@{$items}); $i = $i + 1) { + delete $items->[$i]; + } +} + +#============================================================= + =head2 finishedItems =head3 INPUT @@ -376,9 +403,24 @@ sub buildItem { #============================================================= sub finishedItems { my $self = shift; + + # remove all Items before adding + $self->tab->deleteAllItems(); + + # remove all children + $self->tab->deleteChildren(); + + # add items from collection $self->tab->addItems($self->itemcollection); + + # set last item to know the active item my $item = $self->lastItem(); + + # show the current one if there is one $self->buildItem($item) if defined($item); + + # create a new itemcollection for adding new items + $self->itemcollection(new yui::YItemCollection()); } #============================================================= |