Skip to content

Commit d84d30e

Browse files
committed
Minor code refactorings and documentation.
1 parent e9659a9 commit d84d30e

26 files changed

+279
-250
lines changed

pom.xml

Lines changed: 113 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,17 @@
55
<modelVersion>4.0.0</modelVersion>
66

77
<groupId>com.brunomnsilva</groupId>
8-
<artifactId>JavaFXSmartGraph</artifactId>
9-
<version>1.0-SNAPSHOT</version>
8+
<artifactId>smartgraph</artifactId>
9+
<version>0.9.4-SNAPSHOT</version>
10+
<packaging>jar</packaging>
11+
12+
<name>${project.groupId}:${project.artifactId}</name>
13+
<description>A generic (Java FX) graph visualization library that can automatically arrange the vertices' locations through a force-directed algorithm in real-time.</description>
14+
<url>https://github.com/brunomnsilva/JavaFXSmartGraph</url>
1015

1116
<properties>
12-
<maven.compiler.source>19</maven.compiler.source>
13-
<maven.compiler.target>19</maven.compiler.target>
17+
<maven.compiler.source>1.8</maven.compiler.source>
18+
<maven.compiler.target>1.8</maven.compiler.target>
1419
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
1520
</properties>
1621

@@ -22,15 +27,48 @@
2227
</dependency>
2328
</dependencies>
2429

30+
<licenses>
31+
<license>
32+
<name>MIT License</name>
33+
<url>https://opensource.org/license/mit/</url>
34+
</license>
35+
</licenses>
36+
37+
<developers>
38+
<developer>
39+
<name>Bruno Silva</name>
40+
<email>brunomnsilva@gmail.com</email>
41+
<organization>brunomnsilva</organization>
42+
<organizationUrl>http://www.brunomnsilva.com</organizationUrl>
43+
</developer>
44+
</developers>
45+
46+
<scm>
47+
<connection>scm:git:git://github.com/brunomnsilva/JavaFXSmartGraph.git</connection>
48+
<developerConnection>scm:git:ssh://github.com:brunomnsilva/JavaFXSmartGraph.git</developerConnection>
49+
<url>http://github.com/brunomnsilva/JavaFXSmartGraph/tree/master</url>
50+
</scm>
51+
52+
<distributionManagement>
53+
<snapshotRepository>
54+
<id>ossrh</id>
55+
<url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
56+
</snapshotRepository>
57+
<repository>
58+
<id>ossrh</id>
59+
<url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
60+
</repository>
61+
</distributionManagement>
62+
2563
<build>
2664
<plugins>
2765
<plugin>
2866
<groupId>org.apache.maven.plugins</groupId>
2967
<artifactId>maven-compiler-plugin</artifactId>
3068
<version>3.10.1</version>
3169
<configuration>
32-
<source>19</source>
33-
<target>19</target>
70+
<source>1.8</source>
71+
<target>1.8</target>
3472
</configuration>
3573
</plugin>
3674
<plugin>
@@ -51,9 +89,77 @@
5189
<noHeaderFiles>true</noHeaderFiles>
5290
</configuration>
5391
</execution>
92+
<execution>
93+
<!-- Configuration for running with: mvn clean javafx:run@example -->
94+
<id>example</id>
95+
<configuration>
96+
<mainClass>com.brunomnsilva.smartgraph.example.ExampleMain</mainClass>
97+
<launcher>app</launcher>
98+
<jlinkZipName>app</jlinkZipName>
99+
<jlinkImageName>app</jlinkImageName>
100+
<noManPages>true</noManPages>
101+
<stripDebug>true</stripDebug>
102+
<noHeaderFiles>true</noHeaderFiles>
103+
</configuration>
104+
</execution>
105+
</executions>
106+
</plugin>
107+
108+
<!-- For Maven Central deployment -->
109+
<plugin>
110+
<groupId>org.sonatype.plugins</groupId>
111+
<artifactId>nexus-staging-maven-plugin</artifactId>
112+
<version>1.6.7</version>
113+
<extensions>true</extensions>
114+
<configuration>
115+
<serverId>ossrh</serverId>
116+
<nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>
117+
<autoReleaseAfterClose>true</autoReleaseAfterClose>
118+
</configuration>
119+
</plugin>
120+
121+
<plugin>
122+
<groupId>org.apache.maven.plugins</groupId>
123+
<artifactId>maven-source-plugin</artifactId>
124+
<version>2.2.1</version>
125+
<executions>
126+
<execution>
127+
<id>attach-sources</id>
128+
<goals>
129+
<goal>jar-no-fork</goal>
130+
</goals>
131+
</execution>
132+
</executions>
133+
</plugin>
134+
<plugin>
135+
<groupId>org.apache.maven.plugins</groupId>
136+
<artifactId>maven-javadoc-plugin</artifactId>
137+
<version>2.9.1</version>
138+
<executions>
139+
<execution>
140+
<id>attach-javadocs</id>
141+
<goals>
142+
<goal>jar</goal>
143+
</goals>
144+
</execution>
54145
</executions>
55146
</plugin>
147+
<plugin>
148+
<groupId>org.apache.maven.plugins</groupId>
149+
<artifactId>maven-gpg-plugin</artifactId>
150+
<version>1.5</version>
151+
<executions>
152+
<execution>
153+
<id>sign-artifacts</id>
154+
<phase>verify</phase>
155+
<goals>
156+
<goal>sign</goal>
157+
</goals>
158+
</execution>
159+
</executions>
160+
</plugin>
161+
56162
</plugins>
57163
</build>
58-
164+
59165
</project>

src/main/java/com/brunomnsilva/smartgraph/Main.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
import java.util.logging.Logger;
3737

3838
/**
39+
* Class that provides an example of using the library.
3940
*
4041
* @author brunomnsilva
4142
*/
@@ -77,13 +78,13 @@ public void start(Stage ignored) {
7778
stage.show();
7879

7980
/*
80-
IMPORTANT: Must call init() after scene is displayed so we can have width and height values
81-
to initially place the vertices according to the placement strategy
81+
IMPORTANT: Must call init() after scene is displayed, so we can have width and height values
82+
to initially place the vertices according to the placement strategy.
8283
*/
8384
graphView.init();
8485

8586
/*
86-
Bellow you can see how to attach actions for when vertices and edges are double clicked
87+
Bellow you can see how to attach actions for when vertices and edges are double-clicked
8788
*/
8889
graphView.setVertexDoubleClickAction((SmartGraphVertex<String> graphVertex) -> {
8990
System.out.println("Vertex contains element: " + graphVertex.getUnderlyingVertex().element());

src/main/java/com/brunomnsilva/smartgraph/containers/ContentResizerPane.java

Lines changed: 0 additions & 88 deletions
This file was deleted.

src/main/java/com/brunomnsilva/smartgraph/containers/ContentZoomPane.java

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,17 +43,14 @@
4343
* It shows the zoom level with a slider control and reacts to mouse scrolls and
4444
* mouse dragging.
4545
* <br/>
46-
* The content node is out forward in the z-index so it can react to mouse
46+
* The content node is out forward in the z-index, so it can react to mouse
4747
* events first. The node should consume any event not meant to propagate to
4848
* this pane.
4949
*
5050
* @author brunomnsilva
5151
*/
5252
public class ContentZoomPane extends BorderPane {
5353

54-
/*
55-
PAN AND ZOOM
56-
*/
5754
private final DoubleProperty scaleFactorProperty = new ReadOnlyDoubleWrapper(1);
5855
private final Node content;
5956

@@ -68,10 +65,9 @@ public ContentZoomPane(Node content) {
6865

6966
this.content = content;
7067

71-
Node center = content;
7268
content.toFront();
7369

74-
setCenter(center);
70+
setCenter(content);
7571
setRight(createSlider());
7672

7773
enablePanAndZoom();
@@ -149,9 +145,8 @@ private void enablePanAndZoom() {
149145
}
150146

151147
}
152-
//do not propagate
148+
//do not propagate event
153149
event.consume();
154-
155150
});
156151

157152
final DragContext sceneDragContext = new DragContext();
@@ -188,7 +183,7 @@ public DoubleProperty scaleFactorProperty() {
188183
return scaleFactorProperty;
189184
}
190185

191-
class DragContext {
186+
private static class DragContext {
192187

193188
double mouseAnchorX;
194189
double mouseAnchorY;

src/main/java/com/brunomnsilva/smartgraph/containers/SmartGraphDemoContainer.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,13 @@
2929
import javafx.scene.layout.HBox;
3030

3131
/**
32+
* A simple container that provides zoom and toggling of automatic layout of a SmartGraphPanel.
3233
*
33-
* @author Bruno Silva
34+
* @author brunomnsilva
3435
*/
3536
public class SmartGraphDemoContainer extends BorderPane {
3637

37-
public SmartGraphDemoContainer(SmartGraphPanel graphView) {
38+
public SmartGraphDemoContainer(SmartGraphPanel<?,?> graphView) {
3839

3940
setCenter(new ContentZoomPane(graphView));
4041

src/main/java/com/brunomnsilva/smartgraph/example/City.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,26 +22,26 @@
2222
* THE SOFTWARE.
2323
*/
2424

25-
/*
26-
* To change this license header, choose License Headers in Project Properties.
27-
* To change this template file, choose Tools | Templates
28-
* and open the template in the editor.
29-
*/
3025
package com.brunomnsilva.smartgraph.example;
3126

3227
import com.brunomnsilva.smartgraph.graphview.SmartLabelSource;
3328

3429
/**
35-
*
30+
* A simple class to represent a city in an example usage of the library.
3631
* @author brunomnsilva
3732
*/
3833
public class City {
3934
private String name;
40-
private int population;
35+
private float population;
4136

42-
public City(String name, int age) {
37+
/**
38+
* City constructor
39+
* @param name name of the city
40+
* @param population population (in millions)
41+
*/
42+
public City(String name, float population) {
4343
this.name = name;
44-
this.population = age;
44+
this.population = population;
4545
}
4646

4747
@SmartLabelSource
@@ -54,11 +54,11 @@ public void setName(String name) {
5454
}
5555

5656

57-
public int getPopulation() {
57+
public float getPopulation() {
5858
return population;
5959
}
6060

61-
public void setPopulation(int population) {
61+
public void setPopulation(float population) {
6262
this.population = population;
6363
}
6464

0 commit comments

Comments
 (0)