mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-11 23:46:15 +00:00
Merge branch 'timeline' of https://github.com/tmciver-basis/autopsy into timeline
This commit is contained in:
commit
59eb47f092
@ -35,6 +35,7 @@ import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Calendar;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
@ -403,7 +404,7 @@ public class Simile2 extends CallableSystemAction implements Presenter.Toolbar {
|
||||
final NumberAxis yAxis = new NumberAxis();
|
||||
xAxis.setLabel("Day of Month");
|
||||
yAxis.setLabel("Number of Events");
|
||||
ObservableList<BarChart.Data> bcData = makeObservableListByMonthAllDays(me);
|
||||
ObservableList<BarChart.Data> bcData = makeObservableListByMonthAllDays(me, ye.getYear());
|
||||
BarChart.Series<String, Number> series = new BarChart.Series(bcData);
|
||||
series.setName(me.getMonthName() + " " + ye.getYear());
|
||||
|
||||
@ -414,9 +415,19 @@ public class Simile2 extends CallableSystemAction implements Presenter.Toolbar {
|
||||
//data.getNode().setScaleX(2);
|
||||
data.getNode().addEventHandler(MouseEvent.MOUSE_PRESSED,
|
||||
new EventHandler<MouseEvent>() {
|
||||
MonthEpoch myme = me;
|
||||
|
||||
@Override
|
||||
public void handle(MouseEvent e) {
|
||||
final FsContentRootNode d = new FsContentRootNode("Test Root", (((MonthEpoch) data.getExtraValue()).getDays().get(Integer.valueOf(((String) data.getXValue()).split("-")[1]) - 1)).getEvents());
|
||||
int day = (Integer.valueOf(((String) data.getXValue()).split("-")[1]));
|
||||
DayEpoch de = myme.getDay(day);
|
||||
List<AbstractFile> afs = Collections.EMPTY_LIST;
|
||||
if (de != null) {
|
||||
afs = de.getEvents();
|
||||
} else {
|
||||
logger.log(Level.SEVERE, "There were no events for the clicked-on day.");
|
||||
}
|
||||
final FsContentRootNode d = new FsContentRootNode("Test Root", afs);
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
@ -431,10 +442,13 @@ public class Simile2 extends CallableSystemAction implements Presenter.Toolbar {
|
||||
return bc;
|
||||
}
|
||||
|
||||
private ObservableList<BarChart.Data> makeObservableListByMonthAllDays(final MonthEpoch me) {
|
||||
private ObservableList<BarChart.Data> makeObservableListByMonthAllDays(final MonthEpoch me, int year) {
|
||||
ObservableList<BarChart.Data> bcData = FXCollections.observableArrayList();
|
||||
for (DayEpoch day : me.getDays()) {
|
||||
BarChart.Data d = new BarChart.Data(me.month + 1 + "-" + String.valueOf(day.dayNum), day.files.size());
|
||||
int totalDays = me.getTotalNumDays(year);
|
||||
for (int i = 1; i <= totalDays; ++i) {
|
||||
DayEpoch day = me.getDay(i);
|
||||
int numFiles = day == null ? 0 : day.getNumFiles();
|
||||
BarChart.Data d = new BarChart.Data(me.month + 1 + "-" + i, numFiles);
|
||||
d.setExtraValue(me);
|
||||
bcData.add(d);
|
||||
}
|
||||
@ -554,6 +568,12 @@ public class Simile2 extends CallableSystemAction implements Presenter.Toolbar {
|
||||
return month;
|
||||
}
|
||||
|
||||
public int getTotalNumDays(int year) {
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.set(year, month, 1);
|
||||
return cal.getActualMaximum(Calendar.DAY_OF_MONTH);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getNumFiles() {
|
||||
int numFiles = 0;
|
||||
@ -563,6 +583,17 @@ public class Simile2 extends CallableSystemAction implements Presenter.Toolbar {
|
||||
return numFiles;
|
||||
}
|
||||
|
||||
public DayEpoch getDay(int dayNum) {
|
||||
DayEpoch de = null;
|
||||
for (DayEpoch d : days) {
|
||||
if (d.dayNum == dayNum) {
|
||||
de = d;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return de;
|
||||
}
|
||||
|
||||
public void add(AbstractFile af, int day) {
|
||||
DayEpoch dayEpoch = null;
|
||||
for (DayEpoch de : days) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user