From b9a4e9c8a68dcb6b17617f4f7a5ad5ad3298bfa9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Wed, 9 Mar 2016 22:05:38 +0100 Subject: Imported Upstream version 1.7.1 --- lib/gcstar/GCGraphicComponents/GCDoubleLists.pm | 73 ++++++++++++++++++------- 1 file changed, 52 insertions(+), 21 deletions(-) (limited to 'lib/gcstar/GCGraphicComponents') diff --git a/lib/gcstar/GCGraphicComponents/GCDoubleLists.pm b/lib/gcstar/GCGraphicComponents/GCDoubleLists.pm index c59cae1..63ab50f 100644 --- a/lib/gcstar/GCGraphicComponents/GCDoubleLists.pm +++ b/lib/gcstar/GCGraphicComponents/GCDoubleLists.pm @@ -470,6 +470,32 @@ use GCUtils; $self->removeFromPermanent($self->{ignoreString}); } + sub setModel + { + my ($self, $model) = @_; + $self->{model} = $model; + if ($model) + { + my $groups = $model->getGroups; + $self->{separator} = $model->getDisplayedText('Separator'); + while (my ($key, $value) = each %{$model->{fieldsInfo}}) + { + next if !$value->{displayed}; + my $displayed = $groups->{$value->{group}}->{displayed} + . $self->{separator} + . $value->{displayed}; + $self->{fieldNameToId}->{$displayed} = $key; + $self->{fieldIdToName}->{$key} = $displayed; + } + my $order = 0; + foreach (@{$model->{groups}}) + { + $self->{groupsOrder}->{$groups->{$_->{id}}->{displayed}} = $order++; + } + $self->{model} = $model; + } + } + sub new { my ($proto, $parent, $preList, $isIdList, $ignoreField) = @_; @@ -524,27 +550,32 @@ use GCUtils; $self->{fieldNameToId} = {}; $self->{groupsOrder} = {}; - my $model = $self->{parent}->{model}; - if ($model) - { - my $groups = $model->getGroups; - $self->{separator} = $model->getDisplayedText('Separator'); - while (my ($key, $value) = each %{$model->{fieldsInfo}}) - { - next if !$value->{displayed}; - my $displayed = $groups->{$value->{group}}->{displayed} - . $self->{separator} - . $value->{displayed}; - $self->{fieldNameToId}->{$displayed} = $key; - $self->{fieldIdToName}->{$key} = $displayed; - } - my $order = 0; - foreach (@{$model->{groups}}) - { - $self->{groupsOrder}->{$groups->{$_->{id}}->{displayed}} = $order++; - } - $self->{model} = $model; - } +# my $model = $self->{parent}->{model}; +# use Data::Dumper; +# if ($model) +# { +# my $groups = $model->getGroups; +# print "GROUPS : ",Dumper($groups),"\n"; +# print "FIELDS : ",Dumper($model->{fieldsInfo}),"\n"; +# $self->{separator} = $model->getDisplayedText('Separator'); +# while (my ($key, $value) = each %{$model->{fieldsInfo}}) +# { +# next if !$value->{displayed}; +# my $displayed = $groups->{$value->{group}}->{displayed} +# . $self->{separator} +# . $value->{displayed}; +# print "ADDING ",$displayed,"\n"; +# $self->{fieldNameToId}->{$displayed} = $key; +# $self->{fieldIdToName}->{$key} = $displayed; +# } +# my $order = 0; +# foreach (@{$model->{groups}}) +# { +# $self->{groupsOrder}->{$groups->{$_->{id}}->{displayed}} = $order++; +# } +# $self->{model} = $model; +# } + $self->setModel($self->{parent}->{model}); if ($preList) { -- cgit v1.2.3