use of com.att.aro.core.packetanalysis.pojo.AnalysisFilter in project VideoOptimzer by attdevsupport.
the class TimeRangeAnalysisDialog method cloneFilter.
private AnalysisFilter cloneFilter(AnalysisFilter filter) {
Collection<ApplicationSelection> appSel = filter.getApplicationSelections();
HashMap<String, ApplicationSelection> applications = new HashMap<String, ApplicationSelection>(appSel.size());
for (ApplicationSelection aSel : appSel) {
ApplicationSelection clonedAP = new ApplicationSelection(aSel);
applications.put(clonedAP.getAppName(), clonedAP);
}
TimeRange clonedTimeRange = null;
if (filter.getTimeRange() != null) {
TimeRange original = filter.getTimeRange();
clonedTimeRange = new TimeRange(original.getTitle(), original.getTimeRangeType(), original.getBeginTime(), original.getEndTime());
}
AnalysisFilter clonedFilter = new AnalysisFilter(applications, clonedTimeRange, filter.getDomainNames() == null ? null : new HashMap<>(filter.getDomainNames()));
clonedFilter.setIpv4Sel(filter.isIpv4Sel());
clonedFilter.setIpv6Sel(filter.isIpv6Sel());
clonedFilter.setTcpSel(filter.isTcpSel());
clonedFilter.setUdpSel(filter.isUdpSel());
clonedFilter.setDnsSelection(filter.isDnsSelection());
return clonedFilter;
}
use of com.att.aro.core.packetanalysis.pojo.AnalysisFilter in project VideoOptimzer by attdevsupport.
the class TimeRangeAnalysisDialog method updateCurrentfilter.
private boolean updateCurrentfilter() {
if (ipv4Selection || ipv6Selection) {
if (tcpSelection || udpSelection || dnsSelection) {
if (currentTraceResult.getFilter() != null) {
AnalysisFilter filter = currentTraceResult.getFilter();
Map<InetAddress, String> domainNames = filter.getDomainNames();
Map<String, ApplicationSelection> appSelections = new HashMap<>(filter.getAppSelections().size());
for (ApplicationSelection sel : filter.getAppSelections().values()) {
if (domainNames != null) {
sel.setDomainNames(domainNames);
}
appSelections.put(sel.getAppName(), new ApplicationSelection(sel));
}
filter.setIpv4Sel(ipv4Selection);
filter.setIpv6Sel(ipv6Selection);
filter.setTcpSel(tcpSelection);
filter.setUdpSel(udpSelection);
filter.setDnsSelection(dnsSelection);
return true;
}
} else {
MessageDialogFactory.getInstance().showErrorDialog(this, resourceBundle.getString("filter.noProtocolSelection.error"));
}
} else {
MessageDialogFactory.getInstance().showErrorDialog(this, resourceBundle.getString("filter.noIpSelection.error"));
}
return false;
}
use of com.att.aro.core.packetanalysis.pojo.AnalysisFilter in project VideoOptimzer by attdevsupport.
the class TimeRangeAnalysisDialog method getReanalyzeButton.
/*
* Get Reanalyze button
*/
private JButton getReanalyzeButton() {
if (reanalyzeButton == null) {
reanalyzeButton = new JButton();
reanalyzeButton.setText(resourceBundle.getString("menu.tools.timeRangeAnalysis.reanalyze.button"));
reanalyzeButton.setToolTipText(resourceBundle.getString("menu.tools.timeRangeAnalysis.reanalyze.button.tooltip"));
reanalyzeButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
double startTime;
double endTime;
try {
startTime = getTimeValue(startTimeTextField);
endTime = getTimeValue(endTimeTextField);
} catch (NumberFormatException e) {
MessageDialogFactory.getInstance().showErrorDialog(TimeRangeAnalysisDialog.this, resourceBundle.getString("timerangeanalysis.numberError"));
return;
}
double timeRangeEndTime = Double.valueOf(doubleToFixedDecimal(traceEndTime, 3));
if (startTime < endTime) {
if (startTime >= 0.0 && startTime <= endTime && endTime <= timeRangeEndTime) {
if (!updateCurrentfilter()) {
return;
}
AnalysisFilter filter = currentTraceResult.getFilter();
filter.setTimeRange(new TimeRange(startTime, endTime));
((MainFrame) parent).updateFilter(filter);
dispose();
} else {
String strErrorMessage = MessageFormat.format(resourceBundle.getString("timerangeanalysis.rangeError"), 0.00, doubleToFixedDecimal(traceEndTime, 3));
MessageDialogFactory.showMessageDialog(TimeRangeAnalysisDialog.this, strErrorMessage, resourceBundle.getString("menu.error.title"), JOptionPane.ERROR_MESSAGE);
}
} else {
String strErrorMessage = resourceBundle.getString("timerangeanalysis.startTimeError");
MessageDialogFactory.showMessageDialog(TimeRangeAnalysisDialog.this, strErrorMessage, resourceBundle.getString("menu.error.title"), JOptionPane.ERROR_MESSAGE);
}
}
});
}
return reanalyzeButton;
}
use of com.att.aro.core.packetanalysis.pojo.AnalysisFilter in project VideoOptimzer by attdevsupport.
the class ExcludeTimeRangeAnalysisDialog method getOKButton.
/**
* Initializes and returns the start button
*/
private JButton getOKButton() {
if (startButton == null) {
startButton = new JButton();
startButton.setText(ResourceBundleHelper.getMessageString(DialogItem.Button_ok));
startButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
double startTime;
double endTime;
try {
startTime = getTimeValue(startTimeTextField);
endTime = getTimeValue(endTimeTextField);
} catch (NumberFormatException e) {
MessageDialogFactory.getInstance().showErrorDialog(ExcludeTimeRangeAnalysisDialog.this, ResourceBundleHelper.getMessageString(DialogItem.timerangeanalysis_numberError));
return;
}
double timeRangeEndTime = Double.valueOf(DECIMAL_FORMAT.format(traceEndTime));
if (startTime < endTime) {
if ((startTime >= 0.0) && (startTime <= endTime) && endTime <= timeRangeEndTime) {
AnalysisFilter filter = ((MainFrame) parent).getController().getTheModel().getAnalyzerResult().getFilter();
filter.setTimeRange(new TimeRange(startTime, endTime));
if (!hasDataAfterFiltering(filter)) {
MessageDialogFactory.getInstance().showErrorDialog(ExcludeTimeRangeAnalysisDialog.this, ResourceBundleHelper.getMessageString(DialogItem.timerangeanalysis_noResultDataError));
} else {
((MainFrame) parent).updateFilter(filter);
dispose();
}
} else {
String strErrorMessage = MessageFormat.format(ResourceBundleHelper.getMessageString(DialogItem.timerangeanalysis_rangeError), 0.00, DECIMAL_FORMAT.format(timeRangeEndTime));
MessageDialogFactory.showMessageDialog(ExcludeTimeRangeAnalysisDialog.this, strErrorMessage, ResourceBundleHelper.getMessageString(DialogItem.menu_error_title), JOptionPane.ERROR_MESSAGE);
}
} else {
String strErrorMessage = ResourceBundleHelper.getMessageString(DialogItem.timerangeanalysis_startTimeError);
MessageDialogFactory.showMessageDialog(ExcludeTimeRangeAnalysisDialog.this, strErrorMessage, ResourceBundleHelper.getMessageString(DialogItem.menu_error_title), JOptionPane.ERROR_MESSAGE);
}
}
});
}
return startButton;
}
use of com.att.aro.core.packetanalysis.pojo.AnalysisFilter in project VideoOptimzer by attdevsupport.
the class TemperaturePlot method populate.
@Override
public void populate(XYPlot plot, AROTraceData analysis) {
XYSeries series = new XYSeries(0);
XYIntervalSeriesCollection thermalDataSeries = new XYIntervalSeriesCollection();
if (analysis == null) {
LOGGER.info("analysis data is null");
} else {
TraceResultType resultType = analysis.getAnalyzerResult().getTraceresult().getTraceResultType();
if (resultType.equals(TraceResultType.TRACE_FILE)) {
LOGGER.info("didn't get analysis trace data!");
} else {
TraceDirectoryResult traceresult = (TraceDirectoryResult) analysis.getAnalyzerResult().getTraceresult();
AnalysisFilter filter = analysis.getAnalyzerResult().getFilter();
temperatureInfos = traceresult.getTemperatureInfos();
thermalStatusInfos = traceresult.getThermalstatusInfos();
NumberAxis axis = new NumberAxis();
axis.setAutoRange(true);
// Calculate max and min temperature
List<Integer> tempLists = new ArrayList<>();
if (CollectionUtils.isNotEmpty(temperatureInfos)) {
for (TemperatureEvent bi : temperatureInfos) {
series.add(bi.getTimeRecorded(), bi.getcelciusTemperature());
tempLists.add(bi.getcelciusTemperature());
}
TemperatureEvent last = temperatureInfos.get(temperatureInfos.size() - 1);
if (filter.getTimeRange() != null) {
series.add(filter.getTimeRange().getEndTime().doubleValue(), last.getcelciusTemperature());
} else {
series.add(traceresult.getTraceDuration(), last.getcelciusTemperature());
}
XYItemRenderer renderer = plot.getRenderer(0);
renderer.setBaseToolTipGenerator(new XYToolTipGenerator() {
@Override
public String generateToolTip(XYDataset dataset, int series, int item) {
return toolTipContent(item);
}
});
Collections.sort(tempLists);
axis.setRange(Math.round(tempLists.get(0) / 1.2), Math.round(tempLists.get(tempLists.size() - 1) * 1.2));
axis.setAutoRange(false);
plot.setRenderer(0, renderer);
}
if (CollectionUtils.isNotEmpty(thermalStatusInfos)) {
Map<ThermalStatus, XYIntervalSeries> seriesMap = new EnumMap<ThermalStatus, XYIntervalSeries>(ThermalStatus.class);
for (ThermalStatus tstatus : ThermalStatus.values()) {
XYIntervalSeries series2 = new XYIntervalSeries(tstatus);
seriesMap.put(tstatus, series2);
thermalDataSeries.addSeries(series2);
}
Iterator<ThermalStatusInfo> iter = thermalStatusInfos.iterator();
if (iter.hasNext()) {
while (iter.hasNext()) {
ThermalStatusInfo info = iter.next();
seriesMap.get(info.getThermalStatus()).add(info.getBeginTimeStamp(), info.getBeginTimeStamp(), info.getEndTimeStamp(), 0.5, 0, 100);
}
}
XYBarRenderer barRenderer = new XYBarRenderer();
barRenderer.setDrawBarOutline(false);
barRenderer.setUseYInterval(true);
barRenderer.setAutoPopulateSeriesPaint(false);
barRenderer.setShadowVisible(false);
barRenderer.setGradientPaintTransformer(null);
barRenderer.setBarPainter(new StandardXYBarPainter());
setRenderingColorForDataSeries(barRenderer, thermalDataSeries);
barRenderer.setBaseToolTipGenerator(new XYToolTipGenerator() {
@Override
public String generateToolTip(XYDataset dataset, int series, int item) {
ThermalStatus info = (ThermalStatus) thermalDataSeries.getSeries(series).getKey();
return MessageFormat.format(ResourceBundleHelper.getMessageString("network.tooltip"), dataset.getX(series, item), ResourceBundleHelper.getEnumString(info));
}
});
plot.setRenderer(1, barRenderer);
plot.setRangeAxis(axis);
}
}
plot.setDataset(0, new XYSeriesCollection(series));
plot.setDataset(1, thermalDataSeries);
}
}
Aggregations