diff options
Diffstat (limited to 'lib/gcstar/GCGraphicComponents')
-rw-r--r-- | lib/gcstar/GCGraphicComponents/GCDoubleLists.pm | 73 |
1 files changed, 52 insertions, 21 deletions
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) { |