Edge/GenericEdge.pm

filter: Statementstmt 84.8% 28 / 33 Branchbran 50.0% 1 / 2 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 9 / 9 Podpod 100% 3 / 3 totaltotal 80.7% 42 / 52 CC 3 SCAR 8.2
CC
3
Cov
79%
_addAdditionalNodes
5.7
BEGIN
1.0
BEGIN
1.0
CRAP 2.3
« Node.pm ↑ Summary Node/ShapeNode.pm »
1 package yEd::Edge::GenericEdge;
2  
3 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 3 ▶use yEd::PropertyBasedObject;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 3 ▶use base qw(yEd::Edge);
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 =head1 NAME
8  
9 yEd::Edge::GenericEdge - generic Edge type
10  
11 =head1 DESCRIPTION
12  
13 A generic Edge type which mostly behaves like a PolyLineEdge without smoothening.
14  
15 It has two lines and can have a filling in between.
16  
17 Like generic Nodes it has Java based properties that define it.
18 But this is hidden away at the moment since there actually is only one characteristic type.
19 This means that this class could change significantly with future versions of yEd.
20  
21 Make sure to have a look at L<yEd::Edge>, the properties and functions described there will not be repeated here.
22  
23 =head1 SUPPORTED FEATURES
24  
25 The type specific features are fully supported.
26  
27 For basic Edge type feature support and which Edge types are supported see L<yEd::Edge>.
28  
29 =head1 PROPERTIES
30  
31 =head2 all properties from base class
32  
33 L<yEd::Edge>
34  
35 =head2 configuration
36  
37 Type: descrete values ( framed )
38  
39 Default: framed
40  
41 There is only one type at the moment, so this can be ignored.
42  
43 =head2 fillColor
44  
45 Type: '#0000fa' (rgb) or '#000000cc' (rgb + transparency) java.awt.Color hex form or 'none'
46  
47 Default: 'none'
48  
49 The filling between the 2 Edge lines.
50  
51 =head1 SUBROUTINES/METHODS
52  
53 =head2 all functions from base class
54  
55 L<yEd::Edge>
56  
57 =cut
58  
59 3 my %conf = (
60 'framed' => 'com.yworks.edge.framed',
61 );
62  
63 1 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
Pod documented
64 1 my ($class, @args) = @_;
65 1 my $self = bless {}, $class;
66 1 return $self->_init(@args);
67 }
68  
69 1 ▶sub _init {
Subroutine _init: called CC=1 SCAR=0.0
70 1 my ($self, @args) = @_;
71 1 $self->configuration('framed');
72 1 $self->fillColor('none');
73 1 $self->SUPER::_init(@args);
74 1 return $self;
75 }
76  
77 3 ▶sub configuration {
Subroutine configuration: called CC=1 SCAR=0.0
Pod documented
78 3 my $mask = join '|', keys %conf;
79 3 return _PROPERTY('^(?:' . $mask . ')$', @_);
80 }
81 2 ▶sub fillColor {
Subroutine fillColor: called CC=1 SCAR=0.0
Pod documented
82 2 return _PROPERTY($match{'color'}, @_);
83 }
84  
85 1 ▶sub _addTypeNode {
Subroutine _addTypeNode: called CC=1 SCAR=0.0
86 1 my ($self, $node) = @_;
87 1 my $type = $node->addNewChild('', 'y:GenericEdge');
88 1 $type->setAttribute('configuration', $conf{$self->configuration()});
89 1 return $type;
90 }
91 1 ▶sub _addAdditionalNodes {
Subroutine _addAdditionalNodes: called CC=3 SCAR=17.3
92 1 my ($self, $node) = @_;
93 1 ▶ if ($self->configuration() eq 'framed' and $self->fillColor() ne 'none') {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->configuration eq "framed" and $self->fillColor ne "none") 0 1 1
Condition33%1/3
$self->configuration eq "framed" and $self->fillColor ne "none"
!ll&&!rl&&r
010
MC/DC0%0/2
$self->configuration eq "framed" and $self->fillColor ne "none"
$self->configuration eq "framed" $self->fillColor ne "none"
Truth table33%1/3
A and B
A= $self->configuration eq "framed"B= $self->fillColor ne "none"
ABresult
0X0
100
111
94 0 my $sp = $node->addNewChild('', 'y:StyleProperties');
95 0 my $p = $sp->addNewChild('', 'y:Property');
96 0 $p->setAttribute('class', 'java.awt.Color');
97 0 $p->setAttribute('name', 'FramedEdgePainter.fillColor');
98 0 $p->setAttribute('value', $self->fillColor());
99 }
100 }
101  
102 =head1 SEE ALSO
103  
104 L<yEd::Document> for further informations about the whole package
105  
106 L<yEd::PropertyBasedObject> for further basic information about properties and their additional functions
107  
108 L<yEd::Edge> for information about the Edge base class and which other Edge types are currently supported
109  
110 =cut
111  
112 3 1;
« Node.pm ↑ Summary Node/ShapeNode.pm »