diff --git a/src/main/java/edu/wpi/first/outlineviewer/controller/MainWindowController.java b/src/main/java/edu/wpi/first/outlineviewer/controller/MainWindowController.java index d4483be..9db1622 100644 --- a/src/main/java/edu/wpi/first/outlineviewer/controller/MainWindowController.java +++ b/src/main/java/edu/wpi/first/outlineviewer/controller/MainWindowController.java @@ -64,6 +64,8 @@ public class MainWindowController { private TreeTableColumn valueColumn; @FXML private TreeTableColumn typeColumn; + @FXML + private TreeTableColumn lastUpdateColumn; @FXML @SuppressWarnings("PMD.AccessorMethodGeneration") @@ -85,6 +87,7 @@ private void initialize() { NetworkTableUtilities.simpleKey(param.getValue().getValue().getKey()))); valueColumn.setCellValueFactory(new TreeItemPropertyValueFactory<>("value")); typeColumn.setCellValueFactory(new TreeItemPropertyValueFactory<>("type")); + lastUpdateColumn.setCellValueFactory(new TreeItemPropertyValueFactory<>("lastUpdated")); valueColumn.setCellFactory(param -> new TreeEntryTreeTableCell<>()); valueColumn.setOnEditCommit(event -> { diff --git a/src/main/java/edu/wpi/first/outlineviewer/model/TreeEntry.java b/src/main/java/edu/wpi/first/outlineviewer/model/TreeEntry.java index 43d7005..4b3e634 100644 --- a/src/main/java/edu/wpi/first/outlineviewer/model/TreeEntry.java +++ b/src/main/java/edu/wpi/first/outlineviewer/model/TreeEntry.java @@ -29,6 +29,8 @@ public TreeEntry(NetworkTableEntry entry) { () -> networkTableEntry.get().getValue().getValue(), networkTableEntry)); this.type.bind(Bindings.createObjectBinding( () -> networkTableEntry.get().getValue().getType().toString(), networkTableEntry)); + this.lastUpdated.bind(Bindings.createLongBinding( + () -> networkTableEntry.get().getValue().getTime(), networkTableEntry)); } public final NetworkTableEntry getNetworkTableEntry() { diff --git a/src/main/java/edu/wpi/first/outlineviewer/model/TreeRow.java b/src/main/java/edu/wpi/first/outlineviewer/model/TreeRow.java index 2248720..5b48852 100644 --- a/src/main/java/edu/wpi/first/outlineviewer/model/TreeRow.java +++ b/src/main/java/edu/wpi/first/outlineviewer/model/TreeRow.java @@ -4,7 +4,9 @@ import javafx.beans.property.ObjectProperty; import javafx.beans.property.SimpleObjectProperty; import javafx.beans.property.SimpleStringProperty; +import javafx.beans.property.SimpleLongProperty; import javafx.beans.property.StringProperty; +import javafx.beans.property.LongProperty; import java.util.Objects; @@ -16,6 +18,7 @@ public class TreeRow { protected final StringProperty key = new SimpleStringProperty(this, "key", ""); protected final ObjectProperty value = new SimpleObjectProperty<>(this, "value", null); protected final StringProperty type = new SimpleStringProperty(this, "type", ""); + protected final LongProperty lastUpdated = new SimpleLongProperty(this, "lastUpdated", 0); protected TreeRow() { // Users must provide a key! @@ -64,12 +67,21 @@ public StringProperty typeProperty() { return type; } + public long getLastUpdated() { + return lastUpdated.get(); + } + + public LongProperty lastUpdatedProperty() { + return lastUpdated; + } + @Override public String toString() { return MoreObjects.toStringHelper(this) .add("Key", key.getValue()) .add("Value", value.get()) .add("Type", typeProperty().getValue()) + .add("Last Updated", lastUpdated.getValue()) .toString(); } } diff --git a/src/main/resources/edu/wpi/first/outlineviewer/MainWindow.fxml b/src/main/resources/edu/wpi/first/outlineviewer/MainWindow.fxml index 70b242f..a495f1f 100644 --- a/src/main/resources/edu/wpi/first/outlineviewer/MainWindow.fxml +++ b/src/main/resources/edu/wpi/first/outlineviewer/MainWindow.fxml @@ -34,6 +34,7 @@ + diff --git a/src/test/java/edu/wpi/first/outlineviewer/model/TreeRowTest.java b/src/test/java/edu/wpi/first/outlineviewer/model/TreeRowTest.java index b1bb6d9..7bca126 100644 --- a/src/test/java/edu/wpi/first/outlineviewer/model/TreeRowTest.java +++ b/src/test/java/edu/wpi/first/outlineviewer/model/TreeRowTest.java @@ -48,7 +48,7 @@ void getTypeTest() { @Test void toStringTest() { - assertEquals("TreeRow{Key=key, Value=value, Type=}", new TreeRow("key", "value").toString()); + assertEquals("TreeRow{Key=key, Value=value, Type=, Last Updated=0}", new TreeRow("key", "value").toString()); } private static class FakeTreeRow extends TreeRow {