use of com.att.aro.ui.view.menu.file.TimeRangeEditorDialog in project VideoOptimzer by attdevsupport.
the class AROFileMenu method displayTimeRangeEditor.
private TimeRangeEditorDialog displayTimeRangeEditor(File traceFolder, boolean analyzeOnExit, JDialog splash) throws Exception {
TimeRangeEditorDialog dialog;
dialog = new TimeRangeEditorDialog(traceFolder, analyzeOnExit, splash);
dialog.pack();
dialog.setSize(dialog.getPreferredSize());
dialog.validate();
dialog.setModalityType(ModalityType.APPLICATION_MODAL);
dialog.setVisible(true);
return dialog;
}
use of com.att.aro.ui.view.menu.file.TimeRangeEditorDialog in project VideoOptimzer by attdevsupport.
the class AROFileMenu method openTraceFolderInTimeRange.
/**
* Choose a trace folder and transfer to time-range dialog
*
* @param aEvent
* @param isRecent
*/
private void openTraceFolderInTimeRange(ActionEvent aEvent) {
File traceFolder = null;
Object event = aEvent.getSource();
if (event instanceof JMenuItem) {
traceFolder = selectTraceFolder(aEvent, false);
if (traceFolder != null) {
try {
JDialog splash = new TransitionDialog(parent.getFrame(), "Preparing to open Time-Range chooser/editor dialog");
TimeRangeEditorDialog dialog;
dialog = displayTimeRangeEditor(traceFolder, false, splash);
if (dialog != null && dialog.isContinueWithAnalyze()) {
launchTraceFolderAnalysis(traceFolder, dialog.getTimeRange());
}
} catch (Exception e) {
LOG.error("Exception in TimeRangeDialog:", e);
new MessageDialogFactory().showErrorDialog(null, "Exception in TimeRangeDialog:" + e.getMessage());
}
} else {
LOG.error("failed to identify action event:" + aEvent.getClass().getName());
}
}
}
use of com.att.aro.ui.view.menu.file.TimeRangeEditorDialog in project VideoOptimzer by attdevsupport.
the class AROFileMenu method openTraceFolder.
/**
* Choose a trace folder for direct analysis
*
* @param aEvent
* @param isRecent
* @return
*/
private void openTraceFolder(ActionEvent aEvent, boolean isRecent) {
File traceFolder = null;
Object event = aEvent.getSource();
if (event instanceof JMenuItem) {
if ((traceFolder = selectTraceFolder(aEvent, isRecent)) != null) {
File trj;
TimeRange timeRange = null;
if ((trj = new File(traceFolder, "time-range.json")).exists()) {
try {
String jsonData = fileManager.readAllData(trj.getPath());
if (!jsonData.contains("\"timeRangeType\" : \"DEFAULT\",")) {
JDialog splash = new TransitionDialog(parent.getFrame(), "Time-Range file detected\n", "Preparing to open in Time-Range chooser/editor dialog");
TimeRangeEditorDialog dialog;
try {
if ((dialog = displayTimeRangeEditor(traceFolder, true, splash)) != null && dialog.isContinueWithAnalyze()) {
timeRange = dialog.getTimeRange();
} else {
LOG.debug("Time-Range, Selection cancelled by user");
splash.dispose();
return;
}
} catch (Exception e) {
LOG.error("Exception in TimeRangeDialog:", e);
new MessageDialogFactory().showErrorDialog(null, "Exception in TimeRangeDialog:" + e.getMessage());
return;
}
} else {
TraceTimeRange traceTimeRange;
if ((traceTimeRange = timeRangeReadWrite.readData(traceFolder)) != null) {
if (traceTimeRange.getTimeRangeList().stream().filter(a -> a.getTimeRangeType().equals(TimeRangeType.DEFAULT)).count() > 1) {
LOG.error("Too many TimeRanges set to AUTO");
MessageDialogFactory.getInstance().showErrorDialog(parent.getFrame(), "Too many TimeRanges set to AUTO, please fix the selections");
return;
}
Optional<TimeRange> optionalTimeRange = traceTimeRange.getTimeRangeList().stream().filter(p -> p.getTimeRangeType().equals(TimeRange.TimeRangeType.DEFAULT)).findFirst();
if (optionalTimeRange.isPresent()) {
timeRange = optionalTimeRange.get();
}
}
}
} catch (IOException e) {
LOG.error("Problem reading time-range.json", e);
}
}
if (timeRange != null) {
launchTraceFolderAnalysis(traceFolder, timeRange);
} else {
launchTraceFolderAnalysis(traceFolder);
}
} else {
LOG.error("Invalid trace folder selected, no traffic file");
}
}
}
Aggregations