| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package UR::Object::Property::View::DescriptionLineItem::Text; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
15
|
use strict; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
30
|
|
|
4
|
1
|
|
|
1
|
|
3
|
use warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
310
|
|
|
5
|
|
|
|
|
|
|
require UR; |
|
6
|
|
|
|
|
|
|
our $VERSION = "0.46"; # UR $VERSION; |
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
UR::Object::Type->define( |
|
9
|
|
|
|
|
|
|
class_name => __PACKAGE__, |
|
10
|
|
|
|
|
|
|
is => 'UR::Object::View::Default::Text', |
|
11
|
|
|
|
|
|
|
doc => "View used by 'ur show properties' for each property line item", |
|
12
|
|
|
|
|
|
|
); |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub _update_view_from_subject { |
|
15
|
7
|
|
|
7
|
|
8
|
my $self = shift; |
|
16
|
|
|
|
|
|
|
|
|
17
|
7
|
|
|
|
|
14
|
my $property_meta = $self->subject; |
|
18
|
7
|
50
|
|
|
|
16
|
return unless ($property_meta); |
|
19
|
|
|
|
|
|
|
|
|
20
|
7
|
50
|
|
|
|
13
|
my $nullable = $property_meta->is_optional ? "NULLABLE" : ""; |
|
21
|
|
|
|
|
|
|
|
|
22
|
7
|
|
|
|
|
14
|
my $column_name = $property_meta->column_name; |
|
23
|
7
|
50
|
|
|
|
10
|
unless ($column_name) { |
|
24
|
7
|
50
|
|
|
|
14
|
if ($property_meta->via) { |
|
|
|
50
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
25
|
0
|
|
|
|
|
0
|
$column_name = $property_meta->via . '->' . $property_meta->to; |
|
26
|
|
|
|
|
|
|
} elsif ($property_meta->is_classwide) { |
|
27
|
0
|
|
|
|
|
0
|
$column_name = '(classwide)'; |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
} elsif ($property_meta->is_delegated) { |
|
30
|
|
|
|
|
|
|
# delegated, but not via. Must be an object accessor |
|
31
|
0
|
|
|
|
|
0
|
$column_name = '' |
|
32
|
|
|
|
|
|
|
} elsif ($property_meta->is_calculated) { |
|
33
|
0
|
|
|
|
|
0
|
my $calc_from = $property_meta->calculate_from; |
|
34
|
0
|
0
|
0
|
|
|
0
|
if ($calc_from and @$calc_from) { |
|
35
|
0
|
|
|
|
|
0
|
$column_name = '(calculated from ' . join(',',@$calc_from). ')'; |
|
36
|
|
|
|
|
|
|
} else { |
|
37
|
0
|
|
|
|
|
0
|
$column_name = '(calculated)'; |
|
38
|
|
|
|
|
|
|
} |
|
39
|
|
|
|
|
|
|
} else { |
|
40
|
7
|
|
|
|
|
9
|
$column_name = '(no column)'; |
|
41
|
|
|
|
|
|
|
} |
|
42
|
|
|
|
|
|
|
} |
|
43
|
|
|
|
|
|
|
|
|
44
|
7
|
|
|
|
|
7
|
my $data_type_string; |
|
45
|
7
|
50
|
|
|
|
12
|
if (defined $property_meta->data_type) { |
|
46
|
7
|
|
|
|
|
13
|
my $len = $property_meta->data_length; |
|
47
|
7
|
100
|
|
|
|
10
|
$data_type_string = $property_meta->data_type . ( $len ? "(".$len.")" : ""); |
|
48
|
|
|
|
|
|
|
} else { |
|
49
|
0
|
|
|
|
|
0
|
$data_type_string = '(no type)'; |
|
50
|
|
|
|
|
|
|
} |
|
51
|
|
|
|
|
|
|
|
|
52
|
7
|
100
|
|
|
|
17
|
my $text = sprintf(" %2s %30s %-40s %25s $nullable", |
|
53
|
|
|
|
|
|
|
$property_meta->is_id ? "ID" : " ", |
|
54
|
|
|
|
|
|
|
$property_meta->property_name, |
|
55
|
|
|
|
|
|
|
$column_name, |
|
56
|
|
|
|
|
|
|
$data_type_string, |
|
57
|
|
|
|
|
|
|
); |
|
58
|
|
|
|
|
|
|
|
|
59
|
7
|
|
|
|
|
20
|
my $widget = $self->widget(); |
|
60
|
7
|
|
|
|
|
8
|
my $buffer_ref = $widget->[0]; |
|
61
|
7
|
|
|
|
|
4
|
$$buffer_ref = $text; |
|
62
|
7
|
|
|
|
|
13
|
return 1; |
|
63
|
|
|
|
|
|
|
} |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
1; |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=pod |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=head1 NAME |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
UR::Object::Property::View::DescriptionLineItem::Text - View class for UR::Object::Property |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
Used by UR::Namespace::Command::Show::Properties when displaying information about a property |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=cut |