Subversion Repository Public Repository

ramani

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets">
    <h:head> 

    </h:head>

    <h:body>
        <ui:composition template="../template.xhtml">
            <ui:define name="caminho">
                <h:outputLabel value="/ Criar visualização"
                               style="font-weight: bold"/>
            </ui:define>
            <ui:define name="conteudoCentro">
                <p:layout>
                    <h:form>               
                        <p:layoutUnit position="center" >

                            <p:wizard
                                flowListener="#{grafoBean.onFlowProcessAutorArtigo}"
                                >
                                <center>
                                    <p:tab id="tabAutor" title="Autor">
                                        <center>
                                            <h:outputLabel value="Grafo de Autores Citaação Rescursivo"
                                                           style="font-size: 25px; font-weight: bold;"/>
                                            <hr/>
                                            </center>
                                            <h:panelGrid columns="2">
                                                <h:outputText value="Nome do Autor"/>
                                                <p:autoComplete
                                                    required="true"
                                                    requiredMessage="É necessario selecionar  um autor"
                                                    id="autoCompleteAutor"
                                                    forceSelection="true"
                                                    minQueryLength="4"
                                                    value="#{grafoBean.autor}"
                                                    converter="AutorConverter"
                                                    completeMethod="#{grafoBean.autoCompleteAutor}"
                                                    var="autoComplete"
                                                    itemLabel="#{autoComplete.nome}"
                                                    itemValue="#{autoComplete}"                                                                       
                                                    />
                                            </h:panelGrid>                                        
                                        </center>

                                    </p:tab>

                                    <p:tab id="tabGrafoCitacaoRecursivo" title="Grafo">
                                        <style>


                                            .link {
                                                fill: none;
                                                stroke: #666;
                                                stroke-width: 1.5px;
                                            }

                                            #licensing {
                                                fill: green;
                                            }

                                            .link.licensing {
                                                stroke: green;
                                            }

                                            .link.resolved {
                                                stroke-dasharray: 0,2 1;
                                            }

                                            circle {
                                                fill: #3399ff;
                                                stroke: #333;
                                                stroke-width: 1.5px;
                                            }

                                            text {
                                                font: 10px sans-serif;
                                                pointer-events: none;
                                                text-shadow: 0 1px 0 #fff, 1px 0 0 #fff, 0 -1px 0 #fff, -1px 0 0 #fff;
                                            }

                                        </style>
                                        <h:outputStylesheet library="css" name="grafo.css"/>
                                        <h:outputScript library="js" name="d3.v3.min.js" ></h:outputScript>
                                        <div id="graph" style="border: 2px solid #3399ff; width: 1400px; height: 1000px; margin: 0 auto"></div>
                                        <script>

                                            var links = ${grafoBean.citacoesAutor};
                                            var nodes = {};
                                            var margin = {top: 0, right: 0, bottom: 0, left: 0};
                                            var width = 1390;
                                            var height = 990;
                                            var color = d3.scale.category20();
                                            var randomX = d3.random.normal(width / 2, 80),
                                                    randomY = d3.random.normal(height / 2, 80);

                                            var data = d3.range(2000).map(function() {
                                                return [
                                                    randomX(),
                                                    randomY()
                                                ];
                                            });



// Compute the distinct nodes from the links.
                                            links.forEach(function(link) {
                                                link.source = nodes[link.source] ||
                                                        (nodes[link.source] = {name: link.source});
                                                link.target = nodes[link.target] ||
                                                        (nodes[link.target] = {name: link.target});
                                                link.value = +link.value;
                                            });

                                            var width = 1300,
                                                    height = 600;

                                            var force = d3.layout.force()
                                                    .nodes(d3.values(nodes))
                                                    .links(links)
                                                    .size([width, height])
                                                    .linkDistance(100)
                                                    .charge(-100)
                                                    .gravity(0.1)
                                                    .on("tick", tick)
                                                    .start();

                                            var svg = d3.select("#graph").append("svg")
                                                    .style("width", "1390")
                                                    .style("height", "990")
                                                    .style("margin", "0 auto")
                                                    .append("g");


                                            svg.append("svg:defs").selectAll("marker")
                                                    .data(["end"])      // Different link/path types can be defined here
                                                    .enter().append("svg:marker")    // This section adds in the arrows
                                                    .attr("id", String)
                                                    .attr("viewBox", "0 -5 10 10")
                                                    .attr("refX", 15)
                                                    .attr("refY", -1.5)
                                                    .attr("markerWidth", 6)
                                                    .attr("markerHeight", 6)
                                                    .attr("orient", "auto")
                                                    .append("svg:path")
                                                    .attr("d", "M0,-5L10,0L0,5");


                                            var path = svg.append("svg:g").selectAll("path")
                                                    .data(force.links())
                                                    .enter().append("svg:path")
                                                    .attr("class", "link")
                                                    .attr("marker-end", "url(#end)");


                                            var node = svg.selectAll(".node")
                                                    .data(force.nodes())
                                                    .enter().append("g")
                                                    .attr("class", "node")
                                                    .on("mouseover", mouseover)
                                                    .on("mouseout", mouseout)
                                                    .call(force.drag);


                                            node.append("circle")
                                                    .attr("r", 10)
                                                    .attr("opacity", 0.5)
                                                    .style("fill", function(d, i) {
                                                        return color(i);
                                                    });


                                            node.append("text")
                                                    .attr("x", 12)
                                                    .attr("dy", ".35em")
                                                    .style("font", "12px sans-serif")
                                                    .text(function(d) {
                                                        return d.name;
                                                    });

// add the curvy lines
                                            function tick() {
                                                path.attr("d", function(d) {
                                                    var dx = d.target.x - d.source.x,
                                                            dy = d.target.y - d.source.y,
                                                            dr = Math.sqrt(dx * dx + dy * dy);
                                                    return "M" +
                                                            d.source.x + "," +
                                                            d.source.y + "A" +
                                                            dr + "," + dr + " 0 0,1 " +
                                                            d.target.x + "," +
                                                            d.target.y;
                                                });

                                                node
                                                        .attr("transform", function(d) {
                                                            return "translate(" + d.x + "," + d.y + ")";
                                                        });
                                            }
                                            function mouseover() {
                                                d3.select(this).select("circle").transition()
                                                        .duration(750)
                                                        .attr("r", 35)
                                                        .attr("opacity", 1.0);

                                                d3.select(this).select("text").transition()
                                                        .duration(750)
                                                        .attr("x", 30)                                                        
                                                        .style("font", "20px sans-serif");
                                            }

                                            function mouseout() {
                                                d3.select(this).select("circle").transition()
                                                        .duration(750)
                                                        .attr("r", 10)
                                                        .attr("opacity", 0.5);
                                                
                                                d3.select(this).select("text").transition()
                                                        .duration(750)
                                                        .attr("x", 12)                                                        
                                                        .style("font", "12px sans-serif");
                                            }

                                        </script>
                                    </p:tab>    
                                </center>

                            </p:wizard>
                        </p:layoutUnit>
                    </h:form>
                </p:layout>
            </ui:define>
        </ui:composition>
    </h:body>
</html>

Commits for ramani/Ramani/web/restrito/grafoCitacaoRecursivo.xhtml

Diff revisions: vs.
Revision Author Commited Message
581 Diff Diff heartle picture heartle Wed 18 Mar, 2015 03:20:13 +0000
580 Diff Diff heartle picture heartle Tue 17 Mar, 2015 03:55:44 +0000
568 Diff Diff heartle picture heartle Mon 15 Dec, 2014 03:35:05 +0000
567 Diff Diff heartle picture heartle Fri 05 Dec, 2014 18:28:16 +0000
565 heartle picture heartle Wed 03 Dec, 2014 15:44:35 +0000