-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhyposamlet.java
More file actions
663 lines (536 loc) · 23.9 KB
/
hyposamlet.java
File metadata and controls
663 lines (536 loc) · 23.9 KB
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
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
import org.neo4j.driver.v1.*;
import java.util.ArrayList;
import java.util.Iterator;
import org.neo4j.driver.v1.Value;
import java.sql.*;
import java.sql.SQLException;
import java.time.DateTimeException;
import java.util.ArrayList;
import javafx.application.Application;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.scene.Scene;
import javafx.scene.control.cell.PropertyValueFactory;
import javafx.scene.layout.Border;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
import javafx.geometry.*;
import javafx.scene.control.TextField;
import javafx.scene.control.*;
import javafx.scene.input.*;
import javafx.event.*;
import java.sql.Timestamp;
import java.util.ArrayList;
import org.neo4j.driver.v1.Value;
import java.util.ArrayList;
import java.util.List;
import org.neo4j.driver.v1.Value;
import java.util.ArrayList;
import java.util.List;
import javafx.beans.property.SimpleStringProperty;
public class HistoryNode {
private final SimpleStringProperty _timestamp;
private final SimpleStringProperty _name;
private final SimpleStringProperty _nodeType;
private final SimpleStringProperty _id;
public HistoryNode(String timeStamp, String id, String name, String nodeType){
_timestamp = new SimpleStringProperty(timeStamp);
_id = new SimpleStringProperty(id);
_name = new SimpleStringProperty(name);
_nodeType = new SimpleStringProperty(nodeType);
}
public String getTimestamp() {
return _timestamp.get();
}
public void setTimestamp(String timestamp) {
_timestamp.set(timestamp);
}
public String getId(){
return _id.get();
}
public void setId(String id){
_id.set(id);
}
public String getName(){
return _name.get();
}
public void setName(String name){
_name.set(name);
}
public String getNodeType(){
return _nodeType.get();
}
public void setNodeType(String nodeType){
_nodeType.set(nodeType);
}
}
public class HypoNode implements IHypoNode {
private long _timestamp;
private long _id;
private String _name;
private ArrayList<String> _nodeType;
public HypoNode(){
_nodeType = new ArrayList<>();
}
public HypoNode(long timeStamp, long id, String name, ArrayList<String> nodeType){
_timestamp = timeStamp;
_id = id;
_name = name;
_nodeType = nodeType;
}
public void addTimestamp(long timestamp){
_timestamp = timestamp;
}
public void addId(int id){
_id = id;
}
public void addName(String name){
_name = name;
}
public void addNodeTypes(List<Object> listOfNodeTypes){
for(Object nodeType : listOfNodeTypes){
String nodeTypeAsString = (String) nodeType;
_nodeType.add(nodeTypeAsString);
}
}
public long getTimeStamp(){
return _timestamp;
}
public long getId(){
return _id;
}
public String getName(){
return _name;
}
public ArrayList<String> getNodeType(){
return _nodeType;
}
}
public interface IHypoNode {
void addTimestamp(long timestamp);
void addId(int id);
void addName(String name);
void addNodeTypes(List<Object> nodeType);
long getTimeStamp();
long getId();
String getName();
ArrayList<String> getNodeType();
}
public class SqlConnection {
private Connection _connection;
public SqlConnection(String url) {
_connection = getConnection(url);
}
public Connection getConnection(String url) {
Connection conn = null;
try {
conn = DriverManager.getConnection(url);
} catch (SQLException ex) {
// handle any errors
System.out.println("SQLException: " + ex.getMessage());
System.out.println("SQLState: " + ex.getSQLState());
System.out.println("VendorError: " + ex.getErrorCode());
}
return conn;
}
public void insertIntoSqlHistoryTable(Timestamp timestamp, String name, String type, long nodeId){
Statement statement = null;
try {
statement = _connection.createStatement();
statement.execute("INSERT INTO History (timestamp, name, type, nodeId) VALUES ('" + timestamp + "', ' " + name + "', '" + type + "', '" + nodeId+ "')");
}
catch(Exception e){
e.printStackTrace();
}
}
public void deleteHistoryTable(){
Statement statement = null;
try {
statement = _connection.createStatement();
statement.execute("DELETE FROM History");
}
catch(Exception e){
e.printStackTrace();
}
}
public ArrayList<HistoryNode> getFromSqlHistoryTable() {
Statement stmt = null;
ResultSet resultSet = null;
//ArrayList<String> listOfResultsFromSQL = new ArrayList<>();
ArrayList<HistoryNode> listOfResultsFromSQL = new ArrayList<>();
try {
stmt = _connection.createStatement();
resultSet = stmt.executeQuery("SELECT * FROM History ORDER BY timestamp ASC");
while (resultSet.next()) {
String timestamp = resultSet.getString("timestamp");
String name = resultSet.getString("name");
String type = resultSet.getString("type");
String nodeId = resultSet.getString("nodeId");
/*String singleResult = "Timestamp: " + timestamp + ", Name: " + name
+ ", Type: " + type + ", NodeId: " + nodeId + "\n";*/
HistoryNode historyNode = new HistoryNode(timestamp, nodeId, name, type);
listOfResultsFromSQL.add(historyNode);
//listOfResultsFromSQL.add(singleResult);
}
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
if (resultSet != null) resultSet.close();
} catch (SQLException e) {
e.printStackTrace();
}
try {
if (stmt != null) stmt.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
return listOfResultsFromSQL;
}
public Connection getSqlConnection(){
return _connection;
}
}
public class NeoDbConnection {
private Session session;
private Driver driver;
public NeoDbConnection(String uri){
initializeDbSession(uri);
}
private void initializeDbSession(String uri){
try {
driver = GraphDatabase.driver(uri);
session = driver.session();
}
catch(Exception e){
System.out.println("Error! Neo4j-server not running / Can't connect to Neo4j-server");
}
}
public IHypoNode createRootNode(String userInput){
String statementString = "CREATE (n:Root {name:'" + userInput + "'}) SET n.creationTime = timestamp() RETURN n.creationTime, n.name, ID(n), labels(n)";
Statement createRootStatement = new Statement(statementString);
IHypoNode hypoNode = processStatement(createRootStatement);
return hypoNode;
}
public IHypoNode createSelectionNode(String selection){
String statementString = "CREATE (n:Selection {name:'" + selection.trim() + "'}) SET n.creationTime = timestamp() RETURN n.creationTime, n.name, ID(n), labels(n)";
Statement createSelectionStatement = new Statement(statementString);
IHypoNode hypoNode = processStatement(createSelectionStatement);
return hypoNode;
}
public IHypoNode createSpecificationNode(String specification ){
String statementString = "CREATE (n:Specification {name:'" + specification + "'}) SET n.creationTime = timestamp() RETURN n.creationTime, n.name, ID(n), labels(n)";
Statement createSpecificationStatement = new Statement(statementString);
IHypoNode hypoNode = processStatement(createSpecificationStatement);
return hypoNode;
}
public IHypoNode createAssociationNode(String association){
String statementString = "CREATE (n:Association {name:'" + association + "'}) SET n.creationTime = timestamp() RETURN n.creationTime, n.name, ID(n), labels(n) ";
String oldStatementNOTFORASSOCIATION = "MATCH (mark:Selection {name: '"+ association +"', creationTime: '+ cTime +'}) " +
"MATCH (p_mark)-[:MARK_RELATION]->(mark) WHERE (p_mark:Root OR p_mark:Specification) " +
"MATCH (n) WHERE (n:Specification OR n:Root OR n:Selection) "+
"AND NOT (n)-[:MARK_RELATION]->(mark) "+
"AND NOT (n)-[:ASS_RELATION]->(:Association{name: mark.name})<-[:ASS_RELATION]-(mark) "+
"AND NOT (n.name = mark.name) "+
"AND n.creationTime < mark.creationTime "+
"AND (n)-[:MARK_RELATION|SPEC_RELATION|ASS_RELATION*]->(mark) " +
"AND n.name CONTAINS mark.name "+
"WITH n, mark " +
"CREATE (mark)-[r:ASS_RELATION]->(a:Association {name: mark.name})<-[r2:ASS_RELATION]-(n)";
Statement createAssociationStatement = new Statement(statementString);
IHypoNode associationNode = processStatement(createAssociationStatement);
return associationNode;
}
//HØJ KOBLING!! Denne metode skal nok refaktoreres. Lad den returnere de fundne noder, og derefter kan en anden metode lave relationen.
// OBS: Der er muligvis et underliggende problem i måden process-statement og handleresult er lavet på. De kan ikke nødvendigvis håndtere lister af noder.
public void findAllMatchingSpecOrRootNodes(IHypoNode markNode, String nodeName){
String statementString =
"MATCH (m:Selection) WHERE ID(m) = " + markNode.getId()+" "+
"MATCH (n) WHERE (n:Specification OR n:Root) AND (LOWER(n.name) CONTAINS LOWER('" + nodeName +
"')) AND NOT (n)-[:MARK]->(m)" +
"RETURN n.name, n.creationTime, ID(n) AS id, labels(n) AS type";
Statement findAllMatchingSpecOrRootNodesStatement = new Statement(statementString);
StatementResult statementResult = executeStatement(findAllMatchingSpecOrRootNodesStatement);
ArrayList<IHypoNode> listOfHypoNodes = new ArrayList<IHypoNode>() ;
boolean foundMatches = statementResult.hasNext();
while(statementResult.hasNext()){
IHypoNode hypoNode;
Record record= statementResult.next();
long timestamp = record.get("n.creationTime").asLong();
int id = record.get("id").asInt();
String name = record.get("n.name").asString();
Iterable<Value> typeList = record.get("type").values();
Iterator<Value> recordIterator = typeList.iterator();
ArrayList<String> labelList = new ArrayList<String>();
while(recordIterator.hasNext()) {
Value obj = recordIterator.next();
labelList.add(obj.asString());
System.out.println("labelType: " + obj);
}
hypoNode = new HypoNode(timestamp, id, name, labelList);
listOfHypoNodes.add(hypoNode);
}
if(foundMatches) {
IHypoNode associationNode = createAssociationNode(markNode.getName());
createRelationBetweenTwoNodes(markNode, associationNode, "ASS");
for (IHypoNode node : listOfHypoNodes) {
createRelationBetweenTwoNodes(associationNode, node, "ASS");
}
}
}
public IHypoNode getNodeToEditFrom(HistoryNode historyNode){
String statementString = "MATCH (n) WHERE ID(n) = " + Integer.parseInt(historyNode.getId()) + " RETURN n.creationTime, n.name, ID(n), labels(n)";
Statement createRelationBetweenTwoNodesStatement = new Statement(statementString);
IHypoNode hypoNode = processStatement(createRelationBetweenTwoNodesStatement);
return hypoNode;
}
public void createRelationBetweenTwoNodes(IHypoNode fromNode, IHypoNode toNode, String relationType){
String statementString = "MATCH (n:" + fromNode.getNodeType().get(0) + " {creationTime:" + fromNode.getTimeStamp() + ", name:\"" + fromNode.getName() +
"\"}) MATCH (l:"+toNode.getNodeType().get(0)+
" {creationTime:" + toNode.getTimeStamp() + ", name:\"" + toNode.getName() + "\"}) CREATE (n)-[:"+relationType+"]->(l)";
Statement createRelationBetweenTwoNodesStatement = new Statement(statementString);
processStatement(createRelationBetweenTwoNodesStatement);
}
public ArrayList<IHypoNode> findConnectedAssociations(IHypoNode fromNode){
String statementString = "MATCH (n:Selection {creationTime: " + fromNode.getTimeStamp() + "})-[:ASS*]->(m) WHERE NOT (n:Selection {creationTime: " + fromNode.getTimeStamp() + "})-[:ASS*1]->(m) RETURN m.name, m.creationTime, ID(m) AS id, labels(m) AS type";
Statement findAssociationsStatement = new Statement(statementString);
StatementResult statementResult = executeStatement(findAssociationsStatement);
ArrayList<IHypoNode> listOfHypoNodes = new ArrayList<IHypoNode>() ;
while(statementResult.hasNext()){
IHypoNode hypoNode;
Record record= statementResult.next();
long timestamp = record.get("m.creationTime").asLong();
int id = record.get("id").asInt();
String name = record.get("m.name").asString();
Iterable<Value> typeList = record.get("type").values();
Iterator<Value> recordIterator = typeList.iterator();
ArrayList<String> labelList = new ArrayList<String>();
while(recordIterator.hasNext()) {
Value obj = recordIterator.next();
labelList.add(obj.asString());
}
hypoNode = new HypoNode(timestamp, id, name, labelList);
listOfHypoNodes.add(hypoNode);
}
return listOfHypoNodes;
}
public void deleteAllFromDatabase(){
String statementString = "MATCH (n) DETACH DELETE n";
Statement deleteAllStatement = new Statement(statementString);
processStatement(deleteAllStatement);
}
public IHypoNode processStatement(Statement statement){
StatementResult statementResult = executeStatement(statement);
IHypoNode nodeObject = handleResult(statementResult);
return nodeObject;
}
private StatementResult executeStatement(Statement statement){
StatementResult statementResult = session.run(statement);
return statementResult;
}
private IHypoNode handleResult(StatementResult statementResult){
while(statementResult.hasNext()){
Record record = statementResult.next();
IHypoNode hypoNode = new HypoNode();
hypoNode.addTimestamp(record.get(0).asLong());
hypoNode.addName(record.get(1).asString());
hypoNode.addId(record.get(2).asInt());
hypoNode.addNodeTypes(record.get(3).asList());
return hypoNode;
}
return new HypoNode();
}
}
public class Main extends Application {
public SqlConnection sqlDb;
public IHypoNode fromNode;
public IHypoNode toNode;
private boolean _isDragged = false;
private boolean _hasBeenAddedAsInput = false;
private boolean _hasBeenSelected = false;
private Scene _scene;
private TextField _inputTextField;
private TextField _specificationTextField;
private TextArea _historyTextArea;
private TextArea _outputTextArea;
private NeoDbConnection _neoDb;
private Button _inputButton;
private Button _deleteAllFromNeo4j;
private Button _deleteAllFromHistoryDatabase;
private boolean _controlPressed;
private ArrayList<IHypoNode> _listOfHypoNodes = new ArrayList();
private TableView _historyTable = new TableView();
private final ObservableList<HistoryNode> _historyData = FXCollections.observableArrayList();
public static void main(String[] args) {
launch(args);
}
@Override
public void start(Stage primaryStage) {
primaryStage.setTitle("Hyponet");
try {
_neoDb = new NeoDbConnection("bolt://localhost:7687");
sqlDb = new SqlConnection("jdbc:mysql://188.166.67.46/hyponet?" +
"user=jewsef&password=dit6OsVbgK8k");
System.out.println("SqlDbConnection: " + sqlDb.getSqlConnection().toString());
} catch (Exception e) {
System.out.println("Main.start() - " + e.getMessage());
}
BorderPane border = initializeGridPane();
_scene = new Scene(border, 1000, 700);
initializeEventHandlers();
primaryStage.setScene(_scene);
primaryStage.show();
}
private BorderPane initializeGridPane() {
BorderPane borderPane = new BorderPane();
BorderPane innerBorderPane = new BorderPane();
BorderPane topBorderPane = new BorderPane();
VBox rightVBox = new VBox();
borderPane.setPadding(new Insets(25, 25, 25, 25));
innerBorderPane.setPadding(new Insets(70, 5, 5, 5));
topBorderPane.setPadding(new Insets(5, 5, 5, 5));
_inputTextField = new TextField();
_specificationTextField = new TextField();
_specificationTextField.setMaxWidth(500);
_specificationTextField.setDisable(true);
_specificationTextField.setVisible(false);
_historyTextArea = new TextArea();
_outputTextArea = new TextArea();
_inputButton = new Button();
_inputButton.setText("Ny Rodnode");
borderPane.setCenter(innerBorderPane);
borderPane.setTop(topBorderPane);
innerBorderPane.setCenter(_inputTextField);
innerBorderPane.setTop(_specificationTextField);
innerBorderPane.setRight(_inputButton);
_historyTable.setEditable(true);
TableColumn timestampColumn = new TableColumn("Timestamp");
timestampColumn.setResizable(true);
TableColumn nameColumn = new TableColumn("Name");
TableColumn typeColumn = new TableColumn("Type");
TableColumn nodeIdColumn = new TableColumn("Node ID");
timestampColumn.setCellValueFactory(
new PropertyValueFactory<HistoryNode,String>("timestamp")
);
nameColumn.setCellValueFactory(
new PropertyValueFactory<HistoryNode,String>("name")
);
typeColumn.setCellValueFactory(
new PropertyValueFactory<HistoryNode,String>("nodeType")
);
nodeIdColumn.setCellValueFactory(
new PropertyValueFactory<HistoryNode,String>("id")
);
_historyTable.setItems(_historyData);
_historyTable.getColumns().addAll(timestampColumn, nameColumn, typeColumn, nodeIdColumn);
_historyTable.autosize();
_deleteAllFromHistoryDatabase = new Button();
_deleteAllFromHistoryDatabase.setText("Slet Historik");
_deleteAllFromNeo4j = new Button();
_deleteAllFromNeo4j.setText("Slet Neo4j");
topBorderPane.setCenter(_historyTable);
topBorderPane.setRight(rightVBox);
rightVBox.getChildren().addAll(_deleteAllFromNeo4j, _deleteAllFromHistoryDatabase);
borderPane.setBottom(_outputTextArea);
BorderPane.setAlignment(_deleteAllFromNeo4j, Pos.BOTTOM_LEFT);
BorderPane.setAlignment(_deleteAllFromHistoryDatabase, Pos.BOTTOM_RIGHT);
BorderPane.setAlignment(_inputTextField, Pos.CENTER);
BorderPane.setAlignment(_inputButton, Pos.CENTER_RIGHT);
return borderPane;
}
/*public String getSelectedText(TextField textField){
String text = textField.getSelectedText();
return text;
}*/
/*public Connection getSqlConnection(){
}
*/
private void initializeEventHandlers() {
EventHandler<MouseEvent> dragEvent = (e) -> {
_isDragged = true;
};
EventHandler<MouseEvent> releaseEvent = (e) -> {
if (_isDragged) {
String textSelectionUntrimmed = _inputTextField.getSelectedText();
String textSelection = textSelectionUntrimmed.trim();
_isDragged = false;
if (_hasBeenAddedAsInput && !textSelection.isEmpty()) {
IHypoNode hypoNode = _neoDb.createSelectionNode(textSelection);
toNode = hypoNode;
_neoDb.createRelationBetweenTwoNodes(fromNode, toNode, "MARK");
fromNode = hypoNode;
_neoDb.findAllMatchingSpecOrRootNodes(hypoNode, hypoNode.getName());
ArrayList<IHypoNode> listOfHypoNodes = _neoDb.findConnectedAssociations(fromNode);
_outputTextArea.clear();
for(IHypoNode node : listOfHypoNodes) {
_outputTextArea.appendText(node.getName() + " - ID: " + node.getId() + "\n");
}
_specificationTextField.setDisable(false);
_specificationTextField.setVisible(true);
_hasBeenAddedAsInput = false;
}
}
};
EventHandler<MouseEvent> clickEvent = (e) -> {
System.out.println("Mousebutton clicked");
};
_inputButton.setOnAction((e) -> {
_hasBeenAddedAsInput = true;
String inputText = _inputTextField.getText();
IHypoNode hypoNode = _neoDb.createRootNode(inputText);
sqlDb.insertIntoSqlHistoryTable(new Timestamp(hypoNode.getTimeStamp()), hypoNode.getName(), hypoNode.getNodeType().get(0), hypoNode.getId()); //SQL command Insert into SQL DB
fromNode = hypoNode;
_historyTextArea.clear();
getLatestHistoryFromSql();
});
_deleteAllFromHistoryDatabase.setOnAction((e) -> {
sqlDb.deleteHistoryTable();
_historyTextArea.clear();
getLatestHistoryFromSql();
});
_deleteAllFromNeo4j.setOnAction((e) -> {
_neoDb.deleteAllFromDatabase();
_historyTextArea.clear();
getLatestHistoryFromSql();
});
_specificationTextField.setOnKeyPressed((event) -> {
if (event.getCode() == KeyCode.ENTER) {
String allText = _specificationTextField.getText();
IHypoNode hypoNode = _neoDb.createSpecificationNode(allText);
sqlDb.insertIntoSqlHistoryTable(new Timestamp(hypoNode.getTimeStamp()), hypoNode.getName(), hypoNode.getNodeType().get(0), hypoNode.getId()); //SQL command Insert into SQL DB
toNode = hypoNode;
_neoDb.createRelationBetweenTwoNodes(fromNode, toNode, "SPEC");
fromNode = hypoNode;
_historyTextArea.clear();
getLatestHistoryFromSql();
_inputTextField.setText(allText);
_specificationTextField.clear();
_specificationTextField.setDisable(true);
_specificationTextField.setVisible(false);
_hasBeenAddedAsInput = true;
}
});
_inputTextField.addEventFilter(MouseEvent.MOUSE_DRAGGED, dragEvent);
_inputTextField.addEventFilter(MouseEvent.MOUSE_CLICKED, clickEvent);
_inputTextField.addEventFilter(MouseEvent.MOUSE_RELEASED, releaseEvent);
_historyTable.setRowFactory( tv -> {
TableRow<HistoryNode> row = new TableRow<>();
row.setOnMouseClicked(event -> {
if (event.getClickCount() == 2 && (! row.isEmpty()) ) {
HistoryNode rowData = row.getItem();
_inputTextField.setText(rowData.getName());
fromNode = _neoDb.getNodeToEditFrom(rowData);
}
});
return row;
});
}
public void getLatestHistoryFromSql(){
_historyData.clear();
for(HistoryNode historyNode : sqlDb.getFromSqlHistoryTable()){
_historyData.add(historyNode);
}
}
}