[tools 1/2] testbot/cgi: Allow overriding the collection block's property list.

Francois Gouget fgouget at codeweavers.com
Tue May 3 12:47:59 CDT 2022


GetPropertyDescriptors() can now be redefined which allows reordering
the item's properties and inserting extra 'synthetic' ones.
Neither of these was possible by redefining DisplayProperty().

Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
---
This matches the FromPage behavior which only accesses the property list
through GetPropertyDescriptors().
---
 .../lib/ObjectModel/CGI/CollectionBlock.pm    | 25 ++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)

diff --git a/testbot/lib/ObjectModel/CGI/CollectionBlock.pm b/testbot/lib/ObjectModel/CGI/CollectionBlock.pm
index 594ed5649..08844d066 100644
--- a/testbot/lib/ObjectModel/CGI/CollectionBlock.pm
+++ b/testbot/lib/ObjectModel/CGI/CollectionBlock.pm
@@ -161,6 +161,29 @@ sub GenerateErrorPopup($)
 # Individual item property support
 #
 
+
+=pod
+=over 12
+
+=item C<GetPropertyDescriptors()>
+
+Returns the list of columns for the collection table.
+
+By default this matches the property list of the items in the collection and
+that list is then pruned by DisplayProperty().
+
+However it is possible to redefine this method to reorder the columns or add
+extra columns where the values will be synthesized by GenerateDataView().
+
+=back
+=cut
+
+sub GetPropertyDescriptors($)
+{
+  my ($self) = @_;
+  return $self->{Collection}->GetPropertyDescriptors();
+}
+
 =pod
 =over 12
 
@@ -430,7 +453,7 @@ sub GenerateList($)
   my ($self) = @_;
 
   my $Collection = $self->{Collection};
-  my $PropertyDescriptors = $Collection->GetPropertyDescriptors();
+  my $PropertyDescriptors = $self->GetPropertyDescriptors();
 
   my $ColIndex = 0;
   my (@Cols, $HasDT);
-- 
2.30.2




More information about the wine-devel mailing list